vendor: 7,609 bytes, lines 1-2
1/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ 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=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}
vendor: 9,738 bytes, line 2
2function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)}
vendor: 78,439 bytes, lines 2-4
2,input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++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]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h; 3if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px") 4},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.ActiveXObject&&m(a).on("unload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
5; 6 7function sprintf() { 8/* 9 * Copyright (c) 2013 Kevin van Zonneveld (http://kvz.io) 10 * and Contributors (http://phpjs.org/authors) 11 * 12 * Permission is hereby granted, free of charge, to any person obtaining a copy of 13 * this software and associated documentation files (the "Software"), to deal in 14 * the Software without restriction, including without limitation the rights to 15 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 16 * of the Software, and to permit persons to whom the Software is furnished to do 17 * so, subject to the following conditions: 18 * 19 * The above copyright notice and this permission notice shall be included in all 20 * copies or substantial portions of the Software. 21 * 22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 28 * SOFTWARE. 29*/ 30 // discuss at: http://phpjs.org/functions/sprintf/ 31 // original by: Ash Searle (http://hexmen.com/blog/) 32 // improved by: Michael White (http://getsprink.com) 33 // improved by: Jack 34 // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 35 // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 36 // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 37 // improved by: Dj 38 // improved by: Allidylls 39 // input by: Paulo Freitas 40 // input by: Brett Zamir (http://brett-zamir.me) 41 // example 1: sprintf("%01.2f", 123.1); 42 // returns 1: 123.10 43 // example 2: sprintf("[%10s]", 'monkey'); 44 // returns 2: '[ monkey]' 45 // example 3: sprintf("[%'#10s]", 'monkey'); 46 // returns 3: '[####monkey]' 47 // example 4: sprintf("%d", 123456789012345); 48 // returns 4: '123456789012345'
vendor: 5,702 bytes, lines 49-234
49 // example 5: sprintf('%-03s', 'E'); 50 // returns 5: 'E00' 51 52 var regex = /%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g; 53 var a = arguments; 54 var i = 0; 55 var format = a[i++]; 56 57 // pad() 58 var pad = function (str, len, chr, leftJustify) { 59 if (!chr) { 60 chr = ' '; 61 } 62 var padding = (str.length >= len) ? '' : new Array(1 + len - str.length >>> 0) 63 .join(chr); 64 return leftJustify ? str + padding : padding + str; 65 }; 66 67 // justify() 68 var justify = function (value, prefix, leftJustify, minWidth, zeroPad, customPadChar) { 69 var diff = minWidth - value.length; 70 if (diff > 0) { 71 if (leftJustify || !zeroPad) { 72 value = pad(value, minWidth, customPadChar, leftJustify); 73 } else { 74 value = value.slice(0, prefix.length) + pad('', diff, '0', true) + value.slice(prefix.length); 75 } 76 } 77 return value; 78 }; 79 80 // formatBaseX() 81 var formatBaseX = function (value, base, prefix, leftJustify, minWidth, precision, zeroPad) { 82 // Note: casts negative numbers to positive ones 83 var number = value >>> 0; 84 prefix = prefix && number && { 85 '2': '0b', 86 '8': '0', 87 '16': '0x' 88 }[base] || ''; 89 value = prefix + pad(number.toString(base), precision || 0, '0', false); 90 return justify(value, prefix, leftJustify, minWidth, zeroPad); 91 }; 92 93 // formatString() 94 var formatString = function (value, leftJustify, minWidth, precision, zeroPad, customPadChar) { 95 if (precision != null) { 96 value = value.slice(0, precision); 97 } 98 return justify(value, '', leftJustify, minWidth, zeroPad, customPadChar); 99 }; 100 101 // doFormat() 102 var doFormat = function (substring, valueIndex, flags, minWidth, _, precision, type) { 103 var number, prefix, method, textTransform, value; 104 105 if (substring === '%%') { 106 return '%'; 107 } 108 109 // parse flags 110 var leftJustify = false; 111 var positivePrefix = ''; 112 var zeroPad = false; 113 var prefixBaseX = false; 114 var customPadChar = ' '; 115 var flagsl = flags.length; 116 for (var j = 0; flags && j < flagsl; j++) { 117 switch (flags.charAt(j)) { 118 case ' ': 119 positivePrefix = ' '; 120 break; 121 case '+': 122 positivePrefix = '+'; 123 break; 124 case '-': 125 leftJustify = true; 126 break; 127 case "'": 128 customPadChar = flags.charAt(j + 1); 129 break; 130 case '0': 131 zeroPad = true; 132 customPadChar = '0'; 133 break; 134 case '#': 135 prefixBaseX = true; 136 break; 137 } 138 } 139 140 // parameters may be null, undefined, empty-string or real valued 141 // we want to ignore null, undefined and empty-string values 142 if (!minWidth) { 143 minWidth = 0; 144 } else if (minWidth === '*') { 145 minWidth = +a[i++]; 146 } else if (minWidth.charAt(0) == '*') { 147 minWidth = +a[minWidth.slice(1, -1)]; 148 } else { 149 minWidth = +minWidth; 150 } 151 152 // Note: undocumented perl feature: 153 if (minWidth < 0) { 154 minWidth = -minWidth; 155 leftJustify = true; 156 } 157 158 if (!isFinite(minWidth)) { 159 throw new Error('sprintf: (minimum-)width must be finite'); 160 } 161 162 if (!precision) { 163 precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type === 'd') ? 0 : undefined; 164 } else if (precision === '*') { 165 precision = +a[i++]; 166 } else if (precision.charAt(0) == '*') { 167 precision = +a[precision.slice(1, -1)]; 168 } else { 169 precision = +precision; 170 } 171 172 // grab value using valueIndex if required? 173 value = valueIndex ? a[valueIndex.slice(0, -1)] : a[i++]; 174 175 switch (type) { 176 case 's': 177 return formatString(String(value), leftJustify, minWidth, precision, zeroPad, customPadChar); 178 case 'c': 179 return formatString(String.fromCharCode(+value), leftJustify, minWidth, precision, zeroPad); 180 case 'b': 181 return formatBaseX(value, 2, prefixBaseX, leftJustify, minWidth, precision, zeroPad); 182 case 'o': 183 return formatBaseX(value, 8, prefixBaseX, leftJustify, minWidth, precision, zeroPad); 184 case 'x': 185 return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad); 186 case 'X': 187 return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad) 188 .toUpperCase(); 189 case 'u': 190 return formatBaseX(value, 10, prefixBaseX, leftJustify, minWidth, precision, zeroPad); 191 case 'i': 192 case 'd': 193 number = +value || 0; 194 // Plain Math.round doesn't just truncate 195 number = Math.round(number - number % 1); 196 prefix = number < 0 ? '-' : positivePrefix; 197 value = prefix + pad(String(Math.abs(number)), precision, '0', false); 198 return justify(value, prefix, leftJustify, minWidth, zeroPad); 199 case 'e': 200 case 'E': 201 case 'f': // Should handle locales (as per setlocale) 202 case 'F': 203 case 'g': 204 case 'G': 205 number = +value; 206 prefix = number < 0 ? '-' : positivePrefix; 207 method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())]; 208 textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2]; 209 value = prefix + Math.abs(number)[method](precision); 210 return justify(value, prefix, leftJustify, minWidth, zeroPad)[textTransform](); 211 default: 212 return substring; 213 } 214 }; 215 216 return format.replace(regex, doFormat); 217} 218; 219 220/* vim: set expandtab sw=4 ts=4 sts=4: */ 221/** 222 * This object handles ajax requests for pages. It also 223 * handles the reloading of the main menu and scripts. 224 */ 225var AJAX = { 226 /** 227 * @var bool active Whether we are busy 228 */ 229 active: false, 230 /** 231 * @var object source The object whose event initialized the request 232 */ 233 source: null, 234 /**
235 * @var object xhr A reference to the ajax request that is currently running 236 */ 237 xhr: null, 238 /** 239 * @var object lockedTargets, list of locked targets 240 */ 241 lockedTargets: {}, 242 /** 243 * @var function Callback to execute after a successful request 244 * Used by PMA_commonFunctions from common.js 245 */ 246 _callback: function () {}, 247 /** 248 * @var bool _debug Makes noise in your Firebug console 249 */ 250 _debug: false, 251 /** 252 * @var object $msgbox A reference to a jQuery object that links to a message 253 * box that is generated by PMA_ajaxShowMessage() 254 */ 255 $msgbox: null, 256 /** 257 * Given the filename of a script, returns a hash to be 258 * used to refer to all the events registered for the file 259 * 260 * @param key string key The filename for which to get the event name 261 * 262 * @return int 263 */ 264 hash: function (key) { 265 /* http://burtleburtle.net/bob/hash/doobs.html#one */ 266 key += ""; 267 var len = key.length, hash = 0, i = 0; 268 for (; i < len; ++i) { 269 hash += key.charCodeAt(i); 270 hash += (hash << 10); 271 hash ^= (hash >> 6); 272 } 273 hash += (hash << 3); 274 hash ^= (hash >> 11); 275 hash += (hash << 15); 276 return Math.abs(hash); 277 }, 278 /** 279 * Registers an onload event for a file 280 * 281 * @param file string file The filename for which to register the event 282 * @param func function func The function to execute when the page is ready 283 * 284 * @return self For chaining 285 */ 286 registerOnload: function (file, func) { 287 var eventName = 'onload_' + AJAX.hash(file); 288 $(document).bind(eventName, func); 289 if (this._debug) { 290 console.log( 291 // no need to translate 292 "Registered event " + eventName + " for file " + file 293 ); 294 } 295 return this; 296 }, 297 /** 298 * Registers a teardown event for a file. This is useful to execute functions 299 * that unbind events for page elements that are about to be removed. 300 * 301 * @param string file The filename for which to register the event 302 * @param function func The function to execute when 303 * the page is about to be torn down 304 * 305 * @return self For chaining 306 */ 307 registerTeardown: function (file, func) { 308 var eventName = 'teardown_' + AJAX.hash(file); 309 $(document).bind(eventName, func); 310 if (this._debug) { 311 console.log( 312 // no need to translate 313 "Registered event " + eventName + " for file " + file 314 ); 315 } 316 return this; 317 }, 318 /** 319 * Called when a page has finished loading, once for every 320 * file that registered to the onload event of that file. 321 * 322 * @param string file The filename for which to fire the event 323 * 324 * @return void 325 */ 326 fireOnload: function (file) { 327 var eventName = 'onload_' + AJAX.hash(file); 328 $(document).trigger(eventName); 329 if (this._debug) { 330 console.log( 331 // no need to translate 332 "Fired event " + eventName + " for file " + file 333 ); 334 } 335 }, 336 /** 337 * Called just before a page is torn down, once for every 338 * file that registered to the teardown event of that file. 339 * 340 * @param string file The filename for which to fire the event 341 * 342 * @return void 343 */ 344 fireTeardown: function (file) { 345 var eventName = 'teardown_' + AJAX.hash(file); 346 $(document).triggerHandler(eventName); 347 if (this._debug) { 348 console.log( 349 // no need to translate 350 "Fired event " + eventName + " for file " + file 351 ); 352 } 353 }, 354 /** 355 * function to handle lock page mechanism 356 * 357 * @param event the event object 358 * 359 * @return void 360 */ 361 lockPageHandler: function(event) { 362 //Don't lock on enter. 363 if (0 == event.charCode) { 364 return; 365 } 366 367 var lockId = $(this).data('lock-id'); 368 if (typeof lockId === 'undefined') { 369 return; 370 } 371 /* 372 * @todo Fix Code mirror does not give correct full value (query) 373 * in textarea, it returns only the change in content. 374 */ 375 var newHash = null; 376 if (event.data.value == 1) { 377 newHash = AJAX.hash($(this).val()); 378 } else { 379 newHash = AJAX.hash($(this).is(":checked")); 380 } 381 var oldHash = $(this).data('val-hash'); 382 // Set lock if old value != new value 383 // otherwise release lock 384 if (oldHash !== newHash) { 385 AJAX.lockedTargets[lockId] = true; 386 } else { 387 delete AJAX.lockedTargets[lockId]; 388 }
389 // Show lock icon if locked targets is not empty. 390 // otherwise remove lock icon 391 if (!jQuery.isEmptyObject(AJAX.lockedTargets)) { 392 $('#lock_page_icon').html(PMA_getImage('s_lock.png',PMA_messages.strLockToolTip).toString()); 393 } else { 394 $('#lock_page_icon').html(''); 395 } 396 }, 397 /** 398 * resets the lock 399 * 400 * @return void 401 */ 402 resetLock: function() { 403 AJAX.lockedTargets = {}; 404 $('#lock_page_icon').html(''); 405 }, 406 handleMenu: { 407 replace: function (content) { 408 $('#floating_menubar').html(content) 409 // Remove duplicate wrapper 410 // TODO: don't send it in the response 411 .children().first().remove(); 412 $('#topmenu').menuResizer(PMA_mainMenuResizerCallback); 413 } 414 }, 415 /** 416 * Event handler for clicks on links and form submissions 417 * 418 * @param object e Event data 419 * 420 * @return void 421 */ 422 requestHandler: function (event) { 423 // In some cases we don't want to handle the request here and either 424 // leave the browser deal with it natively (e.g: file download) 425 // or leave an existing ajax event handler present elsewhere deal with it 426 var href = $(this).attr('href'); 427 if (typeof event != 'undefined' && (event.shiftKey || event.ctrlKey)) { 428 return true; 429 } else if ($(this).attr('target')) { 430 return true; 431 } else if ($(this).hasClass('ajax') || $(this).hasClass('disableAjax')) { 432 //reset the lockedTargets object, as specified AJAX operation has finished 433 AJAX.resetLock(); 434 return true; 435 } else if (href && href.match(/^#/)) { 436 return true; 437 } else if (href && href.match(/^mailto/)) { 438 return true; 439 } else if ($(this).hasClass('ui-datepicker-next') || 440 $(this).hasClass('ui-datepicker-prev') 441 ) { 442 return true; 443 } 444 445 if (typeof event != 'undefined') { 446 event.preventDefault(); 447 event.stopImmediatePropagation(); 448 } 449 450 //triggers a confirm dialog if: 451 //the user has performed some operations on loaded page 452 //the user clicks on some link, (won't trigger for buttons) 453 //the click event is not triggered by script 454 if (typeof event !== 'undefined' && event.type === 'click' && 455 event.isTrigger !== true && 456 !jQuery.isEmptyObject(AJAX.lockedTargets) && 457 confirm(PMA_messages.strConfirmNavigation) === false 458 ) { 459 return false; 460 } 461 AJAX.resetLock(); 462 var isLink = !! href || false; 463 var previousLinkAborted = false; 464 465 if (AJAX.active === true) { 466 // Cancel the old request if abortable, when the user requests 467 // something else. Otherwise silently bail out, as there is already 468 // a request well in progress. 469 if (AJAX.xhr) { 470 //In case of a link request, attempt aborting 471 AJAX.xhr.abort(); 472 if(AJAX.xhr.status === 0 && AJAX.xhr.statusText === 'abort') { 473 //If aborted 474 AJAX.$msgbox = PMA_ajaxShowMessage(PMA_messages.strAbortedRequest); 475 AJAX.active = false; 476 AJAX.xhr = null; 477 previousLinkAborted = true; 478 } else { 479 //If can't abort 480 return false; 481 } 482 } else { 483 //In case submitting a form, don't attempt aborting 484 return false; 485 } 486 } 487 488 AJAX.source = $(this); 489 490 $('html, body').animate({scrollTop: 0}, 'fast'); 491 492 var url = isLink ? href : $(this).attr('action'); 493 var params = 'ajax_request=true&ajax_page_request=true'; 494 if (! isLink) { 495 params += '&' + $(this).serialize(); 496 } 497 if (! (history && history.pushState)) { 498 // Add a list of menu hashes that we have in the cache to the request 499 params += PMA_MicroHistory.menus.getRequestParam(); 500 } 501 502 if (AJAX._debug) { 503 console.log("Loading: " + url); // no need to translate 504 } 505 506 if (isLink) { 507 AJAX.active = true;
508 AJAX.$msgbox = PMA_ajaxShowMessage(); 509 //Save reference for the new link request 510 AJAX.xhr = $.get(url, params, AJAX.responseHandler); 511 if (history && history.pushState) { 512 var state = { 513 url : href 514 }; 515 if (previousLinkAborted) { 516 //hack: there is already an aborted entry on stack 517 //so just modify the aborted one 518 history.replaceState(state, null, href); 519 } else { 520 history.pushState(state, null, href); 521 } 522 } 523 } else { 524 /** 525 * Manually fire the onsubmit event for the form, if any. 526 * The event was saved in the jQuery data object by an onload 527 * handler defined below. Workaround for bug #3583316 528 */ 529 var onsubmit = $(this).data('onsubmit'); 530 // Submit the request if there is no onsubmit handler 531 // or if it returns a value that evaluates to true 532 if (typeof onsubmit !== 'function' || onsubmit.apply(this, [event])) { 533 AJAX.active = true; 534 AJAX.$msgbox = PMA_ajaxShowMessage(); 535 $.post(url, params, AJAX.responseHandler); 536 } 537 } 538 }, 539 /** 540 * Called after the request that was initiated by this.requestHandler() 541 * has completed successfully or with a caught error. For completely 542 * failed requests or requests with uncaught errors, see the .ajaxError 543 * handler at the bottom of this file. 544 * 545 * To refer to self use 'AJAX', instead of 'this' as this function 546 * is called in the jQuery context. 547 * 548 * @param object e Event data 549 * 550 * @return void 551 */ 552 responseHandler: function (data) { 553 if (typeof data === 'undefined' || data === null) { 554 return; 555 } 556 if (typeof data.success != 'undefined' && data.success) { 557 $('html, body').animate({scrollTop: 0}, 'fast'); 558 PMA_ajaxRemoveMessage(AJAX.$msgbox); 559 560 if (data._redirect) { 561 PMA_ajaxShowMessage(data._redirect, false); 562 AJAX.active = false; 563 AJAX.xhr = null; 564 return; 565 } 566 567 AJAX.scriptHandler.reset(function () { 568 if (data._reloadNavigation) { 569 PMA_reloadNavigation(); 570 } 571 if (data._title) { 572 $('title').replaceWith(data._title); 573 } 574 if (data._menu) { 575 if (history && history.pushState) { 576 var state = { 577 url : data._selflink, 578 menu : data._menu 579 }; 580 history.replaceState(state, null); 581 AJAX.handleMenu.replace(data._menu); 582 } else { 583 PMA_MicroHistory.menus.replace(data._menu); 584 PMA_MicroHistory.menus.add(data._menuHash, data._menu); 585 } 586 } else if (data._menuHash) { 587 if (! (history && history.pushState)) { 588 PMA_MicroHistory.menus.replace(PMA_MicroHistory.menus.get(data._menuHash)); 589 } 590 } 591 if (data._disableNaviSettings) { 592 PMA_disableNaviSettings(); 593 } 594 else { 595 PMA_ensureNaviSettings(data._selflink); 596 } 597 598 // Remove all containers that may have 599 // been added outside of #page_content 600 $('body').children() 601 .not('#pma_navigation') 602 .not('#floating_menubar') 603 .not('#page_nav_icons') 604 .not('#page_content') 605 .not('#selflink') 606 .not('#pma_header') 607 .not('#pma_footer') 608 .not('#pma_demo') 609 .not('#pma_console_container') 610 .not('#prefs_autoload') 611 .remove(); 612 // Replace #page_content with new content 613 if (data.message && data.message.length > 0) { 614 $('#page_content').replaceWith( 615 "<div id='page_content'>" + data.message + "</div>" 616 ); 617 PMA_highlightSQL($('#page_content')); 618 checkNumberOfFields(); 619 } 620 621 if (data._selflink) { 622 var source = data._selflink.split('?')[0]; 623 //Check for faulty links 624 $selflink_replace = { 625 "import.php": "tbl_sql.php", 626 "tbl_chart.php": "sql.php", 627 "tbl_gis_visualization.php": "sql.php" 628 }; 629 if ($selflink_replace[source]) { 630 var replacement = $selflink_replace[source]; 631 data._selflink = data._selflink.replace(source, replacement); 632 } 633 $('#selflink').find('> a').attr('href', data._selflink); 634 } 635 if (data._params) { 636 PMA_commonParams.setAll(data._params); 637 } 638 if (data._scripts) { 639 AJAX.scriptHandler.load(data._scripts); 640 } 641 if (data._selflink && data._scripts && data._menuHash && data._params) { 642 if (! (history && history.pushState)) { 643 PMA_MicroHistory.add( 644 data._selflink, 645 data._scripts, 646 data._menuHash, 647 data._params, 648 AJAX.source.attr('rel') 649 ); 650 } 651 } 652 if (data._displayMessage) { 653 $('#page_content').prepend(data._displayMessage); 654 PMA_highlightSQL($('#page_content')); 655 } 656 657 $('#pma_errors').remove(); 658 659 var msg = ''; 660 if(data._errSubmitMsg){ 661 msg = data._errSubmitMsg; 662 } 663 if (data._errors) { 664 $('<div/>', {id : 'pma_errors'}) 665 .insertAfter('#selflink') 666 .append(data._errors); 667 // bind for php error reporting forms (bottom) 668 $("#pma_ignore_errors_bottom").bind("click", function(e) { 669 e.preventDefault(); 670 PMA_ignorePhpErrors(); 671 }); 672 $("#pma_ignore_all_errors_bottom").bind("click", function(e) { 673 e.preventDefault(); 674 PMA_ignorePhpErrors(false); 675 }); 676 // In case of 'sendErrorReport'='always' 677 // submit the hidden error reporting form. 678 if (data._sendErrorAlways == '1' && 679 data._stopErrorReportLoop != '1' 680 ) { 681 $("#pma_report_errors_form").submit(); 682 PMA_ajaxShowMessage(PMA_messages.phpErrorsBeingSubmitted, false); 683 $('html, body').animate({scrollTop:$(document).height()}, 'slow'); 684 } else if (data._promptPhpErrors) { 685 // otherwise just prompt user if it is set so. 686 msg = msg + PMA_messages.phpErrorsFound; 687 // scroll to bottom where all the errors are displayed. 688 $('html, body').animate({scrollTop:$(document).height()}, 'slow'); 689 } 690 } 691 PMA_ajaxShowMessage(msg, false); 692 // bind for php error reporting forms (popup) 693 $("#pma_ignore_errors_popup").bind("click", function() { 694 PMA_ignorePhpErrors(); 695 }); 696 $("#pma_ignore_all_errors_popup").bind("click", function() { 697 PMA_ignorePhpErrors(false); 698 }); 699 700 if (typeof AJAX._callback === 'function') { 701 AJAX._callback.call(); 702 } 703 AJAX._callback = function () {}; 704 }); 705 706 } else { 707 PMA_ajaxShowMessage(data.error, false); 708 AJAX.active = false;
709 AJAX.xhr = null; 710 PMA_handleRedirectAndReload(data); 711 if (data.fieldWithError) { 712 $(':input.error').removeClass("error"); 713 $('#'+data.fieldWithError).addClass("error"); 714 } 715 } 716 }, 717 /** 718 * This object is in charge of downloading scripts, 719 * keeping track of what's downloaded and firing 720 * the onload event for them when the page is ready. 721 */ 722 scriptHandler: { 723 /** 724 * @var array _scripts The list of files already downloaded 725 */ 726 _scripts: [], 727 /** 728 * @var string _scriptsVersion version of phpMyAdmin from which the 729 * scripts have been loaded 730 */ 731 _scriptsVersion: null, 732 /** 733 * @var array _scriptsToBeLoaded The list of files that 734 * need to be downloaded 735 */ 736 _scriptsToBeLoaded: [], 737 /** 738 * @var array _scriptsToBeFired The list of files for which 739 * to fire the onload event 740 */ 741 _scriptsToBeFired: [], 742 /** 743 * Records that a file has been downloaded 744 * 745 * @param string file The filename 746 * @param string fire Whether this file will be registering 747 * onload/teardown events 748 * 749 * @return self For chaining 750 */ 751 add: function (file, fire) { 752 this._scripts.push(file); 753 if (fire) { 754 // Record whether to fire any events for the file 755 // This is necessary to correctly tear down the initial page 756 this._scriptsToBeFired.push(file); 757 } 758 return this; 759 }, 760 /** 761 * Download a list of js files in one request 762 * 763 * @param array files An array of filenames and flags 764 * 765 * @return void 766 */ 767 load: function (files, callback) { 768 var self = this; 769 // Clear loaded scripts if they are from another version of phpMyAdmin. 770 // Depends on common params being set before loading scripts in responseHandler 771 if (self._scriptsVersion == null) { 772 self._scriptsVersion = PMA_commonParams.get('PMA_VERSION'); 773 } else if (self._scriptsVersion != PMA_commonParams.get('PMA_VERSION')) { 774 self._scripts = []; 775 self._scriptsVersion = PMA_commonParams.get('PMA_VERSION'); 776 } 777 self._scriptsToBeLoaded = []; 778 self._scriptsToBeFired = []; 779 for (var i in files) { 780 self._scriptsToBeLoaded.push(files[i].name); 781 if (files[i].fire) { 782 self._scriptsToBeFired.push(files[i].name); 783 } 784 } 785 // Generate a request string 786 var request = []; 787 var needRequest = false; 788 for (var index in self._scriptsToBeLoaded) { 789 var script = self._scriptsToBeLoaded[index]; 790 // Only for scripts that we don't already have 791 if ($.inArray(script, self._scripts) == -1) { 792 needRequest = true; 793 this.add(script); 794 request.push("scripts%5B%5D=" + script); 795 } 796 } 797 request.push("call_done=1"); 798 request.push("v=" + encodeURIComponent(PMA_commonParams.get('PMA_VERSION'))); 799 // Download the composite js file, if necessary 800 if (needRequest) { 801 this.appendScript("js/get_scripts.js.php?" + request.join("&")); 802 } else { 803 self.done(callback); 804 } 805 }, 806 /** 807 * Called whenever all files are loaded 808 * 809 * @return void 810 */ 811 done: function (callback) { 812 if($.isFunction(callback)) { 813 callback(); 814 } 815 if (typeof ErrorReport !== 'undefined') { 816 ErrorReport.wrap_global_functions(); 817 } 818 for (var i in this._scriptsToBeFired) {
819 AJAX.fireOnload(this._scriptsToBeFired[i]); 820 } 821 AJAX.active = false; 822 }, 823 /** 824 * Appends a script element to the head to load the scripts 825 * 826 * @return void 827 */ 828 appendScript: function (url) { 829 var head = document.head || document.getElementsByTagName('head')[0]; 830 var script = document.createElement('script'); 831 script.type = 'text/javascript'; 832 script.src = url; 833 script.async = false; 834 head.appendChild(script); 835 }, 836 /** 837 * Fires all the teardown event handlers for the current page 838 * and rebinds all forms and links to the request handler 839 * 840 * @param function callback The callback to call after resetting 841 * 842 * @return void 843 */ 844 reset: function (callback) { 845 for (var i in this._scriptsToBeFired) { 846 AJAX.fireTeardown(this._scriptsToBeFired[i]); 847 } 848 this._scriptsToBeFired = []; 849 /** 850 * Re-attach a generic event handler to clicks 851 * on pages and submissions of forms 852 */ 853 $(document).off('click', 'a').on('click', 'a', AJAX.requestHandler); 854 $(document).off('submit', 'form').on('submit', 'form', AJAX.requestHandler); 855 if (! (history && history.pushState)) { 856 PMA_MicroHistory.update(); 857 } 858 callback(); 859 } 860 } 861}; 862 863/** 864 * Here we register a function that will remove the onsubmit event from all 865 * forms that will be handled by the generic page loader. We then save this 866 * event handler in the "jQuery data", so that we can fire it up later in 867 * AJAX.requestHandler(). 868 * 869 * See bug #3583316 870 */ 871AJAX.registerOnload('functions.js', function () { 872 // Registering the onload event for functions.js 873 // ensures that it will be fired for all pages 874 $('form').not('.ajax').not('.disableAjax').each(function () { 875 if ($(this).attr('onsubmit')) { 876 $(this).data('onsubmit', this.onsubmit).attr('onsubmit', ''); 877 } 878 }); 879 880 var $page_content = $('#page_content'); 881 /** 882 * Workaround for passing submit button name,value on ajax form submit 883 * by appending hidden element with submit button name and value. 884 */ 885 $page_content.on('click', 'form input[type=submit]', function() { 886 var buttonName = $(this).attr('name'); 887 if (typeof buttonName === 'undefined') { 888 return; 889 } 890 $(this).closest('form').append($('<input/>', { 891 'type' : 'hidden', 892 'name' : buttonName, 893 'value': $(this).val() 894 })); 895 }); 896 897 /** 898 * Attach event listener to events when user modify visible 899 * Input,Textarea and select fields to make changes in forms 900 */ 901 $page_content.on( 902 'keyup change', 903 'form.lock-page textarea, ' + 904 'form.lock-page input[type="text"], ' + 905 'form.lock-page input[type="number"], ' + 906 'form.lock-page select', 907 {value:1}, 908 AJAX.lockPageHandler 909 ); 910 $page_content.on( 911 'change', 912 'form.lock-page input[type="checkbox"], ' + 913 'form.lock-page input[type="radio"]', 914 {value:2}, 915 AJAX.lockPageHandler 916 ); 917 /** 918 * Reset lock when lock-page form reset event is fired 919 * Note: reset does not bubble in all browser so attach to 920 * form directly. 921 */ 922 $('form.lock-page').on('reset', function(event){ 923 AJAX.resetLock(); 924 }); 925}); 926 927/** 928 * Page load event handler 929 */ 930$(function () { 931 var menuContent = $('<div></div>') 932 .append($('#serverinfo').clone()) 933 .append($('#topmenucontainer').clone()) 934 .html(); 935 if (history && history.pushState) { 936 //set initial state reload 937 var initState = ('state' in window.history && window.history.state !== null); 938 var initURL = $('#selflink').find('> a').attr('href') || location.href; 939 var state = { 940 url : initURL, 941 menu : menuContent 942 }; 943 history.replaceState(state, null); 944 945 $(window).on('popstate', function(event) { 946 var initPop = (! initState && location.href == initURL); 947 initState = true; 948 //check if popstate fired on first page itself 949 if (initPop) { 950 return; 951 } 952 var state = event.originalEvent.state; 953 if (state && state.menu) {
954 AJAX.$msgbox = PMA_ajaxShowMessage(); 955 var params = 'ajax_request=true&ajax_page_request=true'; 956 var url = state.url || location.href; 957 $.get(url, params, AJAX.responseHandler); 958 //TODO: Check if sometimes menu is not retrieved from server, 959 // Not sure but it seems menu was missing only for printview which 960 // been removed lately, so if it's right some dead menu checks/fallbacks 961 // may need to be removed from this file and Header.class.php 962 //AJAX.handleMenu.replace(event.originalEvent.state.menu); 963 } 964 }); 965 } else { 966 // Fallback to microhistory mechanism 967 AJAX.scriptHandler 968 .load([{'name' : 'microhistory.js', 'fire' : 1}], function () { 969 // The cache primer is set by the footer class 970 if (PMA_MicroHistory.primer.url) { 971 PMA_MicroHistory.menus.add( 972 PMA_MicroHistory.primer.menuHash, 973 menuContent 974 ); 975 } 976 $(function () { 977 // Queue up this event twice to make sure that we get a copy 978 // of the page after all other onload events have been fired 979 if (PMA_MicroHistory.primer.url) { 980 PMA_MicroHistory.add( 981 PMA_MicroHistory.primer.url, 982 PMA_MicroHistory.primer.scripts, 983 PMA_MicroHistory.primer.menuHash 984 ); 985 } 986 }); 987 }); 988 } 989}); 990 991/** 992 * Attach a generic event handler to clicks 993 * on pages and submissions of forms 994 */ 995$(document).on('click', 'a', AJAX.requestHandler); 996$(document).on('submit', 'form', AJAX.requestHandler); 997 998/** 999 * Gracefully handle fatal server errors 1000 * (e.g: 500 - Internal server error) 1001 */ 1002$(document).ajaxError(function (event, request, settings) { 1003 if (request.status !== 0) { // Don't handle aborted requests 1004 var errorCode = PMA_sprintf(PMA_messages.strErrorCode, request.status); 1005 var errorText = PMA_sprintf(PMA_messages.strErrorText, request.statusText); 1006 PMA_ajaxShowMessage( 1007 '<div class="error">' + 1008 PMA_messages.strErrorProcessingRequest + 1009 '<div>' + errorCode + '</div>' + 1010 '<div>' + errorText + '</div>' + 1011 '</div>', 1012 false 1013 ); 1014 AJAX.active = false; 1015 } 1016}); 1017; 1018 1019/* vim: set expandtab sw=4 ts=4 sts=4: */ 1020 1021// global var that holds: 0- if ctrl key is not pressed 1- if ctrl key is pressed 1022var ctrlKeyHistory = 0; 1023 1024/** 1025 * Allows moving around inputs/select by Ctrl+arrows 1026 * 1027 * @param object event data 1028 */ 1029function onKeyDownArrowsHandler(e) 1030{ 1031 e = e || window.event; 1032 1033 var o = (e.srcElement || e.target); 1034 if (!o) { 1035 return; 1036 } 1037 if (o.tagName != "TEXTAREA" && o.tagName != "INPUT" && o.tagName != "SELECT") { 1038 return; 1039 } 1040 if ((e.which != 17) && (e.which != 37) && (e.which != 38) && (e.which != 39) && (e.which !=40)) { 1041 return; 1042 } 1043 if (!o.id) { 1044 return; 1045 } 1046 1047 if (e.type == "keyup") { 1048 if (e.which==17) { 1049 ctrlKeyHistory = 0; 1050 } 1051 return; 1052 } 1053 else if (e.type == "keydown") { 1054 if (e.which == 17) { 1055 ctrlKeyHistory = 1; 1056 } 1057 } 1058 1059 if (ctrlKeyHistory != 1) { 1060 return; 1061 } 1062 1063 e.preventDefault(); 1064 1065 var pos = o.id.split("_"); 1066 if (pos[0] != "field" || typeof pos[2] == "undefined") { 1067 return; 1068 } 1069 1070 var x = pos[2], y = pos[1]; 1071 1072 var nO = null; 1073 1074 switch (e.keyCode) { 1075 case 38: 1076 // up 1077 y--; 1078 break; 1079 case 40: 1080 // down 1081 y++; 1082 break; 1083 case 37: 1084 // left 1085 x--; 1086 break; 1087 case 39: 1088 // right 1089 x++; 1090 break; 1091 default: 1092 return; 1093 } 1094 1095 var is_firefox = navigator.userAgent.toLowerCase().indexOf("firefox/") > -1; 1096 1097 var id = "field_" + y + "_" + x; 1098 nO = document.getElementById(id); 1099 if (! nO) { 1100 id = "field_" + y + "_" + x + "_0"; 1101 nO = document.getElementById(id); 1102 } 1103 1104 // skip non existent fields 1105 if (! nO) { 1106 return; 1107 } 1108 1109 // for firefox select tag 1110 var lvalue = o.selectedIndex; 1111 var nOvalue = nO.selectedIndex; 1112 1113 nO.focus(); 1114 1115 if (is_firefox) { 1116 var ffcheck = 0; 1117 var ffversion; 1118 for (ffversion = 3 ;
1118 ffversion < 25 ; ffversion++) { 1119 var is_firefox_v_24 = navigator.userAgent.toLowerCase().indexOf('firefox/'+ffversion) > -1; 1120 if (is_firefox_v_24) { 1121 ffcheck = 1; 1122 break; 1123 } 1124 } 1125 if (ffcheck == 1) { 1126 if (e.which == 38 || e.which == 37) { 1127 nOvalue++; 1128 } 1129 else if (e.which == 40 || e.which == 39) { 1130 nOvalue--; 1131 } 1132 nO.selectedIndex=nOvalue; 1133 } 1134 else { 1135 if (e.which == 38 || e.which == 37) { 1136 lvalue++; 1137 } 1138 else if (e.which == 40 || e.which == 39) { 1139 lvalue--; 1140 } 1141 o.selectedIndex=lvalue; 1142 } 1143 } 1144 1145 if (nO.tagName != 'SELECT') { 1146 nO.select(); 1147 } 1148 e.returnValue = false; 1149} 1150 1151AJAX.registerTeardown('keyhandler.js', function () { 1152 $(document).off('keydown keyup', '#table_columns'); 1153 $(document).off('keydown keyup', 'table.insertRowTable'); 1154}); 1155 1156AJAX.registerOnload('keyhandler.js', function () { 1157 $(document).on('keydown keyup', '#table_columns', function (event) { 1158 onKeyDownArrowsHandler(event.originalEvent); 1159 }); 1160 $(document).on('keydown keyup', 'table.insertRowTable', function (event) { 1161 onKeyDownArrowsHandler(event.originalEvent); 1162 }); 1163}); 1164; 1165 1166/*! jQuery UI - v1.11.2 - 2014-11-30 1167* http://jqueryui.com 1168* Includes: core.js, widget.js, mouse.js, position.js, draggable.js, droppable.js, resizable.js, selectable.js, sortable.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, menu.js, progressbar.js, selectmenu.js, slider.js, spinner.js, tabs.js, tooltip.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer
vendor: 22,758 bytes, lines 1168-1171
1168.js 1169* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ 1170 1171(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function n(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent()[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.2",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return n=!a&&o.length?e.widget.extend.apply(null,[n].concat(o)):n,a?this.each(function(){var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):this.each(function(){var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init()):e.data(this,s,new i(n,this))}),r}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var d=!1;e(document).mouseup(function(){d=!1}),e.widget("ui.mouse",{version:"1.11.2",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:a?e.position.scrollbarWidth():0,height:n?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s||n?i.width():i.outerWidth(),height:s||n?i.height():i.outerHeight()}}},e.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=e.extend({},n);var p,m,g,v,y,b,_=e(n.of),x=e.position.getWithinInfo(n.within),w=e.position.getScrollInfo(x),k=(n.collision||"flip").split(" "),T={};return b=s(_),_[0].preventDefault&&(n.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,t,i=(n[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),T[this]=[e?e[0]:0,t?t[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===n.at[0]?y.left+=m:"center"===n.at[0]&&(y.left+=m/2),"bottom"===n.at[1]?y.top+=g:"center"===n.at[1]&&(y.top+=g/2),p=t(T.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function(){var s,l,u=e(this),d=u.outerWidth(),c=u.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),D=d+f+i(this,"marginRight")+w.width,S=c+b+i(this,"marginBottom")+w.height,M=e.extend({},y),C=t(T.my,u.outerWidth(),u.outerHeight());"right"===n.my[0]?M.left-=d:"center"===n.my[0]&&(M.left-=d/2),"bottom"===n.my[1]?M.top-=c:"center"===n.my[1]&&(M.top-=c/2),M.left+=C[0],M.top+=C[1],a||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[k[t]]&&e.ui.position[k[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:D,collisionHeight:S,offset:[p[0]+C[0],p[1]+C[1]],my:n.my,at:n.at,within:x,elem:u})}),n.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,a=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,e.top+p+f+m>u&&(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,e.top+p+f+m>d&&(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.
1171draggable",e.ui.mouse,{version:"1.11.2
vendor: 8,689 bytes, line 1171
1171",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(s){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper),n=s?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width()-this.helperProportions.width-this.margins.left,(e(a).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)
vendor: 1,856 bytes, line 1171
1171},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left
vendor: 5,567 bytes, lines 1171-1172
1171:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)} 1172},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=e.extend({},i,{item:s.element});s.sortables=[],e(s.options.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,e.each(s.sortables,function(){var e=this;e.isOver?(e.isOver=0,s.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,n))})},drag:function(t,i,s){e.each(s.sortables,function(){var n=!1,a=this;a.positionAbs=s.positionAbs,a.helperProportions=s.helperProportions,a.offset.click=s.offset.click,a._intersectsWith(a.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==a&&this._intersectsWith(this.containerCache)&&e.contains(a.element[0],this.element[0])&&(n=!1),n})),n?(a.isOver||(a.isOver=1,a.currentItem=i.helper.appendTo(a.element).data("ui-sortable-item",!0),a.options._helper=a.options.helper,a.options.helper=function(){return i.helper[0]},t.target=a.currentItem[0],a._mouseCapture(t,!0),a._mouseStart(t,!0,!0),a.offset.click.top=s.offset.click.top,a.offset.click.left=s.offset.click.left,a.offset.parent.left-=s.offset.parent.left-a.offset.parent.left,a.offset.parent.top-=s.offset.parent.top-a.offset.parent.top,s._trigger("toSortable",t),s.dropped=a.element,e.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,a.fromOutside=s),a.currentItem&&(a._mouseDrag(t),i.position=a.position)):a.isOver&&(a.isOver=0,a.cancelHelperRemoval=!0,a.options._revert=a.options.revert,a.options.revert=!1,a._trigger("out",t,a._uiHash(a)),a._mouseStop(t,!0),a.options.revert=a.options._revert,a.options.helper=a.options._helper,a.placeholder&&a.placeholder.remove(),s._refreshOffsets(t),i.position=s._generatePosition(t,!0),s._trigger("fromSortable",t),s.dropped=!1,e.each(s.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY<n.scrollSensitivity?o.scrollTop=a=o.scrollTop+n.scrollSpeed:t.pageY-s.overflowOffset.top<n.scrollSensitivity&&(o.scrollTop=a=o.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+o.offsetWidth-t.pageX<n.scrollSensitivity?o.scrollLeft=a=o.scrollLeft+n.scrollSpeed:t.pageX-s.overflowOffset.left<n.scrollSensitivity&&(o.scrollLeft=a=o.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(r).scrollTop()<n.scrollSensitivity?a=e(r).scrollTop(e(r).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(r).scrollTop())<n.scrollSensitivity&&(a=e(r).scrollTop(e(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(r).scrollLeft()<n.scrollSensitivity?a=e(r).scrollLeft(e(r).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(r).scrollLeft())<n.scrollSensitivity&&(a=e(r).scrollLeft(e(r).scrollLeft()+n.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var n=s.options;s.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var t=e(this),i=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left
vendor: 8,246 bytes, line 1172
1172:i.left})})},drag:function(t,i,s){var n,a,o,r,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left-s.margins.left,l=h+s.snapElements[c].width,u=s.snapElements[c].top-s.margins.top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.droppable",{version:"1.11.2",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s,n){if(!i.offset)return!1;var a=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,r=a+t.helperProportions.width,h=o+t.helperProportions.height,l=i.offset.left,u=i.offset.top,d=l+i.proportions().width,c=u+i.proportions().height;switch(s){case"fit":return a>=l&&d>=r&&o>=u&&c>=h;case"intersect":return a+t.helperProportions.width/2>l&&d>r-t.helperProportions.width/2&&o+t.helperProportions.height/2>u&&c>h-t.helperProportions.height/2;case"pointer":return e(n.pageY,u,i.proportions().height)&&e(n.pageX,l,i.proportions().width);case"touch":return(o>=u&&c>=o||h>=u&&c>=h||u>o&&h>c)&&(a>=l&&d>=a||r>=l&&d>=r||l>a&&r>d);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions().height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance,i),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===n}),a.length&&(s=e(a[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.dropp
vendor: 18,181 bytes, line 1172
1172able,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return t[s]>0?!0:(t[s]=1,n=t[s]>0,t[s]=0,n)},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=this.element.children(this.handles[i]).first().show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var i,s,n,a=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=e(a.containment).scrollLeft()||0,s+=e(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s,n=this.originalMousePosition,a=this.axis,o=t.pageX-n.left||0,r=t.pageY-n.top||0,h=this._change[a];return this._updatePrevProperties(),h?(i=h.apply(this,[t,o,r]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,s,n,a,o=this.options;a={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,n=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),a.maxWidth>i&&(a.maxWidth=i),a.maxHeight>n&&(a.maxHeight=n)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,n=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,a=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),o&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),a&&l&&(e.left=r-t.minWidth),s&&l&&(e.left=r-t.maxWidth),o&&u&&(e.top=h-t.minHeight),n&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],s=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],n=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(s[t],10)||0,i[t]+=parseInt(n[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,n,a,o,r,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,a=h.containerSize.width,o=h._hasScroll(c,"left")?c.scrollWidth:a,r=h._hasScroll(c)?c.scrollHeight:n,h.parentData={element:c,left:s.left,top:s.top,width:o,height:r}))},resize:function(t){var i,s,n,a,o=e(this).resizable("instance"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,d={top:0,left:0},c=o.containerElement,p=!0;c[0]!==document&&/static/.test(c.css("position"))&&(d=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-d.left),u&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?h.top:0),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),i=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-d.left:o.offset.left-h.left)),s=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-d.top:o.offset.top-h.top)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e)})},resize:function(t,i){var s=e(this).resizable("instance"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0},h=function(t,s){e(t).each(function(){var t=e(this),n=e(this).data("ui-resizable-alsoresize"),a={},o=s&&s.length?s:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var i=(n[t]||0)+(r[t]||0);i&&i>=0&&(a[t]=i||null)}),t.css(a)})};"object"!=typeof n.alsoResize||n.alsoResize.nodeType?h(n.alsoResize):e.each(n.alsoResize,function(e,t){h(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,i=e(this).resizable("instance"),s=i.options,n=i.size,a=i.originalSize,o=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,u=h[1]||1,d=Math.round((n.width-a.width)/l)*l,c=Math.round((n.height-a.height)/u)*u,p=a.width+d,f=a.height+c,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,v=s.minWidth&&s.minWidth>p,y=s.minHeight&&s.minHeight>f;s.grid=h,v&&(p+=l),y&&(f+=u),m&&(p-=l),g&&(f-=u),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=o.top-c):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=o.left-d):((0>=f-u||0>=p-l)&&(t=i._getPaddingPlusBorderDimensions(this)),f-u>0?(i.size.height=f,i.position.top=o.top-c):(f=u-t.height,i.size.height=f,i.position.top=o.top+a.height-f),p-l>0?(i.size.width=p,i.position.left=o.left-d):(p=u-t.height,i.size.width=p,i.position.left=o.left+a.width-p))}}),e.ui.resizable,e.widget("ui.
vendor: 7,776 bytes, lines 1172-1173
1172selectable",e.ui.mouse,{version:"1.11.2",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this; 1173this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||this._isFloating(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,a.widgetName+"-item")===a?(s=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this));
vendor: 20,346 bytes, line 1173
1173return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-e(document).scrollTop()<o.scrollSensitivity?r=e(document).scrollTop(e(document).scrollTop()-o.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<o.scrollSensitivity&&(r=e(document).scrollTop(e(document).scrollTop()+o.scrollSpeed)),t.pageX-e(document).scrollLeft()<o.scrollSensitivity?r=e(document).scrollLeft(e(document).scrollLeft()-o.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<o.scrollSensitivity&&(r=e(document).scrollLeft(e(document).scrollLeft()+o.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!e.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=e.left,o=a+e.width,r=e.top,h=r+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>r&&h>s+l,c="y"===this.options.axis||t+u>a&&o>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return s?this.floating?a&&"right"===a||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){r.push(this)}var s,n,a,o,r=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(a=e(l[s]),n=a.length-1;n>=0;n--)o=e.data(a[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&h.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return e(r)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(n=e(c[i]),s=n.length-1;s>=0;s--)a=e.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(d.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(i=d.length-1;i>=0;i--)for(o=d[i][1],r=d[i][0],s=0,l=r.length;l>s;s++)h=e(r[s]),h.data(this.widgetName+"-item",o),u.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),n=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?t.currentItem.children().each(function(){e("<td> </td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(n)}):"img"===s&&n.attr("src",t.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(e,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var i,s,n,a,o,r,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,a=null,u=c.floating||this._isFloating(this.currentItem),o=u?"left":"top",r=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[o],l=!1,t[d]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(t[d]-h)&&(n=Math.abs(t[d]-h),a=this.items[s],this.direction=l?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(t=e(n.containment)[0],i=e(n.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(t){var i,s,n=this.options,a=t.pageX,o=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.
1173accordion",{version:"1.11.2",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,n=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),s=t.next(),n=s.uniqueId().attr("id"); 1174t.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(t=n.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.
vendor: 4,459 bytes, line 1174
1174css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?e():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:o?e():n,newPanel:r};t.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?e():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev().attr("aria-selected","false"),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"})},_animate:function(e,t,i){var s,n,a,o=this,r=0,h=e.length&&(!t.length||e.index()<t.index()),l=this.options.animate||{},u=h&&l.down||l,d=function(){o._toggleComplete(i)};return"number"==typeof u&&(a=u),"string"==typeof u&&(n=u),n=n||u.easing||l.easing,a=a||u.duration||l.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(this.hideProps,{duration:a,easing:n,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:a,easing:n,complete:d,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?r+=i.now:"content"!==o.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-r),r=0)}}),void 0):t.animate(this.hideProps,a,n,d):e.animate(this.showProps,a,n,d)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.2",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var i=e(t.currentTarget);i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)
vendor: 27,327 bytes, line 1174
1174}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var i,s,n,a,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,s=this.previousFilter||"",n=String.fromCharCode(t.keyCode),a=!1,clearTimeout(this.filterTimer),n===s?a=!0:n=s+n,i=this._filterMenuItems(n),i=a&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(t.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(t,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,n=this.options.icons.submenu,a=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),a.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),s=e("<span>").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=a.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset().top-this.activeMenu.offset().top-i-s,a=this.activeMenu.scrollTop(),o=this.activeMenu.height(),r=t.outerHeight(),0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find(".ui-state-active").not(".ui-state-focus").removeClass("ui-state-active")},_closeOnDocumentClick:function(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]()),this.focus(i,s)},nextPage:function(t){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-s-n}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-s+n>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)},_filterMenuItems:function(t){var i=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(e.trim(e(this).text()))})}}),e.widget("ui.autocomplete",{version:"1.11.2",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,i,s,n=this.element[0].nodeName.toLowerCase(),a="textarea"===n,o="input"===n;this.isMultiLine=a?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[a||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var a=e.ui.keyCode;switch(n.keyCode){case a.PAGE_UP:t=!0,this._move("previousPage",n);break;case a.PAGE_DOWN:t=!0,this._move("nextPage",n);break;case a.UP:t=!0,this._keyEvent("previous",n);break;case a.DOWN:t=!0,this._keyEvent("next",n);break;case a.ENTER:this.menu.active&&(t=!0,n.preventDefault(),this.menu.select(n));break;case a.TAB:this.menu.active&&this.menu.select(n);break;case a.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=e.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(e){return s?(s=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(s){s.target===t.element[0]||s.target===i||e.contains(i,s.target)||t.close()})})},menufocus:function(t,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:n})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&e.trim(s).length&&(this.liveRegion.children().hide(),e("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,s=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,s){s(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,n){s.xhr&&s.xhr.abort(),s.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){n(e)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),i=this.menu.element.is(":visible"),s=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!s)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var s=this;e.each(i,function(e,i){s._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var s=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return s.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var c,p="ui-button ui-widget ui-state-default ui-corner-all",f="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",m=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},g=function(t){var i=t.name,s=t.form,n=e([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?e(s).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),n};e.widget("ui.button",{version:"1.11.2",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,m),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,i=this.options,s="checkbox"===this.type||"radio"===this.type,n=s?"":"ui-state-active";null===i.label&&(i.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(p).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){i.disabled||this===c&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){i.disabled||e(this).removeClass(n)}).bind("click"+this.eventNamespace,function(e){i.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),s&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return i.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(i.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var s=t.element[0];g(s).not(s).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return i.disabled?!1:(e(this).addClass("ui-state-active"),c=this,t.document.one("mouseup",function(){c=null}),void 0)}).bind("mouseup"+this.eventNamespace,function(){return i.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return i.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",i.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(p+" ui-state-active "+f).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton(),void 0)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?g(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(f),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),s=this.options.icons,n=s.primary&&s.secondary,a=[];s.primary||s.secondary?(this.options.text&&a.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(a.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):a.push("ui-button-text-only"),t.addClass(a.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.2",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),i=this.element.find(this.options.items),s=i.filter(":ui-button");i.not(":ui-button").button(),s.button("refresh"),this.buttons=i.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.2"}});var v;e.extend(n.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return r(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var s,n,a;s=t.nodeName.toLowerCase(),n="div"===s||"span"===s,t.id||(this.uuid+=1,t.id="dp"+this.uuid),a=this._newInst(e(t),n),a.settings=e.extend({},i||{}),"input"===s?this._connectDatepicker(t,a):n&&this._inlineDatepicker(t,a)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?a(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var s=e(t);i.append=e([]),i.trigger=e([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,"datepicker",i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var s,n,a,o=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),o&&(i.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[r?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&t.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),a=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:a,alt:n,title:n}):e("<button type='button'></button>").addClass(this._triggerClass).html(a?e("<img/>").attr({src:a,alt:n,title:n}):n)),t[r?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,s,n,a=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(i=0,s=0,n=0;e.length>n;n++)e[n].length>i&&(i=e[n].length,s=n);return s},a.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),a.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())),e.input.attr("size",this._formatDate(e,a).length)}},_inlineDatepicker:function(t,i){var s=e(t);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,s,n,a){var o,h,l,u,d,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),r(c.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(c,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,l/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var i,s=e(t),n=e.data(t,"datepicker");s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty())
vendor: 4,831 bytes, lines 1174-1175
1174 1175},_enableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,a.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,a.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,s){var n,a,o,h,l=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),a=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),r(l.settings,n),null!==o&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,o)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),l),this._autoSize(l),this._setDate(l,a),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,s,n,a=e.datepicker._getInst(t.target),o=!0,r=a.dpDiv.is(".ui-datepicker-rtl");if(a._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),o=!1;break;case 13:return n=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",a.dpDiv),n[0]&&e.datepicker._selectDay(t.target,a.selectedMonth,a.selectedYear,n[0]),i=e.datepicker._get(a,"onSelect"),i?(s=e.datepicker._formatDate(a),i.apply(a.input?a.input[0]:null,[s,a])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,s,n=e.datepicker._getInst(t.target);return e.datepicker._get(n,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0
vendor: 23,744 bytes, line 1175
1175},_doKeyUp:function(t){var i,s=e.datepicker._getInst(t.target);if(s.input.val()!==s.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,e.datepicker._getFormatConfig(s)),i&&(e.datepicker._setDateFromField(s),e.datepicker._updateAlternate(s),e.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,n,a,o,h,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),n=e.datepicker._get(i,"beforeShow"),a=n?n.apply(t,[t,i]):{},a!==!1&&(r(i.settings,a),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),h={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),h=e.datepicker._checkOffset(i,h,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,v=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var i,s=this._getNumberOfMonths(t),n=s[1],a=17,r=t.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&t.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),t.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,s){var n=t.dpDiv.outerWidth(),a=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,r=t.input?t.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:e(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?n-o:0,i.left-=s&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=s&&i.top===t.input.offset().top+r?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+a>l&&l>a?Math.abs(a+r):0),i},_findPos:function(t){for(var i,s=this._getInst(t),n=this._get(s,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[n?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,s,n,a,o=this._curInst;!o||t&&o!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(o,"showAnim"),s=this._get(o,"duration"),n=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[i]||e.effects[i])?o.dpDiv.hide(i,e.datepicker._get(o,"showOptions"),s,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,a=this._get(o,"onClose"),a&&a.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),s=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==s)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,s){var n=e(t),a=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(a,i+("M"===s?this._get(a,"showCurrentAtPos"):0),s),this._updateDatepicker(a))},_gotoToday:function(t){var i,s=e(t),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(t,i,s){var n=e(t),a=this._getInst(n[0]);a["selected"+("M"===s?"Month":"Year")]=a["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(a),this._adjustDate(n)},_selectDay:function(t,i,s,n){var a,o=e(t);e(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(a=this._getInst(o[0]),a.selectedDay=a.currentDay=e("a",n).html(),a.selectedMonth=a.currentMonth=i,a.selectedYear=a.currentYear=s,this._selectDate(t,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var s,n=e(t),a=this._getInst(n[0]);i=null!=i?i:this._formatDate(a),a.input&&a.input.val(i),this._updateAlternate(a),s=this._get(a,"onSelect"),s?s.apply(a.input?a.input[0]:null,[i,a]):a.input&&a.input.trigger("change"),a.inline?this._updateDatepicker(a):(this._hideDatepicker(),this._lastInput=a.input[0],"object"!=typeof a.input[0]&&a.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,s,n,a=this._get(t,"altField");a&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),s=this._getDate(t),n=this.formatDate(i,s,this._getFormatConfig(t)),e(a).each(function(){e(this).val(n)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,s){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,a,o,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,c=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,v=-1,y=-1,b=!1,_=function(e){var i=t.length>n+1&&t.charAt(n+1)===e;return i&&n++,i},x=function(e){var t=_(e),s="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,n="y"===e?s:1,a=RegExp("^\\d{"+n+","+s+"}"),o=i.substring(h).match(a);if(!o)throw"Missing number at position "+h;return h+=o[0].length,parseInt(o[0],10)},w=function(t,s,n){var a=-1,o=e.map(_(t)?n:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,t){var s=t[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(a=t[0],h+=s.length,!1):void 0}),-1!==a)return a+1;throw"Unknown name at position "+h},k=function(){if(i.charAt(h)!==t.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;t.length>n;n++)if(b)"'"!==t.charAt(n)||_("'")?k():b=!1;else switch(t.charAt(n)){case"d":v=x("d");break;case"D":w("D",d,c);break;case"o":y=x("o");break;case"m":g=x("m");break;case"M":g=w("M",p,f);break;case"y":m=x("y");break;case"@":r=new Date(x("@")),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"!":r=new Date((x("!")-this._ticksTo1970)/1e4),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"'":_("'")?k():b=!0;break;default:k()}if(i.length>h&&(o=i.substr(h),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),y>-1)for(g=1,v=y;;){if(a=this._getDaysInMonth(m,g-1),a>=v)break;g++,v-=a}if(r=this._daylightSavingAdjust(new Date(m,g-1,v)),r.getFullYear()!==m||r.getMonth()+1!==g||r.getDate()!==v)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>s+1&&e.charAt(s+1)===t;return i&&s++,i},l=function(e,t,i){var s=""+t;if(h(e))for(;i>s.length;)s="0"+s;return s},u=function(e,t,i,s){return h(e)?s[t]:i[t]},d="",c=!1;if(t)for(s=0;e.length>s;s++)if(c)"'"!==e.charAt(s)||h("'")?d+=e.charAt(s):c=!1;else switch(e.charAt(s)){case"d":d+=l("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),n,a);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=l("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),o,r);break;case"y":d+=h("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(s)}return d},_possibleChars:function(e){var t,i="",s=!1,n=function(i){var s=e.length>t+1&&e.charAt(t+1)===i;return s&&t++,s};for(t=0;e.length>t;t++)if(s)"'"!==e.charAt(t)||n("'")?i+=e.charAt(t):s=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),s=e.lastVal=e.input?e.input.val():null,n=this._getDefaultDate(e),a=n,o=this._getFormatConfig(e);try{a=this.parseDate(i,s,o)||n}catch(r){s=t?"":s}e.selectedDay=a.getDate(),e.drawMonth=e.selectedMonth=a.getMonth(),e.drawYear=e.selectedYear=a.getFullYear(),e.currentDay=s?a.getDate():0,e.currentMonth=s?a.getMonth():0,e.currentYear=s?a.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,s){var n=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},a=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,a=n.getFullYear(),o=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":o+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o));break;case"y":case"Y":a+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o))}l=h.exec(i)}return new Date(a,o,r)},o=null==i||""===i?s:"string"==typeof i?a(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return o=o&&"Invalid Date"==""+o?s:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var s=!t,n=e.selectedMonth,a=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),n===e.selectedMonth&&a===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(s?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),s="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(s,-i,"M")},next:function(){e.datepicker._adjustDate(s,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(s)},selectDay:function(){return e.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(s,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,s,n,a,o,r,h,l,u,d,c,p,f,m,g,v,y,b,_,x,w,k,T,D,S,M,C,N,A,P,I,z,H,F,E,O,j,W,L=new Date,R=this._daylightSavingAdjust(new Date(L.getFullYear(),L.getMonth(),L.getDate())),Y=this._get(e,"isRTL"),B=this._get(e,"showButtonPanel"),J=this._get(e,"hideIfNoPrevNext"),q=this._get(e,"navigationAsDateFormat"),K=this._getNumberOfMonths(e),V=this._get(e,"showCurrentAtPos"),U=this._get(e,"stepMonths"),Q=1!==K[0]||1!==K[1],G=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),X=this._getMinMaxDate(e,"min"),$=this._getMinMaxDate(e,"max"),Z=e.drawMonth-V,et=e.drawYear;if(0>Z&&(Z+=12,et--),$)for(t=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-K[0]*K[1]+1,$.getDate())),t=X&&X>t?X:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=q?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-U,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":J?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(e,"nextText"),n=q?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z+U,1)),this._getFormatConfig(e)):n,a=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":J?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",o=this._get(e,"currentText"),r=this._get(e,"gotoCurrent")&&e.currentDay?G:R,o=q?this.formatDate(o,r,this._getFormatConfig(e)):o,h=e.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(e,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(e,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(Y?"":h)+"</div>":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",w=0;K[0]>w;w++){for(k="",this.maxRows=4,T=0;K[1]>T;T++){if(D=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),S=" ui-corner-all",M="",Q){if(M+="<div class='ui-datepicker-group",K[1]>1)switch(T){case 0:M+=" ui-datepicker-group-first",S=" ui-corner-"+(Y?"right":"left");break;case K[1]-1:M+=" ui-datepicker-group-last",S=" ui-corner-"+(Y?"left":"right");break;default:M+=" ui-datepicker-group-middle",S=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+S+"'>"+(/all|left/.test(S)&&0===w?Y?a:s:"")+(/all|right/.test(S)&&0===w?Y?s:a:"")+this._generateMonthYearHeader(e,Z,et,X,$,w>0||T>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",C=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",x=0;7>x;x++)N=(x+u)%7,C+="<th scope='col'"+((x+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+c[N]+"'>"+p[N]+"</span></th>";for(M+=C+"</tr></thead><tbody>",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),P=(this._getFirstDayOfMonth(et,Z)-u+7)%7,I=Math.ceil((P+A)/7),z=Q?this.maxRows>I?this.maxRows:I:I,this.maxRows=z,H=this._daylightSavingAdjust(new Date(et,Z,1-P)),F=0;z>F;F++){for(M+="<tr>",E=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(H)+"</td>":"",x=0;7>x;x++)O=g?g.apply(e.input?e.input[0]:null,[H]):[!0,""],j=H.getMonth()!==Z,W=j&&!y||!O[0]||X&&X>H||$&&H>$,E+="<td class='"+((x+u+6)%7>=5?" ui-datepicker-week-end":"")+(j?" ui-datepicker-other-month":"")+(H.getTime()===D.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===H.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(W?" "+this._unselectableClass+" ui-state-disabled":"")+(j&&!v?"":" "+O[1]+(H.getTime()===G.getTime()?" "+this._currentClass:"")+(H.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(j&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"'")+"'")+(W?"":" data-handler='selectDay' data-event='click' data-month='"+H.getMonth()+"' data-year='"+H.getFullYear()+"'")+">"+(j&&!v?" ":W?"<span class='ui-state-default'>"+H.getDate()+"</span>":"<a class='ui-state-default"+(H.getTime()===R.getTime()?" ui-state-highlight":"")+(H.getTime()===G.getTime()?" ui-state-active":"")+(j?" ui-priority-secondary":"")+"' href='#'>"+H.getDate()+"</a>")+"</td>",H.setDate(H.getDate()+1),H=this._daylightSavingAdjust(H);M+=E+"</tr>"}Z++,Z>11&&(Z=0,et++),M+="</tbody></table>"+(Q?"</div>"+(K[0]>0&&T===K[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),k+=M}_+=k}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,s,n,a,o,r){var h,l,u,d,c,p,f,m,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",_="";if(a||!g)_+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,_+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!h||u>=s.getMonth())&&(!l||n.getMonth()>=u)&&(_+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+r[u]+"</option>");_+="</select>"}if(y||(b+=_+(!a&&g&&v?"":" ")),!e.yearshtml)if(e.yearshtml="",a||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);return isNaN(t)?c:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=n?Math.min(m,n.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!a&&g&&v?"":" ")+_),b+="</div>"},_adjustInstDate:function(e,t,i){var s=e.drawYear+("Y"===i?t:0),n=e.drawMonth+("M"===i?t:0),a=Math.min(e.selectedDay,this._getDaysInMonth(s,n))+("D"===i?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(s,n,a)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),n=i&&i>t?i:t;return s&&n>s?s:n},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,s){var n=this._getNumberOfMonths(e),a=this._daylightSavingAdjust(new Date(i,s+(0>t?t:n[0]*n[1]),1));return 0>t&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(e,a)},_isInRange:function(e,t){var i,s,n=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),o=null,r=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),o=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||t.getTime()>=n.getTime())&&(!a||t.getTime()<=a.getTime())&&(!o||t.getFullYear()>=o)&&(!r||r>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,s){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var n=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(s,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),n,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new n,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.2",e.datepicker,e.widget("ui.d
vendor: 13,839 bytes, lines 1175-1176
1175ialog",{version:"1.11.2",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this._createWrapper(),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(this.uiDialog),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(n){}this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),a=Math.max.apply(null,n);return a>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",a+1),s=!0),s&&!i&&this._trigger("focus",t),s},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement; 1176e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0;if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");t.target!==n[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==s[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){n.focus()}),t.preventDefault()):(this._delay(function(){s.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html(" "),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(i,function(i,s){var n,a;s=e.isFunction(s)?{click:s,text:i}:s,s=e.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(t.element[0],arguments)},a={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,e("<button></button>",s).button(a).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,t(n))},drag:function(e,s){i._trigger("drag",e,t(s))},stop:function(n,a){var o=a.offset.left-i.document.scrollLeft(),r=a.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(r>=0?"+":"")+r,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,t(a))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,s=this.options,n=s.resizable,a=this.uiDialog.css("position"),o="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:o,start:function(s,n){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,t(n))},resize:function(e,s){i._trigger("resize",e,t(s))},stop:function(n,a){var o=i.uiDialog.offset(),r=o.left-i.document.scrollLeft(),h=o.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,t(a))}}).css("position",a)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(s=!0),e in i.resizableRelatedOptions&&(n[e]=t)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,t){var i,s,n=this.uiDialog;"dialogClass"===e&&n.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=n.is(":data(ui-draggable)"),i&&!t&&n.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(s=n.is(":data(ui-resizable)"),s&&!t&&n.resizable("destroy"),s&&"string"==typeof t&&n.resizable("option","handles",t),s||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),e=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),t=Math.max(0,s.minHeight-e),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-e):"none","auto"===s.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<div>").addClass("ui-widget-overlay ui-front").appendTo(this._appendTo()),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1)}},_destroyOverlay:function(){if(this.options.modal&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.progressbar",{version:"1.11.2",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")
vendor: 18,405 bytes, line 1176
1176}}),e.widget("ui.selectmenu",{version:"1.11.2",defaultElement:"<select>",options:{appendTo:null,disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:null,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this,i=this.element.attr("tabindex");this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:i||this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true"}).insertAfter(this.element),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<span>",{"class":"ui-selectmenu-text"}).appendTo(this.button),this._setText(this.buttonText,this.element.find("option:selected").text()),this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,i){e.preventDefault(),t._setSelection(),t._select(i.item.data("ui-selectmenu-item"),e)},focus:function(e,i){var s=i.item.data("ui-selectmenu-item");null!=t.focusIndex&&s.index!==t.focusIndex&&(t._trigger("focus",e,{item:s}),t.isOpen||t._select(s,e)),t.focusIndex=s.index,t.button.attr("aria-activedescendant",t.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,i){var s=this,n="";e.each(i,function(i,a){a.optgroup!==n&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(a.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:a.optgroup}).appendTo(t),n=a.optgroup),s._renderItemData(t,a)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,i){var s=e("<li>");return i.disabled&&s.addClass("ui-state-disabled"),this._setText(s,i.label),s.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html(" ")},_move:function(e,t){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex):(i=this.menuItems.eq(this.element[0].selectedIndex),n+=":not(.ui-state-disabled)"),s="first"===e||"last"===e?i["first"===e?"prevAll":"nextAll"](n).eq(-1):i[e+"All"](n).eq(0),s.length&&this.menuInstance.focus(t,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;this.range&&(window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_toggleAttr:function(){this.button.toggleClass("ui-corner-top",this.isOpen).toggleClass("ui-corner-all",!this.isOpen).attr("aria-expanded",this.isOpen),this.menuWrap.toggleClass("ui-selectmenu-open",this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var i=[];t.each(function(t,s){var n=e(s),a=n.parent("optgroup");i.push({element:n,index:t,value:n.attr("value"),label:n.text(),optgroup:a.attr("label")||"",disabled:a.prop("disabled")||n.prop("disabled")})}),this.items=i},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),t=n.length;i>t;t++)o.push(a);this.handles=n.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,a,o,r,h,l,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));(n>i||n===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(n=i,a=e(this),o=t)}),r=this._start(t,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),h=a.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-a.width()/2,top:t.pageY-h.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,n,a;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(n=this.values(),n[t]=i,a=this._trigger("slide",e,{handle:this.handles[t],value:i,values:n}),s=this.values(t?0:1),a!==!1&&this.values(t,i))):i!==this.value()&&(a=this._trigger("slide",e,{handle:this.handles[t],value:i}),a!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(t,i){var s,n,a;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),void 0;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(t,i){var s,n=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(n=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!i),this._super(t,i),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var e=(this.options.max-this._valueMin())%this.options.step;this.max=this.options.max-e},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,i,s,n,a,o=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:r.animate}))),t=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(t){var i,s,n,a,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),i=this._start(t,o),i===!1))return}switch(a=this.options.step,s=n=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:n=this._valueMin();break;case e.ui.keyCode.END:n=this._valueMax();break;case e.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+a);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-a)}this._slide(t,o,n)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.s
1176pinner",{version:"1.11.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,s){var n=i.attr(s);void 0!==n&&n.length&&(t[s]=n)}),t}
vendor: 5,351 bytes, lines 1176-1177
1176,_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>▲</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>▼</span>"+"</a>" 1177},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:h(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:h(function(e){this._stepUp(e)}
vendor: 17,463 bytes, line 1177
1177),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:h(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:h(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:h(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(h(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.2",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var i,s;t=t.cloneNode(!1),i=t.href.replace(e,""),s=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return t.hash.length>1&&i===s}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===t&&(s&&this.tabs.each(function(i,n){return e(n).attr("aria-controls")===s?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:n=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),t.ctrlKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function s(){return t>n&&(t=0),0>t&&(t=n),t}for(var n=this.tabs.length-1;-1!==e.inArray(s(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var n,a,o,r=e(s).uniqueId().attr("id"),h=e(s).closest("li"),l=h.attr("aria-controls");t._isLocal(s)?(n=s.hash,o=n.substring(1),a=t.element.find(t._sanitizeSelector(n))):(o=h.attr("aria-controls")||e({}).uniqueId()[0].id,n="#"+o,a=t.element.find(n),a.length||(a=t._createPanel(o),a.insertAfter(t.panels[i-1]||t.tablist)),a.attr("aria-live","polite")),a.length&&(t.panels=t.panels.add(a)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":o,"aria-labelledby":r}),a.attr("aria-labelledby",r)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,s=this.element.parent();"fill"===t?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n.closest("li"),o=a[0]===s[0],r=o&&i.collapsible,h=r?e():this._getPanelForTab(a),l=s.length?this._getPanelForTab(s):e(),u={oldTab:s,oldPanel:l,newTab:r?e():a,newPanel:h};t.preventDefault(),a.hasClass("ui-state-disabled")||a.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=r?!1:this.tabs.index(a),this.active=o?e():a,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(a),t),this._toggle(t,u))},_toggle:function(t,i){function s(){a.running=!1,a._trigger("activate",t,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&a.options.show?a._show(o,a.options.show,s):(o.show(),s())}var a=this,o=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&r.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId(),this.tablist.unbind(this.eventNamespace),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var s=this,n=this.tabs.eq(t),a=n.find(".ui-tabs-anchor"),o=this._getPanelForTab(n),r={tab:n,panel:o};this._isLocal(a[0])||(this.xhr=e.ajax(this._ajaxSettings(a,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(n.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){o.html(e),s._trigger("load",i,r)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&s.panels.stop(!1,!0),n.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href"),beforeSend:function(t,a){return n._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:a},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.2",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),n=e.inArray(i,s);-1!==n&&s.splice(n,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t.element)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur");n.target=n.currentTarget=s.element[0],t.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&s.parents().each(function(){var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,n=this,a=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){e.data("ui-tooltip-open")&&n._delay(function(){t&&(t.type=a),this._open(t,e,i)})}),i&&this._open(t,e,i),void 0)},_open:function(t,i,s){function n(e){u.of=e,o.is(":hidden")||o.position(u)}var a,o,r,h,l,u=e.extend({},this.options.position);if(s){if(a=this._find(i))return a.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),a=this._tooltip(i),o=a.tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),s.clone?(l=s.clone(),l.removeAttr("id").find("[id]").removeAttr("id")):l=s,e("<div>").html(l).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:n}),n(t)):o.position(e.extend({of:i},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){o.is(":visible")&&(n(u.of),clearInterval(h))},e.fx.interval)),this._trigger("open",t,{tooltip:o}),r={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var s=e.Event(t);s.currentTarget=i[0],this.close(s,!0)}}},i[0]!==this.element[0]&&(r.remove=function(){this._removeTooltip(o)}),t&&"mouseover"!==t.type||(r.mouseleave="close"),t&&"focusin"!==t.type||(r.focusout="close"),this._on(!0,i,r)}},close:function(t){var i,s=this,n=e(t?t.currentTarget:this.element),a=this._find(n);a&&(i=a.tooltip,a.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),a.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(e(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete s.parents[t]}),a.closing=!0,this._trigger("close",t,{tooltip:i}),a.hiding||(a.closing=!1)))},_tooltip:function(t){var i=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),s=i.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[s]={element:t,tooltip:i}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur"),a=s.element;n.target=n.currentTarget=a[0],t.close(n,!0),e("#"+i).remove(),a.data("ui-tooltip-title")&&(a.attr("title")||a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}})
vendor: 11,735 bytes, line 1177
1177;var y="ui-effects-",b=e;e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[u[l].cache]=o[u[l].cache],n=s._rgba=o._rgba,!1):t}),n.length?("0,0,0,0"===n.join()&&e.extend(n,a.transparent),s):a[i]}function n(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,n){return new e.Color.fn.parse(t,i,s,n)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(n,o,r,h){if(n===t)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=e(n).css(o),o=t);var d=this,c=e.type(n),p=this._rgba=[];return o!==t&&(n=[n,o,r,h],c="array"),"string"===c?this.parse(s(n)||a._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(n[t.idx],t)}),this):"object"===c?(n instanceof l?f(u,function(e,t){n[t.cache]&&(d[t.cache]=n[t.cache].slice())}):f(u,function(t,s){var a=s.cache;f(s.props,function(e,t){if(!d[a]&&s.to){if("alpha"===e||null==n[e])return;d[a]=s.to(d._rgba)}d[a][t.idx]=i(n[e],t,!0)}),d[a]&&0>e.inArray(null,d[a].slice(0,3))&&(d[a][3]=1,s.from&&(d._rgba=s.from(d[a])))}),this):t},is:function(e){var i=l(e),s=!0,n=this;return f(u,function(e,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(e,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),n=s._space(),a=u[n],o=0===this.alpha()?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice();return s=s[a.cache],f(a.props,function(e,n){var a=n.idx,o=r[a],l=s[a],u=d[n.type]||{};null!==l&&(null===o?h[a]=l:(u.mod&&(l-o>u.mod/2?o+=u.mod:o-l>u.mod/2&&(o-=u.mod)),h[a]=i((l-o)*t+o,n)))}),this[n](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*n[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,n=e[1]/255,a=e[2]/255,o=e[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,u=r+h,d=.5*u;return t=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==o?1:o]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],a=e[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,t+1/3)),Math.round(255*n(r,o,t)),Math.round(255*n(r,o,t-1/3)),a]},f(u,function(s,n){var a=n.props,o=n.cache,h=n.to,u=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===t)return this[o].slice();var n,r=e.type(s),d="array"===r||"object"===r?s:arguments,c=this[o].slice();return f(a,function(e,t){var s=d["object"===r?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(n=l(u(c)),n[o]=c,n):l(c)},f(a,function(t,i){l.fn[t]||(l.fn[t]=function(n){var a,o=e.type(n),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===o?u:("function"===o&&(n=n.call(this,u),o=e.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=u+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,n){var a,o,r="";if("transparent"!==n&&("string"!==e.type(n)||(a=s(n)))){if(n=l(a||n),!c.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?t.parentNode:t;(""===r||"transparent"===r)&&o&&o.style;)try{r=e.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{t.style[i]=n}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},a=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(b),function(){function t(t){var i,s,n=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[e.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function i(t,i){var s,a,o={};for(s in i)a=i[s],t[s]!==a&&(n[s]||(e.fx.step[s]||!isNaN(parseFloat(a)))&&(o[s]=a));return o}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(b.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(n,a,o,r){var h=e.speed(a,o,r);return this.queue(function(){var a,o=e(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack():o;l=l.map(function(){var i=e(this);return{el:i,start:t(this)}}),a=function(){e.each(s,function(e,t){n[t]&&o[t+"Class"](n[t])})},a(),l=l.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),o.attr("class",r),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(i,s,n,a){return s?e.effects.animateClass.call(this,{add:i},s,n,a):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,n,a){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,n,a):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,n,a,o){return"boolean"==typeof s||void 0===s?n?e.effects.animateClass.call(this,s?{add:i}:{remove:i},n,a,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,n,a)}}(e.fn.toggleClass),switchClass:function(t,i,s,n,a){return e.effects.animateClass.call(this,{add:i,remove:t},s,n,a)}})}(),function(){function t(t,i,s,n){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(n=s,s=i,i={}),e.isFunction(s)&&(n=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=n||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.2",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(y+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(y+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:t.width(),height:t.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return t.wrap(s),(t[0]===a||e.contains(t[0],a))&&e(a).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(n),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,n){return n=n||{},e.each(i,function(e,i){var a=t.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(a)&&a.call(n[0]),e.isFunction(t)&&t()}var n=e(this),a=s.complete,r=s.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),i()):o.call(n[0],s,i)}var s=t.apply(this,arguments),n=s.mode,a=s.queue,o=e.effects.effect[s.effect];return e.fx.off||!o?n?this[n](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):a===!1?this.each(i):this.queue(a||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);
1177
vendor: 8,146 bytes, line 1178
1178var n=t.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var s,n,a,o=e(this),r=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(o,t.mode||"hide"),d=t.direction||"up",c=r.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u;o.parent().is(".ui-effects-wrapper")?e.effects.save(o.parent(),l):e.effects.save(o,l),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n=s[p](),a=parseFloat(s.css(f))||0,g[p]=v?n:0,m||(o.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?a:n+a),v&&(s.css(p,0),m||s.css(f,a+n)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&o.hide(),e.effects.restore(o,l),e.effects.removeWrapper(o),i()}})},e.effects.effect.bounce=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=o.queue(),_=b.length;for((u||l)&&r.push("opacity"),e.effects.save(o,r),o.show(),e.effects.createWrapper(o),c||(c=o["top"===v?"outerHeight":"outerWidth"]()/3),u&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,y?2*-c:2*c).animate(a,m,g)),l&&(c/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g).animate(a,m,g),c=l?2*c:c/2;l&&(n={opacity:0},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g)),o.queue(function(){l&&o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),o.dequeue()},e.effects.effect.clip=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(o,r),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[c](),l&&(n.css(c,0),n.css(p,a/2)),f[c]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}})},e.effects.effect.drop=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(n,t.mode||"hide"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:r?1:0};e.effects.save(n,a),n.show(),e.effects.createWrapper(n),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&n()}function n(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var a,o,r,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(a=0;d>a;a++)for(h=g.top+a*y,u=a-(d-1)/2,o=0;c>o;o++)r=g.left+o*v,l=o-(c-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:r+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,n,a=e(this),o=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"hide"),h="show"===r,l="hide"===r,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(a,o),a.show(),s=e.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*n[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?n[0]:u,v[f[1]]=h?n[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){l&&a.hide(),e.effects.restore(a,o),e.effects.removeWrapper(a),i()})},e.effects.effect.highlight=function(t,i){var s=e(this),n=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(s,t.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),e.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&s.hide(),e.effects.restore(s,n),i()}})},e.effects.effect.size=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=o.css("position"),y=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||s):(o.from=t.from||("show"===p?b:s),o.to=t.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(y=y.concat(d),o.from=e.effects.setTransition(o,d,a.from.y,o.from),o.to=e.effects.setTransition(o,d,a.to.y,o.to)),a.from.x!==a.to.x&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,a.from.x,o.from),o.to=e.effects.setTransition(o,c,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(y=y.concat(u).concat(l),o.from=e.effects.setTransition(o,u,a.from.y,o.from),o.to=e.effects.setTransition(o,u,a.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=e.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=r.concat(d).concat(c),o.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};
vendor: 3,611 bytes, line 1178
1178f&&e.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=e.effects.setTransition(i,d,a.from.y,i.from),i.to=e.effects.setTransition(i,d,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=e.effects.setTransition(i,c,a.from.x,i.from),i.to=e.effects.setTransition(i,c,a.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),e.effects.restore(o,y),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,i){var s=parseInt(i,10),n=e?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),e.effects.removeWrapper(o),i()}})},e.effects.effect.scale=function(t,i){var s=e(this),n=e.extend(!0,{},t),a=e.effects.setMode(s,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),r=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},e.effects.effect.puff=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"hide"),a="hide"===n,o=parseInt(t.percent,10)||150,r=o/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,n=e(this),a=e.effects.setMode(n,t.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=n.queue(),p=c.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),d=1),s=1;l>s;s++)n.animate({opacity:d},u,t.easing),d=1-d;n.animate({opacity:d},u,t.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),n.dequeue()},e.effects.effect.shake=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"effect"),r=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue(),y=v.length;for(e.effects.save(n,a),n.show(),e.effects.createWrapper(n),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,n.animate(f,d,t.easing),s=1;l>s;s++)n.animate(m,d,t.easing).animate(g,d,t.easing);n.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),n.dequeue()},e.effects.effect.slide=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(n,t.mode||"show"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"to
1178p":"left",u="up"===h||"left"===h,d={};e.effects.save(n,a),n.show(),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(r?u?"+=":"-=":u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.transfer=function(t,i){var s=e(this),n=e(t.to),a="fixed"===n.css("position"),o=e("body"),r=a?o.scrollTop():0,h=a?o.scrollLeft():0,l=n.offset(),u={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},d=s.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:d.top-r,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})}});; 1179 1180/*jslint browser: true */ /*global jQuery: true */ 1181 1182/** 1183 * jQuery Cookie plugin 1184 * 1185 * Copyright (c) 2010 Klaus Hartl (stilbuero.de) 1186 * Dual licensed under the MIT and GPL licenses: 1187 * http://www.opensource.org/licenses/mit-license.php 1188 * http://www.gnu.org/licenses/gpl.html 1189 * 1190 */ 1191 1192// TODO JsDoc 1193 1194/** 1195 * Create a cookie with the given key and value and other optional parameters. 1196 * 1197 * @example $.cookie('the_cookie', 'the_value'); 1198 * @desc Set the value of a cookie. 1199 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); 1200 * @desc Create a cookie with all available options. 1201 * @example $.cookie('the_cookie', 'the_value'); 1202 * @desc Create a session cookie. 1203 * @example $.cookie('the_cookie', null); 1204 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain 1205 * used when the cookie was set. 1206 * 1207 * @param String key The key of the cookie. 1208 * @param String value The value of the cookie. 1209 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. 1210 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. 1211 * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. 1212 * If set to null or omitted, the cookie will be a session cookie and will not be retained 1213 * when the the browser exits. 1214 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). 1215 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). 1216 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will 1217 * require a secure protocol (like HTTPS). 1218 * @type undefined 1219 * 1220 * @name $.cookie 1221 * @cat Plugins/Cookie 1222 * @author Klaus Hartl/[email protected] 1223 */ 1224 1225/** 1226 * Get the value of a cookie with the given key. 1227 * 1228 * @example $.cookie('the_cookie'); 1229 * @desc Get the value of a cookie. 1230 * 1231 * @param String key The key of the cookie. 1232 * @return The value of the cookie. 1233 * @type String 1234 * 1235 * @name $.cookie 1236 * @cat Plugins/Cookie 1237 * @author Klaus Hartl/[email protected] 1238 */ 1239jQuery.cookie = function (key, value, options) { 1240 1241 // key and at least value given, set cookie... 1242 if (arguments.length > 1 && String(value) !== "[object Object]") { 1243 options = jQuery.extend({}, options); 1244 1245 if (value === null || value === undefined) { 1246 options.expires = -1; 1247 } 1248 1249 if (typeof options.expires === 'number') { 1250 var days = options.expires, t = options.expires = new Date(); 1251 t.setDate(t.getDate() + days); 1252 } 1253 1254 value = String(value); 1255 1256 return (document.cookie = [ 1257 encodeURIComponent(key), '=', 1258 options.raw ? value : encodeURIComponent(value), 1259 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 1260 options.path ? '; path=' + options.path : '', 1261 options.domain ? '; domain=' + options.domain : '', 1262 options.secure ? '; secure' : '' 1263 ].join('')); 1264 } 1265 1266 // key and possibly options given, get cookie... 1267 options = value || {}; 1268 var result, decode = options.raw ? function (s) { return s; }
vendor: 7,449 bytes, lines 1268-1471
1268 : decodeURIComponent; 1269 return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null; 1270}; 1271; 1272 1273/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh) 1274 * Licensed under the MIT License (LICENSE.txt). 1275 * 1276 * Version: 3.1.12 1277 * 1278 * Requires: jQuery 1.2.2+ 1279 */ 1280 1281(function (factory) { 1282 if ( typeof define === 'function' && define.amd ) { 1283 // AMD. Register as an anonymous module. 1284 define(['jquery'], factory); 1285 } else if (typeof exports === 'object') { 1286 // Node/CommonJS style for Browserify 1287 module.exports = factory; 1288 } else { 1289 // Browser globals 1290 factory(jQuery); 1291 } 1292}(function ($) { 1293 1294 var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], 1295 toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? 1296 ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], 1297 slice = Array.prototype.slice, 1298 nullLowestDeltaTimeout, lowestDelta; 1299 1300 if ( $.event.fixHooks ) { 1301 for ( var i = toFix.length; i; ) { 1302 $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; 1303 } 1304 } 1305 1306 var special = $.event.special.mousewheel = { 1307 version: '3.1.12', 1308 1309 setup: function() { 1310 if ( this.addEventListener ) { 1311 for ( var i = toBind.length; i; ) { 1312 this.addEventListener( toBind[--i], handler, false ); 1313 } 1314 } else { 1315 this.onmousewheel = handler; 1316 } 1317 // Store the line height and page height for this particular element 1318 $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); 1319 $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); 1320 }, 1321 1322 teardown: function() { 1323 if ( this.removeEventListener ) { 1324 for ( var i = toBind.length; i; ) { 1325 this.removeEventListener( toBind[--i], handler, false ); 1326 } 1327 } else { 1328 this.onmousewheel = null; 1329 } 1330 // Clean up the data we added to the element 1331 $.removeData(this, 'mousewheel-line-height'); 1332 $.removeData(this, 'mousewheel-page-height'); 1333 }, 1334 1335 getLineHeight: function(elem) { 1336 var $elem = $(elem), 1337 $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); 1338 if (!$parent.length) { 1339 $parent = $('body'); 1340 } 1341 return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; 1342 }, 1343 1344 getPageHeight: function(elem) { 1345 return $(elem).height(); 1346 }, 1347 1348 settings: { 1349 adjustOldDeltas: true, // see shouldAdjustOldDeltas() below 1350 normalizeOffset: true // calls getBoundingClientRect for each event 1351 } 1352 }; 1353 1354 $.fn.extend({ 1355 mousewheel: function(fn) { 1356 return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); 1357 }, 1358 1359 unmousewheel: function(fn) { 1360 return this.unbind('mousewheel', fn); 1361 } 1362 }); 1363 1364 1365 function handler(event) { 1366 var orgEvent = event || window.event, 1367 args = slice.call(arguments, 1), 1368 delta = 0, 1369 deltaX = 0, 1370 deltaY = 0, 1371 absDelta = 0, 1372 offsetX = 0, 1373 offsetY = 0; 1374 event = $.event.fix(orgEvent); 1375 event.type = 'mousewheel'; 1376 1377 // Old school scrollwheel delta 1378 if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; } 1379 if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; } 1380 if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; } 1381 if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; } 1382 1383 // Firefox < 17 horizontal scrolling related to DOMMouseScroll event 1384 if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { 1385 deltaX = deltaY * -1; 1386 deltaY = 0; 1387 } 1388 1389 // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy 1390 delta = deltaY === 0 ? deltaX : deltaY; 1391 1392 // New school wheel delta (wheel event) 1393 if ( 'deltaY' in orgEvent ) { 1394 deltaY = orgEvent.deltaY * -1; 1395 delta = deltaY; 1396 } 1397 if ( 'deltaX' in orgEvent ) { 1398 deltaX = orgEvent.deltaX; 1399 if ( deltaY === 0 ) { delta = deltaX * -1; } 1400 } 1401 1402 // No change actually happened, no reason to go any further 1403 if ( deltaY === 0 && deltaX === 0 ) { return; } 1404 1405 // Need to convert lines and pages to pixels if we aren't already in pixels 1406 // There are three delta modes: 1407 // * deltaMode 0 is by pixels, nothing to do 1408 // * deltaMode 1 is by lines 1409 // * deltaMode 2 is by pages 1410 if ( orgEvent.deltaMode === 1 ) { 1411 var lineHeight = $.data(this, 'mousewheel-line-height'); 1412 delta *= lineHeight; 1413 deltaY *= lineHeight; 1414 deltaX *= lineHeight; 1415 } else if ( orgEvent.deltaMode === 2 ) { 1416 var pageHeight = $.data(this, 'mousewheel-page-height'); 1417 delta *= pageHeight; 1418 deltaY *= pageHeight; 1419 deltaX *= pageHeight; 1420 } 1421 1422 // Store lowest absolute delta to normalize the delta values 1423 absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) ); 1424 1425 if ( !lowestDelta || absDelta < lowestDelta ) { 1426 lowestDelta = absDelta; 1427 1428 // Adjust older deltas if necessary 1429 if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { 1430 lowestDelta /= 40; 1431 } 1432 } 1433 1434 // Adjust older deltas if necessary 1435 if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { 1436 // Divide all the things by 40! 1437 delta /= 40; 1438 deltaX /= 40; 1439 deltaY /= 40; 1440 } 1441 1442 // Get a whole, normalized value for the deltas 1443 delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta); 1444 deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta); 1445 deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta); 1446 1447 // Normalise offsetX and offsetY properties 1448 if ( special.settings.normalizeOffset && this.getBoundingClientRect ) { 1449 var boundingRect = this.getBoundingClientRect(); 1450 offsetX = event.clientX - boundingRect.left; 1451 offsetY = event.clientY - boundingRect.top; 1452 } 1453 1454 // Add information to the event object 1455 event.deltaX = deltaX; 1456 event.deltaY = deltaY; 1457 event.deltaFactor = lowestDelta; 1458 event.offsetX = offsetX; 1459 event.offsetY = offsetY; 1460 // Go ahead and set deltaMode to 0 since we converted to pixels 1461 // Although this is a little odd since we overwrite the deltaX/Y 1462 // properties with normalized deltas. 1463 event.deltaMode = 0; 1464 1465 // Add event and delta to the front of the arguments 1466 args.unshift(event, delta, deltaX, deltaY); 1467 1468 // Clearout lowestDelta after sometime to better 1469 // handle multiple device types that give different 1470 // a different lowestDelta 1471 // Ex: trackpad = 3 and mouse wheel = 120
1472 if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } 1473 nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); 1474 1475 return ($.event.dispatch || $.event.handle).apply(this, args); 1476 } 1477 1478 function nullLowestDelta() { 1479 lowestDelta = null; 1480 } 1481 1482 function shouldAdjustOldDeltas(orgEvent, absDelta) { 1483 // If this is an older event and the delta is divisable by 120, 1484 // then we are assuming that the browser is treating this as an 1485 // older mouse wheel event and that we should divide the deltas 1486 // by 40 to try and get a more usable deltaFactor. 1487 // Side note, this actually impacts the reported scroll distance 1488 // in older browsers and can cause scrolling to be slower than native. 1489 // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false. 1490 return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0; 1491 } 1492 1493})); 1494; 1495 1496/*! 1497 * jquery.event.drag - v 2.2 1498 * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com 1499 * Open Source MIT License - http://threedubmedia.com/code/license 1500 */ 1501// Created: 2008-06-04 1502// Updated: 2012-05-21 1503// REQUIRES: jquery 1.7.x 1504 1505;(function( $ ){ 1506 1507// add the jquery instance method 1508$.fn.drag = function( str, arg, opts ){ 1509 // figure out the event type 1510 var type = typeof str == "string" ? str : "", 1511 // figure out the event handler... 1512 fn = $.isFunction( str ) ? str : $.isFunction( arg ) ? arg : null; 1513 // fix the event type 1514 if ( type.indexOf("drag") !== 0 ) 1515 type = "drag"+ type; 1516 // were options passed 1517 opts = ( str == fn ? arg : opts ) || {}; 1518 // trigger or bind event handler 1519 return fn ? this.bind( type, opts, fn ) : this.trigger( type ); 1520}; 1521 1522// local refs (increase compression) 1523var $event = $.event, 1524$special = $event.special, 1525// configure the drag special event 1526drag = $special.drag = { 1527 1528 // these are the default settings 1529 defaults: { 1530 which: 1, // mouse button pressed to start drag sequence 1531 distance: 0, // distance dragged before dragstart 1532 not: ':input', // selector to suppress dragging on target elements 1533 handle: null, // selector to match handle target elements 1534 relative: false, // true to use "position", false to use "offset" 1535 drop: true, // false to suppress drop events, true or selector to allow 1536 click: false // false to suppress click events after dragend (no proxy) 1537 }, 1538 1539 // the key name for stored drag data 1540 datakey: "dragdata", 1541 1542 // prevent bubbling for better performance 1543 noBubble: true, 1544 1545 // count bound related events 1546 add: function( obj ){ 1547 // read the interaction data 1548 var data = $.data( this, drag.datakey ), 1549 // read any passed options 1550 opts = obj.data || {}; 1551 // count another realted event 1552 data.related += 1; 1553 // extend data options bound with this event 1554 // don't iterate "opts" in case it is a node 1555 $.each( drag.defaults, function( key, def ){ 1556 if ( opts[ key ] !== undefined ) 1557 data[ key ] = opts[ key ]; 1558 }); 1559 }, 1560 1561 // forget unbound related events 1562 remove: function(){ 1563 $.data( this, drag.datakey ).related -= 1; 1564 }, 1565 1566 // configure interaction, capture settings 1567 setup: function(){ 1568 // check for related events 1569 if ( $.data( this, drag.datakey ) ) 1570 return; 1571 // initialize the drag data with copied defaults 1572 var data = $.extend({ related:0 }, drag.defaults ); 1573 // store the interaction data 1574 $.data( this, drag.datakey, data ); 1575 // bind the mousedown event, which starts drag interactions 1576 $event.add( this, "touchstart mousedown", drag.init, data ); 1577 // prevent image dragging in IE... 1578 if ( this.attachEvent ) 1579 this.attachEvent("ondragstart", drag.dontstart ); 1580 }, 1581 1582 // destroy configured interaction 1583 teardown: function(){ 1584 var data = $.data( this, drag.datakey ) || {}; 1585 // check for related events 1586 if ( data.related ) 1587 return; 1588 // remove the stored data 1589 $.removeData( this, drag.datakey ); 1590 // remove the mousedown event 1591 $event.remove( this, "touchstart mousedown", drag.init ); 1592 // enable text selection 1593 drag.textselect( true ); 1594 // un-prevent image dragging in IE... 1595 if ( this.detachEvent ) 1596 this.detachEvent("ondragstart", drag.dontstart ); 1597 }, 1598 1599 // initialize the interaction 1600 init: function( event ){ 1601 // sorry, only one touch at a time 1602 if ( drag.touched ) 1603 return; 1604 // the drag/drop interaction data 1605 var dd = event.data, results; 1606 // check the which directive 1607 if ( event.which != 0 && dd.which > 0 && event.which != dd.which ) 1608 return; 1609 // check for suppressed selector 1610 if ( $( event.target ).is( dd.not ) ) 1611 return; 1612 // check for handle selector 1613 if ( dd.handle && !$( event.target ).closest( dd.handle, event.currentTarget ).length ) 1614 return; 1615 1616 drag.touched = event.type == 'touchstart' ? this : null; 1617 dd.propagates = 1; 1618 dd.mousedown = this; 1619 dd.interactions = [ drag.interaction( this, dd ) ]; 1620 dd.target = event.target; 1621 dd.pageX = event.pageX; 1622 dd.pageY = event.pageY; 1623 dd.dragging = null; 1624 // handle draginit event... 1625 results = drag.hijack( event, "draginit", dd ); 1626 // early cancel 1627 if ( !dd.propagates ) 1628 return; 1629 // flatten the result set 1630 results = drag.flatten( results ); 1631 // insert new interaction elements 1632 if ( results && results.length ){ 1633 dd.interactions = []; 1634 $.each( results, function(){ 1635 dd.interactions.push( drag.interaction( this, dd ) ); 1636 }); 1637 } 1638 // remember how many interactions are propagating 1639 dd.propagates = dd.interactions.length; 1640 // locate and init the drop targets 1641 if ( dd.drop !== false && $special.drop ) 1642 $special.drop.handler( event, dd ); 1643 // disable text selection 1644 drag.textselect( false ); 1645 // bind additional events... 1646 if ( drag.touched ) 1647 $event.add( drag.touched, "touchmove touchend", drag.handler, dd ); 1648 else 1649 $event.add( document, "mousemove mouseup", drag.handler, dd ); 1650 // helps prevent text selection or scrolling 1651 if ( !drag.touched || dd.live ) 1652 return false;
1653 }, 1654 1655 // returns an interaction object 1656 interaction: function( elem, dd ){ 1657 var offset = $( elem )[ dd.relative ? "position" : "offset" ]() || { top:0, left:0 }; 1658 return { 1659 drag: elem, 1660 callback: new drag.callback(), 1661 droppable: [], 1662 offset: offset 1663 }; 1664 }, 1665 1666 // handle drag-releatd DOM events 1667 handler: function( event ){ 1668 // read the data before hijacking anything 1669 var dd = event.data; 1670 // handle various events 1671 switch ( event.type ){ 1672 // mousemove, check distance, start dragging 1673 case !dd.dragging && 'touchmove': 1674 event.preventDefault(); 1675 case !dd.dragging && 'mousemove': 1676 // drag tolerance, x² + y² = distance² 1677 if ( Math.pow( event.pageX-dd.pageX, 2 ) + Math.pow( event.pageY-dd.pageY, 2 ) < Math.pow( dd.distance, 2 ) ) 1678 break; // distance tolerance not reached 1679 event.target = dd.target; // force target from "mousedown" event (fix distance issue) 1680 drag.hijack( event, "dragstart", dd ); // trigger "dragstart" 1681 if ( dd.propagates ) // "dragstart" not rejected 1682 dd.dragging = true; // activate interaction 1683 // mousemove, dragging 1684 case 'touchmove': 1685 event.preventDefault(); 1686 case 'mousemove': 1687 if ( dd.dragging ){ 1688 // trigger "drag" 1689 drag.hijack( event, "drag", dd ); 1690 if ( dd.propagates ){ 1691 // manage drop events 1692 if ( dd.drop !== false && $special.drop ) 1693 $special.drop.handler( event, dd ); // "dropstart", "dropend" 1694 break; // "drag" not rejected, stop 1695 } 1696 event.type = "mouseup"; // helps "drop" handler behave 1697 } 1698 // mouseup, stop dragging 1699 case 'touchend': 1700 case 'mouseup': 1701 default: 1702 if ( drag.touched ) 1703 $event.remove( drag.touched, "touchmove touchend", drag.handler ); // remove touch events 1704 else 1705 $event.remove( document, "mousemove mouseup", drag.handler ); // remove page events 1706 if ( dd.dragging ){ 1707 if ( dd.drop !== false && $special.drop ) 1708 $special.drop.handler( event, dd ); // "drop" 1709 drag.hijack( event, "dragend", dd ); // trigger "dragend" 1710 } 1711 drag.textselect( true ); // enable text selection 1712 // if suppressing click events... 1713 if ( dd.click === false && dd.dragging ) 1714 $.data( dd.mousedown, "suppress.click", new Date().getTime() + 5 ); 1715 dd.dragging = drag.touched = false; // deactivate element 1716 break; 1717 } 1718 }, 1719 1720 // re-use event object for custom events 1721 hijack: function( event, type, dd, x, elem ){ 1722 // not configured 1723 if ( !dd ) 1724 return; 1725 // remember the original event and type 1726 var orig = { event:event.originalEvent, type:event.type }, 1727 // is the event drag related or drog related? 1728 mode = type.indexOf("drop") ? "drag" : "drop", 1729 // iteration vars 1730 result, i = x || 0, ia, $elems, callback, 1731 len = !isNaN( x ) ? x : dd.interactions.length; 1732 // modify the event type 1733 event.type = type; 1734 // remove the original event 1735 event.originalEvent = null; 1736 // initialize the results 1737 dd.results = []; 1738 // handle each interacted element 1739 do if ( ia = dd.interactions[ i ] ){ 1740 // validate the interaction 1741 if ( type !== "dragend" && ia.cancelled ) 1742 continue; 1743 // set the dragdrop properties on the event object 1744 callback = drag.properties( event, dd, ia ); 1745 // prepare for more results 1746 ia.results = []; 1747 // handle each element 1748 $( elem || ia[ mode ] || dd.droppable ).each(function( p, subject ){ 1749 // identify drag or drop targets individually
1750 callback.target = subject; 1751 // force propagtion of the custom event 1752 event.isPropagationStopped = function(){ return false; }; 1753 // handle the event 1754 result = subject ? $event.dispatch.call( subject, event, callback ) : null; 1755 // stop the drag interaction for this element 1756 if ( result === false ){ 1757 if ( mode == "drag" ){ 1758 ia.cancelled = true; 1759 dd.propagates -= 1; 1760 } 1761 if ( type == "drop" ){ 1762 ia[ mode ][p] = null; 1763 } 1764 } 1765 // assign any dropinit elements 1766 else if ( type == "dropinit" ) 1767 ia.droppable.push( drag.element( result ) || subject ); 1768 // accept a returned proxy element 1769 if ( type == "dragstart" ) 1770 ia.proxy = $( drag.element( result ) || ia.drag )[0]; 1771 // remember this result 1772 ia.results.push( result ); 1773 // forget the event result, for recycling 1774 delete event.result; 1775 // break on cancelled handler 1776 if ( type !== "dropinit" ) 1777 return result; 1778 }); 1779 // flatten the results 1780 dd.results[ i ] = drag.flatten( ia.results ); 1781 // accept a set of valid drop targets 1782 if ( type == "dropinit" ) 1783 ia.droppable = drag.flatten( ia.droppable ); 1784 // locate drop targets 1785 if ( type == "dragstart" && !ia.cancelled ) 1786 callback.update(); 1787 } 1788 while ( ++i < len ) 1789 // restore the original event & type 1790 event.type = orig.type; 1791 event.originalEvent = orig.event; 1792 // return all handler results 1793 return drag.flatten( dd.results ); 1794 }, 1795 1796 // extend the callback object with drag/drop properties... 1797 properties: function( event, dd, ia ){ 1798 var obj = ia.callback; 1799 // elements 1800 obj.drag = ia.drag; 1801 obj.proxy = ia.proxy || ia.drag; 1802 // starting mouse position 1803 obj.startX = dd.pageX; 1804 obj.startY = dd.pageY; 1805 // current distance dragged 1806 obj.deltaX = event.pageX - dd.pageX; 1807 obj.deltaY = event.pageY - dd.pageY; 1808 // original element position 1809 obj.originalX = ia.offset.left; 1810 obj.originalY = ia.offset.top; 1811 // adjusted element position 1812 obj.offsetX = obj.originalX + obj.deltaX; 1813 obj.offsetY = obj.originalY + obj.deltaY; 1814 // assign the drop targets information 1815 obj.drop = drag.flatten( ( ia.drop || [] ).slice() ); 1816 obj.available = drag.flatten( ( ia.droppable || [] ).slice() ); 1817 return obj; 1818 }, 1819 1820 // determine is the argument is an element or jquery instance 1821 element: function( arg ){ 1822 if ( arg && ( arg.jquery || arg.nodeType == 1 ) ) 1823 return arg; 1824 }, 1825 1826 // flatten nested jquery objects and arrays into a single dimension array 1827 flatten: function( arr ){ 1828 return $.map( arr, function( member ){ 1829 return member && member.jquery ? $.makeArray( member ) : 1830 member && member.length ? drag.flatten( member ) : member; 1831 }); 1832 }, 1833 1834 // toggles text selection attributes ON (true) or OFF (false) 1835 textselect: function( bool ){ 1836 $( document )[ bool ? "unbind" : "bind" ]("selectstart", drag.dontstart ) 1837 .css("MozUserSelect", bool ? "" : "none" ); 1838 // .attr("unselectable", bool ? "off" : "on" ) 1839 document.unselectable = bool ? "off" : "on"; 1840 }, 1841 1842 // suppress "selectstart" and "ondragstart" events 1843 dontstart: function(){ 1844 return false; 1845 }, 1846 1847 // a callback instance contructor 1848 callback: function(){} 1849 1850}; 1851 1852// callback methods 1853drag.callback.prototype = { 1854 update: function(){ 1855 if ( $special.drop && this.available.length ) 1856 $.each( this.available, function( i ){ 1857 $special.drop.locate( this, i ); 1858 }); 1859 } 1860}; 1861 1862// patch $.event.$dispatch to allow suppressing clicks 1863var $dispatch = $event.dispatch; 1864$event.dispatch = function( event ){ 1865 if ( $.data( this, "suppress."+ event.type ) - new Date().getTime() > 0 ){ 1866 $.removeData( this, "suppress."+ event.type ); 1867 return; 1868 } 1869 return $dispatch.apply( this, arguments ); 1870}; 1871 1872// event fix hooks for touch events... 1873var touchHooks = 1874$event.fixHooks.touchstart = 1875$event.fixHooks.touchmove = 1876$event.fixHooks.touchend = 1877$event.fixHooks.touchcancel = { 1878 props: "clientX clientY pageX pageY screenX screenY".split( " " ), 1879 filter: function( event, orig ) { 1880 if ( orig ){ 1881 var touched = ( orig.touches && orig.touches[0] ) 1882 || ( orig.changedTouches && orig.changedTouches[0] ) 1883 || null; 1884 // iOS webkit: touchstart, touchmove, touchend 1885 if ( touched ) 1886 $.each( touchHooks.props, function( i, prop ){ 1887 event[ prop ] = touched[ prop ]; 1888 }); 1889 } 1890 return event; 1891 } 1892}; 1893 1894// share the same special event configuration with related events... 1895$special.draginit = $special.dragstart = $special.dragend = drag; 1896 1897})( jQuery );; 1898
vendor: 18,126 bytes, lines 1899-2418
1899/*! jQuery Timepicker Addon - v1.5.0 - 2014-09-01 1900* http://trentrichardson.com/examples/timepicker 1901* Copyright (c) 2014 Trent Richardson; Licensed MIT */ 1902(function ($) { 1903 1904 /* 1905 * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded" 1906 */ 1907 $.ui.timepicker = $.ui.timepicker || {}; 1908 if ($.ui.timepicker.version) { 1909 return; 1910 } 1911 1912 /* 1913 * Extend jQueryUI, get it started with our version number 1914 */ 1915 $.extend($.ui, { 1916 timepicker: { 1917 version: "1.5.0" 1918 } 1919 }); 1920 1921 /* 1922 * Timepicker manager. 1923 * Use the singleton instance of this class, $.timepicker, to interact with the time picker. 1924 * Settings for (groups of) time pickers are maintained in an instance object, 1925 * allowing multiple different settings on the same page. 1926 */ 1927 var Timepicker = function () { 1928 this.regional = []; // Available regional settings, indexed by language code 1929 this.regional[''] = { // Default regional settings 1930 currentText: 'Now', 1931 closeText: 'Done', 1932 amNames: ['AM', 'A'], 1933 pmNames: ['PM', 'P'], 1934 timeFormat: 'HH:mm', 1935 timeSuffix: '', 1936 timeOnlyTitle: 'Choose Time', 1937 timeText: 'Time', 1938 hourText: 'Hour', 1939 minuteText: 'Minute', 1940 secondText: 'Second', 1941 millisecText: 'Millisecond', 1942 microsecText: 'Microsecond', 1943 timezoneText: 'Time Zone', 1944 isRTL: false 1945 }; 1946 this._defaults = { // Global defaults for all the datetime picker instances 1947 showButtonPanel: true, 1948 timeOnly: false, 1949 timeOnlyShowDate: false, 1950 showHour: null, 1951 showMinute: null, 1952 showSecond: null, 1953 showMillisec: null, 1954 showMicrosec: null, 1955 showTimezone: null, 1956 showTime: true, 1957 stepHour: 1, 1958 stepMinute: 1, 1959 stepSecond: 1, 1960 stepMillisec: 1, 1961 stepMicrosec: 1, 1962 hour: 0, 1963 minute: 0, 1964 second: 0, 1965 millisec: 0, 1966 microsec: 0, 1967 timezone: null, 1968 hourMin: 0, 1969 minuteMin: 0, 1970 secondMin: 0, 1971 millisecMin: 0, 1972 microsecMin: 0, 1973 hourMax: 23, 1974 minuteMax: 59, 1975 secondMax: 59, 1976 millisecMax: 999, 1977 microsecMax: 999, 1978 minDateTime: null, 1979 maxDateTime: null, 1980 maxTime: null, 1981 minTime: null, 1982 onSelect: null, 1983 hourGrid: 0, 1984 minuteGrid: 0, 1985 secondGrid: 0, 1986 millisecGrid: 0, 1987 microsecGrid: 0, 1988 alwaysSetTime: true, 1989 separator: ' ', 1990 altFieldTimeOnly: true, 1991 altTimeFormat: null, 1992 altSeparator: null, 1993 altTimeSuffix: null, 1994 altRedirectFocus: true, 1995 pickerTimeFormat: null, 1996 pickerTimeSuffix: null, 1997 showTimepicker: true, 1998 timezoneList: null, 1999 addSliderAccess: false, 2000 sliderAccessArgs: null, 2001 controlType: 'slider', 2002 defaultValue: null, 2003 parse: 'strict' 2004 }; 2005 $.extend(this._defaults, this.regional['']); 2006 }; 2007 2008 $.extend(Timepicker.prototype, { 2009 $input: null, 2010 $altInput: null, 2011 $timeObj: null, 2012 inst: null, 2013 hour_slider: null, 2014 minute_slider: null, 2015 second_slider: null, 2016 millisec_slider: null, 2017 microsec_slider: null, 2018 timezone_select: null, 2019 maxTime: null, 2020 minTime: null, 2021 hour: 0, 2022 minute: 0, 2023 second: 0, 2024 millisec: 0, 2025 microsec: 0, 2026 timezone: null, 2027 hourMinOriginal: null, 2028 minuteMinOriginal: null, 2029 secondMinOriginal: null, 2030 millisecMinOriginal: null, 2031 microsecMinOriginal: null, 2032 hourMaxOriginal: null, 2033 minuteMaxOriginal: null, 2034 secondMaxOriginal: null, 2035 millisecMaxOriginal: null, 2036 microsecMaxOriginal: null, 2037 ampm: '', 2038 formattedDate: '', 2039 formattedTime: '', 2040 formattedDateTime: '', 2041 timezoneList: null, 2042 units: ['hour', 'minute', 'second', 'millisec', 'microsec'], 2043 support: {}, 2044 control: null, 2045 2046 /* 2047 * Override the default settings for all instances of the time picker. 2048 * @param {Object} settings object - the new settings to use as defaults (anonymous object) 2049 * @return {Object} the manager object 2050 */ 2051 setDefaults: function (settings) { 2052 extendRemove(this._defaults, settings || {}); 2053 return this; 2054 }, 2055 2056 /* 2057 * Create a new Timepicker instance 2058 */ 2059 _newInst: function ($input, opts) { 2060 var tp_inst = new Timepicker(), 2061 inlineSettings = {}, 2062 fns = {}, 2063 overrides, i; 2064 2065 for (var attrName in this._defaults) { 2066 if (this._defaults.hasOwnProperty(attrName)) { 2067 var attrValue = $input.attr('time:' + attrName); 2068 if (attrValue) { 2069 try { 2070 inlineSettings[attrName] = eval(attrValue); 2071 } catch (err) { 2072 inlineSettings[attrName] = attrValue; 2073 } 2074 } 2075 } 2076 } 2077 2078 overrides = { 2079 beforeShow: function (input, dp_inst) { 2080 if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) { 2081 return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst); 2082 } 2083 }, 2084 onChangeMonthYear: function (year, month, dp_inst) { 2085 // Update the time as well : this prevents the time from disappearing from the $input field. 2086 tp_inst._updateDateTime(dp_inst); 2087 if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) { 2088 tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst); 2089 } 2090 }, 2091 onClose: function (dateText, dp_inst) { 2092 if (tp_inst.timeDefined === true && $input.val() !== '') { 2093 tp_inst._updateDateTime(dp_inst); 2094 } 2095 if ($.isFunction(tp_inst._defaults.evnts.onClose)) { 2096 tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst); 2097 } 2098 } 2099 }; 2100 for (i in overrides) { 2101 if (overrides.hasOwnProperty(i)) { 2102 fns[i] = opts[i] || null; 2103 } 2104 } 2105 2106 tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, { 2107 evnts: fns, 2108 timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker'); 2109 }); 2110 tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) { 2111 return val.toUpperCase(); 2112 }); 2113 tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) { 2114 return val.toUpperCase(); 2115 }); 2116 2117 // detect which units are supported 2118 tp_inst.support = detectSupport( 2119 tp_inst._defaults.timeFormat + 2120 (tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') + 2121 (tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : '')); 2122 2123 // controlType is string - key to our this._controls 2124 if (typeof(tp_inst._defaults.controlType) === 'string') { 2125 if (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') { 2126 tp_inst._defaults.controlType = 'select'; 2127 } 2128 tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType]; 2129 } 2130 // controlType is an object and must implement create, options, value methods 2131 else { 2132 tp_inst.control = tp_inst._defaults.controlType; 2133 } 2134 2135 // prep the timezone options 2136 var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60, 2137 0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840]; 2138 if (tp_inst._defaults.timezoneList !== null) { 2139 timezoneList = tp_inst._defaults.timezoneList; 2140 } 2141 var tzl = timezoneList.length, tzi = 0, tzv = null; 2142 if (tzl > 0 && typeof timezoneList[0] !== 'object') { 2143 for (; tzi < tzl; tzi++) { 2144 tzv = timezoneList[tzi]; 2145 timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) }; 2146 } 2147 } 2148 tp_inst._defaults.timezoneList = timezoneList; 2149 2150 // set the default units 2151 tp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) : 2152 ((new Date()).getTimezoneOffset() * -1); 2153 tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin : 2154 tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour; 2155 tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin : 2156 tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute; 2157 tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin : 2158 tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second; 2159 tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin : 2160 tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec; 2161 tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin : 2162 tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec; 2163 tp_inst.ampm = ''; 2164 tp_inst.$input = $input; 2165 2166 if (tp_inst._defaults.altField) { 2167 tp_inst.$altInput = $(tp_inst._defaults.altField); 2168 if (tp_inst._defaults.altRedirectFocus === true) { 2169 tp_inst.$altInput.css({ 2170 cursor: 'pointer' 2171 }).focus(function () { 2172 $input.trigger("focus"); 2173 }); 2174 } 2175 } 2176 2177 if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) { 2178 tp_inst._defaults.minDate = new Date(); 2179 } 2180 if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) { 2181 tp_inst._defaults.maxDate = new Date(); 2182 } 2183 2184 // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime.. 2185 if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) { 2186 tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime()); 2187 } 2188 if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) { 2189 tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime()); 2190 } 2191 if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) { 2192 tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime()); 2193 } 2194 if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) { 2195 tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime()); 2196 } 2197 tp_inst.$input.bind('focus', function () { 2198 tp_inst._onFocus(); 2199 }); 2200 2201 return tp_inst; 2202 }, 2203 2204 /* 2205 * add our sliders to the calendar 2206 */ 2207 _addTimePicker: function (dp_inst) { 2208 var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val(); 2209 2210 this.timeDefined = this._parseTime(currDT); 2211 this._limitMinMaxDateTime(dp_inst, false); 2212 this._injectTimePicker(); 2213 }, 2214 2215 /* 2216 * parse the time string from input value or _setTime 2217 */ 2218 _parseTime: function (timeString, withDate) { 2219 if (!this.inst) { 2220 this.inst = $.datepicker._getInst(this.$input[0]); 2221 } 2222 2223 if (withDate || !this._defaults.timeOnly) { 2224 var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat'); 2225 try { 2226 var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults); 2227 if (!parseRes.timeObj) { 2228 return false; 2229 } 2230 $.extend(this, parseRes.timeObj); 2231 } catch (err) { 2232 $.timepicker.log("Error parsing the date/time string: " + err + 2233 "\ndate/time string = " + timeString + 2234 "\ntimeFormat = " + this._defaults.timeFormat + 2235 "\ndateFormat = " + dp_dateFormat); 2236 return false; 2237 } 2238 return true; 2239 } else { 2240 var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults); 2241 if (!timeObj) { 2242 return false; 2243 } 2244 $.extend(this, timeObj); 2245 return true; 2246 } 2247 }, 2248 2249 /* 2250 * generate and inject html for timepicker into ui datepicker 2251 */ 2252 _injectTimePicker: function () { 2253 var $dp = this.inst.dpDiv, 2254 o = this.inst.settings, 2255 tp_inst = this, 2256 litem = '', 2257 uitem = '', 2258 show = null, 2259 max = {}, 2260 gridSize = {}, 2261 size = null, 2262 i = 0, 2263 l = 0; 2264 2265 // Prevent displaying twice 2266 if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) { 2267 var noDisplay = ' style="display:none;"', 2268 html = '<div class="ui-timepicker-div' + (o.isRTL ? ' ui-timepicker-rtl' : '') + '"><dl>' + '<dt class="ui_tpicker_time_label"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' + 2269 '<dd class="ui_tpicker_time"' + ((o.showTime) ? '' : noDisplay) + '></dd>'; 2270 2271 // Create the markup 2272 for (i = 0, l = this.units.length; i < l; i++) { 2273 litem = this.units[i]; 2274 uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1); 2275 show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem]; 2276 2277 // Added by Peter Medeiros: 2278 // - Figure out what the hour/minute/second max should be based on the step values. 2279 // - Example: if stepMinute is 15, then minMax is 45. 2280 max[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10); 2281 gridSize[litem] = 0; 2282 2283 html += '<dt class="ui_tpicker_' + litem + '_label"' + (show ? '' : noDisplay) + '>' + o[litem + 'Text'] + '</dt>' + 2284 '<dd class="ui_tpicker_' + litem + '"><div class="ui_tpicker_' + litem + '_slider"' + (show ? '' : noDisplay) + '></div>'; 2285 2286 if (show && o[litem + 'Grid'] > 0) { 2287 html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>'; 2288 2289 if (litem === 'hour') { 2290 for (var h = o[litem + 'Min']; h <= max[litem]; h += parseInt(o[litem + 'Grid'], 10)) { 2291 gridSize[litem]++; 2292 var tmph = $.datepicker.formatTime(this.support.ampm ? 'hht' : 'HH', {hour: h}, o); 2293 html += '<td data-for="' + litem + '">' + tmph + '</td>'; 2294 } 2295 } 2296 else { 2297 for (var m = o[litem + 'Min']; m <= max[litem]; m += parseInt(o[litem + 'Grid'], 10)) { 2298 gridSize[litem]++; 2299 html += '<td data-for="' + litem + '">' + ((m < 10) ? '0' : '') + m + '</td>'; 2300 } 2301 } 2302 2303 html += '</tr></table></div>'; 2304 } 2305 html += '</dd>'; 2306 } 2307 2308 // Timezone 2309 var showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone; 2310 html += '<dt class="ui_tpicker_timezone_label"' + (showTz ? '' : noDisplay) + '>' + o.timezoneText + '</dt>'; 2311 html += '<dd class="ui_tpicker_timezone" ' + (showTz ? '' : noDisplay) + '></dd>'; 2312 2313 // Create the elements from string 2314 html += '</dl></div>'; 2315 var $tp = $(html); 2316 2317 // if we only want time picker... 2318 if (o.timeOnly === true) { 2319 $tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>'); 2320 $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide(); 2321 } 2322 2323 // add sliders, adjust grids, add events 2324 for (i = 0, l = tp_inst.units.length; i < l; i++) { 2325 litem = tp_inst.units[i]; 2326 uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1); 2327 show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem]; 2328 2329 // add the slider 2330 tp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]); 2331 2332 // adjust the grid and add click event 2333 if (show && o[litem + 'Grid'] > 0) { 2334 size = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']); 2335 $tp.find('.ui_tpicker_' + litem + ' table').css({ 2336 width: size + "%", 2337 marginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + "%"), 2338 marginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + "%") : '0', 2339 borderCollapse: 'collapse' 2340 }).find("td").click(function (e) { 2341 var $t = $(this), 2342 h = $t.html(), 2343 n = parseInt(h.replace(/[^0-9]/g), 10), 2344 ap = h.replace(/[^apm]/ig), 2345 f = $t.data('for'); // loses scope, so we use data-for 2346 2347 if (f === 'hour') { 2348 if (ap.indexOf('p') !== -1 && n < 12) { 2349 n += 12; 2350 } 2351 else { 2352 if (ap.indexOf('a') !== -1 && n === 12) { 2353 n = 0; 2354 } 2355 } 2356 } 2357 2358 tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n); 2359 2360 tp_inst._onTimeChange(); 2361 tp_inst._onSelectHandler(); 2362 }).css({ 2363 cursor: 'pointer', 2364 width: (100 / gridSize[litem]) + '%', 2365 textAlign: 'center', 2366 overflow: 'hidden' 2367 }); 2368 } // end if grid > 0 2369 } // end for loop 2370 2371 // Add timezone options 2372 this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select"); 2373 $.fn.append.apply(this.timezone_select, 2374 $.map(o.timezoneList, function (val, idx) { 2375 return $("<option />").val(typeof val === "object" ? val.value : val).text(typeof val === "object" ? val.label : val); 2376 })); 2377 if (typeof(this.timezone) !== "undefined" && this.timezone !== null && this.timezone !== "") { 2378 var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset() * -1; 2379 if (local_timezone === this.timezone) { 2380 selectLocalTimezone(tp_inst); 2381 } else { 2382 this.timezone_select.val(this.timezone); 2383 } 2384 } else { 2385 if (typeof(this.hour) !== "undefined" && this.hour !== null && this.hour !== "") { 2386 this.timezone_select.val(o.timezone); 2387 } else { 2388 selectLocalTimezone(tp_inst); 2389 } 2390 } 2391 this.timezone_select.change(function () { 2392 tp_inst._onTimeChange(); 2393 tp_inst._onSelectHandler(); 2394 }); 2395 // End timezone options 2396 2397 // inject timepicker into datepicker 2398 var $buttonPanel = $dp.find('.ui-datepicker-buttonpane'); 2399 if ($buttonPanel.length) { 2400 $buttonPanel.before($tp); 2401 } else { 2402 $dp.append($tp); 2403 } 2404 2405 this.$timeObj = $tp.find('.ui_tpicker_time'); 2406 2407 if (this.inst !== null) { 2408 var timeDefined = this.timeDefined; 2409 this._onTimeChange(); 2410 this.timeDefined = timeDefined; 2411 } 2412 2413 // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/ 2414 if (this._defaults.addSliderAccess) { 2415 var sliderAccessArgs = this._defaults.sliderAccessArgs, 2416 rtl = this._defaults.isRTL; 2417 sliderAccessArgs.isRTL = rtl; 2418
vendor: 6,695 bytes, lines 2418-2570
2418 2419 setTimeout(function () { // fix for inline mode 2420 if ($tp.find('.ui-slider-access').length === 0) { 2421 $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs); 2422 2423 // fix any grids since sliders are shorter 2424 var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true); 2425 if (sliderAccessWidth) { 2426 $tp.find('table:visible').each(function () { 2427 var $g = $(this), 2428 oldWidth = $g.outerWidth(), 2429 oldMarginLeft = $g.css(rtl ? 'marginRight' : 'marginLeft').toString().replace('%', ''), 2430 newWidth = oldWidth - sliderAccessWidth, 2431 newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%', 2432 css = { width: newWidth, marginRight: 0, marginLeft: 0 }; 2433 css[rtl ? 'marginRight' : 'marginLeft'] = newMarginLeft; 2434 $g.css(css); 2435 }); 2436 } 2437 } 2438 }, 10); 2439 } 2440 // end slideAccess integration 2441 2442 tp_inst._limitMinMaxDateTime(this.inst, true); 2443 } 2444 }, 2445 2446 /* 2447 * This function tries to limit the ability to go outside the 2448 * min/max date range 2449 */ 2450 _limitMinMaxDateTime: function (dp_inst, adjustSliders) { 2451 var o = this._defaults, 2452 dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay); 2453 2454 if (!this._defaults.showTimepicker) { 2455 return; 2456 } // No time so nothing to check here 2457 2458 if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) { 2459 var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'), 2460 minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0); 2461 2462 if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) { 2463 this.hourMinOriginal = o.hourMin; 2464 this.minuteMinOriginal = o.minuteMin; 2465 this.secondMinOriginal = o.secondMin; 2466 this.millisecMinOriginal = o.millisecMin; 2467 this.microsecMinOriginal = o.microsecMin; 2468 } 2469 2470 if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() === dp_date.getTime()) { 2471 this._defaults.hourMin = minDateTime.getHours(); 2472 if (this.hour <= this._defaults.hourMin) { 2473 this.hour = this._defaults.hourMin; 2474 this._defaults.minuteMin = minDateTime.getMinutes(); 2475 if (this.minute <= this._defaults.minuteMin) { 2476 this.minute = this._defaults.minuteMin; 2477 this._defaults.secondMin = minDateTime.getSeconds(); 2478 if (this.second <= this._defaults.secondMin) { 2479 this.second = this._defaults.secondMin; 2480 this._defaults.millisecMin = minDateTime.getMilliseconds(); 2481 if (this.millisec <= this._defaults.millisecMin) { 2482 this.millisec = this._defaults.millisecMin; 2483 this._defaults.microsecMin = minDateTime.getMicroseconds(); 2484 } else { 2485 if (this.microsec < this._defaults.microsecMin) { 2486 this.microsec = this._defaults.microsecMin; 2487 } 2488 this._defaults.microsecMin = this.microsecMinOriginal; 2489 } 2490 } else { 2491 this._defaults.millisecMin = this.millisecMinOriginal; 2492 this._defaults.microsecMin = this.microsecMinOriginal; 2493 } 2494 } else { 2495 this._defaults.secondMin = this.secondMinOriginal; 2496 this._defaults.millisecMin = this.millisecMinOriginal; 2497 this._defaults.microsecMin = this.microsecMinOriginal; 2498 } 2499 } else { 2500 this._defaults.minuteMin = this.minuteMinOriginal; 2501 this._defaults.secondMin = this.secondMinOriginal; 2502 this._defaults.millisecMin = this.millisecMinOriginal; 2503 this._defaults.microsecMin = this.microsecMinOriginal; 2504 } 2505 } else { 2506 this._defaults.hourMin = this.hourMinOriginal; 2507 this._defaults.minuteMin = this.minuteMinOriginal; 2508 this._defaults.secondMin = this.secondMinOriginal; 2509 this._defaults.millisecMin = this.millisecMinOriginal; 2510 this._defaults.microsecMin = this.microsecMinOriginal; 2511 } 2512 } 2513 2514 if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) { 2515 var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'), 2516 maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0); 2517 2518 if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) { 2519 this.hourMaxOriginal = o.hourMax; 2520 this.minuteMaxOriginal = o.minuteMax; 2521 this.secondMaxOriginal = o.secondMax; 2522 this.millisecMaxOriginal = o.millisecMax; 2523 this.microsecMaxOriginal = o.microsecMax; 2524 } 2525 2526 if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() === dp_date.getTime()) { 2527 this._defaults.hourMax = maxDateTime.getHours(); 2528 if (this.hour >= this._defaults.hourMax) { 2529 this.hour = this._defaults.hourMax; 2530 this._defaults.minuteMax = maxDateTime.getMinutes(); 2531 if (this.minute >= this._defaults.minuteMax) { 2532 this.minute = this._defaults.minuteMax; 2533 this._defaults.secondMax = maxDateTime.getSeconds(); 2534 if (this.second >= this._defaults.secondMax) { 2535 this.second = this._defaults.secondMax; 2536 this._defaults.millisecMax = maxDateTime.getMilliseconds(); 2537 if (this.millisec >= this._defaults.millisecMax) { 2538 this.millisec = this._defaults.millisecMax; 2539 this._defaults.microsecMax = maxDateTime.getMicroseconds(); 2540 } else { 2541 if (this.microsec > this._defaults.microsecMax) { 2542 this.microsec = this._defaults.microsecMax; 2543 } 2544 this._defaults.microsecMax = this.microsecMaxOriginal; 2545 } 2546 } else { 2547 this._defaults.millisecMax = this.millisecMaxOriginal; 2548 this._defaults.microsecMax = this.microsecMaxOriginal; 2549 } 2550 } else { 2551 this._defaults.secondMax = this.secondMaxOriginal; 2552 this._defaults.millisecMax = this.millisecMaxOriginal; 2553 this._defaults.microsecMax = this.microsecMaxOriginal; 2554 } 2555 } else { 2556 this._defaults.minuteMax = this.minuteMaxOriginal; 2557 this._defaults.secondMax = this.secondMaxOriginal; 2558 this._defaults.millisecMax = this.millisecMaxOriginal; 2559 this._defaults.microsecMax = this.microsecMaxOriginal; 2560 } 2561 } else { 2562 this._defaults.hourMax = this.hourMaxOriginal; 2563 this._defaults.minuteMax = this.minuteMaxOriginal; 2564 this._defaults.secondMax = this.secondMaxOriginal; 2565 this._defaults.millisecMax = this.millisecMaxOriginal; 2566 this._defaults.microsecMax = this.microsecMaxOriginal; 2567 } 2568 } 2569 2570 if (dp_inst.settings.minTime!==null) {
vendor: 1,813 bytes, lines 2570-2607
2570 2571 var tempMinTime=new Date("01/01/1970 " + dp_inst.settings.minTime); 2572 if (this.hour<tempMinTime.getHours()) { 2573 this.hour=this._defaults.hourMin=tempMinTime.getHours(); 2574 this.minute=this._defaults.minuteMin=tempMinTime.getMinutes(); 2575 } else if (this.hour===tempMinTime.getHours() && this.minute<tempMinTime.getMinutes()) { 2576 this.minute=this._defaults.minuteMin=tempMinTime.getMinutes(); 2577 } else { 2578 if (this._defaults.hourMin<tempMinTime.getHours()) { 2579 this._defaults.hourMin=tempMinTime.getHours(); 2580 this._defaults.minuteMin=tempMinTime.getMinutes(); 2581 } else if (this._defaults.hourMin===tempMinTime.getHours()===this.hour && this._defaults.minuteMin<tempMinTime.getMinutes()) { 2582 this._defaults.minuteMin=tempMinTime.getMinutes(); 2583 } else { 2584 this._defaults.minuteMin=0; 2585 } 2586 } 2587 } 2588 2589 if (dp_inst.settings.maxTime!==null) { 2590 var tempMaxTime=new Date("01/01/1970 " + dp_inst.settings.maxTime); 2591 if (this.hour>tempMaxTime.getHours()) { 2592 this.hour=this._defaults.hourMax=tempMaxTime.getHours(); 2593 this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes(); 2594 } else if (this.hour===tempMaxTime.getHours() && this.minute>tempMaxTime.getMinutes()) { 2595 this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes(); 2596 } else { 2597 if (this._defaults.hourMax>tempMaxTime.getHours()) { 2598 this._defaults.hourMax=tempMaxTime.getHours(); 2599 this._defaults.minuteMax=tempMaxTime.getMinutes(); 2600 } else if (this._defaults.hourMax===tempMaxTime.getHours()===this.hour && this._defaults.minuteMax>tempMaxTime.getMinutes()) { 2601 this._defaults.minuteMax=tempMaxTime.getMinutes(); 2602 } else { 2603 this._defaults.minuteMax=59; 2604 } 2605 } 2606 } 2607
vendor: 4,470 bytes, lines 2607-2701
2607 2608 if (adjustSliders !== undefined && adjustSliders === true) { 2609 var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10), 2610 minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10), 2611 secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10), 2612 millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10), 2613 microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10); 2614 2615 if (this.hour_slider) { 2616 this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax, step: this._defaults.stepHour }); 2617 this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour)); 2618 } 2619 if (this.minute_slider) { 2620 this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax, step: this._defaults.stepMinute }); 2621 this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute)); 2622 } 2623 if (this.second_slider) { 2624 this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax, step: this._defaults.stepSecond }); 2625 this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond)); 2626 } 2627 if (this.millisec_slider) { 2628 this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax, step: this._defaults.stepMillisec }); 2629 this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec)); 2630 } 2631 if (this.microsec_slider) { 2632 this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax, step: this._defaults.stepMicrosec }); 2633 this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec)); 2634 } 2635 } 2636 2637 }, 2638 2639 /* 2640 * when a slider moves, set the internal time... 2641 * on time change is also called when the time is updated in the text field 2642 */ 2643 _onTimeChange: function () { 2644 if (!this._defaults.showTimepicker) { 2645 return; 2646 } 2647 var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false, 2648 minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false, 2649 second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false, 2650 millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false, 2651 microsec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false, 2652 timezone = (this.timezone_select) ? this.timezone_select.val() : false, 2653 o = this._defaults, 2654 pickerTimeFormat = o.pickerTimeFormat || o.timeFormat, 2655 pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix; 2656 2657 if (typeof(hour) === 'object') { 2658 hour = false; 2659 } 2660 if (typeof(minute) === 'object') { 2661 minute = false; 2662 } 2663 if (typeof(second) === 'object') { 2664 second = false; 2665 } 2666 if (typeof(millisec) === 'object') { 2667 millisec = false; 2668 } 2669 if (typeof(microsec) === 'object') { 2670 microsec = false; 2671 } 2672 if (typeof(timezone) === 'object') { 2673 timezone = false; 2674 } 2675 2676 if (hour !== false) { 2677 hour = parseInt(hour, 10); 2678 } 2679 if (minute !== false) { 2680 minute = parseInt(minute, 10); 2681 } 2682 if (second !== false) { 2683 second = parseInt(second, 10); 2684 } 2685 if (millisec !== false) { 2686 millisec = parseInt(millisec, 10); 2687 } 2688 if (microsec !== false) { 2689 microsec = parseInt(microsec, 10); 2690 } 2691 if (timezone !== false) { 2692 timezone = timezone.toString(); 2693 } 2694 2695 var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0]; 2696 2697 // If the update was done in the input field, the input field should not be updated. 2698 // If the update was done using the sliders, update the input field. 2699 var hasChanged = ( 2700 hour !== parseInt(this.hour,10) || // sliders should all be numeric 2701 minute !== parseInt(this.minute,10) ||
vendor: 32,888 bytes, lines 2701-3743
2701 2702 second !== parseInt(this.second,10) || 2703 millisec !== parseInt(this.millisec,10) || 2704 microsec !== parseInt(this.microsec,10) || 2705 (this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) || 2706 (this.timezone !== null && timezone !== this.timezone.toString()) // could be numeric or "EST" format, so use toString() 2707 ); 2708 2709 if (hasChanged) { 2710 2711 if (hour !== false) { 2712 this.hour = hour; 2713 } 2714 if (minute !== false) { 2715 this.minute = minute; 2716 } 2717 if (second !== false) { 2718 this.second = second; 2719 } 2720 if (millisec !== false) { 2721 this.millisec = millisec; 2722 } 2723 if (microsec !== false) { 2724 this.microsec = microsec; 2725 } 2726 if (timezone !== false) { 2727 this.timezone = timezone; 2728 } 2729 2730 if (!this.inst) { 2731 this.inst = $.datepicker._getInst(this.$input[0]); 2732 } 2733 2734 this._limitMinMaxDateTime(this.inst, true); 2735 } 2736 if (this.support.ampm) { 2737 this.ampm = ampm; 2738 } 2739 2740 // Updates the time within the timepicker 2741 this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o); 2742 if (this.$timeObj) { 2743 if (pickerTimeFormat === o.timeFormat) { 2744 this.$timeObj.text(this.formattedTime + pickerTimeSuffix); 2745 } 2746 else { 2747 this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix); 2748 } 2749 } 2750 2751 this.timeDefined = true; 2752 if (hasChanged) { 2753 this._updateDateTime(); 2754 //this.$input.focus(); // may automatically open the picker on setDate 2755 } 2756 }, 2757 2758 /* 2759 * call custom onSelect. 2760 * bind to sliders slidestop, and grid click. 2761 */ 2762 _onSelectHandler: function () { 2763 var onSelect = this._defaults.onSelect || this.inst.settings.onSelect; 2764 var inputEl = this.$input ? this.$input[0] : null; 2765 if (onSelect && inputEl) { 2766 onSelect.apply(inputEl, [this.formattedDateTime, this]); 2767 } 2768 }, 2769 2770 /* 2771 * update our input with the new date time.. 2772 */ 2773 _updateDateTime: function (dp_inst) { 2774 dp_inst = this.inst || dp_inst; 2775 var dtTmp = (dp_inst.currentYear > 0? 2776 new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) : 2777 new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)), 2778 dt = $.datepicker._daylightSavingAdjust(dtTmp), 2779 //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)), 2780 //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)), 2781 dateFmt = $.datepicker._get(dp_inst, 'dateFormat'), 2782 formatCfg = $.datepicker._getFormatConfig(dp_inst), 2783 timeAvailable = dt !== null && this.timeDefined; 2784 this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg); 2785 var formattedDateTime = this.formattedDate; 2786 2787 // if a slider was changed but datepicker doesn't have a value yet, set it 2788 if (dp_inst.lastVal === "") { 2789 dp_inst.currentYear = dp_inst.selectedYear; 2790 dp_inst.currentMonth = dp_inst.selectedMonth; 2791 dp_inst.currentDay = dp_inst.selectedDay; 2792 } 2793 2794 /* 2795 * remove following lines to force every changes in date picker to change the input value 2796 * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker. 2797 * If the user manually empty the value in the input field, the date picker will never change selected value. 2798 */ 2799 //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) { 2800 // return; 2801 //} 2802 2803 if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) { 2804 formattedDateTime = this.formattedTime; 2805 } else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) { 2806 formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix; 2807 } 2808 2809 this.formattedDateTime = formattedDateTime; 2810 2811 if (!this._defaults.showTimepicker) { 2812 this.$input.val(this.formattedDate); 2813 } else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) { 2814 this.$altInput.val(this.formattedTime); 2815 this.$input.val(this.formattedDate); 2816 } else if (this.$altInput) { 2817 this.$input.val(formattedDateTime); 2818 var altFormattedDateTime = '', 2819 altSeparator = this._defaults.altSeparator !== null ? this._defaults.altSeparator : this._defaults.separator, 2820 altTimeSuffix = this._defaults.altTimeSuffix !== null ? this._defaults.altTimeSuffix : this._defaults.timeSuffix; 2821 2822 if (!this._defaults.timeOnly) { 2823 if (this._defaults.altFormat) { 2824 altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg); 2825 } 2826 else { 2827 altFormattedDateTime = this.formattedDate; 2828 } 2829 2830 if (altFormattedDateTime) { 2831 altFormattedDateTime += altSeparator; 2832 } 2833 } 2834 2835 if (this._defaults.altTimeFormat !== null) { 2836 altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix; 2837 } 2838 else { 2839 altFormattedDateTime += this.formattedTime + altTimeSuffix; 2840 } 2841 this.$altInput.val(altFormattedDateTime); 2842 } else { 2843 this.$input.val(formattedDateTime); 2844 } 2845 2846 this.$input.trigger("change"); 2847 }, 2848 2849 _onFocus: function () { 2850 if (!this.$input.val() && this._defaults.defaultValue) { 2851 this.$input.val(this._defaults.defaultValue); 2852 var inst = $.datepicker._getInst(this.$input.get(0)), 2853 tp_inst = $.datepicker._get(inst, 'timepicker'); 2854 if (tp_inst) { 2855 if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) { 2856 try { 2857 $.datepicker._updateDatepicker(inst); 2858 } catch (err) { 2859 $.timepicker.log(err); 2860 } 2861 } 2862 } 2863 } 2864 }, 2865 2866 /* 2867 * Small abstraction to control types 2868 * We can add more, just be sure to follow the pattern: create, options, value 2869 */ 2870 _controls: { 2871 // slider methods 2872 slider: { 2873 create: function (tp_inst, obj, unit, val, min, max, step) { 2874 var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60 2875 return obj.prop('slide', null).slider({ 2876 orientation: "horizontal", 2877 value: rtl ? val * -1 : val, 2878 min: rtl ? max * -1 : min, 2879 max: rtl ? min * -1 : max, 2880 step: step, 2881 slide: function (event, ui) { 2882 tp_inst.control.value(tp_inst, $(this), unit, rtl ? ui.value * -1 : ui.value); 2883 tp_inst._onTimeChange(); 2884 }, 2885 stop: function (event, ui) { 2886 tp_inst._onSelectHandler(); 2887 } 2888 }); 2889 }, 2890 options: function (tp_inst, obj, unit, opts, val) { 2891 if (tp_inst._defaults.isRTL) { 2892 if (typeof(opts) === 'string') { 2893 if (opts === 'min' || opts === 'max') { 2894 if (val !== undefined) { 2895 return obj.slider(opts, val * -1); 2896 } 2897 return Math.abs(obj.slider(opts)); 2898 } 2899 return obj.slider(opts); 2900 } 2901 var min = opts.min, 2902 max = opts.max; 2903 opts.min = opts.max = null; 2904 if (min !== undefined) { 2905 opts.max = min * -1; 2906 } 2907 if (max !== undefined) { 2908 opts.min = max * -1; 2909 } 2910 return obj.slider(opts); 2911 } 2912 if (typeof(opts) === 'string' && val !== undefined) { 2913 return obj.slider(opts, val); 2914 } 2915 return obj.slider(opts); 2916 }, 2917 value: function (tp_inst, obj, unit, val) { 2918 if (tp_inst._defaults.isRTL) { 2919 if (val !== undefined) { 2920 return obj.slider('value', val * -1); 2921 } 2922 return Math.abs(obj.slider('value')); 2923 } 2924 if (val !== undefined) { 2925 return obj.slider('value', val); 2926 } 2927 return obj.slider('value'); 2928 } 2929 }, 2930 // select methods 2931 select: { 2932 create: function (tp_inst, obj, unit, val, min, max, step) { 2933 var sel = '<select class="ui-timepicker-select ui-state-default ui-corner-all" data-unit="' + unit + '" data-min="' + min + '" data-max="' + max + '" data-step="' + step + '">', 2934 format = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat; 2935 2936 for (var i = min; i <= max; i += step) { 2937 sel += '<option value="' + i + '"' + (i === val ? ' selected' : '') + '>'; 2938 if (unit === 'hour') { 2939 sel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig, '')), {hour: i}, tp_inst._defaults); 2940 } 2941 else if (unit === 'millisec' || unit === 'microsec' || i >= 10) { sel += i; } 2942 else {sel += '0' + i.toString(); } 2943 sel += '</option>'; 2944 } 2945 sel += '</select>'; 2946 2947 obj.children('select').remove(); 2948 2949 $(sel).appendTo(obj).change(function (e) { 2950 tp_inst._onTimeChange(); 2951 tp_inst._onSelectHandler(); 2952 }); 2953 2954 return obj; 2955 }, 2956 options: function (tp_inst, obj, unit, opts, val) { 2957 var o = {}, 2958 $t = obj.children('select'); 2959 if (typeof(opts) === 'string') { 2960 if (val === undefined) { 2961 return $t.data(opts); 2962 } 2963 o[opts] = val; 2964 } 2965 else { o = opts; } 2966 return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step')); 2967 }, 2968 value: function (tp_inst, obj, unit, val) { 2969 var $t = obj.children('select'); 2970 if (val !== undefined) { 2971 return $t.val(val); 2972 } 2973 return $t.val(); 2974 } 2975 } 2976 } // end _controls 2977 2978 }); 2979 2980 $.fn.extend({ 2981 /* 2982 * shorthand just to use timepicker. 2983 */ 2984 timepicker: function (o) { 2985 o = o || {}; 2986 var tmp_args = Array.prototype.slice.call(arguments); 2987 2988 if (typeof o === 'object') { 2989 tmp_args[0] = $.extend(o, { 2990 timeOnly: true 2991 }); 2992 } 2993 2994 return $(this).each(function () { 2995 $.fn.datetimepicker.apply($(this), tmp_args); 2996 }); 2997 }, 2998 2999 /* 3000 * extend timepicker to datepicker 3001 */ 3002 datetimepicker: function (o) { 3003 o = o || {}; 3004 var tmp_args = arguments; 3005 3006 if (typeof(o) === 'string') { 3007 if (o === 'getDate' || (o === 'option' && tmp_args.length === 2 && typeof (tmp_args[1]) === 'string')) { 3008 return $.fn.datepicker.apply($(this[0]), tmp_args); 3009 } else { 3010 return this.each(function () { 3011 var $t = $(this); 3012 $t.datepicker.apply($t, tmp_args); 3013 }); 3014 } 3015 } else { 3016 return this.each(function () { 3017 var $t = $(this); 3018 $t.datepicker($.timepicker._newInst($t, o)._defaults); 3019 }); 3020 } 3021 } 3022 }); 3023 3024 /* 3025 * Public Utility to parse date and time 3026 */ 3027 $.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) { 3028 var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings); 3029 if (parseRes.timeObj) { 3030 var t = parseRes.timeObj; 3031 parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec); 3032 parseRes.date.setMicroseconds(t.microsec); 3033 } 3034 3035 return parseRes.date; 3036 }; 3037 3038 /* 3039 * Public utility to parse time 3040 */ 3041 $.datepicker.parseTime = function (timeFormat, timeString, options) { 3042 var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}), 3043 iso8601 = (timeFormat.replace(/\'.*?\'/g, '').indexOf('Z') !== -1); 3044 3045 // Strict parse requires the timeString to match the timeFormat exactly 3046 var strictParse = function (f, s, o) { 3047 3048 // pattern for standard and localized AM/PM markers 3049 var getPatternAmpm = function (amNames, pmNames) { 3050 var markers = []; 3051 if (amNames) { 3052 $.merge(markers, amNames); 3053 } 3054 if (pmNames) { 3055 $.merge(markers, pmNames); 3056 } 3057 markers = $.map(markers, function (val) { 3058 return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&'); 3059 }); 3060 return '(' + markers.join('|') + ')?'; 3061 }; 3062 3063 // figure out position of time elements.. cause js cant do named captures 3064 var getFormatPositions = function (timeFormat) { 3065 var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g), 3066 orders = { 3067 h: -1, 3068 m: -1, 3069 s: -1, 3070 l: -1, 3071 c: -1, 3072 t: -1, 3073 z: -1 3074 }; 3075 3076 if (finds) { 3077 for (var i = 0; i < finds.length; i++) { 3078 if (orders[finds[i].toString().charAt(0)] === -1) { 3079 orders[finds[i].toString().charAt(0)] = i + 1; 3080 } 3081 } 3082 } 3083 return orders; 3084 }; 3085 3086 var regstr = '^' + f.toString() 3087 .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) { 3088 var ml = match.length; 3089 switch (match.charAt(0).toLowerCase()) { 3090 case 'h': 3091 return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})'; 3092 case 'm': 3093 return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})'; 3094 case 's': 3095 return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})'; 3096 case 'l': 3097 return '(\\d?\\d?\\d)'; 3098 case 'c': 3099 return '(\\d?\\d?\\d)'; 3100 case 'z': 3101 return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?'; 3102 case 't': 3103 return getPatternAmpm(o.amNames, o.pmNames); 3104 default: // literal escaped in quotes 3105 return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?'; 3106 } 3107 }) 3108 .replace(/\s/g, '\\s?') + 3109 o.timeSuffix + '$', 3110 order = getFormatPositions(f), 3111 ampm = '', 3112 treg; 3113 3114 treg = s.match(new RegExp(regstr, 'i')); 3115 3116 var resTime = { 3117 hour: 0, 3118 minute: 0, 3119 second: 0, 3120 millisec: 0, 3121 microsec: 0 3122 }; 3123 3124 if (treg) { 3125 if (order.t !== -1) { 3126 if (treg[order.t] === undefined || treg[order.t].length === 0) { 3127 ampm = ''; 3128 resTime.ampm = ''; 3129 } else { 3130 ampm = $.inArray(treg[order.t].toUpperCase(), o.amNames) !== -1 ? 'AM' : 'PM'; 3131 resTime.ampm = o[ampm === 'AM' ? 'amNames' : 'pmNames'][0]; 3132 } 3133 } 3134 3135 if (order.h !== -1) { 3136 if (ampm === 'AM' && treg[order.h] === '12') { 3137 resTime.hour = 0; // 12am = 0 hour 3138 } else { 3139 if (ampm === 'PM' && treg[order.h] !== '12') { 3140 resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12 3141 } else { 3142 resTime.hour = Number(treg[order.h]); 3143 } 3144 } 3145 } 3146 3147 if (order.m !== -1) { 3148 resTime.minute = Number(treg[order.m]); 3149 } 3150 if (order.s !== -1) { 3151 resTime.second = Number(treg[order.s]); 3152 } 3153 if (order.l !== -1) { 3154 resTime.millisec = Number(treg[order.l]); 3155 } 3156 if (order.c !== -1) { 3157 resTime.microsec = Number(treg[order.c]); 3158 } 3159 if (order.z !== -1 && treg[order.z] !== undefined) { 3160 resTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]); 3161 } 3162 3163 3164 return resTime; 3165 } 3166 return false; 3167 };// end strictParse 3168 3169 // First try JS Date, if that fails, use strictParse 3170 var looseParse = function (f, s, o) { 3171 try { 3172 var d = new Date('2012-01-01 ' + s); 3173 if (isNaN(d.getTime())) { 3174 d = new Date('2012-01-01T' + s); 3175 if (isNaN(d.getTime())) { 3176 d = new Date('01/01/2012 ' + s); 3177 if (isNaN(d.getTime())) { 3178 throw "Unable to parse time with native Date: " + s; 3179 } 3180 } 3181 } 3182 3183 return { 3184 hour: d.getHours(), 3185 minute: d.getMinutes(), 3186 second: d.getSeconds(), 3187 millisec: d.getMilliseconds(), 3188 microsec: d.getMicroseconds(), 3189 timezone: d.getTimezoneOffset() * -1 3190 }; 3191 } 3192 catch (err) { 3193 try { 3194 return strictParse(f, s, o); 3195 } 3196 catch (err2) { 3197 $.timepicker.log("Unable to parse \ntimeString: " + s + "\ntimeFormat: " + f); 3198 } 3199 } 3200 return false; 3201 }; // end looseParse 3202 3203 if (typeof o.parse === "function") { 3204 return o.parse(timeFormat, timeString, o); 3205 } 3206 if (o.parse === 'loose') { 3207 return looseParse(timeFormat, timeString, o); 3208 } 3209 return strictParse(timeFormat, timeString, o); 3210 }; 3211 3212 /** 3213 * Public utility to format the time 3214 * @param {string} format format of the time 3215 * @param {Object} time Object not a Date for timezones 3216 * @param {Object} [options] essentially the regional[].. amNames, pmNames, ampm 3217 * @returns {string} the formatted time 3218 */ 3219 $.datepicker.formatTime = function (format, time, options) { 3220 options = options || {}; 3221 options = $.extend({}, $.timepicker._defaults, options); 3222 time = $.extend({ 3223 hour: 0, 3224 minute: 0, 3225 second: 0, 3226 millisec: 0, 3227 microsec: 0, 3228 timezone: null 3229 }, time); 3230 3231 var tmptime = format, 3232 ampmName = options.amNames[0], 3233 hour = parseInt(time.hour, 10); 3234 3235 if (hour > 11) { 3236 ampmName = options.pmNames[0]; 3237 } 3238 3239 tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) { 3240 switch (match) { 3241 case 'HH': 3242 return ('0' + hour).slice(-2); 3243 case 'H': 3244 return hour; 3245 case 'hh': 3246 return ('0' + convert24to12(hour)).slice(-2); 3247 case 'h': 3248 return convert24to12(hour); 3249 case 'mm': 3250 return ('0' + time.minute).slice(-2); 3251 case 'm': 3252 return time.minute; 3253 case 'ss': 3254 return ('0' + time.second).slice(-2); 3255 case 's': 3256 return time.second; 3257 case 'l': 3258 return ('00' + time.millisec).slice(-3); 3259 case 'c': 3260 return ('00' + time.microsec).slice(-3); 3261 case 'z': 3262 return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, false); 3263 case 'Z': 3264 return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, true); 3265 case 'T': 3266 return ampmName.charAt(0).toUpperCase(); 3267 case 'TT': 3268 return ampmName.toUpperCase(); 3269 case 't': 3270 return ampmName.charAt(0).toLowerCase(); 3271 case 'tt': 3272 return ampmName.toLowerCase(); 3273 default: 3274 return match.replace(/'/g, ""); 3275 } 3276 }); 3277 3278 return tmptime; 3279 }; 3280 3281 /* 3282 * the bad hack :/ override datepicker so it doesn't close on select 3283 // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378 3284 */ 3285 $.datepicker._base_selectDate = $.datepicker._selectDate; 3286 $.datepicker._selectDate = function (id, dateStr) { 3287 var inst = this._getInst($(id)[0]), 3288 tp_inst = this._get(inst, 'timepicker'), 3289 was_inline; 3290 3291 if (tp_inst && inst.settings.showTimepicker) { 3292 tp_inst._limitMinMaxDateTime(inst, true); 3293 was_inline = inst.inline; 3294 inst.inline = inst.stay_open = true; 3295 //This way the onSelect handler called from calendarpicker get the full dateTime 3296 this._base_selectDate(id, dateStr); 3297 inst.inline = was_inline; 3298 inst.stay_open = false; 3299 this._notifyChange(inst); 3300 this._updateDatepicker(inst); 3301 } else { 3302 this._base_selectDate(id, dateStr); 3303 } 3304 }; 3305 3306 /* 3307 * second bad hack :/ override datepicker so it triggers an event when changing the input field 3308 * and does not redraw the datepicker on every selectDate event 3309 */ 3310 $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker; 3311 $.datepicker._updateDatepicker = function (inst) { 3312 3313 // don't popup the datepicker if there is another instance already opened 3314 var input = inst.input[0]; 3315 if ($.datepicker._curInst && $.datepicker._curInst !== inst && $.datepicker._datepickerShowing && $.datepicker._lastInput !== input) { 3316 return; 3317 } 3318 3319 if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) { 3320 3321 this._base_updateDatepicker(inst); 3322 3323 // Reload the time control when changing something in the input text field. 3324 var tp_inst = this._get(inst, 'timepicker'); 3325 if (tp_inst) { 3326 tp_inst._addTimePicker(inst); 3327 } 3328 } 3329 }; 3330 3331 /* 3332 * third bad hack :/ override datepicker so it allows spaces and colon in the input field 3333 */ 3334 $.datepicker._base_doKeyPress = $.datepicker._doKeyPress; 3335 $.datepicker._doKeyPress = function (event) { 3336 var inst = $.datepicker._getInst(event.target), 3337 tp_inst = $.datepicker._get(inst, 'timepicker'); 3338 3339 if (tp_inst) { 3340 if ($.datepicker._get(inst, 'constrainInput')) { 3341 var ampm = tp_inst.support.ampm, 3342 tz = tp_inst._defaults.showTimezone !== null ? tp_inst._defaults.showTimezone : tp_inst.support.timezone, 3343 dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')), 3344 datetimeChars = tp_inst._defaults.timeFormat.toString() 3345 .replace(/[hms]/g, '') 3346 .replace(/TT/g, ampm ? 'APM' : '') 3347 .replace(/Tt/g, ampm ? 'AaPpMm' : '') 3348 .replace(/tT/g, ampm ? 'AaPpMm' : '') 3349 .replace(/T/g, ampm ? 'AP' : '') 3350 .replace(/tt/g, ampm ? 'apm' : '') 3351 .replace(/t/g, ampm ? 'ap' : '') + 3352 " " + tp_inst._defaults.separator + 3353 tp_inst._defaults.timeSuffix + 3354 (tz ? tp_inst._defaults.timezoneList.join('') : '') + 3355 (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) + 3356 dateChars, 3357 chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode); 3358 return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1); 3359 } 3360 } 3361 3362 return $.datepicker._base_doKeyPress(event); 3363 }; 3364 3365 /* 3366 * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField 3367 * Update any alternate field to synchronise with the main field. 3368 */ 3369 $.datepicker._base_updateAlternate = $.datepicker._updateAlternate; 3370 $.datepicker._updateAlternate = function (inst) { 3371 var tp_inst = this._get(inst, 'timepicker'); 3372 if (tp_inst) { 3373 var altField = tp_inst._defaults.altField; 3374 if (altField) { // update alternate field too 3375 var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat, 3376 date = this._getDate(inst), 3377 formatCfg = $.datepicker._getFormatConfig(inst), 3378 altFormattedDateTime = '', 3379 altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator, 3380 altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix, 3381 altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat; 3382 3383 altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix; 3384 if (!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null) { 3385 if (tp_inst._defaults.altFormat) { 3386 altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime; 3387 } 3388 else { 3389 altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime; 3390 } 3391 } 3392 $(altField).val( inst.input.val() ? altFormattedDateTime : ""); 3393 } 3394 } 3395 else { 3396 $.datepicker._base_updateAlternate(inst); 3397 } 3398 }; 3399 3400 /* 3401 * Override key up event to sync manual input changes. 3402 */ 3403 $.datepicker._base_doKeyUp = $.datepicker._doKeyUp; 3404 $.datepicker._doKeyUp = function (event) { 3405 var inst = $.datepicker._getInst(event.target), 3406 tp_inst = $.datepicker._get(inst, 'timepicker'); 3407 3408 if (tp_inst) { 3409 if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) { 3410 try { 3411 $.datepicker._updateDatepicker(inst); 3412 } catch (err) { 3413 $.timepicker.log(err); 3414 } 3415 } 3416 } 3417 3418 return $.datepicker._base_doKeyUp(event); 3419 }; 3420 3421 /* 3422 * override "Today" button to also grab the time. 3423 */ 3424 $.datepicker._base_gotoToday = $.datepicker._gotoToday; 3425 $.datepicker._gotoToday = function (id) { 3426 var inst = this._getInst($(id)[0]), 3427 $dp = inst.dpDiv; 3428 this._base_gotoToday(id); 3429 var tp_inst = this._get(inst, 'timepicker'); 3430 selectLocalTimezone(tp_inst); 3431 var now = new Date(); 3432 this._setTime(inst, now); 3433 this._setDate(inst, now); 3434 }; 3435 3436 /* 3437 * Disable & enable the Time in the datetimepicker 3438 */ 3439 $.datepicker._disableTimepickerDatepicker = function (target) { 3440 var inst = this._getInst(target); 3441 if (!inst) { 3442 return; 3443 } 3444 3445 var tp_inst = this._get(inst, 'timepicker'); 3446 $(target).datepicker('getDate'); // Init selected[Year|Month|Day] 3447 if (tp_inst) { 3448 inst.settings.showTimepicker = false; 3449 tp_inst._defaults.showTimepicker = false; 3450 tp_inst._updateDateTime(inst); 3451 } 3452 }; 3453 3454 $.datepicker._enableTimepickerDatepicker = function (target) { 3455 var inst = this._getInst(target); 3456 if (!inst) { 3457 return; 3458 } 3459 3460 var tp_inst = this._get(inst, 'timepicker'); 3461 $(target).datepicker('getDate'); // Init selected[Year|Month|Day] 3462 if (tp_inst) { 3463 inst.settings.showTimepicker = true; 3464 tp_inst._defaults.showTimepicker = true; 3465 tp_inst._addTimePicker(inst); // Could be disabled on page load 3466 tp_inst._updateDateTime(inst); 3467 } 3468 }; 3469 3470 /* 3471 * Create our own set time function 3472 */ 3473 $.datepicker._setTime = function (inst, date) { 3474 var tp_inst = this._get(inst, 'timepicker'); 3475 if (tp_inst) { 3476 var defaults = tp_inst._defaults; 3477 3478 // calling _setTime with no date sets time to defaults 3479 tp_inst.hour = date ? date.getHours() : defaults.hour; 3480 tp_inst.minute = date ? date.getMinutes() : defaults.minute; 3481 tp_inst.second = date ? date.getSeconds() : defaults.second; 3482 tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec; 3483 tp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec; 3484 3485 //check if within min/max times.. 3486 tp_inst._limitMinMaxDateTime(inst, true); 3487 3488 tp_inst._onTimeChange(); 3489 tp_inst._updateDateTime(inst); 3490 } 3491 }; 3492 3493 /* 3494 * Create new public method to set only time, callable as $().datepicker('setTime', date) 3495 */ 3496 $.datepicker._setTimeDatepicker = function (target, date, withDate) { 3497 var inst = this._getInst(target); 3498 if (!inst) { 3499 return; 3500 } 3501 3502 var tp_inst = this._get(inst, 'timepicker'); 3503 3504 if (tp_inst) { 3505 this._setDateFromField(inst); 3506 var tp_date; 3507 if (date) { 3508 if (typeof date === "string") { 3509 tp_inst._parseTime(date, withDate); 3510 tp_date = new Date(); 3511 tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec); 3512 tp_date.setMicroseconds(tp_inst.microsec); 3513 } else { 3514 tp_date = new Date(date.getTime()); 3515 tp_date.setMicroseconds(date.getMicroseconds()); 3516 } 3517 if (tp_date.toString() === 'Invalid Date') { 3518 tp_date = undefined; 3519 } 3520 this._setTime(inst, tp_date); 3521 } 3522 } 3523 3524 }; 3525 3526 /* 3527 * override setDate() to allow setting time too within Date object 3528 */ 3529 $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker; 3530 $.datepicker._setDateDatepicker = function (target, _date) { 3531 var inst = this._getInst(target); 3532 var date = _date; 3533 if (!inst) { 3534 return; 3535 } 3536 3537 if (typeof(_date) === 'string') { 3538 date = new Date(_date); 3539 if (!date.getTime()) { 3540 this._base_setDateDatepicker.apply(this, arguments); 3541 date = $(target).datepicker('getDate'); 3542 } 3543 } 3544 3545 var tp_inst = this._get(inst, 'timepicker'); 3546 var tp_date; 3547 if (date instanceof Date) { 3548 tp_date = new Date(date.getTime()); 3549 tp_date.setMicroseconds(date.getMicroseconds()); 3550 } else { 3551 tp_date = date; 3552 } 3553 3554 // This is important if you are using the timezone option, javascript's Date 3555 // object will only return the timezone offset for the current locale, so we 3556 // adjust it accordingly. If not using timezone option this won't matter.. 3557 // If a timezone is different in tp, keep the timezone as is 3558 if (tp_inst && tp_date) { 3559 // look out for DST if tz wasn't specified 3560 if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) { 3561 tp_inst.timezone = tp_date.getTimezoneOffset() * -1; 3562 } 3563 date = $.timepicker.timezoneAdjust(date, tp_inst.timezone); 3564 tp_date = $.timepicker.timezoneAdjust(tp_date, tp_inst.timezone); 3565 } 3566 3567 this._updateDatepicker(inst); 3568 this._base_setDateDatepicker.apply(this, arguments); 3569 this._setTimeDatepicker(target, tp_date, true); 3570 }; 3571 3572 /* 3573 * override getDate() to allow getting time too within Date object 3574 */ 3575 $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker; 3576 $.datepicker._getDateDatepicker = function (target, noDefault) { 3577 var inst = this._getInst(target); 3578 if (!inst) { 3579 return; 3580 } 3581 3582 var tp_inst = this._get(inst, 'timepicker'); 3583 3584 if (tp_inst) { 3585 // if it hasn't yet been defined, grab from field 3586 if (inst.lastVal === undefined) { 3587 this._setDateFromField(inst, noDefault); 3588 } 3589 3590 var date = this._getDate(inst); 3591 if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) { 3592 date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec); 3593 date.setMicroseconds(tp_inst.microsec); 3594 3595 // This is important if you are using the timezone option, javascript's Date 3596 // object will only return the timezone offset for the current locale, so we 3597 // adjust it accordingly. If not using timezone option this won't matter.. 3598 if (tp_inst.timezone != null) { 3599 // look out for DST if tz wasn't specified 3600 if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) { 3601 tp_inst.timezone = date.getTimezoneOffset() * -1; 3602 } 3603 date = $.timepicker.timezoneAdjust(date, tp_inst.timezone); 3604 } 3605 } 3606 return date; 3607 } 3608 return this._base_getDateDatepicker(target, noDefault); 3609 }; 3610 3611 /* 3612 * override parseDate() because UI 1.8.14 throws an error about "Extra characters" 3613 * An option in datapicker to ignore extra format characters would be nicer. 3614 */ 3615 $.datepicker._base_parseDate = $.datepicker.parseDate; 3616 $.datepicker.parseDate = function (format, value, settings) { 3617 var date; 3618 try { 3619 date = this._base_parseDate(format, value, settings); 3620 } catch (err) { 3621 // Hack! The error message ends with a colon, a space, and 3622 // the "extra" characters. We rely on that instead of 3623 // attempting to perfectly reproduce the parsing algorithm. 3624 if (err.indexOf(":") >= 0) { 3625 date = this._base_parseDate(format, value.substring(0, value.length - (err.length - err.indexOf(':') - 2)), settings); 3626 $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format); 3627 } else { 3628 throw err; 3629 } 3630 } 3631 return date; 3632 }; 3633 3634 /* 3635 * override formatDate to set date with time to the input 3636 */ 3637 $.datepicker._base_formatDate = $.datepicker._formatDate; 3638 $.datepicker._formatDate = function (inst, day, month, year) { 3639 var tp_inst = this._get(inst, 'timepicker'); 3640 if (tp_inst) { 3641 tp_inst._updateDateTime(inst); 3642 return tp_inst.$input.val(); 3643 } 3644 return this._base_formatDate(inst); 3645 }; 3646 3647 /* 3648 * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate 3649 */ 3650 $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker; 3651 $.datepicker._optionDatepicker = function (target, name, value) { 3652 var inst = this._getInst(target), 3653 name_clone; 3654 if (!inst) { 3655 return null; 3656 } 3657 3658 var tp_inst = this._get(inst, 'timepicker'); 3659 if (tp_inst) { 3660 var min = null, 3661 max = null, 3662 onselect = null, 3663 overrides = tp_inst._defaults.evnts, 3664 fns = {}, 3665 prop, 3666 ret, 3667 oldVal, 3668 $target; 3669 if (typeof name === 'string') { // if min/max was set with the string 3670 if (name === 'minDate' || name === 'minDateTime') { 3671 min = value; 3672 } else if (name === 'maxDate' || name === 'maxDateTime') { 3673 max = value; 3674 } else if (name === 'onSelect') { 3675 onselect = value; 3676 } else if (overrides.hasOwnProperty(name)) { 3677 if (typeof (value) === 'undefined') { 3678 return overrides[name]; 3679 } 3680 fns[name] = value; 3681 name_clone = {}; //empty results in exiting function after overrides updated 3682 } 3683 } else if (typeof name === 'object') { //if min/max was set with the JSON 3684 if (name.minDate) { 3685 min = name.minDate; 3686 } else if (name.minDateTime) { 3687 min = name.minDateTime; 3688 } else if (name.maxDate) { 3689 max = name.maxDate; 3690 } else if (name.maxDateTime) { 3691 max = name.maxDateTime; 3692 } 3693 for (prop in overrides) { 3694 if (overrides.hasOwnProperty(prop) && name[prop]) { 3695 fns[prop] = name[prop]; 3696 } 3697 } 3698 } 3699 for (prop in fns) { 3700 if (fns.hasOwnProperty(prop)) { 3701 overrides[prop] = fns[prop]; 3702 if (!name_clone) { name_clone = $.extend({}, name); } 3703 delete name_clone[prop]; 3704 } 3705 } 3706 if (name_clone && isEmptyObject(name_clone)) { return; } 3707 if (min) { //if min was set 3708 if (min === 0) { 3709 min = new Date(); 3710 } else { 3711 min = new Date(min); 3712 } 3713 tp_inst._defaults.minDate = min; 3714 tp_inst._defaults.minDateTime = min; 3715 } else if (max) { //if max was set 3716 if (max === 0) { 3717 max = new Date(); 3718 } else { 3719 max = new Date(max); 3720 } 3721 tp_inst._defaults.maxDate = max; 3722 tp_inst._defaults.maxDateTime = max; 3723 } else if (onselect) { 3724 tp_inst._defaults.onSelect = onselect; 3725 } 3726 3727 // Datepicker will override our date when we call _base_optionDatepicker when 3728 // calling minDate/maxDate, so we will first grab the value, call 3729 // _base_optionDatepicker, then set our value back. 3730 if(min || max){ 3731 $target = $(target); 3732 oldVal = $target.datetimepicker('getDate'); 3733 ret = this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value); 3734 $target.datetimepicker('setDate', oldVal); 3735 return ret; 3736 } 3737 } 3738 if (value === undefined) { 3739 return this._base_optionDatepicker.call($.datepicker, target, name); 3740 } 3741 return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value); 3742 }; 3743
vendor: 4,469 bytes, lines 3743-3900
3743 3744 /* 3745 * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype, 3746 * it will return false for all objects 3747 */ 3748 var isEmptyObject = function (obj) { 3749 var prop; 3750 for (prop in obj) { 3751 if (obj.hasOwnProperty(prop)) { 3752 return false; 3753 } 3754 } 3755 return true; 3756 }; 3757 3758 /* 3759 * jQuery extend now ignores nulls! 3760 */ 3761 var extendRemove = function (target, props) { 3762 $.extend(target, props); 3763 for (var name in props) { 3764 if (props[name] === null || props[name] === undefined) { 3765 target[name] = props[name]; 3766 } 3767 } 3768 return target; 3769 }; 3770 3771 /* 3772 * Determine by the time format which units are supported 3773 * Returns an object of booleans for each unit 3774 */ 3775 var detectSupport = function (timeFormat) { 3776 var tf = timeFormat.replace(/'.*?'/g, '').toLowerCase(), // removes literals 3777 isIn = function (f, t) { // does the format contain the token? 3778 return f.indexOf(t) !== -1 ? true : false; 3779 }; 3780 return { 3781 hour: isIn(tf, 'h'), 3782 minute: isIn(tf, 'm'), 3783 second: isIn(tf, 's'), 3784 millisec: isIn(tf, 'l'), 3785 microsec: isIn(tf, 'c'), 3786 timezone: isIn(tf, 'z'), 3787 ampm: isIn(tf, 't') && isIn(timeFormat, 'h'), 3788 iso8601: isIn(timeFormat, 'Z') 3789 }; 3790 }; 3791 3792 /* 3793 * Converts 24 hour format into 12 hour 3794 * Returns 12 hour without leading 0 3795 */ 3796 var convert24to12 = function (hour) { 3797 hour %= 12; 3798 3799 if (hour === 0) { 3800 hour = 12; 3801 } 3802 3803 return String(hour); 3804 }; 3805 3806 var computeEffectiveSetting = function (settings, property) { 3807 return settings && settings[property] ? settings[property] : $.timepicker._defaults[property]; 3808 }; 3809 3810 /* 3811 * Splits datetime string into date and time substrings. 3812 * Throws exception when date can't be parsed 3813 * Returns {dateString: dateString, timeString: timeString} 3814 */ 3815 var splitDateTime = function (dateTimeString, timeSettings) { 3816 // The idea is to get the number separator occurrences in datetime and the time format requested (since time has 3817 // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split. 3818 var separator = computeEffectiveSetting(timeSettings, 'separator'), 3819 format = computeEffectiveSetting(timeSettings, 'timeFormat'), 3820 timeParts = format.split(separator), // how many occurrences of separator may be in our format? 3821 timePartsLen = timeParts.length, 3822 allParts = dateTimeString.split(separator), 3823 allPartsLen = allParts.length; 3824 3825 if (allPartsLen > 1) { 3826 return { 3827 dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator), 3828 timeString: allParts.splice(0, timePartsLen).join(separator) 3829 }; 3830 } 3831 3832 return { 3833 dateString: dateTimeString, 3834 timeString: '' 3835 }; 3836 }; 3837 3838 /* 3839 * Internal function to parse datetime interval 3840 * Returns: {date: Date, timeObj: Object}, where 3841 * date - parsed date without time (type Date) 3842 * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional 3843 */ 3844 var parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) { 3845 var date, 3846 parts, 3847 parsedTime; 3848 3849 parts = splitDateTime(dateTimeString, timeSettings); 3850 date = $.datepicker._base_parseDate(dateFormat, parts.dateString, dateSettings); 3851 3852 if (parts.timeString === '') { 3853 return { 3854 date: date 3855 }; 3856 } 3857 3858 parsedTime = $.datepicker.parseTime(timeFormat, parts.timeString, timeSettings); 3859 3860 if (!parsedTime) { 3861 throw 'Wrong time format'; 3862 } 3863 3864 return { 3865 date: date, 3866 timeObj: parsedTime 3867 }; 3868 }; 3869 3870 /* 3871 * Internal function to set timezone_select to the local timezone 3872 */ 3873 var selectLocalTimezone = function (tp_inst, date) { 3874 if (tp_inst && tp_inst.timezone_select) { 3875 var now = date || new Date(); 3876 tp_inst.timezone_select.val(-now.getTimezoneOffset()); 3877 } 3878 }; 3879 3880 /* 3881 * Create a Singleton Instance 3882 */ 3883 $.timepicker = new Timepicker(); 3884 3885 /** 3886 * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5) 3887 * @param {number} tzMinutes if not a number, less than -720 (-1200), or greater than 840 (+1400) this value is returned 3888 * @param {boolean} iso8601 if true formats in accordance to iso8601 "+12:45" 3889 * @return {string} 3890 */ 3891 $.timepicker.timezoneOffsetString = function (tzMinutes, iso8601) { 3892 if (isNaN(tzMinutes) || tzMinutes > 840 || tzMinutes < -720) { 3893 return tzMinutes; 3894 } 3895 3896 var off = tzMinutes, 3897 minutes = off % 60, 3898 hours = (off - minutes) / 60, 3899 iso = iso8601 ? ':' : '', 3900 tz = (off >= 0 ? '+' : '-') + ('0' + Math.abs(hours)).slice(-2) + iso + ('0' + Math.abs(minutes)).slice(-2);
vendor: 13,184 bytes, lines 3901-4248
3901 3902 if (tz === '+00:00') { 3903 return 'Z'; 3904 } 3905 return tz; 3906 }; 3907 3908 /** 3909 * Get the number in minutes that represents a timezone string 3910 * @param {string} tzString formatted like "+0500", "-1245", "Z" 3911 * @return {number} the offset minutes or the original string if it doesn't match expectations 3912 */ 3913 $.timepicker.timezoneOffsetNumber = function (tzString) { 3914 var normalized = tzString.toString().replace(':', ''); // excuse any iso8601, end up with "+1245" 3915 3916 if (normalized.toUpperCase() === 'Z') { // if iso8601 with Z, its 0 minute offset 3917 return 0; 3918 } 3919 3920 if (!/^(\-|\+)\d{4}$/.test(normalized)) { // possibly a user defined tz, so just give it back 3921 return tzString; 3922 } 3923 3924 return ((normalized.substr(0, 1) === '-' ? -1 : 1) * // plus or minus 3925 ((parseInt(normalized.substr(1, 2), 10) * 60) + // hours (converted to minutes) 3926 parseInt(normalized.substr(3, 2), 10))); // minutes 3927 }; 3928 3929 /** 3930 * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate) 3931 * @param {Date} date 3932 * @param {string} toTimezone formatted like "+0500", "-1245" 3933 * @return {Date} 3934 */ 3935 $.timepicker.timezoneAdjust = function (date, toTimezone) { 3936 var toTz = $.timepicker.timezoneOffsetNumber(toTimezone); 3937 if (!isNaN(toTz)) { 3938 date.setMinutes(date.getMinutes() + -date.getTimezoneOffset() - toTz); 3939 } 3940 return date; 3941 }; 3942 3943 /** 3944 * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to 3945 * enforce date range limits. 3946 * n.b. The input value must be correctly formatted (reformatting is not supported) 3947 * @param {Element} startTime 3948 * @param {Element} endTime 3949 * @param {Object} options Options for the timepicker() call 3950 * @return {jQuery} 3951 */ 3952 $.timepicker.timeRange = function (startTime, endTime, options) { 3953 return $.timepicker.handleRange('timepicker', startTime, endTime, options); 3954 }; 3955 3956 /** 3957 * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to 3958 * enforce date range limits. 3959 * @param {Element} startTime 3960 * @param {Element} endTime 3961 * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`, 3962 * a boolean value that can be used to reformat the input values to the `dateFormat`. 3963 * @param {string} method Can be used to specify the type of picker to be added 3964 * @return {jQuery} 3965 */ 3966 $.timepicker.datetimeRange = function (startTime, endTime, options) { 3967 $.timepicker.handleRange('datetimepicker', startTime, endTime, options); 3968 }; 3969 3970 /** 3971 * Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to 3972 * enforce date range limits. 3973 * @param {Element} startTime 3974 * @param {Element} endTime 3975 * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`, 3976 * a boolean value that can be used to reformat the input values to the `dateFormat`. 3977 * @return {jQuery} 3978 */ 3979 $.timepicker.dateRange = function (startTime, endTime, options) { 3980 $.timepicker.handleRange('datepicker', startTime, endTime, options); 3981 }; 3982 3983 /** 3984 * Calls `method` on the `startTime` and `endTime` elements, and configures them to 3985 * enforce date range limits. 3986 * @param {string} method Can be used to specify the type of picker to be added 3987 * @param {Element} startTime 3988 * @param {Element} endTime 3989 * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`, 3990 * a boolean value that can be used to reformat the input values to the `dateFormat`. 3991 * @return {jQuery} 3992 */ 3993 $.timepicker.handleRange = function (method, startTime, endTime, options) { 3994 options = $.extend({}, { 3995 minInterval: 0, // min allowed interval in milliseconds 3996 maxInterval: 0, // max allowed interval in milliseconds 3997 start: {}, // options for start picker 3998 end: {} // options for end picker 3999 }, options); 4000 4001 // for the mean time this fixes an issue with calling getDate with timepicker() 4002 var timeOnly = false; 4003 if(method === 'timepicker'){ 4004 timeOnly = true; 4005 method = 'datetimepicker'; 4006 } 4007 4008 function checkDates(changed, other) { 4009 var startdt = startTime[method]('getDate'), 4010 enddt = endTime[method]('getDate'), 4011 changeddt = changed[method]('getDate'); 4012 4013 if (startdt !== null) { 4014 var minDate = new Date(startdt.getTime()), 4015 maxDate = new Date(startdt.getTime()); 4016 4017 minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval); 4018 maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval); 4019 4020 if (options.minInterval > 0 && minDate > enddt) { // minInterval check 4021 endTime[method]('setDate', minDate); 4022 } 4023 else if (options.maxInterval > 0 && maxDate < enddt) { // max interval check 4024 endTime[method]('setDate', maxDate); 4025 } 4026 else if (startdt > enddt) { 4027 other[method]('setDate', changeddt); 4028 } 4029 } 4030 } 4031 4032 function selected(changed, other, option) { 4033 if (!changed.val()) { 4034 return; 4035 } 4036 var date = changed[method].call(changed, 'getDate'); 4037 if (date !== null && options.minInterval > 0) { 4038 if (option === 'minDate') { 4039 date.setMilliseconds(date.getMilliseconds() + options.minInterval); 4040 } 4041 if (option === 'maxDate') { 4042 date.setMilliseconds(date.getMilliseconds() - options.minInterval); 4043 } 4044 } 4045 4046 if (date.getTime) { 4047 other[method].call(other, 'option', option, date); 4048 } 4049 } 4050 4051 $.fn[method].call(startTime, $.extend({ 4052 timeOnly: timeOnly, 4053 onClose: function (dateText, inst) { 4054 checkDates($(this), endTime); 4055 }, 4056 onSelect: function (selectedDateTime) { 4057 selected($(this), endTime, 'minDate'); 4058 } 4059 }, options, options.start)); 4060 $.fn[method].call(endTime, $.extend({ 4061 timeOnly: timeOnly, 4062 onClose: function (dateText, inst) { 4063 checkDates($(this), startTime); 4064 }, 4065 onSelect: function (selectedDateTime) { 4066 selected($(this), startTime, 'maxDate'); 4067 } 4068 }, options, options.end)); 4069 4070 checkDates(startTime, endTime); 4071 4072 selected(startTime, endTime, 'minDate'); 4073 selected(endTime, startTime, 'maxDate'); 4074 4075 return $([startTime.get(0), endTime.get(0)]); 4076 }; 4077 4078 /** 4079 * Log error or data to the console during error or debugging 4080 * @param {Object} err pass any type object to log to the console during error or debugging 4081 * @return {void} 4082 */ 4083 $.timepicker.log = function () { 4084 if (window.console) { 4085 window.console.log.apply(window.console, Array.prototype.slice.call(arguments)); 4086 } 4087 }; 4088 4089 /* 4090 * Add util object to allow access to private methods for testability. 4091 */ 4092 $.timepicker._util = { 4093 _extendRemove: extendRemove, 4094 _isEmptyObject: isEmptyObject, 4095 _convert24to12: convert24to12, 4096 _detectSupport: detectSupport, 4097 _selectLocalTimezone: selectLocalTimezone, 4098 _computeEffectiveSetting: computeEffectiveSetting, 4099 _splitDateTime: splitDateTime, 4100 _parseDateTimeInternal: parseDateTimeInternal 4101 }; 4102 4103 /* 4104 * Microsecond support 4105 */ 4106 if (!Date.prototype.getMicroseconds) { 4107 Date.prototype.microseconds = 0; 4108 Date.prototype.getMicroseconds = function () { return this.microseconds; }; 4109 Date.prototype.setMicroseconds = function (m) { 4110 this.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000)); 4111 this.microseconds = m % 1000; 4112 return this; 4113 }; 4114 } 4115 4116 /* 4117 * Keep up with the version 4118 */ 4119 $.timepicker.version = "1.5.0"; 4120 4121})(jQuery); 4122; 4123 4124/*! 4125 * jQuery hashchange event - v1.3 - 7/21/2010 4126 * http://benalman.com/projects/jquery-hashchange-plugin/ 4127 * 4128 * Copyright (c) 2010 "Cowboy" Ben Alman 4129 * Dual licensed under the MIT and GPL licenses. 4130 * http://benalman.com/about/license/ 4131 */ 4132 4133// Script: jQuery hashchange event 4134// 4135// *Version: 1.3, Last updated: 7/21/2010* 4136// 4137// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/ 4138// GitHub - http://github.com/cowboy/jquery-hashchange/ 4139// Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js 4140// (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (0.8kb gzipped) 4141// 4142// About: License 4143// 4144// Copyright (c) 2010 "Cowboy" Ben Alman, 4145// Dual licensed under the MIT and GPL licenses. 4146// http://benalman.com/about/license/ 4147// 4148// About: Examples 4149// 4150// These working examples, complete with fully commented code, illustrate a few 4151// ways in which this plugin can be used. 4152// 4153// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/ 4154// document.domain - http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/ 4155// 4156// About: Support and Testing 4157// 4158// Information about what version or versions of jQuery this plugin has been 4159// tested with, what browsers it has been tested in, and where the unit tests 4160// reside (so you can test it yourself). 4161// 4162// jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2 4163// Browsers Tested - Internet Explorer 6-8, Firefox 2-4, Chrome 5-6, Safari 3.2-5, 4164// Opera 9.6-10.60, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5. 4165// Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/ 4166// 4167// About: Known issues 4168// 4169// While this jQuery hashchange event implementation is quite stable and 4170// robust, there are a few unfortunate browser bugs surrounding expected 4171// hashchange event-based behaviors, independent of any JavaScript 4172// window.onhashchange abstraction. See the following examples for more 4173// information: 4174// 4175// Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/ 4176// Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/ 4177// WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/ 4178// Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/ 4179// 4180// Also note that should a browser natively support the window.onhashchange 4181// event, but not report that it does, the fallback polling loop will be used. 4182// 4183// About: Release History 4184// 4185// 1.3 - (7/21/2010) Reorganized IE6/7 Iframe code to make it more 4186// "removable" for mobile-only development. Added IE6/7 document.title 4187// support. Attempted to make Iframe as hidden as possible by using 4188// techniques from http://www.paciellogroup.com/blog/?p=604. Added 4189// support for the "shortcut" format $(window).hashchange( fn ) and 4190// $(window).hashchange() like jQuery provides for built-in events. 4191// Renamed jQuery.hashchangeDelay to <jQuery.fn.hashchange.delay> and 4192// lowered its default value to 50. Added <jQuery.fn.hashchange.domain> 4193// and <jQuery.fn.hashchange.src> properties plus document-domain.html 4194// file to address access denied issues when setting document.domain in 4195// IE6/7. 4196// 1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin 4197// from a page on another domain would cause an error in Safari 4. Also, 4198// IE6/7 Iframe is now inserted after the body (this actually works), 4199// which prevents the page from scrolling when the event is first bound. 4200// Event can also now be bound before DOM ready, but it won't be usable 4201// before then in IE6/7. 4202// 1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug 4203// where browser version is incorrectly reported as 8.0, despite 4204// inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag. 4205// 1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special 4206// window.onhashchange functionality into a separate plugin for users 4207// who want just the basic event & back button support, without all the 4208// extra awesomeness that BBQ provides. This plugin will be included as 4209// part of jQuery BBQ, but also be available separately. 4210 4211(function($,window,undefined){ 4212 '$:nomunge'; // Used by YUI compressor. 4213 4214 // Reused string. 4215 var str_hashchange = 'hashchange', 4216 4217 // Method / object references. 4218 doc = document, 4219 fake_onhashchange, 4220 special = $.event.special, 4221 4222 // Does the browser support window.onhashchange? Note that IE8 running in 4223 // IE7 compatibility mode reports true for 'onhashchange' in window, even 4224 // though the event isn't supported, so also test document.documentMode. 4225 doc_mode = doc.documentMode, 4226 supports_onhashchange = 'on' + str_hashchange in window && ( doc_mode === undefined || doc_mode > 7 ); 4227 4228 // Get location.hash (or what you'd expect location.hash to be) sans any 4229 // leading #. Thanks for making this necessary, Firefox! 4230 function get_fragment( url ) { 4231 url = url || location.href; 4232 return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' ); 4233 }; 4234 4235 // Method: jQuery.fn.hashchange 4236 // 4237 // Bind a handler to the window.onhashchange event or trigger all bound 4238 // window.onhashchange event handlers. This behavior is consistent with 4239 // jQuery's built-in event handlers. 4240 // 4241 // Usage: 4242 // 4243 // > jQuery(window).hashchange( [ handler ] ); 4244 // 4245 // Arguments: 4246 // 4247 // handler - (Function) Optional handler to be bound to the hashchange 4248 // event. This is a "shortcut" for the more verbose form:
4249 // jQuery(window).bind( 'hashchange', handler ). If handler is omitted, 4250 // all bound window.onhashchange event handlers will be triggered. This 4251 // is a shortcut for the more verbose 4252 // jQuery(window).trigger( 'hashchange' ). These forms are described in 4253 // the <hashchange event> section. 4254 // 4255 // Returns: 4256 // 4257 // (jQuery) The initial jQuery collection of elements. 4258 4259 // Allow the "shortcut" format $(elem).hashchange( fn ) for binding and 4260 // $(elem).hashchange() for triggering, like jQuery does for built-in events. 4261 $.fn[ str_hashchange ] = function( fn ) { 4262 return fn ? this.bind( str_hashchange, fn ) : this.trigger( str_hashchange ); 4263 }; 4264 4265 // Property: jQuery.fn.hashchange.delay 4266 // 4267 // The numeric interval (in milliseconds) at which the <hashchange event> 4268 // polling loop executes. Defaults to 50. 4269 4270 // Property: jQuery.fn.hashchange.domain 4271 // 4272 // If you're setting document.domain in your JavaScript, and you want hash 4273 // history to work in IE6/7, not only must this property be set, but you must 4274 // also set document.domain BEFORE jQuery is loaded into the page. This 4275 // property is only applicable if you are supporting IE6/7 (or IE8 operating 4276 // in "IE7 compatibility" mode). 4277 // 4278 // In addition, the <jQuery.fn.hashchange.src> property must be set to the 4279 // path of the included "document-domain.html" file, which can be renamed or 4280 // modified if necessary (note that the document.domain specified must be the 4281 // same in both your main JavaScript as well as in this file). 4282 // 4283 // Usage: 4284 // 4285 // jQuery.fn.hashchange.domain = document.domain; 4286 4287 // Property: jQuery.fn.hashchange.src 4288 // 4289 // If, for some reason, you need to specify an Iframe src file (for example, 4290 // when setting document.domain as in <jQuery.fn.hashchange.domain>), you can 4291 // do so using this property. Note that when using this property, history 4292 // won't be recorded in IE6/7 until the Iframe src file loads. This property 4293 // is only applicable if you are supporting IE6/7 (or IE8 operating in "IE7 4294 // compatibility" mode). 4295 // 4296 // Usage: 4297 // 4298 // jQuery.fn.hashchange.src = 'path/to/file.html'; 4299 4300 $.fn[ str_hashchange ].delay = 50; 4301 /* 4302 $.fn[ str_hashchange ].domain = null; 4303 $.fn[ str_hashchange ].src = null; 4304 */ 4305 4306 // Event: hashchange event 4307 // 4308 // Fired when location.hash changes. In browsers that support it, the native 4309 // HTML5 window.onhashchange event is used, otherwise a polling loop is 4310 // initialized, running every <jQuery.fn.hashchange.delay> milliseconds to 4311 // see if the hash has changed. In IE6/7 (and IE8 operating in "IE7 4312 // compatibility" mode), a hidden Iframe is created to allow the back button 4313 // and hash-based history to work. 4314 // 4315 // Usage as described in <jQuery.fn.hashchange>: 4316 // 4317 // > // Bind an event handler. 4318 // > jQuery(window).hashchange( function(e) { 4319 // > var hash = location.hash; 4320 // > ... 4321 // > }); 4322 // > 4323 // > // Manually trigger the event handler. 4324 // > jQuery(window).hashchange(); 4325 // 4326 // A more verbose usage that allows for event namespacing: 4327 // 4328 // > // Bind an event handler. 4329 // > jQuery(window).bind( 'hashchange', function(e) { 4330 // > var hash = location.hash; 4331 // > ... 4332 // > }); 4333 // > 4334 // > // Manually trigger the event handler. 4335 // > jQuery(window).trigger( 'hashchange' ); 4336 // 4337 // Additional Notes: 4338 // 4339 // * The polling loop and Iframe are not created until at least one handler 4340 // is actually bound to the 'hashchange' event. 4341 // * If you need the bound handler(s) to execute immediately, in cases where 4342 // a location.hash exists on page load, via bookmark or page refresh for 4343 // example, use jQuery(window).hashchange() or the more verbose 4344 // jQuery(window).trigger( 'hashchange' ). 4345 // * The event can be bound before DOM ready, but since it won't be usable 4346 // before then in IE6/7 (due to the necessary Iframe), recommended usage is 4347 // to bind it inside a DOM ready handler. 4348 4349 // Override existing $.event.special.hashchange methods (allowing this plugin 4350 // to be defined after jQuery BBQ in BBQ's source code). 4351 special[ str_hashchange ] = $.extend( special[ str_hashchange ], { 4352 4353 // Called only when the first 'hashchange' event is bound to window. 4354 setup: function() { 4355 // If window.onhashchange is supported natively, there's nothing to do.. 4356 if ( supports_onhashchange ) { return false; } 4357 4358 // Otherwise, we need to create our own. And we don't want to call this 4359 // until the user binds to the event, just in case they never do, since it 4360 // will create a polling loop and possibly even a hidden Iframe. 4361 $( fake_onhashchange.start ); 4362 }, 4363 4364 // Called only when the last 'hashchange' event is unbound from window. 4365 teardown: function() { 4366 // If window.onhashchange is supported natively, there's nothing to do.. 4367 if ( supports_onhashchange ) { return false; } 4368 4369 // Otherwise, we need to stop ours (if possible). 4370 $( fake_onhashchange.stop ); 4371 } 4372 4373 }); 4374 4375 // fake_onhashchange does all the work of triggering the window.onhashchange 4376 // event for browsers that don't natively support it, including creating a
4377 // polling loop to watch for hash changes and in IE 6/7 creating a hidden 4378 // Iframe to enable back and forward. 4379 fake_onhashchange = (function(){ 4380 var self = {}, 4381 timeout_id, 4382 4383 // Remember the initial hash so it doesn't get triggered immediately. 4384 last_hash = get_fragment(), 4385 4386 fn_retval = function(val){ return val; }, 4387 history_set = fn_retval, 4388 history_get = fn_retval; 4389 4390 // Start the polling loop. 4391 self.start = function() { 4392 timeout_id || poll(); 4393 }; 4394 4395 // Stop the polling loop. 4396 self.stop = function() { 4397 timeout_id && clearTimeout( timeout_id ); 4398 timeout_id = undefined; 4399 }; 4400 4401 // This polling loop checks every $.fn.hashchange.delay milliseconds to see 4402 // if location.hash has changed, and triggers the 'hashchange' event on 4403 // window when necessary. 4404 function poll() { 4405 var hash = get_fragment(), 4406 history_hash = history_get( last_hash ); 4407 4408 if ( hash !== last_hash ) { 4409 history_set( last_hash = hash, history_hash ); 4410 4411 $(window).trigger( str_hashchange ); 4412 4413 } else if ( history_hash !== last_hash ) { 4414 location.href = location.href.replace( /#.*/, '' ) + history_hash; 4415 } 4416 4417 timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay ); 4418 }; 4419 4420 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 4421 // vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv 4422 // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 4423 (window.navigator.userAgent.indexOf("MSIE ") > -1 || !!window.navigator.userAgent.match(/Trident.*rv\:11\./)) && !supports_onhashchange && (function(){ 4424 // Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8 4425 // when running in "IE7 compatibility" mode. 4426 4427 var iframe, 4428 iframe_src; 4429 4430 // When the event is bound and polling starts in IE 6/7, create a hidden 4431 // Iframe for history handling. 4432 self.start = function(){ 4433 if ( !iframe ) { 4434 iframe_src = $.fn[ str_hashchange ].src; 4435 iframe_src = iframe_src && iframe_src + get_fragment(); 4436 4437 // Create hidden Iframe. Attempt to make Iframe as hidden as possible 4438 // by using techniques from http://www.paciellogroup.com/blog/?p=604. 4439 iframe = $('<iframe tabindex="-1" title="empty"/>').hide() 4440 4441 // When Iframe has completely loaded, initialize the history and 4442 // start polling. 4443 .one( 'load', function(){ 4444 iframe_src || history_set( get_fragment() ); 4445 poll(); 4446 }) 4447 4448 // Load Iframe src if specified, otherwise nothing. 4449 .attr( 'src', iframe_src || 'javascript:0' ) 4450 4451 // Append Iframe after the end of the body to prevent unnecessary 4452 // initial page scrolling (yes, this works). 4453 .insertAfter( 'body' )[0].contentWindow; 4454 4455 // Whenever `document.title` changes, update the Iframe's title to 4456 // prettify the back/next history menu entries. Since IE sometimes 4457 // errors with "Unspecified error" the very first time this is set 4458 // (yes, very useful) wrap this with a try/catch block. 4459 doc.onpropertychange = function(){ 4460 try { 4461 if ( event.propertyName === 'title' ) { 4462 iframe.document.title = doc.title; 4463 } 4464 } catch(e) {} 4465 }; 4466 4467 } 4468 }; 4469 4470 // Override the "stop" method since an IE6/7 Iframe was created. Even 4471 // if there are no longer any bound event handlers, the polling loop 4472 // is still necessary for back/next to work at all! 4473 self.stop = fn_retval; 4474 4475 // Get history by looking at the hidden Iframe's location.hash. 4476 history_get = function() { 4477 return get_fragment( iframe.location.href ); 4478 }; 4479 4480 // Set a new history item by opening and then closing the Iframe 4481 // document, *then* setting its location.hash. If document.domain has 4482 // been set, update that as well. 4483 history_set = function( hash, history_hash ) { 4484 var iframe_doc = iframe.document, 4485 domain = $.fn[ str_hashchange ].domain; 4486 4487 if ( hash !== history_hash ) { 4488 // Update Iframe with any initial `document.title` that might be set. 4489 iframe_doc.title = doc.title; 4490 4491 // Opening the Iframe's document after it has been closed is what 4492 // actually adds a history entry. 4493 iframe_doc.open(); 4494 4495 // Set document.domain for the Iframe document as well, if necessary. 4496 domain && iframe_doc.write( '<script>document.domain="' + domain + '"</script>' ); 4497 4498 iframe_doc.close(); 4499 4500 // Update the Iframe's hash, for great justice. 4501 iframe.location.hash = hash; 4502 } 4503 }; 4504 4505 })(); 4506 // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4507 // ^^^^^^^^^^^^^^^^^^^ REMOVE IF NOT SUPPORTING IE6/7/8 ^^^^^^^^^^^^^^^^^^^ 4508 // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4509 4510 return self; 4511 })(); 4512 4513})(jQuery,this); 4514; 4515 4516/** 4517 * Debounce and throttle function's decorator plugin 1.0.5 4518 * 4519 * Copyright (c) 2009 Filatov Dmitry ([email protected]) 4520 * Dual licensed under the MIT and GPL licenses: 4521 * http://www.opensource.org/licenses/mit-license.php 4522 * http://www.gnu.org/licenses/gpl.html 4523 * 4524 */ 4525 4526(function($) { 4527 4528$.extend({ 4529 4530 debounce : function(fn, timeout, invokeAsap, ctx) { 4531 4532 if(arguments.length == 3 && typeof invokeAsap != 'boolean') { 4533 ctx = invokeAsap; 4534 invokeAsap = false;
4535 } 4536 4537 var timer; 4538 4539 return function() { 4540 4541 var args = arguments; 4542 ctx = ctx || this; 4543 4544 invokeAsap && !timer && fn.apply(ctx, args); 4545 4546 clearTimeout(timer); 4547 4548 timer = setTimeout(function() { 4549 !invokeAsap && fn.apply(ctx, args); 4550 timer = null; 4551 }, timeout); 4552 4553 }; 4554 4555 }, 4556 4557 throttle : function(fn, timeout, ctx) { 4558 4559 var timer, args, needInvoke; 4560 4561 return function() { 4562 4563 args = arguments; 4564 needInvoke = true; 4565 ctx = ctx || this; 4566 4567 if(!timer) { 4568 (function() { 4569 if(needInvoke) { 4570 fn.apply(ctx, args); 4571 needInvoke = false; 4572 timer = setTimeout(arguments.callee, timeout); 4573 } 4574 else { 4575 timer = null; 4576 } 4577 })(); 4578 } 4579 4580 }; 4581 4582 } 4583 4584}); 4585 4586})(jQuery);; 4587 4588/* vim: set expandtab sw=4 ts=4 sts=4: */ 4589/** 4590 * Handles the resizing of a menu according to the available screen width 4591 * 4592 * Uses themes/original/css/resizable-menu.css.php 4593 * 4594 * To initialise: 4595 * $('#myMenu').menuResizer(function () { 4596 * // This function will be called to find out how much 4597 * // available horizontal space there is for the menu 4598 * return $('body').width() - 5; // Some extra margin for good measure 4599 * }); 4600 * 4601 * To trigger a resize operation: 4602 * $('#myMenu').menuResizer('resize'); // Bind this to $(window).resize() 4603 * 4604 * To restore the menu to a state like before it was initialized: 4605 * $('#myMenu').menuResizer('destroy'); 4606 * 4607 * @package PhpMyAdmin 4608 */ 4609(function ($) { 4610 function MenuResizer($container, widthCalculator) { 4611 var self = this; 4612 self.$container = $container; 4613 self.widthCalculator = widthCalculator; 4614 // create submenu container 4615 var link = $('<a />', {href: '#', 'class': 'tab nowrap'}) 4616 .text(PMA_messages.strMore) 4617 .bind('click', false); // same as event.preventDefault() 4618 var img = $container.find('li img'); 4619 if (img.length) { 4620 $(PMA_getImage('b_more.png').toString()).prependTo(link); 4621 } 4622 var $submenu = $('<li />', {'class': 'submenu'}) 4623 .append(link) 4624 .append($('<ul />')) 4625 .mouseenter(function() { 4626 if ($(this).find('ul .tabactive').length === 0) { 4627 $(this) 4628 .addClass('submenuhover') 4629 .find('> a') 4630 .addClass('tabactive'); 4631 } 4632 }) 4633 .mouseleave(function() { 4634 if ($(this).find('ul .tabactive').length === 0) { 4635 $(this) 4636 .removeClass('submenuhover') 4637 .find('> a') 4638 .removeClass('tabactive'); 4639 } 4640 }); 4641 $container.children('.clearfloat').remove(); 4642 $container.append($submenu).append("<div class='clearfloat'></div>"); 4643 setTimeout(function () { 4644 self.resize(); 4645 }, 4); 4646 } 4647 MenuResizer.prototype.resize = function () { 4648 var wmax = this.widthCalculator.call(this.$container); 4649 var $submenu = this.$container.find('.submenu:last'); 4650 var submenu_w = $submenu.outerWidth(true); 4651 var $submenu_ul = $submenu.find('ul'); 4652 var $li = this.$container.find('> li'); 4653 var $li2 = $submenu_ul.find('li'); 4654 var more_shown = $li2.length > 0; 4655 // Calculate the total width used by all the shown tabs 4656 var total_len = more_shown ? submenu_w : 0; 4657 var l = $li.length - 1; 4658 var i; 4659 for (i = 0; i < l; i++) { 4660 total_len += $($li[i]).outerWidth(true); 4661 } 4662 // Now hide menu elements that don't fit into the menubar 4663 var hidden = false; // Whether we have hidden any tabs 4664 while (total_len >= wmax && --l >= 0) { // Process the tabs backwards 4665 hidden = true; 4666 var el = $($li[l]); 4667 var el_width = el.outerWidth(true); 4668 el.data('width', el_width); 4669 if (! more_shown) { 4670 total_len -= el_width; 4671 el.prependTo($submenu_ul); 4672 total_len += submenu_w; 4673 more_shown = true; 4674 } else { 4675 total_len -= el_width; 4676 el.prependTo($submenu_ul); 4677 } 4678 } 4679 // If we didn't hide any tabs, then there might be some space to show some 4680 if (! hidden) { 4681 // Show menu elements that do fit into the menubar 4682 for (i = 0, l = $li2.length; i < l; i++) { 4683 total_len += $($li2[i]).data('width'); 4684 // item fits or (it is the last item 4685 // and it would fit if More got removed) 4686 if (total_len < wmax || 4687 (i == $li2.length - 1 && total_len - submenu_w < wmax) 4688 ) { 4689 $($li2[i]).insertBefore($submenu); 4690 } else { 4691 break; 4692 } 4693 } 4694 } 4695 // Show/hide the "More" tab as needed 4696 if ($submenu_ul.find('li').length > 0) { 4697 $submenu.addClass('shown'); 4698 } else { 4699 $submenu.removeClass('shown'); 4700 } 4701 if (this.$container.find('> li').length == 1) { 4702 // If there is only the "More" tab left, then we need 4703 // to align the submenu to the left edge of the tab 4704 $submenu_ul.removeClass().addClass('only'); 4705 } else { 4706 // Otherwise we align the submenu to the right edge of the tab 4707 $submenu_ul.removeClass().addClass('notonly'); 4708 } 4709 if ($submenu.find('.tabactive').length) { 4710 $submenu 4711 .addClass('active') 4712 .find('> a') 4713 .removeClass('tab') 4714 .addClass('tabactive'); 4715 } else { 4716 $submenu 4717 .removeClass('active') 4718 .find('> a') 4719 .addClass('tab') 4720 .removeClass('tabactive'); 4721 } 4722 }; 4723 MenuResizer.prototype.destroy = function () { 4724 var $submenu = this.$container.find('li.submenu').removeData(); 4725 $submenu.find('li').appendTo(this.$container); 4726 $submenu.remove(); 4727 }; 4728 4729 /** Public API */ 4730 var methods = { 4731 init: function(widthCalculator) { 4732 return this.each(function () { 4733 var $this = $(this); 4734 if (! $this.data('menuResizer')) { 4735 $this.data( 4736 'menuResizer', 4737 new MenuResizer($this, widthCalculator) 4738 ); 4739 } 4740 }); 4741 }, 4742 resize: function () { 4743 return this.each(function () { 4744 var self = $(this).data('menuResizer'); 4745 if (self) { 4746 self.resize(); 4747 } 4748 }); 4749 }, 4750 destroy: function () { 4751 return this.each(function () { 4752 var self = $(this).data('menuResizer'); 4753 if (self) { 4754 self.destroy(); 4755 } 4756 }); 4757 } 4758 }; 4759 4760 /** Extend jQuery */ 4761 $.fn.menuResizer = function(method) { 4762 if (methods[method]) { 4763 return methods[method].call(this); 4764 } else if (typeof method === 'function') { 4765 return methods.init.apply(this, [method]); 4766 } else { 4767 $.error('Method ' + method + ' does not exist on jQuery.menuResizer'); 4768 } 4769 }; 4770})(jQuery); 4771; 4772 4773/* vim: set expandtab sw=4 ts=4 sts=4: */ 4774/** 4775 * Conditionally included if framing is not allowed 4776 */ 4777if (self == top) { 4778 var style_element = document.getElementById("cfs-style"); 4779 // check if style_element has already been removed 4780 // to avoid frequently reported js error 4781 if (typeof(style_element) != 'undefined' && style_element != null) { 4782 style_element.parentNode.removeChild(style_element); 4783 } 4784} else { 4785 top.location = self.location; 4786} 4787; 4788 4789/* vim: set expandtab sw=4 ts=4 sts=4: */ 4790/** 4791 * JavaScript functionality for Routines, Triggers and Events. 4792 * 4793 * @package PhpMyadmin 4794 */ 4795/** 4796 * @var RTE Contains all the JavaScript functionality 4797 * for Routines, Triggers and Events 4798 */ 4799var RTE = { 4800 /** 4801 * Construct for the object that provides the 4802 * functionality for Routines, Triggers and Events 4803 */ 4804 object: function (type) { 4805 $.extend(this, RTE.COMMON); 4806 switch (type) { 4807 case 'routine': 4808 $.extend(this, RTE.ROUTINE); 4809 break; 4810 case 'trigger': 4811 // nothing extra yet for triggers 4812 break; 4813 case 'event': 4814 $.extend(this, RTE.EVENT); 4815 break; 4816 default: 4817 break; 4818 } 4819 }, 4820 /** 4821 * @var string param_template Template for a row in the routine editor
4822 */ 4823 param_template: '' 4824}; 4825 4826/** 4827 * @var RTE.COMMON a JavaScript namespace containing the functionality 4828 * for Routines, Triggers and Events 4829 * 4830 * This namespace is extended by the functionality required 4831 * to handle a specific item (a routine, trigger or event) 4832 * in the relevant javascript files in this folder 4833 */ 4834RTE.COMMON = { 4835 /** 4836 * @var $ajaxDialog Query object containing the reference to the 4837 * dialog that contains the editor 4838 */ 4839 $ajaxDialog: null, 4840 /** 4841 * @var syntaxHiglighter Reference to the codemirror editor 4842 */ 4843 syntaxHiglighter: null, 4844 /** 4845 * @var buttonOptions Object containing options for 4846 * the jQueryUI dialog buttons 4847 */ 4848 buttonOptions: {}, 4849 /** 4850 * Validate editor form fields. 4851 */ 4852 validate: function () { 4853 /** 4854 * @var $elm a jQuery object containing the reference 4855 * to an element that is being validated 4856 */ 4857 var $elm = null; 4858 // Common validation. At the very least the name 4859 // and the definition must be provided for an item 4860 $elm = $('table.rte_table').last().find('input[name=item_name]'); 4861 if ($elm.val() === '') { 4862 $elm.focus(); 4863 alert(PMA_messages.strFormEmpty); 4864 return false; 4865 } 4866 $elm = $('table.rte_table').find('textarea[name=item_definition]'); 4867 if ($elm.val() === '') { 4868 if (this.syntaxHiglighter !== null) { 4869 this.syntaxHiglighter.focus(); 4870 } 4871 else { 4872 $('textarea[name=item_definition]').last().focus(); 4873 } 4874 alert(PMA_messages.strFormEmpty); 4875 return false; 4876 } 4877 // The validation has so far passed, so now 4878 // we can validate item-specific fields. 4879 return this.validateCustom(); 4880 }, // end validate() 4881 /** 4882 * Validate custom editor form fields. 4883 * This function can be overridden by 4884 * other files in this folder 4885 */ 4886 validateCustom: function () { 4887 return true; 4888 }, // end validateCustom() 4889 /** 4890 * Execute some code after the ajax 4891 * dialog for the editor is shown. 4892 * This function can be overridden by 4893 * other files in this folder 4894 */ 4895 postDialogShow: function () { 4896 // Nothing by default 4897 }, // end postDialogShow() 4898 4899 exportDialog: function ($this) { 4900 var $msg = PMA_ajaxShowMessage(); 4901 if ($this.hasClass('mult_submit')) { 4902 var combined = { 4903 success: true, 4904 title: PMA_messages.strExport, 4905 message: '', 4906 error: '' 4907 }; 4908 // export anchors of all selected rows 4909 var export_anchors = $('input.checkall:checked').parents('tr').find('.export_anchor'); 4910 var count = export_anchors.length; 4911 var returnCount = 0; 4912 4913 export_anchors.each(function () { 4914 $.get($(this).attr('href'), {'ajax_request': true}, function (data) { 4915 returnCount++; 4916 if (data.success === true) { 4917 combined.message += "\n" + data.message + "\n"; 4918 if (returnCount == count) { 4919 showExport(combined); 4920 } 4921 } else { 4922 // complain even if one export is failing 4923 combined.success = false; 4924 combined.error += "\n" + data.error + "\n"; 4925 if (returnCount == count) { 4926 showExport(combined); 4927 } 4928 } 4929 }); 4930 }); 4931 } else { 4932 $.get($this.attr('href'), {'ajax_request': true}, showExport); 4933 } 4934 4935 function showExport(data) { 4936 if (data.success === true) { 4937 PMA_ajaxRemoveMessage($msg); 4938 /** 4939 * @var button_options Object containing options 4940 * for jQueryUI dialog buttons 4941 */ 4942 var button_options = {}; 4943 button_options[PMA_messages.strClose] = function () { 4944 $(this).dialog("close").remove(); 4945 }; 4946 /**
4947 * Display the dialog to the user 4948 */ 4949 data.message = '<textarea cols="40" rows="15" style="width: 100%;">' + data.message + '</textarea>'; 4950 var $ajaxDialog = $('<div>' + data.message + '</div>').dialog({ 4951 width: 500, 4952 buttons: button_options, 4953 title: data.title 4954 }); 4955 // Attach syntax highlighted editor to export dialog 4956 /** 4957 * @var $elm jQuery object containing the reference 4958 * to the Export textarea. 4959 */ 4960 var $elm = $ajaxDialog.find('textarea'); 4961 PMA_getSQLEditor($elm); 4962 } else { 4963 PMA_ajaxShowMessage(data.error, false); 4964 } 4965 } // end showExport() 4966 }, // end exportDialog() 4967 editorDialog: function (is_new, $this) { 4968 var that = this; 4969 /** 4970 * @var $edit_row jQuery object containing the reference to 4971 * the row of the the item being edited 4972 * from the list of items 4973 */ 4974 var $edit_row = null; 4975 if ($this.hasClass('edit_anchor')) { 4976 // Remeber the row of the item being edited for later, 4977 // so that if the edit is successful, we can replace the 4978 // row with info about the modified item. 4979 $edit_row = $this.parents('tr'); 4980 } 4981 /** 4982 * @var $msg jQuery object containing the reference to 4983 * the AJAX message shown to the user 4984 */ 4985 var $msg = PMA_ajaxShowMessage(); 4986 $.get($this.attr('href'), {'ajax_request': true}, function (data) { 4987 if (data.success === true) { 4988 // We have successfully fetched the editor form 4989 PMA_ajaxRemoveMessage($msg); 4990 // Now define the function that is called when 4991 // the user presses the "Go" button 4992 that.buttonOptions[PMA_messages.strGo] = function () { 4993 // Move the data from the codemirror editor back to the 4994 // textarea, where it can be used in the form submission. 4995 if (typeof CodeMirror != 'undefined') { 4996 that.syntaxHiglighter.save(); 4997 } 4998 // Validate editor and submit request, if passed. 4999 if (that.validate()) { 5000 /** 5001 * @var data Form data to be sent in the AJAX request 5002 */ 5003 var data = $('form.rte_form').last().serialize(); 5004 $msg = PMA_ajaxShowMessage( 5005 PMA_messages.strProcessingRequest 5006 ); 5007 var url = $('form.rte_form').last().attr('action'); 5008 $.post(url, data, function (data) { 5009 if (data.success === true) { 5010 // Item created successfully 5011 PMA_ajaxRemoveMessage($msg); 5012 PMA_slidingMessage(data.message); 5013 that.$ajaxDialog.dialog('close'); 5014 // If we are in 'edit' mode, we must 5015 // remove the reference to the old row. 5016 if (mode === 'edit' && $edit_row !== null ) { 5017 $edit_row.remove(); 5018 } 5019 // Sometimes, like when moving a trigger from 5020 // a table to another one, the new row should 5021 // not be inserted into the list. In this case 5022 // "data.insert" will be set to false. 5023 if (data.insert) { 5024 // Insert the new row at the correct 5025 // location in the list of items 5026 /** 5027 * @var text Contains the name of an item from 5028 * the list that is used in comparisons 5029 * to find the correct location where 5030 * to insert a new row. 5031 */ 5032 var text = ''; 5033 /** 5034 * @var inserted Whether a new item has been 5035 * inserted in the list or not 5036 */ 5037 var inserted = false;
5038 $('table.data').find('tr').each(function () { 5039 text = $(this) 5040 .children('td') 5041 .eq(0) 5042 .find('strong') 5043 .text() 5044 .toUpperCase(); 5045 text = $.trim(text); 5046 if (text !== '' && text > data.name) { 5047 $(this).before(data.new_row); 5048 inserted = true; 5049 return false; 5050 } 5051 }); 5052 if (! inserted) { 5053 // If we didn't manage to insert the row yet, 5054 // it must belong at the end of the list, 5055 // so we insert it there. 5056 $('table.data').append(data.new_row); 5057 } 5058 // Fade-in the new row 5059 $('tr.ajaxInsert') 5060 .show('slow') 5061 .removeClass('ajaxInsert'); 5062 } else if ($('table.data').find('tr').has('td').length === 0) { 5063 // If we are not supposed to insert the new row, 5064 // we will now check if the table is empty and 5065 // needs to be hidden. This will be the case if 5066 // we were editing the only item in the list, 5067 // which we removed and will not be inserting 5068 // something else in its place. 5069 $('table.data').hide("slow", function () { 5070 $('#nothing2display').show("slow"); 5071 }); 5072 } 5073 // Now we have inserted the row at the correct 5074 // position, but surely at least some row classes 5075 // are wrong now. So we will itirate throught 5076 // all rows and assign correct classes to them 5077 /** 5078 * @var ct Count of processed rows 5079 */ 5080 var ct = 0; 5081 /** 5082 * @var rowclass Class to be attached to the row 5083 * that is being processed 5084 */ 5085 var rowclass = ''; 5086 $('table.data').find('tr').has('td').each(function () { 5087 rowclass = (ct % 2 === 0) ? 'odd' : 'even'; 5088 $(this).removeClass().addClass(rowclass); 5089 ct++; 5090 }); 5091 // If this is the first item being added, remove 5092 // the "No items" message and show the list. 5093 if ($('table.data').find('tr').has('td').length > 0 && 5094 $('#nothing2display').is(':visible') 5095 ) { 5096 $('#nothing2display').hide("slow", function () { 5097 $('table.data').show("slow"); 5098 }); 5099 } 5100 PMA_reloadNavigation(); 5101 } else { 5102 PMA_ajaxShowMessage(data.error, false); 5103 } 5104 }); // end $.post() 5105 } // end "if (that.validate())" 5106 }; // end of function that handles the submission of the Editor 5107 that.buttonOptions[PMA_messages.strClose] = function () { 5108 $(this).dialog("close"); 5109 }; 5110 /**
5111 * Display the dialog to the user 5112 */ 5113 that.$ajaxDialog = $('<div id="rteDialog">' + data.message + '</div>').dialog({ 5114 width: 700, 5115 minWidth: 500, 5116 maxHeight: $(window).height(), 5117 buttons: that.buttonOptions, 5118 title: data.title, 5119 modal: true, 5120 open: function () { 5121 if ($('#rteDialog').parents('.ui-dialog').height() > $(window).height()) { 5122 $('#rteDialog').dialog("option", "height", $(window).height()); 5123 } 5124 $(this).find('input[name=item_name]').focus(); 5125 $(this).find('input.datefield').each(function () { 5126 PMA_addDatepicker($(this).css('width', '95%'), 'date'); 5127 }); 5128 $(this).find('input.datetimefield').each(function () { 5129 PMA_addDatepicker($(this).css('width', '95%'), 'datetime'); 5130 }); 5131 $.datepicker.initialized = false; 5132 }, 5133 close: function () { 5134 $(this).remove(); 5135 } 5136 }); 5137 /** 5138 * @var mode Used to remeber whether the editor is in 5139 * "Edit" or "Add" mode 5140 */ 5141 var mode = 'add'; 5142 if ($('input[name=editor_process_edit]').length > 0) { 5143 mode = 'edit'; 5144 } 5145 // Attach syntax highlighted editor to the definition 5146 /** 5147 * @var elm jQuery object containing the reference to 5148 * the Definition textarea. 5149 */ 5150 var $elm = $('textarea[name=item_definition]').last(); 5151 that.syntaxHiglighter = PMA_getSQLEditor($elm); 5152 5153 // Execute item-specific code 5154 that.postDialogShow(data); 5155 } else { 5156 PMA_ajaxShowMessage(data.error, false); 5157 } 5158 }); // end $.get() 5159 }, 5160 5161 dropDialog: function ($this) { 5162 /** 5163 * @var $curr_row Object containing reference to the current row 5164 */ 5165 var $curr_row = $this.parents('tr'); 5166 /** 5167 * @var question String containing the question to be asked for c
5167onfirmation 5168 */ 5169 var question = $('<div/>').text( 5170 $curr_row.children('td').children('.drop_sql').html() 5171 ); 5172 // We ask for confirmation first here, before submitting the ajax request 5173 $this.PMA_confirm(question, $this.attr('href'), function (url) { 5174 /** 5175 * @var msg jQuery object containing the reference to 5176 * the AJAX message shown to the user 5177 */ 5178 var $msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); 5179 $.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function (data) { 5180 if (data.success === true) { 5181 /** 5182 * @var $table Object containing reference 5183 * to the main list of elements 5184 */ 5185 var $table = $curr_row.parent(); 5186 // Check how many rows will be left after we remove 5187 // the one that the user has requested us to remove 5188 if ($table.find('tr').length === 3) { 5189 // If there are two rows left, it means that they are 5190 // the header of the table and the rows that we are 5191 // about to remove, so after the removal there will be 5192 // nothing to show in the table, so we hide it. 5193 $table.hide("slow", function () { 5194 $(this).find('tr.even, tr.odd').remove(); 5195 $('.withSelected').remove(); 5196 $('#nothing2display').show("slow"); 5197 }); 5198 } else { 5199 $curr_row.hide("slow", function () { 5200 $(this).remove(); 5201 // Now we have removed the row from the list, but maybe 5202 // some row classes are wrong now. So we will itirate 5203 // throught all rows and assign correct classes to them. 5204 /** 5205 * @var ct Count of processed rows 5206 */ 5207 var ct = 0; 5208 /** 5209 * @var rowclass Class to be attached to the row 5210 * that is being processed 5211 */ 5212 var rowclass = ''; 5213 $table.find('tr').has('td').each(function () { 5214 rowclass = (ct % 2 === 1) ? 'odd' : 'even'; 5215 $(this).removeClass().addClass(rowclass); 5216 ct++; 5217 }); 5218 }); 5219 } 5220 // Get rid of the "Loading" message 5221 PMA_ajaxRemoveMessage($msg); 5222 // Show the query that we just executed 5223 PMA_slidingMessage(data.sql_query); 5224 PMA_reloadNavigation(); 5225 } else { 5226 PMA_ajaxShowMessage(data.error, false); 5227 } 5228 }); // end $.get() 5229 }); // end $.PMA_confirm() 5230 }, 5231 5232 dropMultipleDialog: function ($this) { 5233 // We ask for confirmation here 5234 $this.PMA_confirm(PMA_messages.strDropRTEitems, '', function (url) { 5235 /** 5236 * @var msg jQuery object containing the reference to 5237 * the AJAX message shown to the user 5238 */ 5239 var $msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); 5240 5241 // drop anchors of all selected rows 5242 var drop_anchors = $('input.checkall:checked').parents('tr').find('.drop_anchor'); 5243 var success = true; 5244 var count = drop_anchors.length; 5245 var returnCount = 0; 5246 5247 drop_anchors.each(function () { 5248 var $anchor = $(this); 5249 /** 5250 * @var $curr_row Object containing reference to the current row 5251 */ 5252 var $curr_row = $anchor.parents('tr');
5253 $.get($anchor.attr('href'), {'is_js_confirmed': 1, 'ajax_request': true}, function (data) { 5254 returnCount++; 5255 if (data.success === true) { 5256 /** 5257 * @var $table Object containing reference 5258 * to the main list of elements 5259 */ 5260 var $table = $curr_row.parent(); 5261 // Check how many rows will be left after we remove 5262 // the one that the user has requested us to remove 5263 if ($table.find('tr').length === 3) { 5264 // If there are two rows left, it means that they are 5265 // the header of the table and the rows that we are 5266 // about to remove, so after the removal there will be 5267 // nothing to show in the table, so we hide it. 5268 $table.hide("slow", function () { 5269 $(this).find('tr.even, tr.odd').remove(); 5270 $('.withSelected').remove(); 5271 $('#nothing2display').show("slow"); 5272 }); 5273 } else { 5274 $curr_row.hide("fast", function () { 5275 $(this).remove(); 5276 // Now we have removed the row from the list, but maybe 5277 // some row classes are wrong now. So we will itirate 5278 // throught all rows and assign correct classes to them. 5279 /** 5280 * @var ct Count of processed rows 5281 */ 5282 var ct = 0; 5283 /** 5284 * @var rowclass Class to be attached to the row 5285 * that is being processed 5286 */ 5287 var rowclass = ''; 5288 $table.find('tr').has('td').each(function () { 5289 rowclass = (ct % 2 === 1) ? 'odd' : 'even'; 5290 $(this).removeClass().addClass(rowclass); 5291 ct++; 5292 }); 5293 }); 5294 } 5295 if (returnCount == count) { 5296 if (success) { 5297 // Get rid of the "Loading" message 5298 PMA_ajaxRemoveMessage($msg); 5299 $('#rteListForm_checkall').prop({checked: false, indeterminate: false}); 5300 } 5301 PMA_reloadNavigation(); 5302 } 5303 } else { 5304 PMA_ajaxShowMessage(data.error, false); 5305 success = false; 5306 if (returnCount == count) { 5307 PMA_reloadNavigation(); 5308 } 5309 } 5310 }); // end $.get() 5311 }); // end drop_anchors.each() 5312 }); // end $.PMA_confirm() 5313 } 5314}; // end RTE namespace 5315 5316/** 5317 * @var RTE.EVENT JavaScript functionality for events 5318 */ 5319RTE.EVENT = { 5320 validateCustom: function () { 5321 /** 5322 * @var elm a jQuery object containing the reference 5323 * to an element that is being validated 5324 */ 5325 var $elm = null; 5326 if (this.$ajaxDialog.find('select[name=item_type]').find(':selected').val() === 'RECURRING') { 5327 // The interval field must not be empty for recurring events 5328 $elm = this.$ajaxDialog.find('input[name=item_interval_value]'); 5329 if ($elm.val() === '') { 5330 $elm.focus(); 5331 alert(PMA_messages.strFormEmpty); 5332 return false; 5333 } 5334 } else { 5335 // The execute_at field must not be empty for "once off" events 5336 $elm = this.$ajaxDialog.find('input[name=item_execute_at]'); 5337 if ($elm.val() === '') { 5338 $elm.focus(); 5339 alert(PMA_messages.strFormEmpty); 5340 return false;
5341 } 5342 } 5343 return true; 5344 } 5345}; 5346 5347/** 5348 * @var RTE.ROUTINE JavaScript functionality for routines 5349 */ 5350RTE.ROUTINE = { 5351 /** 5352 * Overriding the postDialogShow() function defined in common.js 5353 * 5354 * @param data JSON-encoded data from the ajax request 5355 */ 5356 postDialogShow: function (data) { 5357 // Cache the template for a parameter table row 5358 RTE.param_template = data.param_template; 5359 var that = this; 5360 // Make adjustments in the dialog to make it AJAX compatible 5361 $('td.routine_param_remove').show(); 5362 $('input[name=routine_removeparameter]').remove(); 5363 $('input[name=routine_addparameter]').css('width', '100%'); 5364 // Enable/disable the 'options' dropdowns for parameters as necessary 5365 $('table.routine_params_table').last().find('th[colspan=2]').attr('colspan', '1'); 5366 $('table.routine_params_table').last().find('tr').has('td').each(function () { 5367 that.setOptionsForParameter( 5368 $(this).find('select[name^=item_param_type]'), 5369 $(this).find('input[name^=item_param_length]'), 5370 $(this).find('select[name^=item_param_opts_text]'), 5371 $(this).find('select[name^=item_param_opts_num]') 5372 ); 5373 }); 5374 // Enable/disable the 'options' dropdowns for 5375 // function return value as necessary 5376 this.setOptionsForParameter( 5377 $('table.rte_table').last().find('select[name=item_returntype]'), 5378 $('table.rte_table').last().find('input[name=item_returnlength]'), 5379 $('table.rte_table').last().find('select[name=item_returnopts_text]'), 5380 $('table.rte_table').last().find('select[name=item_returnopts_num]') 5381 ); 5382 }, 5383 /** 5384 * Overriding the validateCustom() function defined in common.js 5385 */ 5386 validateCustom: function () { 5387 /** 5388 * @var isSuccess Stores the outcome of the validation 5389 */ 5390 var isSuccess = true; 5391 /** 5392 * @var inputname The value of the "name" attribute for 5393 * the field that is being processed 5394 */ 5395 var inputname = ''; 5396 this.$ajaxDialog.find('table.routine_params_table').last().find('tr').each(function () { 5397 // Every parameter of a routine must have 5398 // a non-empty direction, name and type 5399 if (isSuccess) { 5400 $(this).find(':input').each(function () { 5401 inputname = $(this).attr('name'); 5402 if (inputname.substr(0, 14) === 'item_param_dir' || 5403 inputname.substr(0, 15) === 'item_param_name' || 5404 inputname.substr(0, 15) === 'item_param_type') { 5405 if ($(this).val() === '') { 5406 $(this).focus(); 5407 isSuccess = false; 5408 return false; 5409 } 5410 } 5411 }); 5412 } else { 5413 return false; 5414 } 5415 }); 5416 if (! isSuccess) { 5417 alert(PMA_messages.strFormEmpty); 5418 return false; 5419 } 5420 this.$ajaxDialog.find('table.routine_params_table').last().find('tr').each(function () { 5421 // SET, ENUM, VARCHAR and VARBINARY fields must have length/values 5422 var $inputtyp = $(this).find('select[name^=item_param_type]'); 5423 var $inputlen = $(this).find('input[name^=item_param_length]'); 5424 if ($inputtyp.length && $inputlen.length) { 5425 if (($inputtyp.val() === 'ENUM' || $inputtyp.val() === 'SET' || $inputtyp.val().substr(0, 3) === 'VAR') && 5426 $inputlen.val() === '' 5427 ) { 5428 $inputlen.focus(); 5429 isSuccess = false; 5430 return false; 5431 } 5432 } 5433 }); 5434 if (! isSuccess) { 5435 alert(PMA_messages.strFormEmpty); 5436 return false; 5437 } 5438 if (this.$ajaxDialog.find('select[name=item_type]').find(':selected').val() === 'FUNCTION') { 5439 // The length/values of return variable for functions must 5440 // be set, if the type is SET, ENUM, VARCHAR or VARBINARY. 5441 var $returntyp = this.$ajaxDialog.find('select[name=item_returntype]'); 5442 var $returnlen = this.$ajaxDialog.find('input[name=item_returnlength]'); 5443 if (($returntyp.val() === 'ENUM' || $returntyp.val() === 'SET' || $returntyp.val().substr(0, 3) === 'VAR') && 5444 $returnlen.val() === '' 5445 ) { 5446 $returnlen.focus(); 5447 alert(PMA_messages.strFormEmpty); 5448 return false;
5449 } 5450 } 5451 if ($('select[name=item_type]').find(':selected').val() === 'FUNCTION') { 5452 // A function must contain a RETURN statement in its definition 5453 if (this.$ajaxDialog.find('table.rte_table').find('textarea[name=item_definition]').val().toUpperCase().indexOf('RETURN') < 0) { 5454 this.syntaxHiglighter.focus(); 5455 alert(PMA_messages.MissingReturn); 5456 return false; 5457 } 5458 } 5459 return true; 5460 }, 5461 /** 5462 * Enable/disable the "options" dropdown and "length" input for 5463 * parameters and the return variable in the routine editor 5464 * as necessary. 5465 * 5466 * @param type a jQuery object containing the reference 5467 * to the "Type" dropdown box 5468 * @param len a jQuery object containing the reference 5469 * to the "Length" input box 5470 * @param text a jQuery object containing the reference 5471 * to the dropdown box with options for 5472 * parameters of text type 5473 * @param num a jQuery object containing the reference 5474 * to the dropdown box with options for 5475 * parameters of numeric type 5476 */ 5477 setOptionsForParameter: function ($type, $len, $text, $num) { 5478 /** 5479 * @var no_opts a jQuery object containing the reference 5480 * to an element to be displayed when no 5481 * options are available 5482 */ 5483 var $no_opts = $text.parent().parent().find('.no_opts'); 5484 /** 5485 * @var no_len a jQuery object containing the reference 5486 * to an element to be displayed when no 5487 * "length/values" field is available 5488 */ 5489 var $no_len = $len.parent().parent().find('.no_len'); 5490 5491 // Process for parameter options 5492 switch ($type.val()) { 5493 case 'TINYINT': 5494 case 'SMALLINT': 5495 case 'MEDIUMINT': 5496 case 'INT': 5497 case 'BIGINT': 5498 case 'DECIMAL': 5499 case 'FLOAT': 5500 case 'DOUBLE': 5501 case 'REAL': 5502 $text.parent().hide(); 5503 $num.parent().show(); 5504 $no_opts.hide(); 5505 break; 5506 case 'TINYTEXT': 5507 case 'TEXT': 5508 case 'MEDIUMTEXT': 5509 case 'LONGTEXT': 5510 case 'CHAR': 5511 case 'VARCHAR': 5512 case 'SET': 5513 case 'ENUM': 5514 $text.parent().show(); 5515 $num.parent().hide(); 5516 $no_opts.hide(); 5517 break; 5518 default: 5519 $text.parent().hide(); 5520 $num.parent().hide(); 5521 $no_opts.show(); 5522 break; 5523 } 5524 // Process for parameter length 5525 switch ($type.val()) { 5526 case 'DATE': 5527 case 'DATETIME': 5528 case 'TIME': 5529 case 'TINYBLOB': 5530 case 'TINYTEXT': 5531 case 'BLOB': 5532 case 'TEXT': 5533 case 'MEDIUMBLOB': 5534 case 'MEDIUMTEXT': 5535 case 'LONGBLOB': 5536 case 'LONGTEXT': 5537 $text.closest('tr').find('a:first').hide(); 5538 $len.parent().hide(); 5539 $no_len.show(); 5540 break; 5541 default: 5542 if ($type.val() == 'ENUM' || $type.val() == 'SET') { 5543 $text.closest('tr').find('a:first').show(); 5544 } else { 5545 $text.closest('tr').find('a:first').hide(); 5546 } 5547 $len.parent().show(); 5548 $no_len.hide(); 5549 break; 5550 } 5551 }, 5552 executeDialog: function ($this) { 5553 var that = this; 5554 /** 5555 * @var msg jQuery object containing the reference to 5556 * the AJAX message shown to the user 5557 */ 5558 var $msg = PMA_ajaxShowMessage(); 5559 $.get($this.attr('href'), {'ajax_request': true}, function (data) { 5560 if (data.success === true) { 5561 PMA_ajaxRemoveMessage($msg); 5562 // If 'data.dialog' is true we show a dialog with a form 5563 // to get the input parameters for routine, otherwise 5564 // we just show the results of the query 5565 if (data.dialog) { 5566 // Define the function that is called when 5567 // the user presses the "Go" button 5568 that.buttonOptions[PMA_messages.strGo] = function () { 5569 /** 5570 * @var data Form data to be sent in the AJAX request 5571 */ 5572 var data = $('form.rte_form').last().serialize();
5573 $msg = PMA_ajaxShowMessage( 5574 PMA_messages.strProcessingRequest 5575 ); 5576 $.post('db_routines.php', data, function (data) { 5577 if (data.success === true) { 5578 // Routine executed successfully 5579 PMA_ajaxRemoveMessage($msg); 5580 PMA_slidingMessage(data.message); 5581 $ajaxDialog.dialog('close'); 5582 } else { 5583 PMA_ajaxShowMessage(data.error, false); 5584 } 5585 }); 5586 }; 5587 that.buttonOptions[PMA_messages.strClose] = function () { 5588 $(this).dialog("close"); 5589 }; 5590 /** 5591 * Display the dialog to the user 5592 */ 5593 var $ajaxDialog = $('<div>' + data.message + '</div>').dialog({ 5594 width: 650, 5595 buttons: that.buttonOptions, 5596 title: data.title, 5597 modal: true, 5598 close: function () { 5599 $(this).remove(); 5600 } 5601 }); 5602 $ajaxDialog.find('input[name^=params]').first().focus(); 5603 /** 5604 * Attach the datepickers to the relevant form fields 5605 */ 5606 $ajaxDialog.find('input.datefield, input.datetimefield').each(function () { 5607 PMA_addDatepicker($(this).css('width', '95%')); 5608 }); 5609 /* 5610 * Define the function if the user presses enter 5611 */ 5612 $('form.rte_form').on('keyup', function (event) { 5613 event.preventDefault(); 5614 if (event.keyCode === 13) { 5615 /** 5616 * @var data Form data to be sent in the AJAX request 5617 */ 5618 var data = $(this).serialize(); 5619 $msg = PMA_ajaxShowMessage( 5620 PMA_messages.strProcessingRequest 5621 ); 5622 var url = $(this).attr('action'); 5623 $.post(url, data, function (data) { 5624 if (data.success === true) { 5625 // Routine executed successfully 5626 PMA_ajaxRemoveMessage($msg); 5627 PMA_slidingMessage(data.message); 5628 $('form.rte_form').off('keyup'); 5629 $ajaxDialog.remove(); 5630 } else { 5631 PMA_ajaxShowMessage(data.error, false); 5632 } 5633 }); 5634 } 5635 }); 5636 } else { 5637 // Routine executed successfully 5638 PMA_slidingMessage(data.message); 5639 } 5640 } else { 5641 PMA_ajaxShowMessage(data.error, false); 5642 } 5643 }); // end $.get() 5644 } 5645}; 5646 5647/** 5648 * Attach Ajax event handlers for the Routines, Triggers and Events editor 5649 */ 5650$(function () { 5651 /** 5652 * Attach Ajax event handlers for the Add/Edit functionality. 5653 */ 5654 $(document).on('click', 'a.ajax.add_anchor, a.ajax.edit_anchor', function (event) { 5655 event.preventDefault(); 5656 var type = $(this).attr('href').substr(0, $(this).attr('href').indexOf('?')); 5657 if (type.indexOf('routine') != -1) { 5658 type = 'routine'; 5659 } else if (type.indexOf('trigger') != -1) { 5660 type = 'trigger'; 5661 } else if (type.indexOf('event') != -1) { 5662 type = 'event'; 5663 } else { 5664 type = ''; 5665 } 5666 var dialog = new RTE.object(type); 5667 dialog.editorDialog($(this).hasClass('add_anchor'), $(this)); 5668 }); // end $(document).on() 5669 5670 /** 5671 * Attach Ajax event handlers for the Execute routine functionality 5672 */ 5673 $(document).on('click', 'a.ajax.exec_anchor', function (event) { 5674 event.preventDefault(); 5675 var dialog = new RTE.object('routine'); 5676 dialog.executeDialog($(this)); 5677 }); // end $(document).on() 5678 5679 /** 5680 * Attach Ajax event handlers for Export of Routines, Triggers and Events 5681 */ 5682 $(document).on('click', 'a.ajax.export_anchor', function (event) { 5683 event.preventDefault(); 5684 var dialog = new RTE.object(); 5685 dialog.exportDialog($(this)); 5686 }); // end $(document).on() 5687 5688 $(document).on('click', '#rteListForm.ajax .mult_submit[value="export"]', function (event) { 5689 event.preventDefault(); 5690 var dialog = new RTE.object(); 5691 dialog.exportDialog($(this)); 5692 }); // end $(document).on() 5693 5694 /** 5695 * Attach Ajax event handlers for Drop functionality 5696 * of Routines, Triggers and Events. 5697 */ 5698 $(document).on('click', 'a.ajax.drop_anchor', function (event) { 5699 event.preventDefault(); 5700 var dialog = new RTE.object(); 5701 dialog.dropDialog($(this)); 5702 }); // end $(document).on() 5703 5704 $(document).on('click', '#rteListForm.ajax .mult_submit[value="drop"]', function (event) { 5705 event.preventDefault(); 5706 var dialog = new RTE.object(); 5707 dialog.dropMultipleDialog($(this)); 5708 }); // end $(document).on() 5709 5710 /** 5711 * Attach Ajax event handlers for the "Change event/routine type" 5712 * functionality in the events editor, so that the correct 5713 * rows are shown in the editor when changing the event type 5714 */ 5715 $(document).on('change', 'select[name=item_type]', function () { 5716 $(this) 5717 .closest('table') 5718 .find('tr.recurring_event_row, tr.onetime_event_row, tr.routine_return_row, .routine_direction_cell')
5719 .toggle(); 5720 }); // end $(document).on() 5721 5722 /** 5723 * Attach Ajax event handlers for the "Change parameter type" 5724 * functionality in the routines editor, so that the correct 5725 * option/length fields, if any, are shown when changing 5726 * a parameter type 5727 */ 5728 $(document).on('change', 'select[name^=item_param_type]', function () { 5729 /** 5730 * @var row jQuery object containing the reference to 5731 * a row in the routine parameters table 5732 */ 5733 var $row = $(this).parents('tr').first(); 5734 var rte = new RTE.object('routine'); 5735 rte.setOptionsForParameter( 5736 $row.find('select[name^=item_param_type]'), 5737 $row.find('input[name^=item_param_length]'), 5738 $row.find('select[name^=item_param_opts_text]'), 5739 $row.find('select[name^=item_param_opts_num]') 5740 ); 5741 }); // end $(document).on() 5742 5743 /** 5744 * Attach Ajax event handlers for the "Change the type of return 5745 * variable of function" functionality, so that the correct fields, 5746 * if any, are shown when changing the function return type type 5747 */ 5748 $(document).on('change', 'select[name=item_returntype]', function () { 5749 var rte = new RTE.object('routine'); 5750 var $table = $(this).closest('table.rte_table'); 5751 rte.setOptionsForParameter( 5752 $table.find('select[name=item_returntype]'), 5753 $table.find('input[name=item_returnlength]'), 5754 $table.find('select[name=item_returnopts_text]'), 5755 $table.find('select[name=item_returnopts_num]') 5756 ); 5757 }); // end $(document).on() 5758 5759 /** 5760 * Attach Ajax event handlers for the "Add parameter to routine" functionality 5761 */ 5762 $(document).on('click', 'input[name=routine_addparameter]', function (event) { 5763 event.preventDefault(); 5764 /** 5765 * @var routine_params_table jQuery object containing the reference 5766 * to the routine parameters table 5767 */ 5768 var $routine_params_table = $(this).closest('div.ui-dialog').find('.routine_params_table'); 5769 /** 5770 * @var new_param_row A string containing the HTML code for the 5771 * new row for the routine parameters table 5772 */ 5773 var new_param_row = RTE.param_template.replace(/%s/g, $routine_params_table.find('tr').length - 1); 5774 // Append the new row to the parameters table 5775 $routine_params_table.append(new_param_row); 5776 // Make sure that the row is correctly shown according to the type of routine 5777 if ($(this).closest('div.ui-dialog').find('table.rte_table select[name=item_type]').val() === 'FUNCTION') { 5778 $('tr.routine_return_row').show(); 5779 $('td.routine_direction_cell').hide(); 5780 } 5781 /** 5782 * @var newrow jQuery object containing the reference to the newly 5783 * inserted row in the routine parameters table 5784 */ 5785 var $newrow = $(this).closest('div.ui-dialog').find('table.routine_params_table').find('tr').has('td').last(); 5786 // Enable/disable the 'options' dropdowns for parameters as necessary 5787 var rte = new RTE.object('routine'); 5788 rte.setOptionsForParameter( 5789 $newrow.find('select[name^=item_param_type]'), 5790 $newrow.find('input[name^=item_param_length]'), 5791 $newrow.find('select[name^=item_param_opts_text]'), 5792 $newrow.find('select[name^=item_param_opts_num]') 5793 ); 5794 }); // end $(document).on() 5795 5796 /** 5797 * Attach Ajax event handlers for the 5798 * "Remove parameter from routine" functionality 5799 */ 5800 $(document).on('click', 'a.routine_param_remove_anchor', function (event) { 5801 event.preventDefault(); 5802 $(this).parent().parent().remove(); 5803 // After removing a parameter, the indices of the name attributes in 5804 // the input fields lose the correct order and need to be reordered. 5805 /** 5806 * @var index Counter used for reindexing the input 5807 * fields in the routine parameters table 5808 */ 5809 var index = 0;
5810 $(this).closest('div.ui-dialog').find('table.routine_params_table').find('tr').has('td').each(function () { 5811 $(this).find(':input').each(function () { 5812 /** 5813 * @var inputname The value of the name attribute of 5814 * the input field being reindexed 5815 */ 5816 var inputname = $(this).attr('name'); 5817 if (inputname.substr(0, 14) === 'item_param_dir') { 5818 $(this).attr('name', inputname.substr(0, 14) + '[' + index + ']'); 5819 } else if (inputname.substr(0, 15) === 'item_param_name') { 5820 $(this).attr('name', inputname.substr(0, 15) + '[' + index + ']'); 5821 } else if (inputname.substr(0, 15) === 'item_param_type') { 5822 $(this).attr('name', inputname.substr(0, 15) + '[' + index + ']'); 5823 } else if (inputname.substr(0, 17) === 'item_param_length') { 5824 $(this).attr('name', inputname.substr(0, 17) + '[' + index + ']'); 5825 $(this).attr('id', 'item_param_length_' + index); 5826 } else if (inputname.substr(0, 20) === 'item_param_opts_text') { 5827 $(this).attr('name', inputname.substr(0, 20) + '[' + index + ']'); 5828 } else if (inputname.substr(0, 19) === 'item_param_opts_num') { 5829 $(this).attr('name', inputname.substr(0, 19) + '[' + index + ']'); 5830 } 5831 }); 5832 index++; 5833 }); 5834 }); // end $(document).on() 5835}); // end of $() 5836; 5837 5838/* 5839 TraceKit - Cross brower stack traces - github.com/occ/TraceKit 5840 MIT license 5841*/ 5842 5843;(function(window, undefined) { 5844 5845 5846var TraceKit = {}; 5847var _oldTraceKit = window.TraceKit; 5848 5849// global reference to slice 5850var _slice = [].slice; 5851var UNKNOWN_FUNCTION = '?'; 5852 5853 5854/** 5855 * _has, a better form of hasOwnProperty 5856 * Example: _has(MainHostObject, property) === true/false 5857 * 5858 * @param {Object} host object to check property 5859 * @param {string} key to check 5860 */ 5861function _has(object, key) { 5862 return Object.prototype.hasOwnProperty.call(object, key); 5863} 5864 5865function _isUndefined(what) { 5866 return typeof what === 'undefined'; 5867} 5868 5869/** 5870 * TraceKit.noConflict: Export TraceKit out to another variable 5871 * Example: var TK = TraceKit.noConflict() 5872 */ 5873TraceKit.noConflict = function noConflict() { 5874 window.TraceKit = _oldTraceKit; 5875 return TraceKit; 5876}; 5877 5878/** 5879 * TraceKit.wrap: Wrap any function in a TraceKit reporter 5880 * Example: func = TraceKit.wrap(func); 5881 * 5882 * @param {Function} func Function to be wrapped 5883 * @return {Function} The wrapped func 5884 */ 5885TraceKit.wrap = function traceKitWrapper(func) { 5886 function wrapped() { 5887 try { 5888 return func.apply(this, arguments); 5889 } catch (e) { 5890 TraceKit.report(e); 5891 throw e; 5892 } 5893 } 5894 return wrapped; 5895}; 5896 5897/** 5898 * TraceKit.report: cross-browser processing of unhandled exceptions 5899 * 5900 * Syntax: 5901 * TraceKit.report.subscribe(function(stackInfo) { ... }) 5902 * TraceKit.report.unsubscribe(function(stackInfo) { ... }) 5903 * TraceKit.report(exception) 5904 * try { ...code... } catch(ex) { TraceKit.report(ex); } 5905 * 5906 * Supports: 5907 * - Firefox: full stack trace with line numbers, plus column number 5908 * on top frame; column number is not guaranteed 5909 * - Opera: full stack trace with line and column numbers 5910 * - Chrome: full stack trace with line and column numbers 5911 * - Safari: line and column number for the top frame only; some frames 5912 * may be missing, and column number is not guaranteed 5913 * - IE: line and column number for the top frame only; some frames 5914 * may be missing, and column number is not guaranteed 5915 * 5916 * In theory, TraceKit should work on all of the following versions: 5917 * - IE5.5+ (only 8.0 tested) 5918 * - Firefox 0.9+ (only 3.5+ tested) 5919 * - Opera 7+ (only 10.50 tested; versions 9 and earlier may require 5920 * Exceptions Have Stacktrace to be enabled in opera:config) 5921 * - Safari 3+ (only 4+ tested) 5922 * - Chrome 1+ (only 5+ tested) 5923 * - Konqueror 3.5+ (untested) 5924 * 5925 * Requires TraceKit.computeStackTrace. 5926 * 5927 * Tries to catch all unhandled exceptions and report them to the 5928 * subscribed handlers. Please note that TraceKit.report will rethrow the 5929 * exception. This is REQUIRED in order to get a useful stack trace in IE. 5930 * If the exception does not reach the top of the browser, you will only 5931 * get a stack trace from the point where TraceKit.report was called. 5932 *
vendor: 4,983 bytes, lines 5933-6090
5933 * Handlers receive a stackInfo object as described in the 5934 * TraceKit.computeStackTrace docs. 5935 */ 5936TraceKit.report = (function reportModuleWrapper() { 5937 var handlers = [], 5938 lastException = null, 5939 lastExceptionStack = null; 5940 5941 /** 5942 * Add a crash handler. 5943 * @param {Function} handler 5944 */ 5945 function subscribe(handler) { 5946 installGlobalHandler(); 5947 handlers.push(handler); 5948 } 5949 5950 /** 5951 * Remove a crash handler. 5952 * @param {Function} handler 5953 */ 5954 function unsubscribe(handler) { 5955 for (var i = handlers.length - 1; i >= 0; --i) { 5956 if (handlers[i] === handler) { 5957 handlers.splice(i, 1); 5958 } 5959 } 5960 } 5961 5962 /** 5963 * Dispatch stack information to all handlers. 5964 * @param {Object.<string, *>} stack 5965 */ 5966 function notifyHandlers(stack, windowError) { 5967 var exception = null; 5968 if (windowError && !TraceKit.collectWindowErrors) { 5969 return; 5970 } 5971 for (var i in handlers) { 5972 if (_has(handlers, i)) { 5973 try { 5974 handlers[i].apply(null, [stack].concat(_slice.call(arguments, 2))); 5975 } catch (inner) { 5976 exception = inner; 5977 } 5978 } 5979 } 5980 5981 if (exception) { 5982 throw exception; 5983 } 5984 } 5985 5986 var _oldOnerrorHandler, _onErrorHandlerInstalled; 5987 5988 /** 5989 * Ensures all global unhandled exceptions are recorded. 5990 * Supported by Gecko and IE. 5991 * @param {string} message Error message. 5992 * @param {string} url URL of script that generated the exception. 5993 * @param {(number|string)} lineNo The line number at which the error 5994 * occurred. 5995 */ 5996 function traceKitWindowOnError(message, url, lineNo) { 5997 var stack = null; 5998 5999 if (lastExceptionStack) { 6000 TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(lastExceptionStack, url, lineNo, message); 6001 stack = lastExceptionStack; 6002 lastExceptionStack = null; 6003 lastException = null; 6004 } else { 6005 var location = { 6006 'url': url, 6007 'line': lineNo 6008 }; 6009 location.func = TraceKit.computeStackTrace.guessFunctionName(location.url, location.line); 6010 location.context = TraceKit.computeStackTrace.gatherContext(location.url, location.line); 6011 stack = { 6012 'mode': 'onerror', 6013 'message': message, 6014 'url': document.location.href, 6015 'stack': [location], 6016 'useragent': navigator.userAgent 6017 }; 6018 } 6019 6020 notifyHandlers(stack, 'from window.onerror'); 6021 6022 if (_oldOnerrorHandler) { 6023 return _oldOnerrorHandler.apply(this, arguments); 6024 } 6025 6026 return false; 6027 } 6028 6029 function installGlobalHandler () 6030 { 6031 if (_onErrorHandlerInstalled === true) { 6032 return; 6033 } 6034 _oldOnerrorHandler = window.onerror; 6035 window.onerror = traceKitWindowOnError; 6036 _onErrorHandlerInstalled = true; 6037 } 6038 6039 /** 6040 * Reports an unhandled Error to TraceKit. 6041 * @param {Error} ex 6042 */ 6043 function report(ex) { 6044 var args = _slice.call(arguments, 1); 6045 if (lastExceptionStack) { 6046 if (lastException === ex) { 6047 return; // already caught by an inner catch block, ignore 6048 } else { 6049 var s = lastExceptionStack; 6050 lastExceptionStack = null; 6051 lastException = null; 6052 notifyHandlers.apply(null, [s, null].concat(args)); 6053 } 6054 } 6055 6056 var stack = TraceKit.computeStackTrace(ex); 6057 lastExceptionStack = stack; 6058 lastException = ex; 6059 6060 // If the stack trace is incomplete, wait for 2 seconds for 6061 // slow slow IE to see if onerror occurs or not before reporting 6062 // this exception; otherwise, we will end up with an incomplete 6063 // stack trace 6064 window.setTimeout(function () { 6065 if (lastException === ex) { 6066 lastExceptionStack = null; 6067 lastException = null; 6068 notifyHandlers.apply(null, [stack, null].concat(args)); 6069 } 6070 }, (stack.incomplete ? 2000 : 0)); 6071 6072 throw ex; // re-throw to propagate to the top level (and cause window.onerror) 6073 } 6074 6075 report.subscribe = subscribe; 6076 report.unsubscribe = unsubscribe; 6077 return report; 6078}()); 6079 6080/** 6081 * TraceKit.computeStackTrace: cross-browser stack traces in JavaScript 6082 * 6083 * Syntax: 6084 * s = TraceKit.computeStackTrace.ofCaller([depth]) 6085 * s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below) 6086 * Returns: 6087 * s.name - exception name 6088 * s.message - exception message 6089 * s.stack[i].url - JavaScript or HTML file URL 6090 * s.stack[i].func - function name, or empty for anonymous functions (if guessing did n
6090ot work) 6091 * s.stack[i].args - arguments passed to the function, if known 6092 * s.stack[i].line - line number, if known 6093 * s.stack[i].column - column number, if known 6094 * s.stack[i].context - an array of source code lines; the middle element corresponds to the correct line# 6095 * s.mode - 'stack', 'stacktrace', 'multiline', 'callers', 'onerror', or 'failed' -- method used to collect the stack trace 6096 * 6097 * Supports: 6098 * - Firefox: full stack trace with line numbers and unreliable column 6099 * number on top frame 6100 * - Opera 10: full stack trace with line and column numbers 6101 * - Opera 9-: full stack trace with line numbers 6102 * - Chrome: full stack trace with line and column numbers 6103 * - Safari: line and column number for the topmost stacktrace element 6104 * only 6105 * - IE: no line numbers whatsoever 6106 * 6107 * Tries to guess names of anonymous functions by looking for assignments 6108 * in the source code. In IE and Safari, we have to guess source file names 6109 * by searching for function bodies inside all page scripts. This will not 6110 * work for scripts that are loaded cross-domain. 6111 * Here be dragons: some function names may be guessed incorrectly, and 6112 * duplicate functions may be mismatched. 6113 * 6114 * TraceKit.computeStackTrace should only be used for tracing purposes. 6115 * Logging of unhandled exceptions should be done with TraceKit.report, 6116 * which builds on top of TraceKit.computeStackTrace and provides better 6117 * IE support by utilizing the window.onerror event to retrieve information 6118 * about the top of the stack. 6119 * 6120 * Note: In IE and Safari, no stack trace is recorded on the Error object, 6121 * so computeStackTrace instead walks its *own* chain of callers. 6122 * This means that: 6123 * * in Safari, some methods may be missing from the stack trace; 6124 * * in IE, the topmost function in the stack trace will always be the 6125 * caller of computeStackTrace. 6126 * 6127 * This is okay for tracing (because you are likely to be calling 6128 * computeStackTrace from the function you want to be the topmost element 6129 * of the stack trace anyway), but not okay for logging unhandled 6130 * exceptions (because your catch block will likely be far away from the 6131 * inner function that actually caused the exception). 6132 * 6133 * Tracing example: 6134 * function trace(message) { 6135 * var stackInfo = TraceKit.computeStackTrace.ofCaller(); 6136 * var data = message + "\n"; 6137 * for(var i in stackInfo.stack) { 6138 * var item = stackInfo.stack[i]; 6139 * data += (item.func || '[anonymous]') + "() in " + item.url + ":" + (item.line || '0') + "\n"; 6140 * } 6141 * if (window.console) 6142 * console.info(data); 6143 * else 6144 * alert(data); 6145 * } 6146 */ 6147TraceKit.computeStackTrace = (function computeStackTraceWrapper() { 6148 var debug = false, 6149 sourceCache = {}; 6150 6151 /** 6152 * Attempts to retrieve source code via XMLHttpRequest, which is used 6153 * to look up anonymous function names. 6154 * @param {string} url URL of source code. 6155 * @return {string} Source contents. 6156 */ 6157 function loadSource(url) { 6158 if (!TraceKit.remoteFetching) { //Only attempt request if remoteFetching is on. 6159 return ''; 6160 } 6161 try { 6162 function getXHR() { 6163 try { 6164 return new window.XMLHttpRequest(); 6165 } catch (e) { 6166 // explicitly bubble up the exception if not found 6167 return new window.ActiveXObject('Microsoft.XMLHTTP'); 6168 } 6169 } 6170 6171 var request = getXHR(); 6172 request.open('GET', url, false); 6173 request.send(''); 6174 return request.responseText; 6175 } catch (e) { 6176 return ''; 6177 } 6178 } 6179 6180 /** 6181 * Retrieves source code from the source code cache. 6182 * @param {string} url URL of source code. 6183 * @return {Array.<string>} Source contents. 6184 */ 6185 function getSource(url) { 6186 if (!_has(sourceCache, url)) { 6187 // URL needs to be able to fetched within the acceptable domain. Otherwise, 6188 // cross-domain errors will be triggered. 6189 var source = ''; 6190 if (url.indexOf(document.domain) !== -1) { 6191 source = loadSource(url); 6192 } 6193 sourceCache[url] = source ? source.split('\n') : []; 6194 } 6195 6196 return sourceCache[url]; 6197 } 6198 6199 /** 6200 * Tries to use an externally loaded copy of source code to determine 6201 * the name of a function by looking at the name of the variable it was 6202 * assigned to, if any. 6203 * @param {string} url URL of source code. 6204 * @param {(string|number)} lineNo Line number in source code. 6205 * @return {string} The function name, if discoverable. 6206 */ 6207 function guessFunctionName(url, lineNo) { 6208 var reFunctionArgNames = /function ([^(]*)\(([^)]*)\)/, 6209 reGuessFunction = /['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/, 6210 line = '', 6211 maxLines = 10, 6212 source = getSource(url), 6213 m; 6214 6215 if (!source.length) { 6216 return UNKNOWN_FUNCTION; 6217 } 6218 6219 // Walk backwards from the first line in the function until we find the line which 6220 // matches the pattern above, which is the function definition 6221 for (var i = 0; i < maxLines; ++i) { 6222 line = source[lineNo - i] + line; 6223 6224 if (!_isUndefined(line)) { 6225 if ((m = reGuessFunction.exec(line))) { 6226 return m[1]; 6227 } else if ((m = reFunctionArgNames.exec(line))) { 6228 return m[1]; 6229 } 6230 } 6231 } 6232 6233 return UNKNOWN_FUNCTION; 6234 } 6235 6236 /** 6237 * Retrieves the surrounding lines from where an exception occurred. 6238 * @param {string} url URL of source code. 6239 * @param {(string|number)} line Line number in source code to centre 6240 * around for context. 6241 * @return {?Array.<string>} Lines of source code. 6242 */ 6243 function gatherContext(url, line) { 6244 var source = getSource(url); 6245 6246 if (!source.length) { 6247 return null; 6248 } 6249 6250 var context = [], 6251 // linesBefore & linesAfter are inclusive with the offending line. 6252 // if linesOfContext is even, there will be one extra line 6253 // *before* the offending line. 6254 linesBefore = Math.floor(TraceKit.linesOfContext / 2), 6255 // Add one extra line if linesOfContext is odd 6256 linesAfter = linesBefore + (TraceKit.linesOfContext
vendor: 26,363 bytes, lines 6256-7018
6256% 2), 6257 start = Math.max(0, line - linesBefore - 1), 6258 end = Math.min(source.length, line + linesAfter - 1); 6259 6260 line -= 1; // convert to 0-based index 6261 6262 for (var i = start; i < end; ++i) { 6263 if (!_isUndefined(source[i])) { 6264 context.push(source[i]); 6265 } 6266 } 6267 6268 return context.length > 0 ? context : null; 6269 } 6270 6271 /** 6272 * Escapes special characters, except for whitespace, in a string to be 6273 * used inside a regular expression as a string literal. 6274 * @param {string} text The string. 6275 * @return {string} The escaped string literal. 6276 */ 6277 function escapeRegExp(text) { 6278 return text.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g, '\\$&'); 6279 } 6280 6281 /** 6282 * Escapes special characters in a string to be used inside a regular 6283 * expression as a string literal. Also ensures that HTML entities will 6284 * be matched the same as their literal friends. 6285 * @param {string} body The string. 6286 * @return {string} The escaped string. 6287 */ 6288 function escapeCodeAsRegExpForMatchingInsideHTML(body) { 6289 return escapeRegExp(body).replace('<', '(?:<|<)').replace('>', '(?:>|>)').replace('&', '(?:&|&)').replace('"', '(?:"|")').replace(/\s+/g, '\\s+'); 6290 } 6291 6292 /** 6293 * Determines where a code fragment occurs in the source code. 6294 * @param {RegExp} re The function definition. 6295 * @param {Array.<string>} urls A list of URLs to search. 6296 * @return {?Object.<string, (string|number)>} An object containing 6297 * the url, line, and column number of the defined function. 6298 */ 6299 function findSourceInUrls(re, urls) { 6300 var source, m; 6301 for (var i = 0, j = urls.length; i < j; ++i) { 6302 // console.log('searching', urls[i]); 6303 if ((source = getSource(urls[i])).length) { 6304 source = source.join('\n'); 6305 if ((m = re.exec(source))) { 6306 // console.log('Found function in ' + urls[i]); 6307 6308 return { 6309 'url': urls[i], 6310 'line': source.substring(0, m.index).split('\n').length, 6311 'column': m.index - source.lastIndexOf('\n', m.index) - 1 6312 }; 6313 } 6314 } 6315 } 6316 6317 // console.log('no match'); 6318 6319 return null; 6320 } 6321 6322 /** 6323 * Determines at which column a code fragment occurs on a line of the 6324 * source code. 6325 * @param {string} fragment The code fragment. 6326 * @param {string} url The URL to search. 6327 * @param {(string|number)} line The line number to examine. 6328 * @return {?number} The column number. 6329 */ 6330 function findSourceInLine(fragment, url, line) { 6331 var source = getSource(url), 6332 re = new RegExp('\\b' + escapeRegExp(fragment) + '\\b'), 6333 m; 6334 6335 line -= 1; 6336 6337 if (source && source.length > line && (m = re.exec(source[line]))) { 6338 return m.index; 6339 } 6340 6341 return null; 6342 } 6343 6344 /** 6345 * Determines where a function was defined within the source code. 6346 * @param {(Function|string)} func A function reference or serialized 6347 * function definition. 6348 * @return {?Object.<string, (string|number)>} An object containing 6349 * the url, line, and column number of the defined function. 6350 */ 6351 function findSourceByFunctionBody(func) { 6352 var urls = [window.location.href], 6353 scripts = document.getElementsByTagName('script'), 6354 body, 6355 code = '' + func, 6356 codeRE = /^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/, 6357 eventRE = /^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/, 6358 re, 6359 parts, 6360 result; 6361 6362 for (var i = 0; i < scripts.length; ++i) { 6363 var script = scripts[i]; 6364 if (script.src) { 6365 urls.push(script.src); 6366 } 6367 } 6368 6369 if (!(parts = codeRE.exec(code))) { 6370 re = new RegExp(escapeRegExp(code).replace(/\s+/g, '\\s+')); 6371 } 6372 6373 // not sure if this is really necessary, but I don’t have a test 6374 // corpus large enough to confirm that and it was in the original. 6375 else { 6376 var name = parts[1] ? '\\s+' + parts[1] : '', 6377 args = parts[2].split(',').join('\\s*,\\s*'); 6378 6379 body = escapeRegExp(parts[3]).replace(/;$/, ';?'); // semicolon is inserted if the function ends with a comment.replace(/\s+/g, '\\s+'); 6380 re = new RegExp('function' + name + '\\s*\\(\\s*' + args + '\\s*\\)\\s*{\\s*' + body + '\\s*}'); 6381 } 6382 6383 // look for a normal function definition 6384 if ((result = findSourceInUrls(re, urls))) { 6385 return result; 6386 } 6387 6388 // look for an old-school event handler function 6389 if ((parts = eventRE.exec(code))) { 6390 var event = parts[1]; 6391 body = escapeCodeAsRegExpForMatchingInsideHTML(parts[2]); 6392 6393 // look for a function defined in HTML as an onXXX handler 6394 re = new RegExp('on' + event + '=[\\\'"]\\s*' + body + '\\s*[\\\'"]', 'i'); 6395 6396 if ((result = findSourceInUrls(re, urls[0]))) { 6397 return result; 6398 } 6399 6400 // look for ??? 6401 re = new RegExp(body); 6402 6403 if ((result = findSourceInUrls(re, urls))) { 6404 return result; 6405 } 6406 } 6407 6408 return null; 6409 } 6410 6411 // Contents of Exception in various browsers. 6412 // 6413 // SAFARI: 6414 // ex.message = Can't find variable: qq 6415 // ex.line = 59 6416 // ex.sourceId = 580238192 6417 // ex.sourceURL = http://... 6418 // ex.expressionBeginOffset = 96 6419 // ex.expressionCaretOffset = 98 6420 // ex.expressionEndOffset = 98 6421 // ex.name = ReferenceError 6422 // 6423 // FIREFOX: 6424 // ex.message = qq is not defined 6425 // ex.fileName = http://... 6426 // ex.lineNumber = 59 6427 // ex.stack = ...stack trace... (see the example below) 6428 // ex.name = ReferenceError 6429 // 6430 // CHROME: 6431 // ex.message = qq is not defined 6432 // ex.name = ReferenceError 6433 // ex.type = not_defined 6434 // ex.arguments = ['aa'] 6435 // ex.stack = ...stack trace... 6436 // 6437 // INTERNET EXPLORER: 6438 // ex.message = ... 6439 // ex.name = ReferenceError 6440 // 6441 // OPERA: 6442 // ex.message = ...message... (see the example below) 6443 // ex.name = ReferenceError 6444 // ex.opera#sourceloc = 11 (pretty much useless, duplicates the info in ex.message) 6445 // ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace' 6446 6447 /** 6448 * Computes stack trace information from the stack property. 6449 * Chrome and Gecko use this property. 6450 * @param {Error} ex 6451 * @return {?Object.<string, *>} Stack trace information. 6452 */ 6453 function computeStackTraceFromStackProp(ex) { 6454 if (!ex.stack) { 6455 return null; 6456 } 6457 6458 var chrome = /^\s*at (?:((?:\[object object\])?\S+(?: \[as \S+\])?) )?\(?((?:file|http|https):.*?):(\d+)(?::(\d+))?\)?\s*$/i, 6459 gecko = /^\s*(\S*)(?:\((.*?)\))?@((?:file|http|https).*?):(\d+)(?::(\d+))?\s*$/i, 6460 lines = ex.stack.split('\n'), 6461 stack = [], 6462 parts, 6463 element, 6464 reference = /^(.*) is undefined$/.exec(ex.message); 6465 6466 for (var i = 0, j = lines.length; i < j; ++i) { 6467 if ((parts = gecko.exec(lines[i]))) { 6468 element = { 6469 'url': parts[3], 6470 'func': parts[1] || UNKNOWN_FUNCTION, 6471 'args': parts[2] ? parts[2].split(',') : '', 6472 'line': +parts[4], 6473 'column': parts[5] ? +parts[5] : null 6474 }; 6475 } else if ((parts = chrome.exec(lines[i]))) { 6476 element = { 6477 'url': parts[2], 6478 'func': parts[1] || UNKNOWN_FUNCTION, 6479 'line': +parts[3], 6480 'column': parts[4] ? +parts[4] : null 6481 }; 6482 } else { 6483 continue; 6484 } 6485 6486 if (!element.func && element.line) { 6487 element.func = guessFunctionName(element.url, element.line); 6488 } 6489 6490 if (element.line) { 6491 element.context = gatherContext(element.url, element.line); 6492 } 6493 6494 stack.push(element); 6495 } 6496 6497 if (stack[0] && stack[0].line && !stack[0].column && reference) { 6498 stack[0].column = findSourceInLine(reference[1], stack[0].url, stack[0].line); 6499 } 6500 6501 if (!stack.length) { 6502 return null; 6503 } 6504 6505 return { 6506 'mode': 'stack', 6507 'name': ex.name, 6508 'message': ex.message, 6509 'url': document.location.href, 6510 'stack': stack, 6511 'useragent': navigator.userAgent 6512 }; 6513 } 6514 6515 /** 6516 * Computes stack trace information from the stacktrace property. 6517 * Opera 10 uses this property. 6518 * @param {Error} ex 6519 * @return {?Object.<string, *>} Stack trace information. 6520 */ 6521 function computeStackTraceFromStacktraceProp(ex) { 6522 // Access and store the stacktrace property before doing ANYTHING 6523 // else to it because Opera is not very good at providing it 6524 // reliably in other circumstances. 6525 var stacktrace = ex.stacktrace; 6526 6527 var testRE = / line (\d+), column (\d+) in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\) in (.*):\s*$/i, 6528 lines = stacktrace.split('\n'), 6529 stack = [], 6530 parts; 6531 6532 for (var i = 0, j = lines.length; i < j; i += 2) { 6533 if ((parts = testRE.exec(lines[i]))) { 6534 var element = { 6535 'line': +parts[1], 6536 'column': +parts[2], 6537 'func': parts[3] || parts[4], 6538 'args': parts[5] ? parts[5].split(',') : [], 6539 'url': parts[6] 6540 }; 6541 6542 if (!element.func && element.line) { 6543 element.func = guessFunctionName(element.url, element.line); 6544 } 6545 if (element.line) { 6546 try { 6547 element.context = gatherContext(element.url, element.line); 6548 } catch (exc) {} 6549 } 6550 6551 if (!element.context) { 6552 element.context = [lines[i + 1]]; 6553 } 6554 6555 stack.push(element); 6556 } 6557 } 6558 6559 if (!stack.length) { 6560 return null; 6561 } 6562 6563 return { 6564 'mode': 'stacktrace', 6565 'name': ex.name, 6566 'message': ex.message, 6567 'url': document.location.href, 6568 'stack': stack, 6569 'useragent': navigator.userAgent 6570 }; 6571 } 6572 6573 /** 6574 * NOT TESTED. 6575 * Computes stack trace information from an error message that includes 6576 * the stack trace. 6577 * Opera 9 and earlier use this method if the option to show stack 6578 * traces is turned on in opera:config. 6579 * @param {Error} ex 6580 * @return {?Object.<string, *>} Stack information. 6581 */ 6582 function computeStackTraceFromOperaMultiLineMessage(ex) { 6583 // Opera includes a stack trace into the exception message. An example is: 6584 // 6585 // Statement on line 3: Undefined variable: undefinedFunc 6586 // Backtrace: 6587 // Line 3 of linked script file://localhost/Users/andreyvit/Projects/TraceKit/javascript-client/sample.js: In function zzz 6588 // undefinedFunc(a); 6589 // Line 7 of inline#1 script in file://localhost/Users/andreyvit/Projects/TraceKit/javascript-client/sample.html: In function yyy 6590 // zzz(x, y, z); 6591 // Line 3 of inline#1 script in file://localhost/Users/andreyvit/Projects/TraceKit/javascript-client/sample.html: In function xxx 6592 // yyy(a, a, a); 6593 // Line 1 of function script 6594 // try { xxx('hi'); return false; } catch(ex) { TraceKit.report(ex); } 6595 // ... 6596 6597 var lines = ex.message.split('\n'); 6598 if (lines.length < 4) { 6599 return null; 6600 } 6601 6602 var lineRE1 = /^\s*Line (\d+) of linked script ((?:file|http|https)\S+)(?:: in function (\S+))?\s*$/i, 6603 lineRE2 = /^\s*Line (\d+) of inline#(\d+) script in ((?:file|http|https)\S+)(?:: in function (\S+))?\s*$/i, 6604 lineRE3 = /^\s*Line (\d+) of function script\s*$/i, 6605 stack = [], 6606 scripts = document.getElementsByTagName('script'), 6607 inlineScriptBlocks = [], 6608 parts, 6609 i, 6610 len, 6611 source; 6612 6613 for (i in scripts) { 6614 if (_has(scripts, i) && !scripts[i].src) { 6615 inlineScriptBlocks.push(scripts[i]); 6616 } 6617 } 6618 6619 for (i = 2, len = lines.length; i < len; i += 2) { 6620 var item = null; 6621 if ((parts = lineRE1.exec(lines[i]))) { 6622 item = { 6623 'url': parts[2], 6624 'func': parts[3], 6625 'line': +parts[1] 6626 }; 6627 } else if ((parts = lineRE2.exec(lines[i]))) { 6628 item = { 6629 'url': parts[3], 6630 'func': parts[4] 6631 }; 6632 var relativeLine = (+parts[1]); // relative to the start of the <SCRIPT> block 6633 var script = inlineScriptBlocks[parts[2] - 1]; 6634 if (script) { 6635 source = getSource(item.url); 6636 if (source) { 6637 source = source.join('\n'); 6638 var pos = source.indexOf(script.innerText); 6639 if (pos >= 0) { 6640 item.line = relativeLine + source.substring(0, pos).split('\n').length; 6641 } 6642 } 6643 } 6644 } else if ((parts = lineRE3.exec(lines[i]))) { 6645 var url = window.location.href.replace(/#.*$/, ''), 6646 line = parts[1]; 6647 var re = new RegExp(escapeCodeAsRegExpForMatchingInsideHTML(lines[i + 1])); 6648 source = findSourceInUrls(re, [url]); 6649 item = { 6650 'url': url, 6651 'line': source ? source.line : line, 6652 'func': '' 6653 }; 6654 } 6655 6656 if (item) { 6657 if (!item.func) { 6658 item.func = guessFunctionName(item.url, item.line); 6659 } 6660 var context = gatherContext(item.url, item.line); 6661 var midline = (context ? context[Math.floor(context.length / 2)] : null); 6662 if (context && midline.replace(/^\s*/, '') === lines[i + 1].replace(/^\s*/, '')) { 6663 item.context = context; 6664 } else { 6665 // if (context) alert("Context mismatch. Correct midline:\n" + lines[i+1] + "\n\nMidline:\n" + midline + "\n\nContext:\n" + context.join("\n") + "\n\nURL:\n" + item.url); 6666 item.context = [lines[i + 1]]; 6667 } 6668 stack.push(item); 6669 } 6670 } 6671 if (!stack.length) { 6672 return null; // could not parse multiline exception message as Opera stack trace 6673 } 6674 6675 return { 6676 'mode': 'multiline', 6677 'name': ex.name, 6678 'message': lines[0], 6679 'url': document.location.href, 6680 'stack': stack, 6681 'useragent': navigator.userAgent 6682 }; 6683 } 6684 6685 /** 6686 * Adds information about the first frame to incomplete stack traces. 6687 * Safari and IE require this to get complete data on the first frame. 6688 * @param {Object.<string, *>} stackInfo Stack trace information from 6689 * one of the compute* methods. 6690 * @param {string} url The URL of the script that caused an error. 6691 * @param {(number|string)} lineNo The line number of the script that 6692 * caused an error. 6693 * @param {string=} message The error generated by the browser, which 6694 * hopefully contains the name of the object that caused the error. 6695 * @return {boolean} Whether or not the stack information was 6696 * augmented. 6697 */ 6698 function augmentStackTraceWithInitialElement(stackInfo, url, lineNo, message) { 6699 var initial = { 6700 'url': url, 6701 'line': lineNo 6702 }; 6703 6704 if (initial.url && initial.line) { 6705 stackInfo.incomplete = false; 6706 6707 if (!initial.func) { 6708 initial.func = guessFunctionName(initial.url, initial.line); 6709 } 6710 6711 if (!initial.context) { 6712 initial.context = gatherContext(initial.url, initial.line); 6713 } 6714 6715 var reference = / '([^']+)' /.exec(message); 6716 if (reference) { 6717 initial.column = findSourceInLine(reference[1], initial.url, initial.line); 6718 } 6719 6720 if (stackInfo.stack.length > 0) { 6721 if (stackInfo.stack[0].url === initial.url) { 6722 if (stackInfo.stack[0].line === initial.line) { 6723 return false; // already in stack trace 6724 } else if (!stackInfo.stack[0].line && stackInfo.stack[0].func === initial.func) { 6725 stackInfo.stack[0].line = initial.line; 6726 stackInfo.stack[0].context = initial.context; 6727 return false; 6728 } 6729 } 6730 } 6731 6732 stackInfo.stack.unshift(initial); 6733 stackInfo.partial = true; 6734 return true; 6735 } else { 6736 stackInfo.incomplete = true; 6737 } 6738 6739 return false; 6740 } 6741 6742 /** 6743 * Computes stack trace information by walking the arguments.caller 6744 * chain at the time the exception occurred. This will cause earlier 6745 * frames to be missed but is the only way to get any stack trace in 6746 * Safari and IE. The top frame is restored by 6747 * {@link augmentStackTraceWithInitialElement}. 6748 * @param {Error} ex 6749 * @return {?Object.<string, *>} Stack trace information. 6750 */ 6751 function computeStackTraceByWalkingCallerChain(ex, depth) { 6752 var functionName = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i, 6753 stack = [], 6754 funcs = {}, 6755 recursion = false, 6756 parts, 6757 item, 6758 source; 6759 6760 for (var curr = computeStackTraceByWalkingCallerChain.caller; curr && !recursion; curr = curr.caller) { 6761 if (curr === computeStackTrace || curr === TraceKit.report) { 6762 // console.log('skipping internal function'); 6763 continue; 6764 } 6765 6766 item = { 6767 'url': null, 6768 'func': UNKNOWN_FUNCTION, 6769 'line': null, 6770 'column': null 6771 }; 6772 6773 if (curr.name) { 6774 item.func = curr.name; 6775 } else if ((parts = functionName.exec(curr.toString()))) { 6776 item.func = parts[1]; 6777 } 6778 6779 if ((source = findSourceByFunctionBody(curr))) { 6780 item.url = source.url; 6781 item.line = source.line; 6782 6783 if (item.func === UNKNOWN_FUNCTION) { 6784 item.func = guessFunctionName(item.url, item.line); 6785 } 6786 6787 var reference = / '([^']+)' /.exec(ex.message || ex.description); 6788 if (reference) { 6789 item.column = findSourceInLine(reference[1], source.url, source.line); 6790 } 6791 } 6792 6793 if (funcs['' + curr]) { 6794 recursion = true; 6795 }else{ 6796 funcs['' + curr] = true; 6797 } 6798 6799 stack.push(item); 6800 } 6801 6802 if (depth) { 6803 // console.log('depth is ' + depth); 6804 // console.log('stack is ' + stack.length); 6805 stack.splice(0, depth); 6806 } 6807 6808 var result = { 6809 'mode': 'callers', 6810 'name': ex.name, 6811 'message': ex.message, 6812 'url': document.location.href, 6813 'stack': stack, 6814 'useragent': navigator.userAgent 6815 }; 6816 augmentStackTraceWithInitialElement(result, ex.sourceURL || ex.fileName, ex.line || ex.lineNumber, ex.message || ex.description); 6817 return result; 6818 } 6819 6820 /** 6821 * Computes a stack trace for an exception. 6822 * @param {Error} ex 6823 * @param {(string|number)=} depth 6824 */ 6825 function computeStackTrace(ex, depth) { 6826 var stack = null; 6827 depth = (depth == null ? 0 : +depth); 6828 6829 try { 6830 // This must be tried first because Opera 10 *destroys* 6831 // its stacktrace property if you try to access the stack 6832 // property first!! 6833 stack = computeStackTraceFromStacktraceProp(ex); 6834 if (stack) { 6835 return stack; 6836 } 6837 } catch (e) { 6838 if (debug) { 6839 throw e; 6840 } 6841 } 6842 6843 try { 6844 stack = computeStackTraceFromStackProp(ex); 6845 if (stack) { 6846 return stack; 6847 } 6848 } catch (e) { 6849 if (debug) { 6850 throw e; 6851 } 6852 } 6853 6854 try { 6855 stack = computeStackTraceFromOperaMultiLineMessage(ex); 6856 if (stack) { 6857 return stack; 6858 } 6859 } catch (e) { 6860 if (debug) { 6861 throw e; 6862 } 6863 } 6864 6865 try { 6866 stack = computeStackTraceByWalkingCallerChain(ex, depth + 1); 6867 if (stack) { 6868 return stack; 6869 } 6870 } catch (e) { 6871 if (debug) { 6872 throw e; 6873 } 6874 } 6875 6876 return { 6877 'mode': 'failed' 6878 }; 6879 } 6880 6881 /** 6882 * Logs a stacktrace starting from the previous call and working down. 6883 * @param {(number|string)=} depth How many frames deep to trace. 6884 * @return {Object.<string, *>} Stack trace information. 6885 */ 6886 function computeStackTraceOfCaller(depth) { 6887 depth = (depth == null ? 0 : +depth) + 1; // "+ 1" because "ofCaller" should drop one frame 6888 try { 6889 throw new Error(); 6890 } catch (ex) { 6891 return computeStackTrace(ex, depth + 1); 6892 } 6893 6894 return null; 6895 } 6896 6897 computeStackTrace.augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement; 6898 computeStackTrace.guessFunctionName = guessFunctionName; 6899 computeStackTrace.gatherContext = gatherContext; 6900 computeStackTrace.ofCaller = computeStackTraceOfCaller; 6901 6902 return computeStackTrace; 6903}()); 6904 6905/** 6906 * Extends support for global error handling for asynchronous browser 6907 * functions. Adopted from Closure Library's errorhandler.js 6908 */ 6909(function extendToAsynchronousCallbacks() { 6910 var _helper = function _helper(fnName) { 6911 var originalFn = window[fnName]; 6912 window[fnName] = function traceKitAsyncExtension() { 6913 // Make a copy of the arguments 6914 var args = _slice.call(arguments); 6915 var originalCallback = args[0]; 6916 if (typeof (originalCallback) === 'function') { 6917 args[0] = TraceKit.wrap(originalCallback); 6918 } 6919 // IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it 6920 // also only supports 2 argument and doesn't care what "this" is, so we 6921 // can just call the original function directly. 6922 if (originalFn.apply) { 6923 return originalFn.apply(this, args); 6924 } else { 6925 return originalFn(args[0], args[1]); 6926 } 6927 }; 6928 }; 6929 6930 _helper('setTimeout'); 6931 _helper('setInterval'); 6932}()); 6933 6934//Default options: 6935if (!TraceKit.remoteFetching) { 6936 TraceKit.remoteFetching = true; 6937} 6938if (!TraceKit.collectWindowErrors) { 6939 TraceKit.collectWindowErrors = true; 6940} 6941if (!TraceKit.linesOfContext || TraceKit.linesOfContext < 1) { 6942 // 5 lines before, the offending line, 5 lines after 6943 TraceKit.linesOfContext = 11; 6944} 6945 6946 6947 6948// Export to global object 6949window.TraceKit = TraceKit; 6950 6951}(window)); 6952; 6953 6954/* vim: set expandtab sw=4 ts=4 sts=4: */ 6955/** 6956 * general function, usually for data manipulation pages 6957 * 6958 */ 6959 6960var ErrorReport = { 6961 /** 6962 * @var object stores the last exception info 6963 */ 6964 _last_exception: null, 6965 /** 6966 * handles thrown error exceptions based on user preferences 6967 * 6968 * @return void 6969 */ 6970 error_handler: function (exception) { 6971 if (exception.name === null || typeof(exception.name) == "undefined") { 6972 exception.name = ErrorReport._extractExceptionName(exception); 6973 } 6974 ErrorReport._last_exception = exception; 6975 $.get("error_report.php", { 6976 ajax_request: true, 6977 server: PMA_commonParams.get('server'), 6978 token: PMA_commonParams.get('token'), 6979 get_settings: true, 6980 exception_type: 'js' 6981 }, function (data) { 6982 if (data.success !== true) { 6983 PMA_ajaxShowMessage(data.error, false); 6984 return; 6985 } 6986 if (data.report_setting == "ask") { 6987 ErrorReport._showErrorNotification(); 6988 } else if (data.report_setting == "always") { 6989 report_data = ErrorReport._get_report_data(exception); 6990 post_data = $.extend(report_data, { 6991 send_error_report: true, 6992 automatic: true 6993 }); 6994 $.post("error_report.php", post_data, function (data) { 6995 if (data.success === false) { 6996 //in the case of an error, show the error message returned. 6997 PMA_ajaxShowMessage(data.error, false); 6998 } else { 6999 PMA_ajaxShowMessage(data.message, false); 7000 } 7001 }); 7002 } 7003 }); 7004 }, 7005 /** 7006 * Shows the modal dialog previewing the report 7007 * 7008 * @param exception object error report info 7009 * 7010 * @return void 7011 */ 7012 _showReportDialog: function (exception) { 7013 var report_data = ErrorReport._get_report_data(exception); 7014 7015 /*Remove the hidden dialogs if there are*/ 7016 if ($('#error_report_dialog').length !== 0) { 7017 $('#error_report_dialog').remove(); 7018 }
7019 var $div = $('<div id="error_report_dialog"></div>'); 7020 7021 var button_options = {}; 7022 7023 button_options[PMA_messages.strSendErrorReport] = function () { 7024 var $dialog = $(this); 7025 var post_data = $.extend(report_data, { 7026 send_error_report: true, 7027 description: $("#report_description").val(), 7028 always_send: $("#always_send_checkbox")[0].checked 7029 }); 7030 $.post("error_report.php", post_data, function (data) { 7031 $dialog.dialog('close'); 7032 if (data.success === false) { 7033 //in the case of an error, show the error message returned. 7034 PMA_ajaxShowMessage(data.error, false); 7035 } else { 7036 PMA_ajaxShowMessage(data.message, 3000); 7037 } 7038 }); 7039 }; 7040 7041 button_options[PMA_messages.strCancel] = function () { 7042 $(this).dialog('close'); 7043 }; 7044 7045 $.post("error_report.php", report_data, function (data) { 7046 if (data.success === false) { 7047 //in the case of an error, show the error message returned. 7048 PMA_ajaxShowMessage(data.error, false); 7049 } else { 7050 // Show dialog if the request was successful 7051 $div 7052 .append(data.message) 7053 .dialog({ 7054 title: PMA_messages.strSubmitErrorReport, 7055 width: 650, 7056 modal: true, 7057 buttons: button_options, 7058 close: function () { 7059 $(this).remove(); 7060 } 7061 }); 7062 } 7063 }); // end $.get() 7064 }, 7065 /** 7066 * Shows the small notification that asks for user permission 7067 * 7068 * @return void 7069 */ 7070 _showErrorNotification: function () { 7071 ErrorReport._removeErrorNotification(); 7072 7073 var $div = $( 7074 '<div style="position:fixed;bottom:0;left:0;right:0;margin:0;' + 7075 'z-index:1000" class="error" id="error_notification"></div>' 7076 ).append( 7077 PMA_getImage("s_error.png") + PMA_messages.strErrorOccurred 7078 ); 7079 7080 var $buttons = $('<div class="floatright"></div>'); 7081 7082 var button_html = '<button id="show_error_report">'; 7083 button_html += PMA_messages.strShowReportDetails; 7084 button_html += '</button>'; 7085 7086 button_html += '<a id="change_error_settings">'; 7087 button_html += PMA_getImage('s_cog.png', PMA_messages.strChangeReportSettings); 7088 button_html += '</a>'; 7089 7090 button_html += '<a href="#" id="ignore_error">'; 7091 button_html += PMA_getImage('b_close.png', PMA_messages.strIgnore); 7092 button_html += '</a>'; 7093 7094 $buttons.html(button_html); 7095 7096 $div.append($buttons); 7097 $div.appendTo(document.body); 7098 $("#change_error_settings").on("click", ErrorReport._redirect_to_settings); 7099 $("#show_error_report").on("click", ErrorReport._createReportDialog); 7100 $("#ignore_error").on("click", ErrorReport._removeErrorNotification); 7101 }, 7102 /** 7103 * Removes the notification if it was displayed before 7104 * 7105 * @return void 7106 */ 7107 _removeErrorNotification: function (e) { 7108 if (e) { 7109 // don't remove the hash fragment by navigating to # 7110 e.preventDefault(); 7111 } 7112 $("#error_notification").fadeOut(function () { 7113 $(this).remove(); 7114 }); 7115 }, 7116 /** 7117 * Extracts Exception name from message if it exists 7118 * 7119 * @return String 7120 */ 7121 _extractExceptionName: function (exception) { 7122 if (exception.message === null || typeof(exception.message) == "undefined"){ 7123 return ""; 7124 } else { 7125 var reg = /([a-zA-Z]+):/; 7126 var regex_result = null; 7127 regex_result = reg.exec(exception.message); 7128 if(regex_result && regex_result.length == 2) 7129 return regex_result[1]; 7130 else 7131 return ""; 7132 } 7133 }, 7134 /** 7135 * Shows the modal dialog previewing the report 7136 * 7137 * @return void 7138 */ 7139 _createReportDialog: function () { 7140 ErrorReport._removeErrorNotification(); 7141 ErrorReport._showReportDialog(ErrorReport._last_exception); 7142 }, 7143 /** 7144 * Redirects to the settings page containing error report 7145 * preferences 7146 * 7147 * @return void 7148 */ 7149 _redirect_to_settings: function () { 7150 window.location.href = "prefs_forms.php?token=" + PMA_commonParams.get('token'); 7151 }, 7152 /** 7153 * Returns the report data to send to the server 7154 * 7155 * @param exception object exception info 7156 * 7157 * @return object 7158 */ 7159 _get_report_data: function (exception) { 7160 var report_data = { 7161 "ajax_request": true, 7162 "token": PMA_commonParams.get('token'), 7163 "exception": exception, 7164 "current_url": window.location.href, 7165 "exception_type": 'js' 7166 }; 7167 if (AJAX.scriptHandler._scripts.length > 0) { 7168 report_data.scripts = AJAX.scriptHandler._scripts.map( 7169 function (script) { 7170 return script.name; 7171 } 7172 ); 7173 } 7174 return report_data; 7175 }, 7176 /** 7177 * Wraps all global functions that start with PMA_ 7178 * 7179 * @return void 7180 */ 7181 wrap_global_functions: function () { 7182 for (var key in window) { 7183 if (key.indexOf("PMA_") === 0) { 7184 var global = window[key]; 7185 if (typeof(global) === "function") { 7186 window[key] = ErrorReport.wrap_function(global); 7187 } 7188 } 7189 } 7190 }, 7191 /** 7192 * Wraps given function in error reporting code and returns wrapped function 7193 * 7194 * @param func function to be wrapped 7195 * 7196 * @return function 7197 */ 7198 wrap_function: function (func) { 7199 if (!func.wrapped) { 7200 var new_func = function () { 7201 try { 7202 return func.apply(this, arguments); 7203 } catch (x) { 7204 TraceKit.report(x); 7205 } 7206 }; 7207 new_func.wrapped = true; 7208 //Set guid of wrapped function same as original function, so it can be removed 7209 //See bug#4146 (problem with jquery draggable and sortable) 7210 new_func.guid = func.guid = func.guid || new_func.guid || jQuery.guid++; 7211 return new_func; 7212 } else { 7213 return func; 7214 } 7215 }, 7216 /** 7217 * Automatically wraps the callback in AJAX.registerOnload 7218 * 7219 * @return void 7220 */ 7221 _wrap_ajax_onload_callback: function () { 7222 var oldOnload = AJAX.registerOnload; 7223 AJAX.registerOnload = function (file, func) { 7224 func = ErrorReport.wrap_function(func); 7225 oldOnload.call(this, file, func); 7226 }; 7227 }, 7228 /** 7229 * Automatically wraps the callback in $.fn.on 7230 * 7231 * @return void 7232 */ 7233 _wrap_$_on_callback: function () { 7234 var oldOn = $.fn.on; 7235 $.fn.on = function () { 7236 for (var i = 1; i <= 3; i++) { 7237 if (typeof(arguments[i]) === "function") { 7238 arguments[i] = ErrorReport.wrap_function(arguments[i]); 7239 break; 7240 } 7241 } 7242 return oldOn.apply(this, arguments); 7243 }; 7244 }, 7245 /** 7246 * Wraps all global functions that start with PMA_ 7247 * also automatically wraps the callback in AJAX.registerOnload 7248 * 7249 * @return void 7250 */ 7251 set_up_error_reporting: function () { 7252 ErrorReport.wrap_global_functions(); 7253 ErrorReport._wrap_ajax_onload_callback(); 7254 ErrorReport._wrap_$_on_callback(); 7255 } 7256 7257}; 7258 7259TraceKit.report.subscribe(ErrorReport.error_handler); 7260ErrorReport.set_up_error_reporting(); 7261$(function () { 7262 ErrorReport.wrap_global_functions(); 7263}); 7264; 7265 7266/** 7267 * Definition of links to MySQL documentation. 7268 */ 7269 7270var mysql_doc_keyword = { 7271 /* Multi word */ 7272 'CHARACTER SET': Array('charset'), 7273 'SHOW AUTHORS': Array('show-authors'), 7274 'SHOW BINARY LOGS': Array('show-binary-logs'), 7275 'SHOW BINLOG EVENTS': Array('show-binlog-events'), 7276 'SHOW CHARACTER SET': Array('show-character-set'), 7277 'SHOW COLLATION': Array('show-collation'), 7278 'SHOW COLUMNS': Array('show-columns'), 7279 'SHOW CONTRIBUTORS': Array('show-contributors'), 7280 'SHOW CREATE DATABASE': Array('show-create-database'), 7281 'SHOW CREATE EVENT': Array('show-create-event'), 7282 'SHOW CREATE FUNCTION': Array('show-create-function'), 7283 'SHOW CREATE PROCEDURE': Array('show-create-procedure'), 7284 'SHOW CREATE TABLE': Array('show-create-table'), 7285 'SHOW CREATE TRIGGER': Array('show-create-trigger'), 7286 'SHOW CREATE VIEW': Array('show-create-view'), 7287 'SHOW DATABASES': Array('show-databases'), 7288 'SHOW ENGINE': Array('show-engine'), 7289 'SHOW ENGINES': Array('show-engines'), 7290 'SHOW ERRORS': Array('show-errors'), 7291 'SHOW EVENTS': Array('show-events'), 7292 'SHOW FUNCTION CODE': Array('show-function-code'), 7293 'SHOW FUNCTION STATUS': Array('show-function-status'), 7294 'SHOW GRANTS': Array('show-grants'), 7295 'SHOW INDEX': Array('show-index'),
7296 'SHOW MASTER STATUS': Array('show-master-status'), 7297 'SHOW OPEN TABLES': Array('show-open-tables'), 7298 'SHOW PLUGINS': Array('show-plugins'), 7299 'SHOW PRIVILEGES': Array('show-privileges'), 7300 'SHOW PROCEDURE CODE': Array('show-procedure-code'), 7301 'SHOW PROCEDURE STATUS': Array('show-procedure-status'), 7302 'SHOW PROCESSLIST': Array('show-processlist'), 7303 'SHOW PROFILE': Array('show-profile'), 7304 'SHOW PROFILES': Array('show-profiles'), 7305 'SHOW RELAYLOG EVENTS': Array('show-relaylog-events'), 7306 'SHOW SLAVE HOSTS': Array('show-slave-hosts'), 7307 'SHOW SLAVE STATUS': Array('show-slave-status'), 7308 'SHOW STATUS': Array('show-status'), 7309 'SHOW TABLE STATUS': Array('show-table-status'), 7310 'SHOW TABLES': Array('show-tables'), 7311 'SHOW TRIGGERS': Array('show-triggers'), 7312 'SHOW VARIABLES': Array('show-variables'), 7313 'SHOW WARNINGS': Array('show-warnings'), 7314 'LOAD DATA INFILE': Array('load-data'), 7315 'LOAD XML': Array('load-xml'), 7316 'LOCK TABLES': Array('lock-tables'), 7317 'UNLOCK TABLES': Array('lock-tables'), 7318 'ALTER DATABASE': Array('alter-database'), 7319 'ALTER EVENT': Array('alter-event'), 7320 'ALTER LOGFILE GROUP': Array('alter-logfile-group'), 7321 'ALTER FUNCTION': Array('alter-function'), 7322 'ALTER PROCEDURE': Array('alter-procedure'), 7323 'ALTER SERVER': Array('alter-server'), 7324 'ALTER TABLE': Array('alter-table'), 7325 'ALTER TABLESPACE': Array('alter-tablespace'), 7326 'ALTER VIEW': Array('alter-view'), 7327 'CREATE DATABASE': Array('create-database'), 7328 'CREATE EVENT': Array('create-event'), 7329 'CREATE FUNCTION': Array('create-function'), 7330 'CREATE INDEX': Array('create-index'), 7331 'CREATE LOGFILE GROUP': Array('create-logfile-group'), 7332 'CREATE PROCEDURE': Array('create-procedure'), 7333 'CREATE SERVER': Array('create-server'), 7334 'CREATE TABLE': Array('create-table'), 7335 'CREATE TABLESPACE': Array('create-tablespace'), 7336 'CREATE TRIGGER': Array('create-trigger'), 7337 'CREATE VIEW': Array('create-view'), 7338 'DROP DATABASE': Array('drop-database'), 7339 'DROP EVENT': Array('drop-event'), 7340 'DROP FUNCTION': Array('drop-function'), 7341 'DROP INDEX': Array('drop-index'), 7342 'DROP LOGFILE GROUP': Array('drop-logfile-group'), 7343 'DROP PROCEDURE': Array('drop-procedure'), 7344 'DROP SERVER': Array('drop-server'), 7345 'DROP TABLE': Array('drop-table'), 7346 'DROP TABLESPACE': Array('drop-tablespace'), 7347 'DROP TRIGGER': Array('drop-trigger'), 7348 'DROP VIEW': Array('drop-view'), 7349 'RENAME TABLE': Array('rename-table'), 7350 'TRUNCATE TABLE': Array('truncate-table'), 7351 7352 /* Statements */ 7353 'SELECT': Array('select'), 7354 'SET': Array('set'), 7355 'EXPLAIN': Array('explain'), 7356 'DESCRIBE': Array('describe'), 7357 'DELETE': Array('delete'), 7358 'SHOW': Array('show'), 7359 'UPDATE': Array('update'), 7360 'INSERT': Array('insert'), 7361 'REPLACE': Array('replace'), 7362 'CALL': Array('call'), 7363 'DO': Array('do'), 7364 'HANDLER': Array('handler'), 7365 'COLLATE': Array('charset-collations'), 7366 7367 /* Functions */ 7368 'ABS': Array('mathematical-functions', 'function_abs'), 7369 'ACOS': Array('mathematical-functions', 'function_acos'), 7370 'ADDDATE': Array('date-and-time-functions', 'function_adddate'), 7371 'ADDTIME': Array('date-and-time-functions', 'function_addtime'), 7372 'AES_DECRYPT': Array('encryption-functions', 'function_aes_decrypt'), 7373 'AES_ENCRYPT': Array('encryption-functions', 'function_aes_encrypt'), 7374 'AND': Array('logical-operators', 'operator_and'), 7375 'ASCII': Array('string-functions', 'function_ascii'), 7376 'ASIN': Array('mathematical-functions', 'function_asin'), 7377 'ATAN2': Array('mathematical-functions', 'function_atan2'), 7378 'ATAN': Array('mathematical-functions', 'function_atan'), 7379 'AVG': Array('group-by-functions', 'function_avg'), 7380 'BENCHMARK': Array('information-functions', 'function_benchmark'), 7381 'BIN': Array('string-functions', 'function_bin'), 7382 'BINARY': Array('cast-functions', 'operator_binary'), 7383 'BIT_AND': Array('group-by-functions', 'function_bit_and'), 7384 'BIT_COUNT': Array('bit-functions', 'function_bit_count'), 7385 'BIT_LENGTH': Array('string-functions', 'function_bit_length'), 7386 'BIT_OR': Array('group-by-functions', 'function_bit_or'), 7387 'BIT_XOR': Array('group-by-functions', 'function_bit_xor'), 7388 'CASE': Array('control-flow-functions', 'operator_case'), 7389 'CAST': Array('cast-functions', 'function_cast'), 7390 'CEIL': Array('mathematical-functions', 'function_ceil'), 7391 'CEILING': Array('mathematical-functions', 'function_ceiling'), 7392 'CHAR_LENGTH': Array('string-functions', 'function_char_length'), 7393 'CHAR': Array('string-functions', 'function_char'), 7394 'CHARACTER_LENGTH': Array('string-functions', 'function_character_length'), 7395 'CHARSET': Array('information-functions', 'function_charset'), 7396 'COALESCE': Array('comparison-operators', 'function_coalesce'), 7397 'COERCIBILITY': Array('information-functions', 'function_coercibility'), 7398 'COLLATION': Array('information-functions', 'function_collation'), 7399 'COMPRESS': Array('encryption-functions', 'function_compress'), 7400 'CONCAT_WS': Array('string-functions', 'function_concat_ws'), 7401 'CONCAT': Array('string-functions', 'function_concat'), 7402 'CONNECTION_ID': Array('information-functions', 'function_connection_id'), 7403 'CONV': Array('mathematical-functions', 'function_conv'), 7404 'CONVERT_TZ': Array('date-and-time-functions', 'function_convert_tz'), 7405 'Convert': Array('cast-functions', 'function_convert'), 7406 'COS': Array('mathematical-functions', 'function_cos'), 7407 'COT': Array('mathematical-functions', 'function_cot'), 7408 'COUNT': Array('group-by-functions', 'function_count'), 7409 'CRC32': Array('mathematical-functions', 'function_crc32'), 7410 'CURDATE': Array('date-and-time-functions', 'function_curdate'), 7411 'CURRENT_DATE': Array('date-and-time-functions', 'function_current_date'), 7412 'CURRENT_TIME': Array('date-and-time-functions', 'function_current_time'), 7413 'CURRENT_TIMESTAMP': Array('date-and-time-functions', 'function_current_timestamp'), 7414 'CURRENT_USER': Array('information-functions', 'function_current_user'), 7415 'CURTIME': Array('date-and-time-functions', 'function_curtime'), 7416 'DATABASE': Array('information-functions', 'function_database'), 7417 'DATE_ADD': Array('date-and-time-functions', 'function_date_add'), 7418 'DATE_FORMAT': Array('date-and-time-functions', 'function_date_format'), 7419 'DATE_SUB': Array('date-and-time-functions', 'function_date_sub'), 7420 'DATE': Array('date-and-time-functions', 'function_date'), 7421 'DATEDIFF': Array('date-and-time-functions', 'function_datediff'), 7422 'DAY': Array('date-and-time-functions', 'function_day'), 7423 'DAYNAME': Array('date-and-time-functions', 'function_dayname'), 7424 'DAYOFMONTH': Array('date-and-time-functions', 'function_dayofmonth'), 7425 'DAYOFWEEK': Array('date-and-time-functions', 'function_dayofweek'), 7426 'DAYOFYEAR': Array('date-and-time-functions', 'function_dayofyear'), 7427 'DECLARE': Array('declare', 'declare'), 7428 'DECODE': Array('encryption-functions', 'function_decode'), 7429 'DEFAULT': Array('miscellaneous-functions', 'function_default'), 7430 'DEGREES': Array('mathematical-functions', 'function_degrees'), 7431 'DES_DECRYPT': Array('encryption-functions', 'function_des_decrypt'), 7432 'DES_ENCRYPT': Array('encryption-functions', 'function_des_encrypt'), 7433 'DIV': Array('arithmetic-functions', 'operator_div'), 7434 'ELT': Array('string-functions', 'function_elt'), 7435 'ENCODE': Array('encryption-functions', 'function_encode'), 7436 'ENCRYPT': Array('encryption-functions', 'function_encrypt'), 7437 'EXP': Array('mathematical-functions', 'function_exp'), 7438 'EXPORT_SET': Array('string-functions', 'function_export_set'),
7439 'EXTRACT': Array('date-and-time-functions', 'function_extract'), 7440 'ExtractValue': Array('xml-functions', 'function_extractvalue'), 7441 'FIELD': Array('string-functions', 'function_field'), 7442 'FIND_IN_SET': Array('string-functions', 'function_find_in_set'), 7443 'FLOOR': Array('mathematical-functions', 'function_floor'), 7444 'FORMAT': Array('string-functions', 'function_format'), 7445 'FOUND_ROWS': Array('information-functions', 'function_found_rows'), 7446 'FROM_DAYS': Array('date-and-time-functions', 'function_from_days'), 7447 'FROM_UNIXTIME': Array('date-and-time-functions', 'function_from_unixtime'), 7448 'GET_FORMAT': Array('date-and-time-functions', 'function_get_format'), 7449 'GET_LOCK': Array('miscellaneous-functions', 'function_get_lock'), 7450 'GREATEST': Array('comparison-operators', 'function_greatest'), 7451 'GROUP_CONCAT': Array('group-by-functions', 'function_group_concat'), 7452 'HEX': Array('string-functions', 'function_hex'), 7453 'HOUR': Array('date-and-time-functions', 'function_hour'), 7454 'IF': Array('control-flow-functions', 'function_if'), 7455 'IFNULL': Array('control-flow-functions', 'function_ifnull'), 7456 'IN': Array('comparison-operators', 'function_in'), 7457 'INET_ATON': Array('miscellaneous-functions', 'function_inet_aton'), 7458 'INET_NTOA': Array('miscellaneous-functions', 'function_inet_ntoa'), 7459 'INSTR': Array('string-functions', 'function_instr'), 7460 'INTERVAL': Array('comparison-operators', 'function_interval'), 7461 'IS_FREE_LOCK': Array('miscellaneous-functions', 'function_is_free_lock'), 7462 'IS_USED_LOCK': Array('miscellaneous-functions', 'function_is_used_lock'), 7463 'IS': Array('comparison-operators', 'operator_is'), 7464 'ISNULL': Array('comparison-operators', 'function_isnull'), 7465 'LAST_DAY': Array('date-and-time-functions', 'function_last_day'), 7466 'LAST_INSERT_ID': Array('information-functions', 'function_last_insert_id'), 7467 'LCASE': Array('string-functions', 'function_lcase'), 7468 'LEAST': Array('comparison-operators', 'function_least'), 7469 'LEFT': Array('string-functions', 'function_left'), 7470 'LENGTH': Array('string-functions', 'function_length'), 7471 'LIKE': Array('string-comparison-functions', 'operator_like'), 7472 'LN': Array('mathematical-functions', 'function_ln'), 7473 'LOAD_FILE': Array('string-functions', 'function_load_file'), 7474 'LOCALTIME': Array('date-and-time-functions', 'function_localtime'), 7475 'LOCALTIMESTAMP': Array('date-and-time-functions', 'function_localtimestamp'), 7476 'LOCATE': Array('string-functions', 'function_locate'), 7477 'LOG10': Array('mathematical-functions', 'function_log10'), 7478 'LOG2': Array('mathematical-functions', 'function_log2'), 7479 'LOG': Array('mathematical-functions', 'function_log'), 7480 'LOWER': Array('string-functions', 'function_lower'), 7481 'LPAD': Array('string-functions', 'function_lpad'), 7482 'LTRIM': Array('string-functions', 'function_ltrim'), 7483 'MAKE_SET': Array('string-functions', 'function_make_set'), 7484 'MAKEDATE': Array('date-and-time-functions', 'function_makedate'), 7485 'MAKETIME': Array('date-and-time-functions', 'function_maketime'), 7486 'MASTER_POS_WAIT': Array('miscellaneous-functions', 'function_master_pos_wait'), 7487 'MATCH': Array('fulltext-search', 'function_match'), 7488 'MAX': Array('group-by-functions', 'function_max'), 7489 'MD5': Array('encryption-functions', 'function_md5'), 7490 'MICROSECOND': Array('date-and-time-functions', 'function_microsecond'), 7491 'MID': Array('string-functions', 'function_mid'), 7492 'MIN': Array('group-by-functions', 'function_min'), 7493 'MINUTE': Array('date-and-time-functions', 'function_minute'), 7494 'MOD': Array('mathematical-functions', 'function_mod'), 7495 'MONTH': Array('date-and-time-functions', 'function_month'), 7496 'MONTHNAME': Array('date-and-time-functions', 'function_monthname'), 7497 'NAME_CONST': Array('miscellaneous-functions', 'function_name_const'), 7498 'NOT': Array('logical-operators', 'operator_not'), 7499 'NOW': Array('date-and-time-functions', 'function_now'), 7500 'NULLIF': Array('control-flow-functions', 'function_nullif'), 7501 'OCT': Array('mathematical-functions', 'function_oct'), 7502 'OCTET_LENGTH': Array('string-functions', 'function_octet_length'), 7503 'OLD_PASSWORD': Array('encryption-functions', 'function_old_password'), 7504 'OR': Array('logical-operators', 'operator_or'), 7505 'ORD': Array('string-functions', 'function_ord'), 7506 'PASSWORD': Array('encryption-functions', 'function_password'), 7507 'PERIOD_ADD': Array('date-and-time-functions', 'function_period_add'), 7508 'PERIOD_DIFF': Array('date-and-time-functions', 'function_period_diff'), 7509 'PI': Array('mathematical-functions', 'function_pi'), 7510 'POSITION': Array('string-functions', 'function_position'), 7511 'POW': Array('mathematical-functions', 'function_pow'), 7512 'POWER': Array('mathematical-functions', 'function_power'),
7513 'QUARTER': Array('date-and-time-functions', 'function_quarter'), 7514 'QUOTE': Array('string-functions', 'function_quote'), 7515 'RADIANS': Array('mathematical-functions', 'function_radians'), 7516 'RAND': Array('mathematical-functions', 'function_rand'), 7517 'REGEXP': Array('regexp', 'operator_regexp'), 7518 'RELEASE_LOCK': Array('miscellaneous-functions', 'function_release_lock'), 7519 'REPEAT': Array('string-functions', 'function_repeat'), 7520 'REVERSE': Array('string-functions', 'function_reverse'), 7521 'RIGHT': Array('string-functions', 'function_right'), 7522 'RLIKE': Array('regexp', 'operator_rlike'), 7523 'ROUND': Array('mathematical-functions', 'function_round'), 7524 'ROW_COUNT': Array('information-functions', 'function_row_count'), 7525 'RPAD': Array('string-functions', 'function_rpad'), 7526 'RTRIM': Array('string-functions', 'function_rtrim'), 7527 'SCHEMA': Array('information-functions', 'function_schema'), 7528 'SEC_TO_TIME': Array('date-and-time-functions', 'function_sec_to_time'), 7529 'SECOND': Array('date-and-time-functions', 'function_second'), 7530 'SESSION_USER': Array('information-functions', 'function_session_user'), 7531 'SHA': Array('encryption-functions', 'function_sha1'), 7532 'SHA1': Array('encryption-functions', 'function_sha1'), 7533 'SIGN': Array('mathematical-functions', 'function_sign'), 7534 'SIN': Array('mathematical-functions', 'function_sin'), 7535 'SLEEP': Array('miscellaneous-functions', 'function_sleep'), 7536 'SOUNDEX': Array('string-functions', 'function_soundex'), 7537 'SPACE': Array('string-functions', 'function_space'), 7538 'SQRT': Array('mathematical-functions', 'function_sqrt'), 7539 'STD': Array('group-by-functions', 'function_std'), 7540 'STDDEV_POP': Array('group-by-functions', 'function_stddev_pop'), 7541 'STDDEV_SAMP': Array('group-by-functions', 'function_stddev_samp'), 7542 'STDDEV': Array('group-by-functions', 'function_stddev'), 7543 'STR_TO_DATE': Array('date-and-time-functions', 'function_str_to_date'), 7544 'STRCMP': Array('string-comparison-functions', 'function_strcmp'), 7545 'SUBDATE': Array('date-and-time-functions', 'function_subdate'), 7546 'SUBSTR': Array('string-functions', 'function_substr'), 7547 'SUBSTRING_INDEX': Array('string-functions', 'function_substring_index'), 7548 'SUBSTRING': Array('string-functions', 'function_substring'), 7549 'SUBTIME': Array('date-and-time-functions', 'function_subtime'), 7550 'SUM': Array('group-by-functions', 'function_sum'), 7551 'SYSDATE': Array('date-and-time-functions', 'function_sysdate'), 7552 'SYSTEM_USER': Array('information-functions', 'function_system_user'), 7553 'TAN': Array('mathematical-functions', 'function_tan'), 7554 'TIME_FORMAT': Array('date-and-time-functions', 'function_time_format'), 7555 'TIME_TO_SEC': Array('date-and-time-functions', 'function_time_to_sec'), 7556 'TIME': Array('date-and-time-functions', 'function_time'), 7557 'TIMEDIFF': Array('date-and-time-functions', 'function_timediff'), 7558 'TIMESTAMP': Array('date-and-time-functions', 'function_timestamp'), 7559 'TIMESTAMPADD': Array('date-and-time-functions', 'function_timestampadd'), 7560 'TIMESTAMPDIFF': Array('date-and-time-functions', 'function_timestampdiff'), 7561 'TO_DAYS': Array('date-and-time-functions', 'function_to_days'), 7562 'TRIM': Array('string-functions', 'function_trim'), 7563 'TRUNCATE': Array('mathematical-functions', 'function_truncate'), 7564 'UCASE': Array('string-functions', 'function_ucase'), 7565 'UNCOMPRESS': Array('encryption-functions', 'function_uncompress'), 7566 'UNCOMPRESSED_LENGTH': Array('encryption-functions', 'function_uncompressed_length'), 7567 'UNHEX': Array('string-functions', 'function_unhex'), 7568 'UNIX_TIMESTAMP': Array('date-and-time-functions', 'function_unix_timestamp'), 7569 'UpdateXML': Array('xml-functions', 'function_updatexml'), 7570 'UPPER': Array('string-functions', 'function_upper'), 7571 'USER': Array('information-functions', 'function_user'), 7572 'UTC_DATE': Array('date-and-time-functions', 'function_utc_date'), 7573 'UTC_TIME': Array('date-and-time-functions', 'function_utc_time'), 7574 'UTC_TIMESTAMP': Array('date-and-time-functions', 'function_utc_timestamp'), 7575 'UUID_SHORT': Array('miscellaneous-functions', 'function_uuid_short'), 7576 'UUID': Array('miscellaneous-functions', 'function_uuid'), 7577 'VALUES': Array('miscellaneous-functions', 'function_values'), 7578 'VAR_POP': Array('group-by-functions', 'function_var_pop'), 7579 'VAR_SAMP': Array('group-by-functions', 'function_var_samp'),
7580 'VARIANCE': Array('group-by-functions', 'function_variance'), 7581 'VERSION': Array('information-functions', 'function_version'), 7582 'WEEK': Array('date-and-time-functions', 'function_week'), 7583 'WEEKDAY': Array('date-and-time-functions', 'function_weekday'), 7584 'WEEKOFYEAR': Array('date-and-time-functions', 'function_weekofyear'), 7585 'XOR': Array('logical-operators', 'operator_xor'), 7586 'YEAR': Array('date-and-time-functions', 'function_year'), 7587 'YEARWEEK': Array('date-and-time-functions', 'function_yearweek'), 7588 'SOUNDS_LIKE': Array('string-functions', 'operator_sounds-like'), 7589 'IS_NOT_NULL': Array('comparison-operators', 'operator_is-not-null'), 7590 'IS_NOT': Array('comparison-operators', 'operator_is-not'), 7591 'IS_NULL': Array('comparison-operators', 'operator_is-null'), 7592 'NOT_LIKE': Array('string-comparison-functions', 'operator_not-like'), 7593 'NOT_REGEXP': Array('regexp', 'operator_not-regexp'), 7594 'COUNT_DISTINCT': Array('group-by-functions', 'function_count-distinct'), 7595 'NOT_IN': Array('comparison-operators', 'function_not-in') 7596}; 7597 7598var mysql_doc_builtin = { 7599 'TINYINT': Array('numeric-types'), 7600 'SMALLINT': Array('numeric-types'), 7601 'MEDIUMINT': Array('numeric-types'), 7602 'INT': Array('numeric-types'), 7603 'BIGINT': Array('numeric-types'), 7604 'DECIMAL': Array('numeric-types'), 7605 'FLOAT': Array('numeric-types'), 7606 'DOUBLE': Array('numeric-types'), 7607 'REAL': Array('numeric-types'), 7608 'BIT': Array('numeric-types'), 7609 'BOOLEAN': Array('numeric-types'), 7610 'SERIAL': Array('numeric-types'), 7611 'DATE': Array('date-and-time-types'), 7612 'DATETIME': Array('date-and-time-types'), 7613 'TIMESTAMP': Array('date-and-time-types'), 7614 'TIME': Array('date-and-time-types'), 7615 'YEAR': Array('date-and-time-types'), 7616 'CHAR': Array('string-types'), 7617 'VARCHAR': Array('string-types'), 7618 'TINYTEXT': Array('string-types'), 7619 'TEXT': Array('string-types'), 7620 'MEDIUMTEXT': Array('string-types'), 7621 'LONGTEXT': Array('string-types'), 7622 'BINARY': Array('string-types'), 7623 'VARBINARY': Array('string-types'), 7624 'TINYBLOB': Array('string-types'), 7625 'MEDIUMBLOB': Array('string-types'), 7626 'BLOB': Array('string-types'), 7627 'LONGBLOB': Array('string-types'), 7628 'ENUM': Array('string-types'), 7629 'SET': Array('string-types') 7630}; 7631; 7632 7633/* vim: set expandtab sw=4 ts=4 sts=4: */ 7634/** 7635 * general function, usually for data manipulation pages 7636 * 7637 */ 7638 7639/** 7640 * @var sql_box_locked lock for the sqlbox textarea in the querybox 7641 */ 7642var sql_box_locked = false; 7643 7644/** 7645 * @var array holds elements which content should only selected once 7646 */ 7647var only_once_elements = []; 7648 7649/** 7650 * @var int ajax_message_count Number of AJAX messages shown since page load 7651 */ 7652var ajax_message_count = 0; 7653 7654/** 7655 * @var codemirror_editor object containing CodeMirror editor of the query editor in SQL tab 7656 */ 7657var codemirror_editor = false; 7658 7659/** 7660 * @var codemirror_editor object containing CodeMirror editor of the inline query editor 7661 */ 7662var codemirror_inline_editor = false; 7663 7664/** 7665 * @var sql_autocomplete_in_progress bool shows if Table/Column name autocomplete AJAX is in progress 7666 */ 7667var sql_autocomplete_in_progress = false; 7668 7669/** 7670 * @var sql_autocomplete object containing list of columns in each table 7671 */ 7672var sql_autocomplete = false; 7673 7674/**
7675 * @var sql_autocomplete_default_table string containing default table to autocomplete columns 7676 */ 7677var sql_autocomplete_default_table = ''; 7678 7679/** 7680 * @var chart_activeTimeouts object active timeouts that refresh the charts. When disabling a realtime chart, this can be used to stop the continuous ajax requests 7681 */ 7682var chart_activeTimeouts = {}; 7683 7684/** 7685 * @var central_column_list array to hold the columns in central list per db. 7686 */ 7687var central_column_list = []; 7688 7689/** 7690 * @var primary_indexes array to hold 'Primary' index columns. 7691 */ 7692var primary_indexes = []; 7693 7694/** 7695 * @var unique_indexes array to hold 'Unique' index columns. 7696 */ 7697var unique_indexes = []; 7698 7699/** 7700 * @var indexes array to hold 'Index' columns. 7701 */ 7702var indexes = []; 7703 7704/** 7705 * @var fulltext_indexes array to hold 'Fulltext' columns. 7706 */ 7707var fulltext_indexes = []; 7708 7709/** 7710 * @var spatial_indexes array to hold 'Spatial' columns. 7711 */ 7712var spatial_indexes = []; 7713 7714/** 7715 * Make sure that ajax requests will not be cached 7716 * by appending a random variable to their parameters 7717 */ 7718$.ajaxPrefilter(function (options, originalOptions, jqXHR) { 7719 var nocache = new Date().getTime() + "" + Math.floor(Math.random() * 1000000); 7720 if (typeof options.data == "string") { 7721 options.data += "&_nocache=" + nocache; 7722 } else if (typeof options.data == "object") { 7723 options.data = $.extend(originalOptions.data, {'_nocache' : nocache}); 7724 } 7725}); 7726 7727/** 7728 * Hanle redirect and reload flags send as part of AJAX requests 7729 * 7730 * @param data ajax response data 7731 */ 7732function PMA_handleRedirectAndReload(data) { 7733 if (parseInt(data.redirect_flag) == 1) { 7734 // add one more GET param to display session expiry msg 7735 if (window.location.href.indexOf('?') === -1) { 7736 window.location.href += '?session_expired=1'; 7737 } else { 7738 window.location.href += '&session_expired=1'; 7739 } 7740 window.location.reload(); 7741 } else if (parseInt(data.reload_flag) == 1) { 7742 // remove the token param and reload 7743 window.location.href = window.location.href.replace(/&?token=[^&#]*/g, ""); 7744 window.location.reload(); 7745 } 7746} 7747 7748/** 7749 * Creates an SQL editor which supports auto completing etc. 7750 * 7751 * @param $textarea jQuery object wrapping the textarea to be made the editor 7752 * @param options optional options for CodeMirror 7753 * @param resize optional resizing ('vertical', 'horizontal', 'both') 7754 */ 7755function PMA_getSQLEditor($textarea, options, resize) { 7756 if ($textarea.length > 0 && typeof CodeMirror !== 'undefined') { 7757 7758 // merge options for CodeMirror 7759 var defaults = { 7760 lineNumbers: true, 7761 matchBrackets: true, 7762 extraKeys: {"Ctrl-Space": "autocomplete"}, 7763 hintOptions: {"completeSingle": false, "completeOnSingleClick": true}, 7764 indentUnit: 4, 7765 mode: "text/x-mysql", 7766 lineWrapping: true 7767 }; 7768 7769 if (CodeMirror.sqlLint) { 7770 $.extend(defaults, { 7771 gutters: ["CodeMirror-lint-markers"], 7772 lint: { 7773 "getAnnotations": CodeMirror.sqlLint, 7774 "async": true, 7775 } 7776 }); 7777 } 7778 7779 $.extend(true, defaults, options); 7780 7781 // create CodeMirror editor 7782 var codemirrorEditor = CodeMirror.fromTextArea($textarea[0], defaults); 7783 // allow resizing 7784 if (! resize) { 7785 resize = 'vertical'; 7786 } 7787 var handles = ''; 7788 if (resize == 'vertical') { 7789 handles = 'n, s'; 7790 } 7791 if (resize == 'both') { 7792 handles = 'all'; 7793 } 7794 if (resize == 'horizontal') { 7795 handles = 'e, w'; 7796 } 7797 $(codemirrorEditor.getWrapperElement()) 7798 .css('resize', resize) 7799 .resizable({ 7800 handles: handles, 7801 resize: function() { 7802 codemirrorEditor.setSize($(this).width(), $(this).height()); 7803 } 7804 }); 7805 // enable autocomplete 7806 codemirrorEditor.on("inputRead", codemirrorAutocompleteOnInputRead); 7807 7808 return codemirrorEditor; 7809 } 7810 return null; 7811} 7812 7813/** 7814 * Clear text selection 7815 */ 7816function PMA_clearSelection() { 7817 if (document.selection && document.selection.empty) { 7818 document.selection.empty(); 7819 } else if (window.getSelection) { 7820 var sel = window.getSelection(); 7821 if (sel.empty) { 7822 sel.empty(); 7823 } 7824 if (sel.removeAllRanges) { 7825 sel.removeAllRanges(); 7826 } 7827 } 7828} 7829 7830/** 7831 * Create a jQuery UI tooltip 7832 * 7833 * @param $elements jQuery object representing the elements 7834 * @param item the item 7835 * (see http://api.jqueryui.com/tooltip/#option-items) 7836 * @param myContent content of the tooltip 7837 * @param additionalOptions to override the default options 7838 * 7839 */ 7840function PMA_tooltip($elements, item, myContent, additionalOptions) 7841{ 7842 if ($('#no_hint').length > 0) { 7843 return; 7844 } 7845 7846 var defaultOptions = { 7847 content: myContent, 7848 items: item, 7849 tooltipClass: "tooltip", 7850 track: true, 7851 show: false, 7852 hide: false 7853 }; 7854 7855 $elements.tooltip($.extend(true, defaultOptions, additionalOptions)); 7856} 7857 7858/** 7859 * HTML escaping 7860 */ 7861 7862function escapeHtml(unsafe) { 7863 if (typeof(unsafe) != 'undefined') { 7864 return unsafe 7865 .toString() 7866 .replace(/&/g, "&") 7867 .replace(/</g, "<") 7868 .replace(/>/g, ">") 7869 .replace(/"/g, """) 7870 .replace(/'/g, "'"); 7871 } else { 7872 return false;
7873 } 7874} 7875 7876function PMA_sprintf() { 7877 return sprintf.apply(this, arguments); 7878} 7879 7880/** 7881 * Hides/shows the default value input field, depending on the default type 7882 * Ticks the NULL checkbox if NULL is chosen as default value. 7883 */ 7884function PMA_hideShowDefaultValue($default_type) 7885{ 7886 if ($default_type.val() == 'USER_DEFINED') { 7887 $default_type.siblings('.default_value').show().focus(); 7888 } else { 7889 $default_type.siblings('.default_value').hide(); 7890 if ($default_type.val() == 'NULL') { 7891 var $null_checkbox = $default_type.closest('tr').find('.allow_null'); 7892 $null_checkbox.prop('checked', true); 7893 } 7894 } 7895} 7896 7897/** 7898 * Hides/shows the input field for column expression based on whether 7899 * VIRTUAL/PERSISTENT is selected 7900 * 7901 * @param $virtuality virtuality dropdown 7902 */ 7903function PMA_hideShowExpression($virtuality) 7904{ 7905 if ($virtuality.val() == '') { 7906 $virtuality.siblings('.expression').hide(); 7907 } else { 7908 $virtuality.siblings('.expression').show(); 7909 } 7910} 7911 7912/** 7913 * Show notices for ENUM columns; add/hide the default value 7914 * 7915 */ 7916function PMA_verifyColumnsProperties() 7917{ 7918 $("select.column_type").each(function () { 7919 PMA_showNoticeForEnum($(this)); 7920 }); 7921 $("select.default_type").each(function () { 7922 PMA_hideShowDefaultValue($(this)); 7923 }); 7924 $('select.virtuality').each(function () { 7925 PMA_hideShowExpression($(this)); 7926 }); 7927} 7928 7929/** 7930 * Add a hidden field to the form to indicate that this will be an 7931 * Ajax request (only if this hidden field does not exist) 7932 * 7933 * @param $form object the form 7934 */ 7935function PMA_prepareForAjaxRequest($form) 7936{ 7937 if (! $form.find('input:hidden').is('#ajax_request_hidden')) { 7938 $form.append('<input type="hidden" id="ajax_request_hidden" name="ajax_request" value="true" />'); 7939 } 7940} 7941 7942/** 7943 * Generate a new password and copy it to the password input areas 7944 * 7945 * @param passwd_form object the form that holds the password fields 7946 * 7947 * @return boolean always true 7948 */ 7949function suggestPassword(passwd_form) 7950{ 7951 // restrict the password to just letters and numbers to avoid problems: 7952 // "editors and viewers regard the password as multiple words and 7953 // things like double click no longer work" 7954 var pwchars = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWYXZ"; 7955 var passwordlength = 16; // do we want that to be dynamic? no, keep it simple :) 7956 var passwd = passwd_form.generated_pw; 7957 var randomWords = new Int32Array(passwordlength); 7958 7959 passwd.value = ''; 7960 7961 // First we're going to try to use a built-in CSPRNG 7962 if (window.crypto && window.crypto.getRandomValues) { 7963 window.crypto.getRandomValues(randomWords); 7964 } 7965 // Because of course IE calls it msCrypto instead of being standard 7966 else if (window.msCrypto && window.msCrypto.getRandomValues) { 7967 window.msCrypto.getRandomValues(randomWords); 7968 } else { 7969 // Fallback to Math.random 7970 for (var i = 0; i < passwordlength; i++) { 7971 randomWords[i] = Math.floor(Math.random() * pwchars.length); 7972 } 7973 } 7974 7975 for (var i = 0; i < passwordlength; i++) { 7976 passwd.value += pwchars.charAt(Math.abs(randomWords[i]) % pwchars.length); 7977 } 7978 7979 passwd_form.text_pma_pw.value = passwd.value; 7980 passwd_form.text_pma_pw2.value = passwd.value; 7981 return true; 7982} 7983 7984/** 7985 * Version string to integer conversion. 7986 */ 7987function parseVersionString(str) 7988{ 7989 if (typeof(str) != 'string') { return false; } 7990 var add = 0; 7991 // Parse possible alpha/beta/rc/ 7992 var state = str.split('-'); 7993 if (state.length >= 2) { 7994 if (state[1].substr(0, 2) == 'rc') { 7995 add = - 20 - parseInt(state[1].substr(2), 10); 7996 } else if (state[1].substr(0, 4) == 'beta') { 7997 add = - 40 - parseInt(state[1].substr(4), 10); 7998 } else if (state[1].substr(0, 5) == 'alpha') { 7999 add = - 60 - parseInt(state[1].substr(5), 10); 8000 } else if (state[1].substr(0, 3) == 'dev') { 8001 /* We don't handle dev, it's git snapshot */ 8002 add = 0; 8003 } 8004 } 8005 // Parse version 8006 var x = str.split('.'); 8007 // Use 0 for non existing parts 8008 var maj = parseInt(x[0], 10) || 0; 8009 var min = parseInt(x[1], 10) || 0; 8010 var pat = parseInt(x[2], 10) || 0; 8011 var hotfix = parseInt(x[3], 10) || 0; 8012 return maj * 100000000 + min * 1000000 + pat * 10000 + hotfix * 100 + add; 8013} 8014 8015/** 8016 * Indicates current available version on main page. 8017 */ 8018function PMA_current_version(data) 8019{ 8020 if (data && data.version && data.date) { 8021 var current = parseVersionString($('span.version').text()); 8022 var latest = parseVersionString(data.version); 8023 var version_information_message = '<span class="latest">' + 8024 PMA_messages.strLatestAvailable + 8025 ' ' + escapeHtml(data.version) + 8026 '</span>'; 8027 if (latest > current) { 8028 var message = PMA_sprintf( 8029 PMA_messages.strNewerVersion, 8030 escapeHtml(data.version), 8031 escapeHtml(data.date) 8032 ); 8033 var htmlClass = 'notice'; 8034 if (Math.floor(latest / 10000) === Math.floor(current / 10000)) { 8035 /* Security update */ 8036 htmlClass = 'error'; 8037 } 8038 $('#newer_version_notice').remove(); 8039 $('#maincontainer').after('<div id="newer_version_notice" class="' + htmlClass + '">' + message + '</div>'); 8040 } 8041 if (latest === current) { 8042 version_information_message = ' (' + PMA_messages.strUpToDate + ')'; 8043 } 8044 var $liPmaVersion = $('#li_pma_version'); 8045 $liPmaVersion.find('span.latest').remove(); 8046 $liPmaVersion.append(version_information_message); 8047 } 8048} 8049 8050/**
8051 * Loads Git revision data from ajax for index.php 8052 */ 8053function PMA_display_git_revision() 8054{ 8055 $('#is_git_revision').remove(); 8056 $('#li_pma_version_git').remove(); 8057 $.get( 8058 "index.php", 8059 { 8060 "server": PMA_commonParams.get('server'), 8061 "token": PMA_commonParams.get('token'), 8062 "git_revision": true, 8063 "ajax_request": true, 8064 "no_debug": true 8065 }, 8066 function (data) { 8067 if (typeof data !== 'undefined' && data.success === true) { 8068 $(data.message).insertAfter('#li_pma_version'); 8069 } 8070 } 8071 ); 8072} 8073 8074/** 8075 * for libraries/display_change_password.lib.php 8076 * libraries/user_password.php 8077 * 8078 */ 8079 8080function displayPasswordGenerateButton() 8081{ 8082 $('#tr_element_before_generate_password').parent().append('<tr class="vmiddle"><td>' + PMA_messages.strGeneratePassword + '</td><td><input type="button" class="button" id="button_generate_password" value="' + PMA_messages.strGenerate + '" onclick="suggestPassword(this.form)" /><input type="text" name="generated_pw" id="generated_pw" /></td></tr>'); 8083 $('#div_element_before_generate_password').parent().append('<div class="item"><label for="button_generate_password">' + PMA_messages.strGeneratePassword + ':</label><span class="options"><input type="button" class="button" id="button_generate_password" value="' + PMA_messages.strGenerate + '" onclick="suggestPassword(this.form)" /></span><input type="text" name="generated_pw" id="generated_pw" /></div>'); 8084} 8085 8086/* 8087 * Adds a date/time picker to an element 8088 * 8089 * @param object $this_element a jQuery object pointing to the element 8090 */ 8091function PMA_addDatepicker($this_element, type, options) 8092{ 8093 var showTimepicker = true; 8094 if (type=="date") { 8095 showTimepicker = false; 8096 } 8097 8098 var defaultOptions = { 8099 showOn: 'button', 8100 buttonImage: themeCalendarImage, // defined in js/messages.php 8101 buttonImageOnly: true, 8102 stepMinutes: 1, 8103 stepHours: 1, 8104 showSecond: true, 8105 showMillisec: true, 8106 showMicrosec: true, 8107 showTimepicker: showTimepicker, 8108 showButtonPanel: false, 8109 dateFormat: 'yy-mm-dd', // yy means year with four digits 8110 timeFormat: 'HH:mm:ss.lc', 8111 constrainInput: false, 8112 altFieldTimeOnly: false, 8113 showAnim: '', 8114 beforeShow: function (input, inst) { 8115 // Remember that we came from the datepicker; this is used 8116 // in tbl_change.js by verificationsAfterFieldChange() 8117 $this_element.data('comes_from', 'datepicker'); 8118 if ($(input).closest('.cEdit').length > 0) { 8119 setTimeout(function () { 8120 inst.dpDiv.css({ 8121 top: 0, 8122 left: 0, 8123 position: 'relative' 8124 }); 8125 }, 0); 8126 } 8127 // Fix wrong timepicker z-index, doesn't work without timeout 8128 setTimeout(function () { 8129 $('#ui-timepicker-div').css('z-index', $('#ui-datepicker-div').css('z-index')); 8130 }, 0); 8131 }, 8132 onSelect: function() { 8133 $this_element.data('datepicker').inline = true; 8134 }, 8135 onClose: function (dateText, dp_inst) { 8136 // The value is no more from the date picker 8137 $this_element.data('comes_from', ''); 8138 if (typeof $this_element.data('datepicker') !== 'undefined') { 8139 $this_element.data('datepicker').inline = false; 8140 } 8141 } 8142 }; 8143 if (type == "datetime" || type == "timestamp") { 8144 $this_element.datetimepicker($.extend(defaultOptions, options)); 8145 } 8146 else if (type == "date") { 8147 $this_element.datetimepicker($.extend(defaultOptions, options)); 8148 } 8149 else if (type == "time") { 8150 $this_element.timepicker($.extend(defaultOptions, options)); 8151 } 8152} 8153 8154/** 8155 * selects the content of a given object, f.e. a textarea 8156 * 8157 * @param element object element of which the content will be selected 8158 * @param lock var variable which holds the lock for this element 8159 * or true, if no lock exists 8160 * @param only_once boolean if true this is only done once 8161 * f.e. only on first focus 8162 */ 8163function selectContent(element, lock, only_once) 8164{ 8165 if (only_once && only_once_elements[element.name]) { 8166 return; 8167 } 8168 8169 only_once_elements[element.name] = true; 8170 8171 if (lock) { 8172 return; 8173 } 8174 8175 element.select(); 8176} 8177 8178/**
8179 * Displays a confirmation box before submitting a "DROP/DELETE/ALTER" query. 8180 * This function is called while clicking links 8181 * 8182 * @param theLink object the link 8183 * @param theSqlQuery object the sql query to submit 8184 * 8185 * @return boolean whether to run the query or not 8186 */ 8187function confirmLink(theLink, theSqlQuery) 8188{ 8189 // Confirmation is not required in the configuration file 8190 // or browser is Opera (crappy js implementation) 8191 if (PMA_messages.strDoYouReally === '' || typeof(window.opera) != 'undefined') { 8192 return true; 8193 } 8194 8195 var is_confirmed = confirm(PMA_sprintf(PMA_messages.strDoYouReally, theSqlQuery)); 8196 if (is_confirmed) { 8197 if ($(theLink).hasClass('formLinkSubmit')) { 8198 var name = 'is_js_confirmed'; 8199 if ($(theLink).attr('href').indexOf('usesubform') != -1) { 8200 name = 'subform[' + $(theLink).attr('href').substr('#').match(/usesubform\[(\d+)\]/i)[1] + '][is_js_confirmed]'; 8201 } 8202 8203 $(theLink).parents('form').append('<input type="hidden" name="' + name + '" value="1" />'); 8204 } else if (typeof(theLink.href) != 'undefined') { 8205 theLink.href += '&is_js_confirmed=1'; 8206 } else if (typeof(theLink.form) != 'undefined') { 8207 theLink.form.action += '?is_js_confirmed=1'; 8208 } 8209 } 8210 8211 return is_confirmed; 8212} // end of the 'confirmLink()' function 8213 8214/** 8215 * Displays an error message if a "DROP DATABASE" statement is submitted 8216 * while it isn't allowed, else confirms a "DROP/DELETE/ALTER" query before 8217 * submitting it if required. 8218 * This function is called by the 'checkSqlQuery()' js function. 8219 * 8220 * @param theForm1 object the form 8221 * @param sqlQuery1 object the sql query textarea 8222 * 8223 * @return boolean whether to run the query or not 8224 * 8225 * @see checkSqlQuery() 8226 */ 8227function confirmQuery(theForm1, sqlQuery1) 8228{ 8229 // Confirmation is not required in the configuration file 8230 if (PMA_messages.strDoYouReally === '') { 8231 return true; 8232 } 8233 8234 // "DROP DATABASE" statement isn't allowed 8235 if (PMA_messages.strNoDropDatabases !== '') { 8236 var drop_re = new RegExp('(^|;)\\s*DROP\\s+(IF EXISTS\\s+)?DATABASE\\s', 'i'); 8237 if (drop_re.test(sqlQuery1.value)) { 8238 alert(PMA_messages.strNoDropDatabases); 8239 theForm1.reset(); 8240 sqlQuery1.focus(); 8241 return false; 8242 } // end if 8243 } // end if 8244 8245 // Confirms a "DROP/DELETE/ALTER/TRUNCATE" statement 8246 //
8247 // TODO: find a way (if possible) to use the parser-analyser 8248 // for this kind of verification 8249 // For now, I just added a ^ to check for the statement at 8250 // beginning of expression 8251 8252 var do_confirm_re_0 = new RegExp('^\\s*DROP\\s+(IF EXISTS\\s+)?(TABLE|DATABASE|PROCEDURE)\\s', 'i'); 8253 var do_confirm_re_1 = new RegExp('^\\s*ALTER\\s+TABLE\\s+((`[^`]+`)|([A-Za-z0-9_$]+))\\s+DROP\\s', 'i'); 8254 var do_confirm_re_2 = new RegExp('^\\s*DELETE\\s+FROM\\s', 'i'); 8255 var do_confirm_re_3 = new RegExp('^\\s*TRUNCATE\\s', 'i'); 8256 8257 if (do_confirm_re_0.test(sqlQuery1.value) || 8258 do_confirm_re_1.test(sqlQuery1.value) || 8259 do_confirm_re_2.test(sqlQuery1.value) || 8260 do_confirm_re_3.test(sqlQuery1.value)) { 8261 var message; 8262 if (sqlQuery1.value.length > 100) { 8263 message = sqlQuery1.value.substr(0, 100) + '\n ...'; 8264 } else { 8265 message = sqlQuery1.value; 8266 } 8267 var is_confirmed = confirm(PMA_sprintf(PMA_messages.strDoYouReally, message)); 8268 // statement is confirmed -> update the 8269 // "is_js_confirmed" form field so the confirm test won't be 8270 // run on the server side and allows to submit the form 8271 if (is_confirmed) { 8272 theForm1.elements.is_js_confirmed.value = 1; 8273 return true; 8274 } 8275 // statement is rejected -> do not submit the form 8276 else { 8277 window.focus(); 8278 sqlQuery1.focus(); 8279 return false; 8280 } // end if (handle confirm box result) 8281 } // end if (display confirm box) 8282 8283 return true; 8284} // end of the 'confirmQuery()' function 8285 8286/** 8287 * Displays an error message if the user submitted the sql query form with no 8288 * sql query, else checks for "DROP/DELETE/ALTER" statements 8289 * 8290 * @param theForm object the form 8291 * 8292 * @return boolean always false 8293 * 8294 * @see confirmQuery() 8295 */ 8296function checkSqlQuery(theForm) 8297{ 8298 // get the textarea element containing the query 8299 var sqlQuery; 8300 if (codemirror_editor) { 8301 codemirror_editor.save(); 8302 sqlQuery = codemirror_editor.getValue(); 8303 } else { 8304 sqlQuery = theForm.elements.sql_query.value; 8305 } 8306 var isEmpty = 1; 8307 var space_re = new RegExp('\\s+'); 8308 if (typeof(theForm.elements.sql_file) != 'undefined' && 8309 theForm.elements.sql_file.value.replace(space_re, '') !== '') { 8310 return true; 8311 } 8312 if (isEmpty && typeof(theForm.elements.id_bookmark) != 'undefined' && 8313 (theForm.elements.id_bookmark.value !== null || theForm.elements.id_bookmark.value !== '') && 8314 theForm.elements.id_bookmark.selectedIndex !== 0) { 8315 return true; 8316 } 8317 // Checks for "DROP/DELETE/ALTER" statements 8318 if (sqlQuery.replace(space_re, '') !== '') { 8319 return confirmQuery(theForm, sqlQuery); 8320 } 8321 theForm.reset(); 8322 isEmpty = 1; 8323 8324 if (isEmpty) { 8325 alert(PMA_messages.strFormEmpty); 8326 codemirror_editor.focus(); 8327 return false; 8328 } 8329 8330 return true; 8331} // end of the 'checkSqlQuery()' function 8332 8333/** 8334 * Check if a form's element is empty. 8335 * An element containing only spaces is also considered empty 8336 * 8337 * @param object the form 8338 * @param string the name of the form field to put the focus on 8339 * 8340 * @return boolean whether the form field is empty or not 8341 */ 8342function emptyCheckTheField(theForm, theFieldName) 8343{ 8344 var theField = theForm.elements[theFieldName]; 8345 var space_re = new RegExp('\\s+'); 8346 return theField.value.replace(space_re, '') === ''; 8347} // end of the 'emptyCheckTheField()' function 8348 8349/** 8350 * Ensures a value submitted in a form is numeric and is in a range 8351 * 8352 * @param object the form 8353 * @param string the name of the form field to check 8354 * @param integer the minimum authorized value 8355 * @param integer the maximum authorized value 8356 * 8357 * @return boolean whether a valid number has been submitted or not 8358 */ 8359function checkFormElementInRange(theForm, theFieldName, message, min, max) 8360{ 8361 var theField = theForm.elements[theFieldName]; 8362 var val = parseInt(theField.value, 10); 8363 8364 if (typeof(min) == 'undefined') { 8365 min = 0; 8366 } 8367 if (typeof(max) == 'undefined') { 8368 max = Number.MAX_VALUE; 8369 } 8370 8371 // It's not a number 8372 if (isNaN(val)) { 8373 theField.select(); 8374 alert(PMA_messages.strEnterValidNumber); 8375 theField.focus(); 8376 return false;
8377 } 8378 // It's a number but it is not between min and max 8379 else if (val < min || val > max) { 8380 theField.select(); 8381 alert(PMA_sprintf(message, val)); 8382 theField.focus(); 8383 return false; 8384 } 8385 // It's a valid number 8386 else { 8387 theField.value = val; 8388 } 8389 return true; 8390 8391} // end of the 'checkFormElementInRange()' function 8392 8393 8394function checkTableEditForm(theForm, fieldsCnt) 8395{ 8396 // TODO: avoid sending a message if user just wants to add a line 8397 // on the form but has not completed at least one field name 8398 8399 var atLeastOneField = 0; 8400 var i, elm, elm2, elm3, val, id; 8401 8402 for (i = 0; i < fieldsCnt; i++) { 8403 id = "#field_" + i + "_2"; 8404 elm = $(id); 8405 val = elm.val(); 8406 if (val == 'VARCHAR' || val == 'CHAR' || val == 'BIT' || val == 'VARBINARY' || val == 'BINARY') { 8407 elm2 = $("#field_" + i + "_3"); 8408 val = parseInt(elm2.val(), 10); 8409 elm3 = $("#field_" + i + "_1"); 8410 if (isNaN(val) && elm3.val() !== "") { 8411 elm2.select(); 8412 alert(PMA_messages.strEnterValidLength); 8413 elm2.focus(); 8414 return false; 8415 } 8416 } 8417 8418 if (atLeastOneField === 0) { 8419 id = "field_" + i + "_1"; 8420 if (!emptyCheckTheField(theForm, id)) { 8421 atLeastOneField = 1; 8422 } 8423 } 8424 } 8425 if (atLeastOneField === 0) { 8426 var theField = theForm.elements.field_0_1; 8427 alert(PMA_messages.strFormEmpty); 8428 theField.focus(); 8429 return false; 8430 } 8431 8432 // at least this section is under jQuery 8433 var $input = $("input.textfield[name='table']"); 8434 if ($input.val() === "") { 8435 alert(PMA_messages.strFormEmpty); 8436 $input.focus(); 8437 return false; 8438 } 8439 8440 return true; 8441} // enf of the 'checkTableEditForm()' function 8442 8443/** 8444 * True if last click is to check a row. 8445 */ 8446var last_click_checked = false; 8447 8448/** 8449 * Zero-based index of last clicked row. 8450 * Used to handle the shift + click event in the code above. 8451 */ 8452var last_clicked_row = -1; 8453 8454/** 8455 * Zero-based index of last shift clicked row. 8456 */ 8457var last_shift_clicked_row = -1; 8458 8459var _idleSecondsCounter = 0; 8460var IncInterval; 8461var updateTimeout; 8462AJAX.registerTeardown('functions.js', function () { 8463 clearTimeout(updateTimeout); 8464 clearInterval(IncInterval); 8465 $(document).off('mousemove'); 8466}); 8467 8468AJAX.registerOnload('functions.js', function () { 8469 document.onclick = function() { 8470 _idleSecondsCounter = 0; 8471 }; 8472 $(document).on('mousemove',function() { 8473 _idleSecondsCounter = 0; 8474 }); 8475 document.onkeypress = function() { 8476 _idleSecondsCounter = 0; 8477 }; 8478 8479 function SetIdleTime() { 8480 _idleSecondsCounter++; 8481 } 8482 function UpdateIdleTime() { 8483 var href = 'index.php'; 8484 var params = { 8485 'ajax_request' : true, 8486 'token' : PMA_commonParams.get('token'), 8487 'server' : PMA_commonParams.get('server'), 8488 'db' : PMA_commonParams.get('db'), 8489 'access_time':_idleSecondsCounter 8490 }; 8491 $.ajax({ 8492 type: 'POST', 8493 url: href, 8494 data: params, 8495 success: function (data) { 8496 if (data.success) { 8497 if (PMA_commonParams.get('LoginCookieValidity')-_idleSecondsCounter > 5) { 8498 var interval = (PMA_commonParams.get('LoginCookieValidity') - _idleSecondsCounter - 5) * 1000; 8499 if (interval > Math.pow(2, 31) - 1) { // max value for setInterval() function 8500 interval = Math.pow(2, 31) - 1; 8501 } 8502 updateTimeout = window.setTimeout(UpdateIdleTime, interval); 8503 } else { 8504 updateTimeout = window.setTimeout(UpdateIdleTime, 2000); 8505 } 8506 } else { //timeout occurred 8507 window.location.reload(true); 8508 clearInterval(IncInterval); 8509 } 8510 } 8511 }); 8512 } 8513 if (PMA_commonParams.get('logged_in') && PMA_commonParams.get('auth_type') == 'cookie') { 8514 IncInterval = window.setInterval(SetIdleTime, 1000); 8515 var interval = (PMA_commonParams.get('LoginCookieValidity') - 5) * 1000; 8516 if (interval > Math.pow(2, 31) - 1) { // max value for setInterval() function 8517 interval = Math.pow(2, 31) - 1; 8518 } 8519 updateTimeout = window.setTimeout(UpdateIdleTime, interval); 8520 } 8521}); 8522/** 8523 * Unbind all event handlers before tearing down a page 8524 */ 8525AJAX.registerTeardown('functions.js', function () { 8526 $(document).off('click', 'input:checkbox.checkall'); 8527}); 8528AJAX.registerOnload('functions.js', function () { 8529 /** 8530 * Row marking in horizontal mode (use "on" so that it works also for 8531 * next pages reached via AJAX); a tr may have the class noclick to remove 8532 * this behavior. 8533 */ 8534 8535 $(document).on('click', 'input:checkbox.checkall', function (e) { 8536 $this = $(this); 8537 var $tr = $this.closest('tr'); 8538 var $table = $this.closest('table'); 8539 8540 if (!e.shiftKey || last_clicked_row == -1) { 8541 // usual click 8542 8543 var $checkbox = $tr.find(':checkbox.checkall'); 8544 var checked = $this.prop('checked'); 8545 $checkbox.prop('checked', checked).trigger('change'); 8546 if (checked) { 8547 $tr.addClass('marked'); 8548 } else { 8549 $tr.removeClass('marked'); 8550 } 8551 last_click_checked = checked; 8552 8553 // remember the last clicked row 8554 last_clicked_row = last_click_checked ? $table.find('tr.odd:not(.noclick), tr.even:not(.noclick)').index($tr) : -1;
8555 last_shift_clicked_row = -1; 8556 } else { 8557 // handle the shift click 8558 PMA_clearSelection(); 8559 var start, end; 8560 8561 // clear last shift click result 8562 if (last_shift_clicked_row >= 0) { 8563 if (last_shift_clicked_row >= last_clicked_row) { 8564 start = last_clicked_row; 8565 end = last_shift_clicked_row; 8566 } else { 8567 start = last_shift_clicked_row; 8568 end = last_clicked_row; 8569 } 8570 $tr.parent().find('tr.odd:not(.noclick), tr.even:not(.noclick)') 8571 .slice(start, end + 1) 8572 .removeClass('marked') 8573 .find(':checkbox') 8574 .prop('checked', false) 8575 .trigger('change'); 8576 } 8577 8578 // handle new shift click 8579 var curr_row = $table.find('tr.odd:not(.noclick), tr.even:not(.noclick)').index($tr); 8580 if (curr_row >= last_clicked_row) { 8581 start = last_clicked_row; 8582 end = curr_row; 8583 } else { 8584 start = curr_row; 8585 end = last_clicked_row; 8586 } 8587 $tr.parent().find('tr.odd:not(.noclick), tr.even:not(.noclick)') 8588 .slice(start, end + 1) 8589 .addClass('marked') 8590 .find(':checkbox') 8591 .prop('checked', true) 8592 .trigger('change'); 8593 8594 // remember the last shift clicked row 8595 last_shift_clicked_row = curr_row; 8596 } 8597 }); 8598 8599 addDateTimePicker(); 8600 8601 /** 8602 * Add attribute to text boxes for iOS devices (based on bugID: 3508912) 8603 */ 8604 if (navigator.userAgent.match(/(iphone|ipod|ipad)/i)) { 8605 $('input[type=text]').attr('autocapitalize', 'off').attr('autocorrect', 'off'); 8606 } 8607}); 8608 8609/** 8610 * Row highlighting in horizontal mode (use "on" 8611 * so that it works also for pages reached via AJAX) 8612 */ 8613/*AJAX.registerOnload('functions.js', function () { 8614 $(document).on('hover', 'tr.odd, tr.even',function (event) { 8615 var $tr = $(this); 8616 $tr.toggleClass('hover',event.type=='mouseover'); 8617 $tr.children().toggleClass('hover',event.type=='mouseover'); 8618 }); 8619})*/ 8620 8621/** 8622 * This array is used to remember mark status of rows in browse mode 8623 */ 8624var marked_row = []; 8625 8626/** 8627 * marks all rows and selects its first checkbox inside the given element 8628 * the given element is usually a table or a div containing the table or tables 8629 * 8630 * @param container DOM element 8631 */ 8632function markAllRows(container_id) 8633{ 8634 8635 $("#" + container_id).find("input:checkbox:enabled").prop('checked', true) 8636 .trigger("change") 8637 .parents("tr").addClass("marked"); 8638 return true; 8639} 8640 8641/** 8642 * marks all rows and selects its first checkbox inside the given element 8643 * the given element is usually a table or a div containing the table or tables 8644 * 8645 * @param container DOM element 8646 */ 8647function unMarkAllRows(container_id) 8648{ 8649 8650 $("#" + container_id).find("input:checkbox:enabled").prop('checked', false) 8651 .trigger("change") 8652 .parents("tr").removeClass("marked"); 8653 return true; 8654} 8655 8656/** 8657 * Checks/unchecks all checkbox in given container (f.e. a form, fieldset or div) 8658 * 8659 * @param string container_id the container id 8660 * @param boolean state new value for checkbox (true or false) 8661 * @return boolean always true 8662 */ 8663function setCheckboxes(container_id, state) 8664{ 8665 8666 $("#" + container_id).find("input:checkbox").prop('checked', state); 8667 return true; 8668} // end of the 'setCheckboxes()' function 8669 8670/** 8671 * Checks/unchecks all options of a <select> element 8672 * 8673 * @param string the form name 8674 * @param string the element name 8675 * @param boolean whether to check or to uncheck options 8676 * 8677 * @return boolean always true 8678 */ 8679function setSelectOptions(the_form, the_select, do_check) 8680{ 8681 $("form[name='" + the_form + "'] select[name='" + the_select + "']").find("option").prop('selected', do_check); 8682 return true; 8683} // end of the 'setSelectOptions()' function 8684 8685/** 8686 * Sets current value for query box. 8687 */ 8688function setQuery(query) 8689{ 8690 if (codemirror_editor) { 8691 codemirror_editor.setValue(query); 8692 codemirror_editor.focus(); 8693 } else { 8694 document.sqlform.sql_query.value = query; 8695 document.sqlform.sql_query.focus(); 8696 } 8697} 8698 8699/** 8700 * Handles 'Simulate query' button on SQL query box. 8701 * 8702 * @return void 8703 */ 8704function PMA_handleSimulateQueryButton() 8705{ 8706 var update_re = new RegExp('^\\s*UPDATE\\s+((`[^`]+`)|([A-Za-z0-9_$]+))\\s+SET\\s', 'i'); 8707 var delete_re = new RegExp('^\\s*DELETE\\s+FROM\\s', 'i'); 8708 var query = ''; 8709 8710 if (codemirror_editor) { 8711 query = codemirror_editor.getValue(); 8712 } else { 8713 query = $('#sqlquery').val(); 8714 } 8715 8716 var $simulateDml = $('#simulate_dml'); 8717 if (update_re.test(query) || delete_re.test(query)) { 8718 if (! $simulateDml.length) { 8719 $('#button_submit_query') 8720 .before('<input type="button" id="simulate_dml"' + 8721 'tabindex="199" value="' + 8722 PMA_messages.strSimulateDML + 8723 '" />'); 8724 } 8725 } else { 8726 if ($simulateDml.length) { 8727 $simulateDml.remove(); 8728 } 8729 } 8730} 8731 8732/** 8733 * Create quick sql statements. 8734 * 8735 */ 8736function insertQuery(queryType) 8737{ 8738 if (queryType == "clear") { 8739 setQuery(''); 8740 return; 8741 } else if (queryType == "format") { 8742 if (codemirror_editor) { 8743 $('#querymessage').html(PMA_messages.strFormatting + 8744 ' <img class="ajaxIcon" src="' + 8745 pmaThemeImage + 'ajax_clock_small.gif" alt="">'); 8746 var href = 'db_sql_format.php'; 8747 var params = { 8748 'ajax_request': true, 8749 'token': PMA_commonParams.get('token'), 8750 'sql': codemirror_editor.getValue() 8751 }; 8752 $.ajax({ 8753 type: 'POST', 8754 url: href, 8755 data: params, 8756 success: function (data) { 8757 if (data.success) { 8758 codemirror_editor.setValue(data.sql); 8759 } 8760 $('#querymessage').html(''); 8761 } 8762 }); 8763 } 8764 return; 8765 } else if (queryType == "saved") { 8766 if ($.cookie('auto_saved_sql')) { 8767 setQuery($.cookie('auto_saved_sql')); 8768 } else { 8769 PMA_ajaxShowMessage(PMA_messages.strNoAutoSavedQuery); 8770 } 8771 return; 8772 } 8773 8774 var query = ""; 8775 var myListBox = document.sqlform.dummy; 8776 var table = document.sqlform.table.value; 8777 8778 if (myListBox.options.length > 0) { 8779 sql_box_locked = true; 8780 var columnsList = ""; 8781 var valDis = "";
8782 var editDis = ""; 8783 var NbSelect = 0; 8784 for (var i = 0; i < myListBox.options.length; i++) { 8785 NbSelect++; 8786 if (NbSelect > 1) { 8787 columnsList += ", "; 8788 valDis += ","; 8789 editDis += ","; 8790 } 8791 columnsList += myListBox.options[i].value; 8792 valDis += "[value-" + NbSelect + "]"; 8793 editDis += myListBox.options[i].value + "=[value-" + NbSelect + "]"; 8794 } 8795 if (queryType == "selectall") { 8796 query = "SELECT * FROM `" + table + "` WHERE 1"; 8797 } else if (queryType == "select") { 8798 query = "SELECT " + columnsList + " FROM `" + table + "` WHERE 1"; 8799 } else if (queryType == "insert") { 8800 query = "INSERT INTO `" + table + "`(" + columnsList + ") VALUES (" + valDis + ")"; 8801 } else if (queryType == "update") { 8802 query = "UPDATE `" + table + "` SET " + editDis + " WHERE 1"; 8803 } else if (queryType == "delete") { 8804 query = "DELETE FROM `" + table + "` WHERE 1"; 8805 } 8806 setQuery(query); 8807 sql_box_locked = false; 8808 } 8809} 8810 8811 8812/** 8813 * Inserts multiple fields. 8814 * 8815 */ 8816function insertValueQuery() 8817{ 8818 var myQuery = document.sqlform.sql_query; 8819 var myListBox = document.sqlform.dummy; 8820 8821 if (myListBox.options.length > 0) { 8822 sql_box_locked = true; 8823 var columnsList = ""; 8824 var NbSelect = 0; 8825 for (var i = 0; i < myListBox.options.length; i++) { 8826 if (myListBox.options[i].selected) { 8827 NbSelect++; 8828 if (NbSelect > 1) { 8829 columnsList += ", "; 8830 } 8831 columnsList += myListBox.options[i].value; 8832 } 8833 } 8834 8835 /* CodeMirror support */ 8836 if (codemirror_editor) { 8837 codemirror_editor.replaceSelection(columnsList); 8838 //IE support 8839 } else if (document.selection) { 8840 myQuery.focus(); 8841 var sel = document.selection.createRange(); 8842 sel.text = columnsList; 8843 document.sqlform.insert.focus(); 8844 } 8845 //MOZILLA/NETSCAPE support 8846 else if (document.sqlform.sql_query.selectionStart || document.sqlform.sql_query.selectionStart == "0") { 8847 var startPos = document.sqlform.sql_query.selectionStart; 8848 var endPos = document.sqlform.sql_query.selectionEnd; 8849 var SqlString = document.sqlform.sql_query.value; 8850 8851 myQuery.value = SqlString.substring(0, startPos) + columnsList + SqlString.substring(endPos, SqlString.length); 8852 } else { 8853 myQuery.value += columnsList; 8854 } 8855 sql_box_locked = false; 8856 } 8857} 8858 8859/** 8860 * Updates the input fields for the parameters based on the query 8861 */ 8862function updateQueryParameters() { 8863 8864 if ($('#parameterized').is(':checked')) { 8865 var query = codemirror_editor ? codemirror_editor.getValue() : $('#sqlquery').val(); 8866 8867 var allParameters = query.match(/:[a-zA-Z0-9_]+/g); 8868 var parameters = []; 8869 // get unique parameters 8870 if (allParameters) { 8871 $.each(allParameters, function(i, parameter){ 8872 if ($.inArray(parameter, parameters) === -1) { 8873 parameters.push(parameter); 8874 } 8875 }); 8876 } 8877 8878 var $temp = $('<div />'); 8879 $temp.append($('#parametersDiv').children()); 8880 $('#parametersDiv').empty(); 8881 8882 $.each(parameters, function (i, parameter) { 8883 var paramName = parameter.substring(1); 8884 var $param = $temp.find('#paramSpan_' + paramName ); 8885 if (! $param.length) { 8886 $param = $('<span class="parameter" id="paramSpan_' + paramName + '" />'); 8887 $('<label for="param_' + paramName + '" />').text(parameter).appendTo($param); 8888 $('<input type="text" name="parameters[' + parameter + ']" id="param_' + paramName + '" />').appendTo($param); 8889 } 8890 $('#parametersDiv').append($param); 8891 }); 8892 } else { 8893 $('#parametersDiv').empty(); 8894 } 8895} 8896 8897/** 8898 * Add a date/time picker to each element that needs it 8899 * (only when jquery-ui-timepicker-addon.js is loaded) 8900 */ 8901function addDateTimePicker() { 8902 if ($.timepicker !== undefined) { 8903 $('input.timefield, input.datefield, input.datetimefield').each(function () { 8904 8905 var decimals = $(this).parent().attr('data-decimals'); 8906 var type = $(this).parent().attr('data-type'); 8907 8908 var showMillisec = false;
8909 var showMicrosec = false; 8910 var timeFormat = 'HH:mm:ss'; 8911 // check for decimal places of seconds 8912 if (decimals > 0 && type.indexOf('time') != -1){ 8913 if (decimals > 3) { 8914 showMillisec = true; 8915 showMicrosec = true; 8916 timeFormat = 'HH:mm:ss.lc'; 8917 } else { 8918 showMillisec = true; 8919 timeFormat = 'HH:mm:ss.l'; 8920 } 8921 } 8922 PMA_addDatepicker($(this), type, { 8923 showMillisec: showMillisec, 8924 showMicrosec: showMicrosec, 8925 timeFormat: timeFormat 8926 }); 8927 }); 8928 } 8929} 8930 8931/** 8932 * Refresh/resize the WYSIWYG scratchboard 8933 */ 8934function refreshLayout() 8935{ 8936 var $elm = $('#pdflayout'); 8937 var orientation = $('#orientation_opt').val(); 8938 var paper = 'A4'; 8939 var $paperOpt = $('#paper_opt'); 8940 if ($paperOpt.length == 1) { 8941 paper = $paperOpt.val(); 8942 } 8943 var posa = 'y'; 8944 var posb = 'x'; 8945 if (orientation == 'P') { 8946 posa = 'x'; 8947 posb = 'y'; 8948 } 8949 $elm.css('width', pdfPaperSize(paper, posa) + 'px'); 8950 $elm.css('height', pdfPaperSize(paper, posb) + 'px'); 8951} 8952 8953/** 8954 * Initializes positions of elements. 8955 */ 8956function TableDragInit() { 8957 $('.pdflayout_table').each(function () { 8958 var $this = $(this); 8959 var number = $this.data('number'); 8960 var x = $('#c_table_' + number + '_x').val(); 8961 var y = $('#c_table_' + number + '_y').val(); 8962 $this.css('left', x + 'px'); 8963 $this.css('top', y + 'px'); 8964 /* Make elements draggable */ 8965 $this.draggable({ 8966 containment: "parent", 8967 drag: function (evt, ui) { 8968 var number = $this.data('number'); 8969 $('#c_table_' + number + '_x').val(parseInt(ui.position.left, 10)); 8970 $('#c_table_' + number + '_y').val(parseInt(ui.position.top, 10)); 8971 } 8972 }); 8973 }); 8974} 8975 8976/** 8977 * Resets drag and drop positions. 8978 */ 8979function resetDrag() { 8980 $('.pdflayout_table').each(function () { 8981 var $this = $(this); 8982 var x = $this.data('x'); 8983 var y = $this.data('y'); 8984 $this.css('left', x + 'px'); 8985 $this.css('top', y + 'px'); 8986 }); 8987} 8988 8989/** 8990 * User schema handlers. 8991 */ 8992$(function () { 8993 /* Move in scratchboard on manual change */ 8994 $(document).on('change', '.position-change', function () { 8995 var $this = $(this); 8996 var $elm = $('#table_' + $this.data('number')); 8997 $elm.css($this.data('axis'), $this.val() + 'px'); 8998 }); 8999 /* Refresh on paper size/orientation change */ 9000 $(document).on('change', '.paper-change', function () { 9001 var $elm = $('#pdflayout'); 9002 if ($elm.css('visibility') == 'visible') { 9003 refreshLayout(); 9004 TableDragInit(); 9005 } 9006 }); 9007 /* Show/hide the WYSIWYG scratchboard */ 9008 $(document).on('click', '#toggle-dragdrop', function () { 9009 var $elm = $('#pdflayout'); 9010 if ($elm.css('visibility') == 'hidden') { 9011 refreshLayout(); 9012 TableDragInit(); 9013 $elm.css('visibility', 'visible'); 9014 $elm.css('display', 'block'); 9015 $('#showwysiwyg').val('1'); 9016 } else { 9017 $elm.css('visibility', 'hidden'); 9018 $elm.css('display', 'none'); 9019 $('#showwysiwyg').val('0'); 9020 } 9021 }); 9022 /* Reset scratchboard */ 9023 $(document).on('click', '#reset-dragdrop', function () { 9024 resetDrag(); 9025 }); 9026}); 9027 9028/** 9029 * Returns paper sizes for a given format 9030 */ 9031function pdfPaperSize(format, axis) 9032{ 9033 switch (format.toUpperCase()) { 9034 case '4A0': 9035 if (axis == 'x') { 9036 return 4767.87; 9037 } else { 9038 return 6740.79; 9039 } 9040 break; 9041 case '2A0': 9042 if (axis == 'x') { 9043 return 3370.39; 9044 } else { 9045 return 4767.87; 9046 } 9047 break; 9048 case 'A0': 9049 if (axis == 'x') { 9050 return 2383.94; 9051 } else { 9052 return 3370.39; 9053 } 9054 break; 9055 case 'A1': 9056 if (axis == 'x') { 9057 return 1683.78; 9058 } else { 9059 return 2383.94; 9060 } 9061 break; 9062 case 'A2': 9063 if (axis == 'x') { 9064 return 1190.55; 9065 } else { 9066 return 1683.78; 9067 } 9068 break; 9069 case 'A3': 9070 if (axis == 'x') { 9071 return 841.89; 9072 } else { 9073 return 1190.55; 9074 } 9075 break; 9076 case 'A4': 9077 if (axis == 'x') { 9078 return 595.28; 9079 } else { 9080 return 841.89; 9081 } 9082 break; 9083 case 'A5': 9084 if (axis == 'x') { 9085 return 419.53; 9086 } else { 9087 return 595.28; 9088 } 9089 break; 9090 case 'A6': 9091 if (axis == 'x') { 9092 return 297.64; 9093 } else { 9094 return 419.53; 9095 } 9096 break; 9097 case 'A7': 9098 if (axis == 'x') { 9099 return 209.76; 9100 } else { 9101 return 297.64; 9102 } 9103 break; 9104 case 'A8': 9105 if (axis == 'x') { 9106 return 147.40; 9107 } else { 9108 return 209.76; 9109 } 9110 break; 9111 case 'A9': 9112 if (axis == 'x') { 9113 return 104.88; 9114 } else { 9115 return 147.40; 9116 } 9117 break; 9118 case 'A10': 9119 if (axis == 'x') { 9120 return 73.70; 9121 } else { 9122 return 104.88; 9123 } 9124 break; 9125 case 'B0': 9126 if (axis == 'x') { 9127 return 2834.65; 9128 } else { 9129 return 4008.19; 9130 } 9131 break; 9132 case 'B1': 9133 if (axis == 'x') { 9134 return 2004.09; 9135 } else { 9136 return 2834.65; 9137 } 9138 break; 9139 case 'B2': 9140 if (axis == 'x') { 9141 return 1417.32; 9142 } else { 9143 return 2004.09; 9144 } 9145 break; 9146 case 'B3': 9147 if (axis == 'x') { 9148 return 1000.63; 9149 } else { 9150 return 1417.32; 9151 } 9152 break; 9153 case 'B4': 9154 if (axis == 'x') { 9155 return 708.66; 9156 } else { 9157 return 1000.63; 9158 } 9159 break; 9160 case 'B5': 9161 if (axis == 'x') { 9162 return 498.90; 9163 } else { 9164 return 708.66; 9165 } 9166 break; 9167 case 'B6': 9168 if (axis == 'x') { 9169 return 354.33; 9170 } else { 9171 return 498.90; 9172 } 9173 break; 9174 case 'B7': 9175 if (axis == 'x') { 9176 return 249.45; 9177 } else { 9178 return 354.33; 9179 } 9180 break; 9181 case 'B8': 9182 if (axis == 'x') { 9183 return 175.75; 9184 } else { 9185 return 249.45; 9186 } 9187 break; 9188 case 'B9': 9189 if (axis == 'x') { 9190 return 124.72; 9191 } else { 9192 return 175.75; 9193 } 9194 break; 9195 case 'B10': 9196 if (axis == 'x') { 9197 return 87.87; 9198 } else { 9199 return 124.72; 9200 } 9201 break; 9202 case 'C0': 9203 if (axis == 'x') { 9204 return 2599.37; 9205 } else { 9206 return 3676.54; 9207 } 9208 break; 9209 case 'C1': 9210 if (axis == 'x') { 9211 return 1836.85; 9212 } else { 9213 return 2599.37; 9214 } 9215 break; 9216 case 'C2': 9217 if (axis == 'x') { 9218 return 1298.27; 9219 } else { 9220 return 1836.85; 9221 } 9222 break; 9223 case 'C3': 9224 if (axis == 'x') { 9225 return 918.43; 9226 } else { 9227 return 1298.27; 9228 } 9229 break; 9230 case 'C4': 9231 if (axis == 'x') { 9232 return 649.13; 9233 } else { 9234 return 918.43; 9235 } 9236 break; 9237 case 'C5': 9238 if (axis == 'x') { 9239 return 459.21; 9240 } else { 9241 return 649.13; 9242 } 9243 break; 9244 case 'C6': 9245 if (axis == 'x') { 9246 return 323.15; 9247 } else { 9248 return 459.21; 9249 } 9250 break; 9251 case 'C7': 9252 if (axis == 'x') { 9253 return 229.61; 9254 } else { 9255 return 323.15; 9256 } 9257 break; 9258 case 'C8': 9259 if (axis == 'x') { 9260 return 161.57; 9261 } else { 9262 return 229.61; 9263 } 9264 break; 9265 case 'C9': 9266 if (axis == 'x') { 9267 return 113.39; 9268 } else { 9269 return 161.57; 9270 } 9271 break; 9272 case 'C10': 9273 if (axis == 'x') { 9274 return 79.37; 9275 } else { 9276 return 113.39; 9277 } 9278 break; 9279 case 'RA0': 9280 if (axis == 'x') { 9281 return 2437.80; 9282 } else { 9283 return 3458.27; 9284 } 9285 break; 9286 case 'RA1': 9287 if (axis == 'x') { 9288 return 1729.13; 9289 } else { 9290 return 2437.80; 9291 } 9292 break; 9293 case 'RA2': 9294 if (axis == 'x') { 9295 return 1218.90; 9296 } else { 9297 return 1729.13; 9298 } 9299 break; 9300 case 'RA3': 9301 if (axis == 'x') { 9302 return 864.57; 9303 } else { 9304 return 1218.90; 9305 } 9306 break; 9307 case 'RA4': 9308 if (axis == 'x') { 9309 return 609.45; 9310 } else { 9311 return 864.57; 9312 } 9313 break; 9314 case 'SRA0': 9315 if (axis == 'x') { 9316 return 2551.18; 9317 } else { 9318 return 3628.35; 9319 } 9320 break; 9321 case 'SRA1': 9322 if (axis == 'x') { 9323 return 1814.17; 9324 } else { 9325 return 2551.18; 9326 } 9327 break; 9328 case 'SRA2': 9329 if (axis == 'x') { 9330 return 1275.59; 9331 } else { 9332 return 1814.17; 9333 } 9334 break; 9335 case 'SRA3': 9336 if (axis == 'x') { 9337 return 907.09; 9338 } else { 9339 return 1275.59; 9340 } 9341 break; 9342 case 'SRA4': 9343 if (axis == 'x') { 9344 return 637.80; 9345 } else { 9346 return 907.09; 9347 } 9348 break; 9349 case 'LETTER': 9350 if (axis == 'x') { 9351 return 612.00; 9352 } else { 9353 return 792.00; 9354 } 9355 break; 9356 case 'LEGAL': 9357 if (axis == 'x') { 9358 return 612.00; 9359 } else { 9360 return 1008.00; 9361 } 9362 break; 9363 case 'EXECUTIVE': 9364 if (axis == 'x') { 9365 return 521.86; 9366 } else { 9367 return 756.00; 9368 } 9369 break; 9370 case 'FOLIO': 9371 if (axis == 'x') { 9372 return 612.00; 9373 } else { 9374 return 936.00; 9375 } 9376 break; 9377 } // end switch 9378 9379 return 0; 9380} 9381 9382/** 9383 * Get checkbox for foreign key checks 9384 * 9385 * @return string 9386 */ 9387function getForeignKeyCheckboxLoader() { 9388 var html = ''; 9389 html += '<div>'; 9390 html += '<div class="load-default-fk-check-value">'; 9391 html += PMA_getImage('ajax_clock_small.gif'); 9392 html += '</div>'; 9393 html += '</div>'; 9394 return html; 9395} 9396 9397function loadForeignKeyCheckbox() { 9398 // Load default foreign key check value 9399 var params = { 9400 'ajax_request': true, 9401 'token': PMA_commonParams.get('token'), 9402 'server': PMA_commonParams.get('server'), 9403 'get_default_fk_check_value': true 9404 }; 9405 $.get('sql.php', params, function (data) { 9406 var html = '<input type="hidden" name="fk_checks" value="
94060" />' + 9407 '<input type="checkbox" name="fk_checks" id="fk_checks"' + 9408 (data.default_fk_check_value ? ' checked="checked"' : '') + ' />' + 9409 '<label for="fk_checks">' + PMA_messages.strForeignKeyCheck + '</label>'; 9410 $('.load-default-fk-check-value').replaceWith(html); 9411 }); 9412} 9413 9414function getJSConfirmCommonParam(elem) { 9415 return { 9416 'is_js_confirmed' : 1, 9417 'ajax_request' : true, 9418 'fk_checks': $(elem).find('#fk_checks').is(':checked') ? 1 : 0 9419 }; 9420} 9421 9422/** 9423 * Unbind all event handlers before tearing down a page 9424 */ 9425AJAX.registerTeardown('functions.js', function () { 9426 $(document).off('click', "a.inline_edit_sql"); 9427 $(document).off('click', "input#sql_query_edit_save"); 9428 $(document).off('click', "input#sql_query_edit_discard"); 9429 $('input.sqlbutton').unbind('click'); 9430 if (codemirror_editor) { 9431 codemirror_editor.off('blur'); 9432 } else { 9433 $(document).off('blur', '#sqlquery'); 9434 } 9435 $(document).off('change', '#parameterized'); 9436 $('#sqlquery').unbind('keydown'); 9437 $('#sql_query_edit').unbind('keydown'); 9438 9439 if (codemirror_inline_editor) { 9440 // Copy the sql query to the text area to preserve it. 9441 $('#sql_query_edit').text(codemirror_inline_editor.getValue()); 9442 $(codemirror_inline_editor.getWrapperElement()).unbind('keydown'); 9443 codemirror_inline_editor.toTextArea(); 9444 codemirror_inline_editor = false; 9445 } 9446 if (codemirror_editor) { 9447 $(codemirror_editor.getWrapperElement()).unbind('keydown'); 9448 } 9449}); 9450 9451/** 9452 * Jquery Coding for inline editing SQL_QUERY 9453 */ 9454AJAX.registerOnload('functions.js', function () {
9455 // If we are coming back to the page by clicking forward button 9456 // of the browser, bind the code mirror to inline query editor. 9457 bindCodeMirrorToInlineEditor(); 9458 $(document).on('click', "a.inline_edit_sql", function () { 9459 if ($('#sql_query_edit').length) { 9460 // An inline query editor is already open, 9461 // we don't want another copy of it 9462 return false; 9463 } 9464 9465 var $form = $(this).prev('form'); 9466 var sql_query = $form.find("input[name='sql_query']").val().trim(); 9467 var $inner_sql = $(this).parent().prev().find('code.sql'); 9468 var old_text = $inner_sql.html(); 9469 9470 var new_content = "<textarea name=\"sql_query_edit\" id=\"sql_query_edit\">" + sql_query + "</textarea>\n"; 9471 new_content += getForeignKeyCheckboxLoader(); 9472 new_content += "<input type=\"submit\" id=\"sql_query_edit_save\" class=\"button btnSave\" value=\"" + PMA_messages.strGo + "\"/>\n"; 9473 new_content += "<input type=\"button\" id=\"sql_query_edit_discard\" class=\"button btnDiscard\" value=\"" + PMA_messages.strCancel + "\"/>\n"; 9474 var $editor_area = $('div#inline_editor'); 9475 if ($editor_area.length === 0) { 9476 $editor_area = $('<div id="inline_editor_outer"></div>'); 9477 $editor_area.insertBefore($inner_sql); 9478 } 9479 $editor_area.html(new_content); 9480 loadForeignKeyCheckbox(); 9481 $inner_sql.hide(); 9482 9483 bindCodeMirrorToInlineEditor(); 9484 return false; 9485 }); 9486 9487 $(document).on('click', "input#sql_query_edit_save", function () { 9488 $(".success").hide(); 9489 //hide already existing success message 9490 var sql_query; 9491 if (codemirror_inline_editor) { 9492 codemirror_inline_editor.save(); 9493 sql_query = codemirror_inline_editor.getValue(); 9494 } else { 9495 sql_query = $(this).parent().find('#sql_query_edit').val(); 9496 } 9497 var fk_check = $(this).parent().find('#fk_checks').is(':checked'); 9498 9499 var $form = $("a.inline_edit_sql").prev('form'); 9500 var $fake_form = $('<form>', {action: 'import.php', method: 'post'}) 9501 .append($form.find("input[name=server], input[name=db], input[name=table], input[name=token]").clone()) 9502 .append($('<input/>', {type: 'hidden', name: 'show_query', value: 1})) 9503 .append($('<input/>', {type: 'hidden', name: 'is_js_confirmed', value: 0})) 9504 .append($('<input/>', {type: 'hidden', name: 'sql_query', value: sql_query})) 9505 .append($('<input/>', {type: 'hidden', name: 'fk_checks', value: fk_check ? 1 : 0})); 9506 if (! checkSqlQuery($fake_form[0])) { 9507 return false; 9508 } 9509 $fake_form.appendTo($('body')).submit(); 9510 }); 9511 9512 $(document).on('click', "input#sql_query_edit_discard", function () { 9513 var $divEditor = $('div#inline_editor_outer'); 9514 $divEditor.siblings('code.sql').show(); 9515 $divEditor.remove(); 9516 }); 9517 9518 $('input.sqlbutton').click(function (evt) { 9519 insertQuery(evt.target.id); 9520 PMA_handleSimulateQueryButton(); 9521 return false; 9522 }); 9523 9524 $(document).on('change', '#parameterized', updateQueryParameters); 9525 9526 var $inputUsername = $('#input_username'); 9527 if ($inputUsername) { 9528 if ($inputUsername.val() === '') { 9529 $inputUsername.focus(); 9530 } else { 9531 $('#input_password').focus(); 9532 } 9533 } 9534}); 9535 9536/** 9537 * "inputRead" event handler for CodeMirror SQL query editors for autocompletion 9538 */ 9539function codemirrorAutocompleteOnInputRead(instance) { 9540 if (!sql_autocomplete_in_progress 9541 && (!instance.options.hintOptions.tables || !sql_autocomplete)) { 9542 9543 if (!sql_autocomplete) { 9544 // Reset after teardown 9545 instance.options.hintOptions.tables = false; 9546 instance.options.hintOptions.defaultTable = ''; 9547 9548 sql_autocomplete_in_progress = true; 9549 9550 var href = 'db_sql_autocomplete.php'; 9551 var params = { 9552 'ajax_request': true, 9553 'token': PMA_commonParams.get('token'), 9554 'server': PMA_commonParams.get('server'), 9555 'db': PMA_commonParams.get('db'), 9556 'no_debug': true 9557 }; 9558 9559 var columnHintRender = function(elem, self, data) { 9560 $('<div class="autocomplete-column-name">') 9561 .text(data.columnName) 9562 .appendTo(elem); 9563 $('<div class="autocomplete-column-hint">') 9564 .text(data.columnHint) 9565 .appendTo(elem); 9566 }; 9567 9568 $.ajax({ 9569 type: 'POST', 9570 url: href, 9571 data: params, 9572 success: function (data) { 9573 if (data.success) { 9574 var tables = $.parseJSON(data.tables); 9575 sql_autocomplete_default_table = PMA_commonParams.get('table'); 9576 sql_autocomplete = []; 9577 for (var table in tables) { 9578 if (tables.hasOwnProperty(table)) { 9579 var columns = tables[table]; 9580 table = { 9581 text: table, 9582 columns: [] 9583 }; 9584 for (var column in columns) { 9585 if (columns.hasOwnProperty(column)) { 9586 var displayText = columns[column].Type; 9587 if (columns[column].Key == 'PRI') { 9588 displayText += ' | Primary'; 9589 } else if (columns[column].Key == 'UNI') { 9590 displayText += ' | Unique'; 9591 } 9592 table.columns.push({ 9593 text: column, 9594 displayText: column + " | " + displayText, 9595 columnName: column, 9596 columnHint: displayText, 9597 render: columnHintRender 9598 }); 9599 } 9600 } 9601 } 9602 sql_autocomplete.push(table); 9603 } 9604 instance.options.hintOptions.tables = sql_autocomplete; 9605 instance.options.hintOptions.defaultTable = sql_autocomplete_default_table; 9606 } 9607 }, 9608 complete: function () { 9609 sql_autocomplete_in_progress = false;
9610 } 9611 }); 9612 } 9613 else { 9614 instance.options.hintOptions.tables = sql_autocomplete; 9615 instance.options.hintOptions.defaultTable = sql_autocomplete_default_table; 9616 } 9617 } 9618 if (instance.state.completionActive) { 9619 return; 9620 } 9621 var cur = instance.getCursor(); 9622 var token = instance.getTokenAt(cur); 9623 var string = ''; 9624 if (token.string.match(/^[.`\w@]\w*$/)) { 9625 string = token.string; 9626 } 9627 if (string.length > 0) { 9628 CodeMirror.commands.autocomplete(instance); 9629 } 9630} 9631 9632/** 9633 * Remove autocomplete information before tearing down a page 9634 */ 9635AJAX.registerTeardown('functions.js', function () { 9636 sql_autocomplete = false; 9637 sql_autocomplete_default_table = ''; 9638}); 9639 9640/** 9641 * Binds the CodeMirror to the text area used to inline edit a query. 9642 */ 9643function bindCodeMirrorToInlineEditor() { 9644 var $inline_editor = $('#sql_query_edit'); 9645 if ($inline_editor.length > 0) { 9646 if (typeof CodeMirror !== 'undefined') { 9647 var height = $inline_editor.css('height'); 9648 codemirror_inline_editor = PMA_getSQLEditor($inline_editor); 9649 codemirror_inline_editor.getWrapperElement().style.height = height; 9650 codemirror_inline_editor.refresh(); 9651 codemirror_inline_editor.focus(); 9652 $(codemirror_inline_editor.getWrapperElement()) 9653 .bind('keydown', catchKeypressesFromSqlInlineEdit); 9654 } else { 9655 $inline_editor 9656 .focus() 9657 .bind('keydown', catchKeypressesFromSqlInlineEdit); 9658 } 9659 } 9660} 9661 9662function catchKeypressesFromSqlInlineEdit(event) { 9663 // ctrl-enter is 10 in chrome and ie, but 13 in ff 9664 if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10)) { 9665 $("#sql_query_edit_save").trigger('click'); 9666 } 9667} 9668 9669/** 9670 * Adds doc link to single highlighted SQL element 9671 */ 9672function PMA_doc_add($elm, params) 9673{ 9674 if (typeof mysql_doc_template == 'undefined') { 9675 return; 9676 } 9677 9678 var url = PMA_sprintf( 9679 decodeURIComponent(mysql_doc_template), 9680 params[0] 9681 ); 9682 if (params.length > 1) { 9683 url += '#' + params[1]; 9684 } 9685 var content = $elm.text(); 9686 $elm.text(''); 9687 $elm.append('<a target="mysql_doc" class="cm-sql-doc" href="' + url + '">' + content + '</a>'); 9688} 9689 9690/** 9691 * Generates doc links for keywords inside highlighted SQL 9692 */ 9693function PMA_doc_keyword(idx, elm) 9694{ 9695 var $elm = $(elm); 9696 /* Skip already processed ones */ 9697 if ($elm.find('a').length > 0) { 9698 return; 9699 } 9700 var keyword = $elm.text().toUpperCase(); 9701 var $next = $elm.next('.cm-keyword'); 9702 if ($next) { 9703 var next_keyword = $next.text().toUpperCase(); 9704 var full = keyword + ' ' + next_keyword; 9705 9706 var $next2 = $next.next('.cm-keyword'); 9707 if ($next2) { 9708 var next2_keyword = $next2.text().toUpperCase(); 9709 var full2 = full + ' ' + next2_keyword; 9710 if (full2 in mysql_doc_keyword) { 9711 PMA_doc_add($elm, mysql_doc_keyword[full2]); 9712 PMA_doc_add($next, mysql_doc_keyword[full2]); 9713 PMA_doc_add($next2, mysql_doc_keyword[full2]); 9714 return; 9715 } 9716 } 9717 if (full in mysql_doc_keyword) { 9718 PMA_doc_add($elm, mysql_doc_keyword[full]); 9719 PMA_doc_add($next, mysql_doc_keyword[full]); 9720 return; 9721 } 9722 } 9723 if (keyword in mysql_doc_keyword) { 9724 PMA_doc_add($elm, mysql_doc_keyword[keyword]); 9725 } 9726} 9727 9728/** 9729 * Generates doc links for builtins inside highlighted SQL 9730 */ 9731function PMA_doc_builtin(idx, elm) 9732{ 9733 var $elm = $(elm); 9734 var builtin = $elm.text().toUpperCase(); 9735 if (builtin in mysql_doc_builtin) { 9736 PMA_doc_add($elm, mysql_doc_builtin[builtin]); 9737 } 9738} 9739 9740/** 9741 * Higlights SQL using CodeMirror. 9742 */ 9743function PMA_highlightSQL($base) 9744{ 9745 var $elm = $base.find('code.sql'); 9746 $elm.each(function () { 9747 var $sql = $(this); 9748 var $pre = $sql.find('pre'); 9749 /* We only care about visible elements to avoid double processing */ 9750 if ($pre.is(":visible")) { 9751 var $highlight = $('<div class="sql-highlight cm-s-default"></div>'); 9752 $sql.append($highlight); 9753 if (typeof CodeMirror != 'undefined') { 9754 CodeMirror.runMode($sql.text(), 'text/x-mysql', $highlight[0]); 9755 $pre.hide(); 9756 $highlight.find('.cm-keyword').each(PMA_doc_keyword); 9757 $highlight.find('.cm-builtin').each(PMA_doc_builtin); 9758 } 9759 } 9760 }); 9761} 9762 9763/** 9764 * Updates an element containing code. 9765 * 9766 * @param jQuery Object $base base element which contains the raw and the 9767 * highlighted code. 9768 * 9769 * @param string htmlValue code in HTML format, displayed if code cannot be 9770 * highlighted 9771 * 9772 * @param string rawValue raw code, used as a parameter for highlighter 9773 * 9774 * @return bool whether content was updated or not 9775 */ 9776function PMA_updateCode($base, htmlValue, rawValue) 9777{ 9778 var $code = $base.find('code'); 9779 if ($code.length == 0) { 9780 return false;
9781 } 9782 9783 // Determines the type of the content and appropriate CodeMirror mode. 9784 var type = '', mode = ''; 9785 if ($code.hasClass('json')) { 9786 type = 'json'; 9787 mode = 'application/json'; 9788 } else if ($code.hasClass('sql')) { 9789 type = 'sql'; 9790 mode = 'text/x-mysql'; 9791 } else if ($code.hasClass('xml')) { 9792 type = 'xml'; 9793 mode = 'application/xml'; 9794 } else { 9795 return false; 9796 } 9797 9798 // Element used to display unhighlighted code. 9799 var $notHighlighted = $('<pre>' + htmlValue + '</pre>'); 9800 9801 // Tries to highlight code using CodeMirror. 9802 if (typeof CodeMirror != 'undefined') { 9803 var $highlighted = $('<div class="' + type + '-highlight cm-s-default"></div>'); 9804 CodeMirror.runMode(rawValue, mode, $highlighted[0]); 9805 $notHighlighted.hide(); 9806 $code.html('').append($notHighlighted, $highlighted[0]); 9807 } else { 9808 $code.html('').append($notHighlighted); 9809 } 9810 9811 return true; 9812} 9813 9814/** 9815 * Show a message on the top of the page for an Ajax request 9816 * 9817 * Sample usage: 9818 * 9819 * 1) var $msg = PMA_ajaxShowMessage(); 9820 * This will show a message that reads "Loading...". Such a message will not 9821 * disappear automatically and cannot be dismissed by the user. To remove this 9822 * message either the PMA_ajaxRemoveMessage($msg) function must be called or
9823 * another message must be show with PMA_ajaxShowMessage() function. 9824 * 9825 * 2) var $msg = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); 9826 * This is a special case. The behaviour is same as above, 9827 * just with a different message 9828 * 9829 * 3) var $msg = PMA_ajaxShowMessage('The operation was successful'); 9830 * This will show a message that will disappear automatically and it can also 9831 * be dismissed by the user. 9832 * 9833 * 4) var $msg = PMA_ajaxShowMessage('Some error', false); 9834 * This will show a message that will not disappear automatically, but it 9835 * can be dismissed by the user after he has finished reading it. 9836 * 9837 * @param string message string containing the message to be shown. 9838 * optional, defaults to 'Loading...' 9839 * @param mixed timeout number of milliseconds for the message to be visible 9840 * optional, defaults to 5000. If set to 'false', the 9841 * notification will never disappear 9842 * @return jQuery object jQuery Element that holds the message div 9843 * this object can be passed to PMA_aja
9843xRemoveMessage() 9844 * to remove the notification 9845 */ 9846function PMA_ajaxShowMessage(message, timeout) 9847{ 9848 /** 9849 * @var self_closing Whether the notification will automatically disappear 9850 */ 9851 var self_closing = true; 9852 /** 9853 * @var dismissable Whether the user will be able to remove 9854 * the notification by clicking on it 9855 */ 9856 var dismissable = true; 9857 // Handle the case when a empty data.message is passed. 9858 // We don't want the empty message 9859 if (message === '') { 9860 return true; 9861 } else if (! message) { 9862 // If the message is undefined, show the default 9863 message = PMA_messages.strLoading; 9864 dismissable = false; 9865 self_closing = false; 9866 } else if (message == PMA_messages.strProcessingRequest) { 9867 // This is another case where the message should not disappear 9868 dismissable = false; 9869 self_closing = false; 9870 } 9871 // Figure out whether (or after how long) to remove the notification 9872 if (timeout === undefined) { 9873 timeout = 5000; 9874 } else if (timeout === false) { 9875 self_closing = false; 9876 } 9877 // Create a parent element for the AJAX messages, if necessary 9878 if ($('#loading_parent').length === 0) { 9879 $('<div id="loading_parent"></div>') 9880 .prependTo("#page_content"); 9881 } 9882 // Update message count to create distinct message elements every time 9883 ajax_message_count++; 9884 // Remove all old messages, if any 9885 $("span.ajax_notification[id^=ajax_message_num]").remove(); 9886 /** 9887 * @var $retval a jQuery object containing the reference 9888 * to the created AJAX message 9889 */ 9890 var $retval = $( 9891 '<span class="ajax_notification" id="ajax_message_num_' + 9892 ajax_message_count + 9893 '"></span>' 9894 ) 9895 .hide() 9896 .appendTo("#loading_parent") 9897 .html(message) 9898 .show(); 9899 // If the notification is self-closing we should create a callback to remove it 9900 if (self_closing) { 9901 $retval 9902 .delay(timeout) 9903 .fadeOut('medium', function () { 9904 if ($(this).is(':data(tooltip)')) { 9905 $(this).tooltip('destroy'); 9906 } 9907 // Remove the notification 9908 $(this).remove(); 9909 }); 9910 } 9911 // If the notification is dismissable we need to add the relevant class to it 9912 // and add a tooltip so that the users know that it can be removed 9913 if (dismissable) { 9914 $retval.addClass('dismissable').css('cursor', 'pointer'); 9915 /** 9916 * Add a tooltip to the notification to let the user know that (s)he 9917 * can dismiss the ajax notification by clicking on it. 9918 */ 9919 PMA_tooltip( 9920 $retval, 9921 'span', 9922 PMA_messages.strDismiss 9923 ); 9924 } 9925 PMA_highlightSQL($retval); 9926 9927 return $retval; 9928} 9929 9930/** 9931 * Removes the message shown for an Ajax operation when it's completed 9932 * 9933 * @param jQuery object jQuery Element that holds the notification 9934 * 9935 * @return nothing 9936 */ 9937function PMA_ajaxRemoveMessage($this_msgbox) 9938{ 9939 if ($this_msgbox !== undefined && $this_msgbox instanceof jQuery) { 9940 $this_msgbox 9941 .stop(true, true) 9942 .fadeOut('medium'); 9943 if ($this_msgbox.is(':data(tooltip)')) { 9944 $this_msgbox.tooltip('destroy'); 9945 } else { 9946 $this_msgbox.remove(); 9947 } 9948 } 9949} 9950 9951/** 9952 * Requests SQL for previewing before executing. 9953 * 9954 * @param jQuery Object $form Form containing query data 9955 * 9956 * @return void 9957 */ 9958function PMA_previewSQL($form) 9959{ 9960 var form_url = $form.attr('action'); 9961 var form_data = $form.serialize() + 9962 '&do_save_data=1' + 9963 '&preview_sql=1' + 9964 '&ajax_request=1'; 9965 var $msgbox = PMA_ajaxShowMessage(); 9966 $.ajax({ 9967 type: 'POST', 9968 url: form_url, 9969 data: form_data, 9970 success: function (response) { 9971 PMA_ajaxRemoveMessage($msgbox); 9972 if (response.success) { 9973 var $dialog_content = $('<div/>') 9974 .append(response.sql_data); 9975 var button_options = {}; 9976 button_options[PMA_messages.strClose] = function () { 9977 $(this).dialog('close'); 9978 }; 9979 var $response_dialog = $dialog_content.dialog({ 9980 minWidth: 550, 9981 maxHeight: 400, 9982 modal: true, 9983 buttons: button_options, 9984 title: PMA_messages.strPreviewSQL, 9985 close: function () { 9986 $(this).remove(); 9987 }, 9988 open: function () { 9989 // Pretty SQL printing. 9990 PMA_highlightSQL($(this)); 9991 } 9992 }); 9993 } else { 9994 PMA_ajaxShowMessage(response.message); 9995 } 9996 }, 9997 error: function () { 9998 PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest); 9999 } 10000 }); 10001} 10002 10003/** 10004 * check for reserved keyword column name 10005 * 10006 * @param jQuery Object $form Form 10007 * 10008 * @returns true|false 10009 */ 10010 10011function PMA_checkReservedWordColumns($form) { 10012 var is_confirmed = true; 10013 $.ajax({ 10014 type: 'POST', 10015 url: "tbl_structure.php", 10016 data: $form.serialize() + '&reserved_word_check=1', 10017 success: function (data) { 10018 if (typeof data.success != 'undefined' && data.success === true) { 10019 is_confirmed = confirm(data.message); 10020 } 10021 }, 10022 async:false 10023 }); 10024 return is_confirmed; 10025} 10026 10027// This event only need to be fired once after the initial page load 10028$(function () { 10029 /** 10030 * Allows the user to dismiss a notification
10031 * created with PMA_ajaxShowMessage() 10032 */ 10033 $(document).on('click', 'span.ajax_notification.dismissable', function () { 10034 PMA_ajaxRemoveMessage($(this)); 10035 }); 10036 /** 10037 * The below two functions hide the "Dismiss notification" tooltip when a user 10038 * is hovering a link or button that is inside an ajax message 10039 */ 10040 $(document).on('mouseover', 'span.ajax_notification a, span.ajax_notification button, span.ajax_notification input', function () { 10041 if ($(this).parents('span.ajax_notification').is(':data(tooltip)')) { 10042 $(this).parents('span.ajax_notification').tooltip('disable'); 10043 } 10044 }); 10045 $(document).on('mouseout', 'span.ajax_notification a, span.ajax_notification button, span.ajax_notification input', function () { 10046 if ($(this).parents('span.ajax_notification').is(':data(tooltip)')) { 10047 $(this).parents('span.ajax_notification').tooltip('enable'); 10048 } 10049 }); 10050}); 10051 10052/** 10053 * Hides/shows the "Open in ENUM/SET editor" message, depending on the data type of the column currently selected 10054 */ 10055function PMA_showNoticeForEnum(selectElement) 10056{ 10057 var enum_notice_id = selectElement.attr("id").split("_")[1]; 10058 enum_notice_id += "_" + (parseInt(selectElement.attr("id").split("_")[2], 10) + 1); 10059 var selectedType = selectElement.val(); 10060 if (selectedType == "ENUM" || selectedType == "SET") { 10061 $("p#enum_notice_" + enum_notice_id).show(); 10062 } else { 10063 $("p#enum_notice_" + enum_notice_id).hide(); 10064 } 10065} 10066 10067/* 10068 * Creates a Profiling Chart with jqplot. Used in sql.js 10069 * and in server_status_monitor.js 10070 */ 10071function PMA_createProfilingChartJqplot(target, data) 10072{ 10073 return $.jqplot(target, [data], 10074 { 10075 seriesDefaults: { 10076 renderer: $.jqplot.PieRenderer, 10077 rendererOptions: { 10078 showDataLabels: true 10079 } 10080 }, 10081 highlighter: { 10082 show: true, 10083 tooltipLocation: 'se', 10084 sizeAdjust: 0, 10085 tooltipAxes: 'pieref', 10086 useAxesFormatters: false, 10087 formatString: '%s, %.9Ps' 10088 }, 10089 legend: { 10090 show: true, 10091 location: 'e', 10092 rendererOptions: {numberColumns: 2} 10093 }, 10094 // from http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines#Color_Palette 10095 seriesColors: [ 10096 '#fce94f', 10097 '#fcaf3e', 10098 '#e9b96e', 10099 '#8ae234', 10100 '#729fcf', 10101 '#ad7fa8', 10102 '#ef2929', 10103 '#eeeeec', 10104 '#888a85', 10105 '#c4a000', 10106 '#ce5c00', 10107 '#8f5902', 10108 '#4e9a06', 10109 '#204a87', 10110 '#5c3566', 10111 '#a40000', 10112 '#babdb6', 10113 '#2e3436' 10114 ] 10115 } 10116 ); 10117} 10118 10119/** 10120 * Formats a profiling duration nicely (in us and ms time). 10121 * Used in server_status_monitor.js 10122 * 10123 * @param integer Number to be formatted, should be in the range of microsecond to second 10124 * @param integer Accuracy, how many numbers right to the comma should be 10125 * @return string The formatted number 10126 */ 10127function PMA_prettyProfilingNum(num, acc) 10128{ 10129 if (!acc) { 10130 acc = 2; 10131 } 10132 acc = Math.pow(10, acc); 10133 if (num * 1000 < 0.1) { 10134 num = Math.round(acc * (num * 1000 * 1000)) / acc + 'µ'; 10135 } else if (num < 0.1) { 10136 num = Math.round(acc * (num * 1000)) / acc + 'm'; 10137 } else { 10138 num = Math.round(acc * num) / acc; 10139 } 10140 10141 return num + 's'; 10142} 10143 10144 10145/** 10146 * Formats a SQL Query nicely with newlines and indentation. Depends on Codemirror and MySQL Mode! 10147 * 10148 * @param string Query to be formatted 10149 * @return string The formatted query 10150 */ 10151function PMA_SQLPrettyPrint(string) 10152{ 10153 if (typeof CodeMirror == 'undefined') { 10154 return string; 10155 } 10156 10157 var mode = CodeMirror.getMode({}, "text/x-mysql"); 10158 var stream = new CodeMirror.StringStream(string); 10159 var state = mode.startState(); 10160 var token, tokens = []; 10161 var output = ''; 10162 var tabs = function (cnt) { 10163 var ret = ''; 10164 for (var i = 0; i < 4 * cnt; i++) { 10165 ret += " ";
10166 } 10167 return ret; 10168 }; 10169 10170 // "root-level" statements 10171 var statements = { 10172 'select': ['select', 'from', 'on', 'where', 'having', 'limit', 'order by', 'group by'], 10173 'update': ['update', 'set', 'where'], 10174 'insert into': ['insert into', 'values'] 10175 }; 10176 // don't put spaces before these tokens 10177 var spaceExceptionsBefore = {';': true, ',': true, '.': true, '(': true}; 10178 // don't put spaces after these tokens 10179 var spaceExceptionsAfter = {'.': true}; 10180 10181 // Populate tokens array 10182 var str = ''; 10183 while (! stream.eol()) { 10184 stream.start = stream.pos; 10185 token = mode.token(stream, state); 10186 if (token !== null) { 10187 tokens.push([token, stream.current().toLowerCase()]); 10188 } 10189 } 10190 10191 var currentStatement = tokens[0][1]; 10192 10193 if (! statements[currentStatement]) { 10194 return string; 10195 } 10196 // Holds all currently opened code blocks (statement, function or generic) 10197 var blockStack = []; 10198 // Holds the type of block from last iteration (the current is in blockStack[0]) 10199 var previousBlock; 10200 // If a new code block is found, newBlock contains its type for one iteration and vice versa for endBlock 10201 var newBlock, endBlock; 10202 // How much to indent in the current line 10203 var indentLevel = 0; 10204 // Holds the "root-level" statements 10205 var statementPart, lastStatementPart = statements[currentStatement][0]; 10206 10207 blockStack.unshift('statement'); 10208 10209 // Iterate through every token and format accordingly 10210 for (var i = 0; i < tokens.length; i++) { 10211 previousBlock = blockStack[0]; 10212 10213 // New block => push to stack 10214 if (tokens[i][1] == '(') { 10215 if (i < tokens.length - 1 && tokens[i + 1][0] == 'statement-verb') { 10216 blockStack.unshift(newBlock = 'statement'); 10217 } else if (i > 0 && tokens[i - 1][0] == 'builtin') { 10218 blockStack.unshift(newBlock = 'function'); 10219 } else { 10220 blockStack.unshift(newBlock = 'generic'); 10221 } 10222 } else { 10223 newBlock = null; 10224 } 10225 10226 // Block end => pop from stack 10227 if (tokens[i][1] == ')') { 10228 endBlock = blockStack[0]; 10229 blockStack.shift(); 10230 } else { 10231 endBlock = null; 10232 } 10233 10234 // A subquery is starting 10235 if (i > 0 && newBlock == 'statement') { 10236 indentLevel++; 10237 output += "\n" + tabs(indentLevel) + tokens[i][1] + ' ' + tokens[i + 1][1].toUpperCase() + "\n" + tabs(indentLevel + 1); 10238 currentStatement = tokens[i + 1][1]; 10239 i++; 10240 continue; 10241 } 10242 10243 // A subquery is ending 10244 if (endBlock == 'statement' && indentLevel > 0) { 10245 output += "\n" + tabs(indentLevel); 10246 indentLevel--; 10247 } 10248 10249 // One less indentation for statement parts (from, where, order by, etc.) and a newline 10250 statementPart = statements[currentStatement].indexOf(tokens[i][1]); 10251 if (statementPart != -1) { 10252 if (i > 0) { 10253 output += "\n"; 10254 } 10255 output += tabs(indentLevel) + tokens[i][1].toUpperCase(); 10256 output += "\n" + tabs(indentLevel + 1); 10257 lastStatementPart = tokens[i][1]; 10258 } 10259 // Normal indentation and spaces for everything else 10260 else { 10261 if (! spaceExceptionsBefore[tokens[i][1]] && 10262 ! (i > 0 && spaceExceptionsAfter[tokens[i - 1][1]]) && 10263 output.charAt(output.length - 1) != ' ') { 10264 output += " "; 10265 } 10266 if (tokens[i][0] == 'keyword') { 10267 output += tokens[i][1].toUpperCase(); 10268 } else { 10269 output += tokens[i][1]; 10270 } 10271 } 10272 10273 // split columns in select and 'update set' clauses, but only inside statements blocks 10274 if ((lastStatementPart == 'select' || lastStatementPart == 'where' || lastStatementPart == 'set') && 10275 tokens[i][1] == ',' && blockStack[0] == 'statement') { 10276 10277 output += "\n" + tabs(indentLevel + 1); 10278 } 10279 10280 // split conditions in where clauses, but only inside statements blocks 10281 if (lastStatementPart == 'where' && 10282 (tokens[i][1] == 'and' || tokens[i][1] == 'or' || tokens[i][1] == 'xor')) { 10283 10284 if (blockStack[0] == 'statement') { 10285 output += "\n" + tabs(indentLevel + 1); 10286 } 10287 // Todo: Also split and or blocks in newlines & indentation++ 10288 //if (blockStack[0] == 'generic') 10289 // output += ... 10290 } 10291 } 10292 return output; 10293} 10294 10295/** 10296 * jQuery function that uses jQueryUI's dialogs to confirm with user. Does not 10297 * return a jQuery object yet and hence cannot be chained 10298 * 10299 * @param string question 10300 * @param string url URL to be passed to the callbackFn to make 10301 * an Ajax call to 10302 * @param function callbackFn callback to execute after user clicks on OK 10303 * @param function openCallback optional callback to run when dialog is shown 10304 */ 10305 10306jQuery.fn.PMA_confirm = function (question, url, callbackFn, openCallback) { 10307 var confirmState = PMA_commonParams.get('confirm'); 10308 if (! confirmState) { 10309 // user does not want to confirm 10310 if ($.isFunction(callbackFn)) { 10311 callbackFn.call(this, url); 10312 return true; 10313 } 10314 } 10315 if (PMA_messages.strDoYouReally === '') { 10316 return true; 10317 } 10318 10319 /** 10320 * @var button_options Object that stores the options passed to
10320jQueryUI 10321 * dialog 10322 */ 10323 var button_options = [ 10324 { 10325 text: PMA_messages.strOK, 10326 'class': 'submitOK', 10327 click: function () { 10328 $(this).dialog("close"); 10329 if ($.isFunction(callbackFn)) { 10330 callbackFn.call(this, url); 10331 } 10332 } 10333 }, 10334 { 10335 text: PMA_messages.strCancel, 10336 'class': 'submitCancel', 10337 click: function () { 10338 $(this).dialog("close"); 10339 } 10340 } 10341 ]; 10342 10343 $('<div/>', {'id': 'confirm_dialog', 'title': PMA_messages.strConfirm}) 10344 .prepend(question) 10345 .dialog({ 10346 buttons: button_options, 10347 close: function () { 10348 $(this).remove(); 10349 }, 10350 open: openCallback, 10351 modal: true 10352 }); 10353}; 10354 10355/** 10356 * jQuery function to sort a table's body after a new row has been appended to it. 10357 * Also fixes the even/odd classes of the table rows at the end. 10358 * 10359 * @param string text_selector string to select the sortKey's text 10360 * 10361 * @return jQuery Object for chaining purposes 10362 */ 10363jQuery.fn.PMA_sort_table = function (text_selector) { 10364 return this.each(function () { 10365 10366 /** 10367 * @var table_body Object referring to the table's <tbody> element 10368 */ 10369 var table_body = $(this); 10370 /** 10371 * @var rows Object referring to the collection of rows in {@link table_body} 10372 */ 10373 var rows = $(this).find('tr').get(); 10374 10375 //get the text of the field that we will sort by 10376 $.each(rows, function (index, row) { 10377 row.sortKey = $.trim($(row).find(text_selector).text().toLowerCase()); 10378 }); 10379 10380 //get the sorted order 10381 rows.sort(function (a, b) { 10382 if (a.sortKey < b.sortKey) { 10383 return -1; 10384 } 10385 if (a.sortKey > b.sortKey) { 10386 return 1; 10387 } 10388 return 0; 10389 }); 10390 10391 //pull out each row from the table and then append it according to it's order 10392 $.each(rows, function (index, row) { 10393 $(table_body).append(row); 10394 row.sortKey = null; 10395 }); 10396 10397 //Re-check the classes of each row 10398 $(this).find('tr:odd') 10399 .removeClass('even').addClass('odd') 10400 .end() 10401 .find('tr:even') 10402 .removeClass('odd').addClass('even'); 10403 }); 10404}; 10405 10406/** 10407 * Unbind all event handlers before tearing down a page 10408 */ 10409AJAX.registerTeardown('functions.js', function () { 10410 $(document).off('submit', "#create_table_form_minimal.ajax"); 10411 $(document).off('submit', "form.create_table_form.ajax"); 10412 $(document).off('click', "form.create_table_form.ajax input[name=submit_num_fields]"); 10413 $(document).off('keyup', "form.create_table_form.ajax input"); 10414}); 10415 10416/** 10417 * jQuery coding for 'Create Table'. Used on db_operations.php, 10418 * db_structure.php and db_tracking.php (i.e., wherever 10419 * libraries/display_create_table.lib.php is used) 10420 * 10421 * Attach Ajax Event handlers for Create Table 10422 */ 10423AJAX.registerOnload('functions.js', function () { 10424 /** 10425 * Attach event handler for submission of create table form (save) 10426 */ 10427 $(document).on('submit', "form.create_table_form.ajax", function (event) { 10428 event.preventDefault(); 10429 10430 /** 10431 * @var the_form object referring to the create table form 10432 */ 10433 var $form = $(this); 10434 10435 /* 10436 * First validate the form; if there is a problem, avoid submitting it 10437 * 10438 * checkTableEditForm() needs a pure element and not a jQuery object, 10439 * this is why we pass $form[0] as a parameter (the jQuery object 10440 * is actually an array of DOM elements) 10441 */ 10442 10443 if (checkTableEditForm($form[0], $form.find('input[name=orig_num_fields]').val())) { 10444 PMA_prepareForAjaxRequest($form); 10445 if (PMA_checkReservedWordColumns($form)) { 10446 PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); 10447 //User wants to submit the form 10448 $.post($form.attr('action'), $form.serialize() + "&do_save_data=1", function (data) { 10449 if (typeof data !== 'undefined' && data.success === true) { 10450 $('#properties_message') 10451 .removeClass('error') 10452 .html(''); 10453 PMA_ajaxShowMessage(data.message); 10454 // Only if the create table dialog (distinct panel) exists 10455 var $createTableDialog = $("#create_table_dialog"); 10456 if ($createTableDialog.length > 0) { 10457 $createTableDialog.dialog("close").remove(); 10458 } 10459 $('#tableslistcontainer').before(data.formatted_sql); 10460 10461 /** 10462 * @var tables_table Object referring to the <tbody> element that holds the list of tables 10463 */ 10464 var tables_table = $("#tablesForm").find("tbody").not("#tbl_summary_row"); 10465 // this is the first table created in this db 10466 if (tables_table.length === 0) { 10467 PMA_commonActions.refreshMain( 10468 PMA_commonParams.get('opendb_url') 10469 ); 10470 } else { 10471 /** 10472 * @var curr_last_row Object referring to the last <tr> element in {@link tables_table} 10473 */
10474 var curr_last_row = $(tables_table).find('tr:last'); 10475 /** 10476 * @var curr_last_row_index_string String containing the index of {@link curr_last_row} 10477 */ 10478 var curr_last_row_index_string = $(curr_last_row).find('input:checkbox').attr('id').match(/\d+/)[0]; 10479 /** 10480 * @var curr_last_row_index Index of {@link curr_last_row} 10481 */ 10482 var curr_last_row_index = parseFloat(curr_last_row_index_string); 10483 /** 10484 * @var new_last_row_index Index of the new row to be appended to {@link tables_table} 10485 */ 10486 var new_last_row_index = curr_last_row_index + 1; 10487 /** 10488 * @var new_last_row_id String containing the id of the row to be appended to {@link tables_table} 10489 */ 10490 var new_last_row_id = 'checkbox_tbl_' + new_last_row_index; 10491 10492 data.new_table_string = data.new_table_string.replace(/checkbox_tbl_/, new_last_row_id); 10493 //append to table 10494 $(data.new_table_string) 10495 .appendTo(tables_table); 10496 10497 //Sort the table 10498 $(tables_table).PMA_sort_table('th'); 10499 10500 // Adjust summary row 10501 PMA_adjustTotals(); 10502 } 10503 10504 //Refresh navigation as a new table has been added 10505 PMA_reloadNavigation(); 10506 // Redirect to table structure page on creation of new table 10507 var params_12 = 'ajax_request=true&ajax_page_request=true'; 10508 if (! (history && history.pushState)) { 10509 params_12 += PMA_MicroHistory.menus.getRequestParam(); 10510 } 10511 tblStruct_url = 'tbl_structure.php?server=' + data._params.server + 10512 '&db='+ data._params.db + '&token=' + data._params.token + 10513 '&goto=db_structure.php&table=' + data._params.table + ''; 10514 $.get(tblStruct_url, params_12, AJAX.responseHandler); 10515 } else { 10516 PMA_ajaxShowMessage( 10517 '<div class="error">' + data.error + '</div>', 10518 false 10519 ); 10520 } 10521 }); // end $.post() 10522 } 10523 } // end if (checkTableEditForm() ) 10524 }); // end create table form (save) 10525 10526 /** 10527 * Attach event handler for create table form (add fields) 10528 */ 10529 $(document).on('click', "form.create_table_form.ajax input[name=submit_num_fields]", function (event) { 10530 event.preventDefault(); 10531 /** 10532 * @var the_form object referring to the create table form 10533 */ 10534 var $form = $(this).closest('form'); 10535 10536 if (!checkFormElementInRange(this.form, 'added_fields', PMA_messages.strLeastColumnError, 1)) { 10537 return; 10538 } 10539 10540 var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); 10541 PMA_prepareForAjaxRequest($form); 10542 10543 //User wants to add more fields to the table 10544 $.post($form.attr('action'), $form.serialize() + "&submit_num_fields=1", function (data) { 10545 if (typeof data !== 'undefined' && data.success) { 10546 var $pageContent = $("#page_content"); 10547 $pageContent.html(data.message); 10548 PMA_highlightSQL($pageContent); 10549 PMA_verifyColumnsProperties(); 10550 PMA_hideShowConnection($('.create_table_form select[name=tbl_storage_engine]')); 10551 PMA_ajaxRemoveMessage($msgbox); 10552 } else { 10553 PMA_ajaxShowMessage(data.error); 10554 } 10555 }); //end $.post() 10556 }); // end create table form (add fields) 10557 10558 $(document).on('keydown', "form.create_table_form.ajax input[name=added_fields]", function (event) { 10559 if (event.keyCode == 13) { 10560 event.preventDefault(); 10561 event.stopImmediatePropagation(); 10562 $(this) 10563 .closest('form') 10564 .find('input[name=submit_num_fields]') 10565 .click(); 10566 } 10567 }); 10568 $("input[value=AUTO_INCREMENT]").change(function(){ 10569 if (this.checked) { 10570 var col = /\d/.exec($(this).attr('name')); 10571 col = col[0]; 10572 var $selectFieldKey = $('select[name="field_key[' + col + ']"]'); 10573 if ($selectFieldKey.val() === 'none_'+col) { 10574 $selectFieldKey.val('primary_'+col).change(); 10575 } 10576 } 10577 }); 10578 $('body') 10579 .off('click', 'input.preview_sql') 10580 .on('click', 'input.preview_sql', function () { 10581 var $form = $(this).closest('form'); 10582 PMA_previewSQL($form); 10583 }); 10584}); 10585 10586 10587/** 10588 * Validates the password field in a form 10589 * 10590 * @see PMA_messages.strPasswordEmpty 10591 * @see PMA_messages.strPasswordNotSame 10592 * @param object $the_form The form to be validated 10593 * @return bool 10594 */ 10595function PMA_checkPassword($the_form) 10596{ 10597 // Did the user select 'no password'?
10598 if ($the_form.find('#nopass_1').is(':checked')) { 10599 return true; 10600 } else { 10601 var $pred = $the_form.find('#select_pred_password'); 10602 if ($pred.length && ($pred.val() == 'none' || $pred.val() == 'keep')) { 10603 return true; 10604 } 10605 } 10606 10607 var $password = $the_form.find('input[name=pma_pw]'); 10608 var $password_repeat = $the_form.find('input[name=pma_pw2]'); 10609 var alert_msg = false; 10610 10611 if ($password.val() === '') { 10612 alert_msg = PMA_messages.strPasswordEmpty; 10613 } else if ($password.val() != $password_repeat.val()) { 10614 alert_msg = PMA_messages.strPasswordNotSame; 10615 } 10616 10617 if (alert_msg) { 10618 alert(alert_msg); 10619 $password.val(''); 10620 $password_repeat.val(''); 10621 $password.focus(); 10622 return false; 10623 } 10624 return true; 10625} 10626 10627/** 10628 * Unbind all event handlers before tearing down a page 10629 */ 10630AJAX.registerTeardown('functions.js', function () { 10631 $(document).off('click', '#change_password_anchor.ajax'); 10632}); 10633/** 10634 * Attach Ajax event handlers for 'Change Password' on index.php 10635 */ 10636AJAX.registerOnload('functions.js', function () { 10637 10638 /** 10639 * Attach Ajax event handler on the change password anchor 10640 */ 10641 $(document).on('click', '#change_password_anchor.ajax', function (event) { 10642 event.preventDefault(); 10643 10644 var $msgbox = PMA_ajaxShowMessage(); 10645 10646 /** 10647 * @var button_options Object containing options to be passed to jQueryUI's dialog 10648 */ 10649 var button_options = {}; 10650 button_options[PMA_messages.strGo] = function () { 10651 10652 event.preventDefault(); 10653 10654 /** 10655 * @var $the_form Object referring to the change password form 10656 */ 10657 var $the_form = $("#change_password_form"); 10658 10659 if (! PMA_checkPassword($the_form)) { 10660 return false; 10661 } 10662 10663 /** 10664 * @var this_value String containing the value of the submit button. 10665 * Need to append this for the change password form on Server Privileges 10666 * page to work 10667 */ 10668 var this_value = $(this).val(); 10669 10670 var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); 10671 $the_form.append('<input type="hidden" name="ajax_request" value="true" />'); 10672 10673 $.post($the_form.attr('action'), $the_form.serialize() + '&change_pw=' + this_value, function (data) { 10674 if (typeof data === 'undefined' || data.success !== true) { 10675 PMA_ajaxShowMessage(data.error, false); 10676 return; 10677 } 10678 10679 var $pageContent = $("#page_content"); 10680 $pageContent.prepend(data.message); 10681 PMA_highlightSQL($pageContent); 10682 $("#change_password_dialog").hide().remove(); 10683 $("#edit_user_dialog").dialog("close").remove(); 10684 PMA_ajaxRemoveMessage($msgbox); 10685 }); // end $.post() 10686 }; 10687 10688 button_options[PMA_messages.strCancel] = function () { 10689 $(this).dialog('close'); 10690 }; 10691 $.get($(this).attr('href'), {'ajax_request': true}, function (data) { 10692 if (typeof data === 'undefined' || !data.success) { 10693 PMA_ajaxShowMessage(data.error, false); 10694 return; 10695 } 10696 10697 $('<div id="change_password_dialog"></div>') 10698 .dialog({ 10699 title: PMA_messages.strChangePassword, 10700 width: 600, 10701 close: function (ev, ui) { 10702 $(this).remove(); 10703 }, 10704 buttons: button_options, 10705 modal: true 10706 }) 10707 .append(data.message); 10708 // for this dialog, we remove the fieldset wrapping due to double headings 10709 $("fieldset#fieldset_change_password") 10710 .find("legend").remove().end() 10711 .find("table.noclick").unwrap().addClass("some-margin") 10712 .find("input#text_pma_pw").focus(); 10713 displayPasswordGenerateButton(); 10714 $('#fieldset_change_password_footer').hide(); 10715 PMA_ajaxRemoveMessage($msgbox); 10716 $('#change_password_form').bind('submit', function (e) { 10717 e.preventDefault(); 10718 $(this) 10719 .closest('.ui-dialog') 10720 .find('.ui-dialog-buttonpane .ui-button') 10721 .first() 10722 .click(); 10723 }); 10724 }); // end $.get() 10725 }); // end handler for change password anchor 10726}); // end $() for Change Password 10727 10728/** 10729 * Unbind all event handlers before tearing down a page 10730 */ 10731AJAX.registerTeardown('functions.js', function () { 10732 $(document).off('change', "select.column_type");
10733 $(document).off('change', "select.default_type"); 10734 $(document).off('change', "select.virtuality"); 10735 $(document).off('change', 'input.allow_null'); 10736 $(document).off('change', '.create_table_form select[name=tbl_storage_engine]'); 10737}); 10738/** 10739 * Toggle the hiding/showing of the "Open in ENUM/SET editor" message when 10740 * the page loads and when the selected data type changes 10741 */ 10742AJAX.registerOnload('functions.js', function () { 10743 // is called here for normal page loads and also when opening 10744 // the Create table dialog 10745 PMA_verifyColumnsProperties(); 10746 // 10747 // needs on() to work also in the Create Table dialog 10748 $(document).on('change', "select.column_type", function () { 10749 PMA_showNoticeForEnum($(this)); 10750 }); 10751 $(document).on('change', "select.default_type", function () { 10752 PMA_hideShowDefaultValue($(this)); 10753 }); 10754 $(document).on('change', "select.virtuality", function () { 10755 PMA_hideShowExpression($(this)); 10756 }); 10757 $(document).on('change', 'input.allow_null', function () { 10758 PMA_validateDefaultValue($(this)); 10759 }); 10760 $(document).on('change', '.create_table_form select[name=tbl_storage_engine]', function () { 10761 PMA_hideShowConnection($(this)); 10762 }); 10763}); 10764 10765/** 10766 * If the chosen storage engine is FEDERATED show connection field. Hide otherwise 10767 * 10768 * @param $engine_selector storage engine selector 10769 */ 10770function PMA_hideShowConnection($engine_selector) 10771{ 10772 var $connection = $('.create_table_form input[name=connection]'); 10773 var index = $connection.parent('td').index() + 1; 10774 var $labelTh = $connection.parents('tr').prev('tr').children('th:nth-child(' + index + ')'); 10775 if ($engine_selector.val() != 'FEDERATED') { 10776 $connection 10777 .prop('disabled', true) 10778 .parent('td').hide(); 10779 $labelTh.hide(); 10780 } else { 10781 $connection 10782 .prop('disabled', false) 10783 .parent('td').show(); 10784 $labelTh.show(); 10785 } 10786} 10787 10788/** 10789 * If the column does not allow NULL values, makes sure that default is not NULL 10790 */ 10791function PMA_validateDefaultValue($null_checkbox) 10792{ 10793 if (! $null_checkbox.prop('checked')) { 10794 var $default = $null_checkbox.closest('tr').find('.default_type'); 10795 if ($default.val() == 'NULL') { 10796 $default.val('NONE'); 10797 } 10798 } 10799} 10800 10801/** 10802 * function to populate the input fields on picking a column from central list 10803 * 10804 * @param string input_id input id of the name field for the column to be populated 10805 * @param integer offset of the selected column in central list of columns 10806 */ 10807function autoPopulate(input_id, offset) 10808{ 10809 var db = PMA_commonParams.get('db'); 10810 var table = PMA_commonParams.get('table'); 10811 input_id = input_id.substring(0, input_id.length - 1); 10812 $('#' + input_id + '1').val(central_column_list[db + '_' + table][offset].col_name); 10813 var col_type = central_column_list[db + '_' + table][offset].col_type.toUpperCase(); 10814 $('#' + input_id + '2').val(col_type); 10815 var $input3 = $('#' + input_id + '3'); 10816 $input3.val(central_column_list[db + '_' + table][offset].col_length); 10817 if(col_type === 'ENUM' || col_type === 'SET') { 10818 $input3.next().show(); 10819 } else { 10820 $input3.next().hide(); 10821 } 10822 var col_default = central_column_list[db + '_' + table][offset].col_default.toUpperCase(); 10823 var $input4 = $('#' + input_id + '4'); 10824 if (col_default !== '' && col_default !== 'NULL' && col_default !== 'CURRENT_TIMESTAMP') { 10825 $input4.val("USER_DEFINED"); 10826 $input4.next().next().show(); 10827 $input4.next().next().val(central_column_list[db + '_' + table][offset].col_default); 10828 } else { 10829 $input4.val(central_column_list[db + '_' + table][offset].col_default); 10830 $input4.next().next().hide(); 10831 } 10832 $('#' + input_id + '5').val(central_column_list[db + '_' + table][offset].col_collation); 10833 var $input6 = $('#' + input_id + '6'); 10834 $input6.val(central_column_list[db + '_' + table][offset].col_attribute); 10835 if(central_column_list[db + '_' + table][offset].col_extra === 'on update CURRENT_TIMESTAMP') { 10836 $input6.val(central_column_list[db + '_' + table][offset].col_extra); 10837 } 10838 if(central_column_list[db + '_' + table][offset].col_extra.toUpperCase() === 'AUTO_INCREMENT') { 10839 $('#' + input_id + '9').prop("checked",true).change(); 10840 } else { 10841 $('#' + input_id + '9').prop("checked",false); 10842 } 10843 if(central_column_list[db + '_' + table][offset].col_isNull !== '0') { 10844 $('#' + input_id + '7').prop("checked",true); 10845 } else { 10846 $('#' + input_id + '7').prop("checked",false); 10847 } 10848} 10849 10850/** 10851 * Unbind all event handlers before tearing down a page 10852 */ 10853AJAX.registerTeardown('functions.js', function () { 10854 $(document).off('click', "a.open_enum_editor"); 10855 $(document).off('click', "input.add_value"); 10856 $(document).off('click', "#enum_editor td.drop"); 10857 $(document).off('click', 'a.central_columns_dialog'); 10858}); 10859/** 10860 * @var $enum_editor_dialog An object that points to the jQuery 10861 * dialog of the ENUM/SET editor
10862 */ 10863var $enum_editor_dialog = null; 10864/** 10865 * Opens the ENUM/SET editor and controls its functions 10866 */ 10867AJAX.registerOnload('functions.js', function () { 10868 $(document).on('click', "a.open_enum_editor", function () { 10869 // Get the name of the column that is being edited 10870 var colname = $(this).closest('tr').find('input:first').val(); 10871 var title; 10872 var i; 10873 // And use it to make up a title for the page 10874 if (colname.length < 1) { 10875 title = PMA_messages.enum_newColumnVals; 10876 } else { 10877 title = PMA_messages.enum_columnVals.replace( 10878 /%s/, 10879 '"' + escapeHtml(decodeURIComponent(colname)) + '"' 10880 ); 10881 } 10882 // Get the values as a string 10883 var inputstring = $(this) 10884 .closest('td') 10885 .find("input") 10886 .val(); 10887 // Escape html entities 10888 inputstring = $('<div/>') 10889 .text(inputstring) 10890 .html(); 10891 // Parse the values, escaping quotes and 10892 // slashes on the fly, into an array 10893 var values = []; 10894 var in_string = false; 10895 var curr, next, buffer = ''; 10896 for (i = 0; i < inputstring.length; i++) { 10897 curr = inputstring.charAt(i); 10898 next = i == inputstring.length ? '' : inputstring.charAt(i + 1); 10899 if (! in_string && curr == "'") { 10900 in_string = true; 10901 } else if (in_string && curr == "\\" && next == "\\") { 10902 buffer += "\"; 10903 i++; 10904 } else if (in_string && next == "'" && (curr == "'" || curr == "\\")) { 10905 buffer += "'"; 10906 i++; 10907 } else if (in_string && curr == "'") { 10908 in_string = false; 10909 values.push(buffer); 10910 buffer = ''; 10911 } else if (in_string) { 10912 buffer += curr; 10913 } 10914 } 10915 if (buffer.length > 0) { 10916 // The leftovers in the buffer are the last value (if any) 10917 values.push(buffer); 10918 } 10919 var fields = ''; 10920 // If there are no values, maybe the user is about to make a 10921 // new list so we add a few for him/her to get started with. 10922 if (values.length === 0) { 10923 values.push('', '', '', ''); 10924 } 10925 // Add the parsed values to the editor 10926 var drop_icon = PMA_getImage('b_drop.png'); 10927 for (i = 0; i < values.length; i++) { 10928 fields += "<tr><td>" + 10929 "<input type='text' value='" + values[i] + "'/>" + 10930 "</td><td class='drop'>" + 10931 drop_icon + 10932 "</td></tr>"; 10933 } 10934 /** 10935 * @var dialog HTML code for the ENUM/SET dialog 10936 */ 10937 var dialog = "<div id='enum_editor'>" + 10938 "<fieldset>" + 10939 "<legend>" + title + "</legend>" + 10940 "<p>" + PMA_getImage('s_notice.png') + 10941 PMA_messages.enum_hint + "</p>" + 10942 "<table class='values'>" + fields + "</table>" + 10943 "</fieldset><fieldset class='tblFooters'>" + 10944 "<table class='add'><tr><td>" + 10945 "<div class='slider'></div>" + 10946 "</td><td>" + 10947 "<form><div><input type='submit' class='add_value' value='" + 10948 PMA_sprintf(PMA_messages.enum_addValue, 1) + 10949 "'/></div></form>" + 10950 "</td></tr></table>" + 10951 "<input type='hidden' value='" + // So we know which column's data is being edited 10952 $(this).closest('td').find("input").attr("id") + 10953 "' />" + 10954 "</fieldset>" + 10955 "</div>"; 10956 /** 10957 * @var Defines functions to be called when the buttons in 10958 * the buttonOptions jQuery dialog bar are pressed 10959 */ 10960 var buttonOptions = {}; 10961 buttonOptions[PMA_messages.strGo] = function () { 10962 // When the submit button is clicked, 10963 // put the data back into the original form 10964 var value_array = []; 10965 $(this).find(".values input").each(function (index, elm) { 10966 var val = elm.value.replace(/\\/g, '\\\\').replace(/'/g, "''"); 10967 value_array.push("'" + val + "'"); 10968 }); 10969 // get the Length/Values text field where this value belongs 10970 var values_id = $(this).find("input[type='hidden']").val(); 10971 $("input#" + values_id).val(value_array.join(",")); 10972 $(this).dialog("close"); 10973 }; 10974 buttonOptions[PMA_messages.strClose] = function () { 10975 $(this).dialog("close"); 10976 }; 10977 // Show the dialog 10978 var width = parseInt( 10979 (parseInt($('html').css('font-size'), 10) / 13) * 340, 10980 10 10981 ); 10982 if (! width) { 10983 width = 340; 10984 } 10985 $enum_editor_dialog = $(dialog).dialog({ 10986 minWidth: width, 10987 maxHeight: 450, 10988 modal: true, 10989 title: PMA_messages.enum_editor, 10990 buttons: buttonOptions, 10991 open: function () { 10992 // Focus the "Go" button after opening the dialog 10993 $(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button:first').focus(); 10994 }, 10995 close: function () { 10996 $(this).remove(); 10997 } 10998 }); 10999 // slider for choosing how many fields to add 11000 $enum_editor_dialog.find(".slider").slider({ 11001 animate: true, 11002 range: "min", 11003 value: 1, 11004 min: 1, 11005 max: 9, 11006 slide: function (event, ui) { 11007 $(this).closest('table').find('input[type=submit]').val( 11008 PMA_sprintf(PMA_messages.enum_addValue, ui.value) 11009 ); 11010 } 11011 }); 11012 // Focus the slider, otherwise it looks nearly transparent 11013 $('a.ui-slider-handle').addClass('ui-state-focus'); 11014 return false;
11015 }); 11016 11017 $(document).on('click', 'a.central_columns_dialog', function (e) { 11018 var href = "db_central_columns.php"; 11019 var db = PMA_commonParams.get('db'); 11020 var table = PMA_commonParams.get('table'); 11021 var maxRows = $(this).data('maxrows'); 11022 var pick = $(this).data('pick'); 11023 if (pick !== false) { 11024 pick = true; 11025 } 11026 var params = { 11027 'ajax_request' : true, 11028 'token' : PMA_commonParams.get('token'), 11029 'server' : PMA_commonParams.get('server'), 11030 'db' : PMA_commonParams.get('db'), 11031 'cur_table' : PMA_commonParams.get('table'), 11032 'getColumnList':true 11033 }; 11034 var colid = $(this).closest('td').find("input").attr("id"); 11035 var fields = ''; 11036 if (! (db + '_' + table in central_column_list)) { 11037 central_column_list.push(db + '_' + table); 11038 $.ajax({ 11039 type: 'POST', 11040 url: href, 11041 data: params, 11042 success: function (data) { 11043 central_column_list[db + '_' + table] = $.parseJSON(data.message); 11044 }, 11045 async:false 11046 }); 11047 } 11048 var i = 0; 11049 var list_size = central_column_list[db + '_' + table].length; 11050 var min = (list_size <= maxRows) ? list_size : maxRows; 11051 for (i = 0; i < min; i++) { 11052 11053 fields += '<tr><td><div><span style="font-weight:bold">' + 11054 escapeHtml(central_column_list[db + '_' + table][i].col_name) + 11055 '</span><br><span style="color:gray">' + central_column_list[db + '_' + table][i].col_type; 11056 11057 if (central_column_list[db + '_' + table][i].col_attribute !== '') { 11058 fields += '(' + escapeHtml(central_column_list[db + '_' + table][i].col_attribute) + ') '; 11059 } 11060 if (central_column_list[db + '_' + table][i].col_length !== '') { 11061 fields += '(' + escapeHtml(central_column_list[db + '_' + table][i].col_length) +') '; 11062 } 11063 fields += escapeHtml(central_column_list[db + '_' + table][i].col_extra) + '</span>' + 11064 '</div></td>'; 11065 if (pick) { 11066 fields += '<td><input class="pick" style="width:100%" type="submit" value="' + 11067 PMA_messages.pickColumn + '" onclick="autoPopulate(\'' + colid + '\',' + i + ')"/></td>'; 11068 } 11069 fields += '</tr>'; 11070 } 11071 var result_pointer = i; 11072 var search_in = '<input type="text" class="filter_rows" placeholder="' + PMA_messages.searchList + '">'; 11073 if (fields === '') { 11074 fields = PMA_sprintf(PMA_messages.strEmptyCentralList, "'" + db + "'"); 11075 search_in = ''; 11076 } 11077 var seeMore = ''; 11078 if (list_size > maxRows) { 11079 seeMore = "<fieldset class='tblFooters' style='text-align:center;font-weight:bold'>" + 11080 "<a href='#' id='seeMore'>" + PMA_messages.seeMore + "</a></fieldset>"; 11081 } 11082 var central_columns_dialog = "<div style='max-height:400px'>" + 11083 "<fieldset>" + 11084 search_in + 11085 "<table id='col_list' style='width:100%' class='values'>" + fields + "</table>" + 11086 "</fieldset>" + 11087 seeMore + 11088 "</div>"; 11089 11090 var width = parseInt( 11091 (parseInt($('html').css('font-size'), 10) / 13) * 500, 11092 10 11093 ); 11094 if (! width) { 11095 width = 500; 11096 } 11097 var buttonOptions = {}; 11098 var $central_columns_dialog = $(central_columns_dialog).dialog({ 11099 minWidth: width, 11100 maxHeight: 450, 11101 modal: true, 11102 title: PMA_messages.pickColumnTitle, 11103 buttons: buttonOptions, 11104 open: function () { 11105 $('#col_list').on("click", ".pick", function (){ 11106 $central_columns_dialog.remove(); 11107 }); 11108 $(".filter_rows").on("keyup", function () { 11109 $.uiTableFilter($("#col_list"), $(this).val()); 11110 }); 11111 $("#seeMore").click(function() { 11112 fields = ''; 11113 min = (list_size <= maxRows + result_pointer) ? list_size : maxR
11113ows + result_pointer; 11114 for (i = result_pointer; i < min; i++) { 11115 11116 fields += '<tr><td><div><span style="font-weight:bold">' + 11117 central_column_list[db + '_' + table][i].col_name + 11118 '</span><br><span style="color:gray">' + 11119 central_column_list[db + '_' + table][i].col_type; 11120 11121 if (central_column_list[db + '_' + table][i].col_attribute !== '') { 11122 fields += '(' + central_column_list[db + '_' + table][i].col_attribute + ') '; 11123 } 11124 if (central_column_list[db + '_' + table][i].col_length !== '') { 11125 fields += '(' + central_column_list[db + '_' + table][i].col_length + ') '; 11126 } 11127 fields += central_column_list[db + '_' + table][i].col_extra + '</span>' + 11128 '</div></td>'; 11129 if (pick) { 11130 fields += '<td><input class="pick" style="width:100%" type="submit" value="' + 11131 PMA_messages.pickColumn + '" onclick="autoPopulate(\'' + colid + '\',' + i + ')"/></td>'; 11132 } 11133 fields += '</tr>'; 11134 } 11135 $("#col_list").append(fields); 11136 result_pointer = i; 11137 if (result_pointer === list_size) { 11138 $('.tblFooters').hide(); 11139 } 11140 return false; 11141 }); 11142 $(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button:first').focus(); 11143 }, 11144 close: function () { 11145 $('#col_list').off("click", ".pick"); 11146 $(".filter_rows").off("keyup"); 11147 $(this).remove(); 11148 } 11149 }); 11150 return false; 11151 }); 11152 11153 // $(document).on('click', 'a.show_central_list',function(e) { 11154 11155 // }); 11156 // When "add a new value" is clicked, append an empty text field 11157 $(document).on('click', "input.add_value", function (e) { 11158 e.preventDefault(); 11159 var num_new_rows = $enum_editor_dialog.find("div.slider").slider('value'); 11160 while (num_new_rows--) { 11161 $enum_editor_dialog.find('.values') 11162 .append( 11163 "<tr style='display: none;'><td>" + 11164 "<input type='text' />" + 11165 "</td><td class='drop'>" + 11166 PMA_getImage('b_drop.png') + 11167 "</td></tr>" 11168 ) 11169 .find('tr:last') 11170 .show('fast'); 11171 } 11172 }); 11173 11174 // Removes the specified row from the enum editor 11175 $(document).on('click', "#enum_editor td.drop", function () { 11176 $(this).closest('tr').hide('fast', function () { 11177 $(this).remove(); 11178 }); 11179 }); 11180}); 11181 11182/** 11183 * Ensures indexes names are valid according to their type and, for a primary 11184 * key, lock index name to 'PRIMARY' 11185 * @param string form_id Variable which parses the form name as 11186 * the input 11187 * @return boolean false if there is no index form, true else 11188 */ 11189function checkIndexName(form_id) 11190{ 11191 if ($("#" + form_id).length === 0) { 11192 return false; 11193 } 11194 11195 // Gets the elements pointers 11196 var $the_idx_name = $("#input_index_name"); 11197 var $the_idx_choice = $("#select_index_choice"); 11198 11199 // Index is a primary key 11200 if ($the_idx_choice.find("option:selected").val() == 'PRIMARY') { 11201 $the_idx_name.val('PRIMARY'); 11202 $the_idx_name.prop("disabled", true); 11203 } 11204 11205 // Other cases 11206 else { 11207 if ($the_idx_name.val() == 'PRIMARY') { 11208 $the_idx_name.val(""); 11209 } 11210 $the_idx_name.prop("disabled", false); 11211 } 11212 11213 return true; 11214} // end of the 'checkIndexName()' function 11215 11216AJAX.registerTeardown('functions.js', function () { 11217 $(document).off('click', '#index_frm input[type=submit]'); 11218}); 11219AJAX.registerOnload('functions.js', function () { 11220 /** 11221 * Handler for adding more columns to an index in the editor
11222 */ 11223 $(document).on('click', '#index_frm input[type=submit]', function (event) { 11224 event.preventDefault(); 11225 var rows_to_add = $(this) 11226 .closest('fieldset') 11227 .find('.slider') 11228 .slider('value'); 11229 11230 var tempEmptyVal = function () { 11231 $(this).val(''); 11232 }; 11233 11234 var tempSetFocus = function () { 11235 if ($(this).find("option:selected").val() === '') { 11236 return true; 11237 } 11238 $(this).closest("tr").find("input").focus(); 11239 }; 11240 11241 while (rows_to_add--) { 11242 var $indexColumns = $('#index_columns'); 11243 var $newrow = $indexColumns 11244 .find('tbody > tr:first') 11245 .clone() 11246 .appendTo( 11247 $indexColumns.find('tbody') 11248 ); 11249 $newrow.find(':input').each(tempEmptyVal); 11250 // focus index size input on column picked 11251 $newrow.find('select').change(tempSetFocus); 11252 } 11253 }); 11254}); 11255 11256function indexEditorDialog(url, title, callback_success, callback_failure) 11257{ 11258 /*Remove the hidden dialogs if there are*/ 11259 var $editIndexDialog = $('#edit_index_dialog'); 11260 if ($editIndexDialog.length !== 0) { 11261 $editIndexDialog.remove(); 11262 } 11263 var $div = $('<div id="edit_index_dialog"></div>'); 11264 11265 /** 11266 * @var button_options Object that stores the options 11267 * passed to jQueryUI dialog 11268 */ 11269 var button_options = {}; 11270 button_options[PMA_messages.strGo] = function () { 11271 /** 11272 * @var the_form object referring to the export form 11273 */ 11274 var $form = $("#index_frm"); 11275 var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); 11276 PMA_prepareForAjaxRequest($form); 11277 //User wants to submit the form 11278 $.post($form.attr('action'), $form.serialize() + "&do_save_data=1", function (data) { 11279 var $sqlqueryresults = $(".sqlqueryresults"); 11280 if ($sqlqueryresults.length !== 0) { 11281 $sqlqueryresults.remove(); 11282 } 11283 if (typeof data !== 'undefined' && data.success === true) { 11284 PMA_ajaxShowMessage(data.message); 11285 var $resultQuery = $('.result_query'); 11286 if ($resultQuery.length) { 11287 $resultQuery.remove(); 11288 } 11289 if (data.sql_query) { 11290 $('<div class="result_query"></div>') 11291 .html(data.sql_query) 11292 .prependTo('#page_content'); 11293 PMA_highlightSQL($('#page_content')); 11294 } 11295 $(".result_query .notice").remove(); 11296 $resultQuery.prepend(data.message); 11297 /*Reload the field form*/ 11298 $("#table_index").remove(); 11299 $("<div id='temp_div'><div>") 11300 .append(data.index_table) 11301 .find("#table_index") 11302 .insertAfter("#index_header"); 11303 var $editIndexDialog = $("#edit_index_dialog"); 11304 if ($editIndexDialog.length > 0) { 11305 $editIndexDialog.dialog("close"); 11306 } 11307 $('div.no_indexes_defined').hide(); 11308 if (callback_success) { 11309 callback_success(); 11310 } 11311 PMA_reloadNavigation(); 11312 } else { 11313 var $temp_div = $("<div id='temp_div'><div>").append(data.error); 11314 var $error; 11315 if ($temp_div.find(".error code").length !== 0) { 11316 $error = $temp_div.find(".error code").addClass("error"); 11317 } else { 11318 $error = $temp_div; 11319 } 11320 if (callback_failure) { 11321 callback_failure(); 11322 } 11323 PMA_ajaxShowMessage($error, false); 11324 } 11325 }); // end $.post() 11326 }; 11327 button_options[PMA_messages.strPreviewSQL] = function () { 11328 // Function for Previewing SQL 11329 var $form = $('#index_frm'); 11330 PMA_previewSQL($form); 11331 }; 11332 button_options[PMA_messages.strCancel] = function () { 11333 $(this).dialog('close'); 11334 };
11335 var $msgbox = PMA_ajaxShowMessage(); 11336 $.get("tbl_indexes.php", url, function (data) { 11337 if (typeof data !== 'undefined' && data.success === false) { 11338 //in the case of an error, show the error message returned. 11339 PMA_ajaxShowMessage(data.error, false); 11340 } else { 11341 PMA_ajaxRemoveMessage($msgbox); 11342 // Show dialog if the request was successful 11343 $div 11344 .append(data.message) 11345 .dialog({ 11346 title: title, 11347 width: 450, 11348 height: 350, 11349 open: PMA_verifyColumnsProperties, 11350 modal: true, 11351 buttons: button_options, 11352 close: function () { 11353 $(this).remove(); 11354 } 11355 }); 11356 $div.find('.tblFooters').remove(); 11357 showIndexEditDialog($div); 11358 } 11359 }); // end $.get() 11360} 11361 11362function showIndexEditDialog($outer) 11363{ 11364 checkIndexType(); 11365 checkIndexName("index_frm"); 11366 var $indexColumns = $('#index_columns'); 11367 $indexColumns.find('td').each(function () { 11368 $(this).css("width", $(this).width() + 'px'); 11369 }); 11370 $indexColumns.find('tbody').sortable({ 11371 axis: 'y', 11372 containment: $indexColumns.find("tbody"), 11373 tolerance: 'pointer' 11374 }); 11375 PMA_showHints($outer); 11376 PMA_init_slider(); 11377 // Add a slider for selecting how many columns to add to the index 11378 $outer.find('.slider').slider({ 11379 animate: true, 11380 value: 1, 11381 min: 1, 11382 max: 16, 11383 slide: function (event, ui) { 11384 $(this).closest('fieldset').find('input[type=submit]').val( 11385 PMA_sprintf(PMA_messages.strAddToIndex, ui.value) 11386 ); 11387 } 11388 }); 11389 $('div.add_fields').removeClass('hide'); 11390 // focus index size input on column picked 11391 $outer.find('table#index_columns select').change(function () { 11392 if ($(this).find("option:selected").val() === '') { 11393 return true; 11394 } 11395 $(this).closest("tr").find("input").focus(); 11396 }); 11397 // Focus the slider, otherwise it looks nearly transparent 11398 $('a.ui-slider-handle').addClass('ui-state-focus'); 11399 // set focus on index name input, if empty 11400 var input = $outer.find('input#input_index_name'); 11401 input.val() || input.focus(); 11402} 11403 11404/** 11405 * Function to display tooltips that were 11406 * generated on the PHP side by PMA_Util::showHint() 11407 * 11408 * @param object $div a div jquery object which specifies the 11409 * domain for searching for tooltips. If we 11410 * omit this parameter the function searches 11411 * in the whole body 11412 **/ 11413function PMA_showHints($div) 11414{ 11415 if ($div === undefined || ! $div instanceof jQuery || $div.length === 0) { 11416 $div = $("body"); 11417 } 11418 $div.find('.pma_hint').each(function () { 11419 PMA_tooltip( 11420 $(this).children('img'), 11421 'img', 11422 $(this).children('span').html() 11423 ); 11424 }); 11425} 11426 11427AJAX.registerOnload('functions.js', function () { 11428 PMA_showHints(); 11429}); 11430 11431function PMA_mainMenuResizerCallback() { 11432 // 5 px margin for jumping menu in Chrome 11433 return $(document.body).width() - 5; 11434} 11435// This must be fired only once after the initial page load 11436$(function () { 11437 // Initialise the menu resize plugin 11438 $('#topmenu').menuResizer(PMA_mainMenuResizerCallback); 11439 // register resize event 11440 $(window).resize(function () { 11441 $('#topmenu').menuResizer('resize'); 11442 }); 11443}); 11444 11445/** 11446 * Get the row number from the classlist (for example, row_1) 11447 */ 11448function PMA_getRowNumber(classlist) 11449{ 11450 return parseInt(classlist.split(/\s+row_/)[1], 10); 11451} 11452 11453/** 11454 * Changes status of slider 11455 */ 11456function PMA_set_status_label($element) 11457{ 11458 var text; 11459 if ($element.css('display') == 'none') { 11460 text = '+ '; 11461 } else { 11462 text = '- '; 11463 } 11464 $element.closest('.slide-wrapper').prev().find('span').text(text); 11465} 11466 11467/** 11468 * var toggleButton This is a function that creates a toggle 11469 * sliding button given a jQuery reference 11470 * to the correct DOM element 11471 */ 11472var toggleButton = function ($obj) { 11473 // In rtl mode the toggle switch is flipped horizontally 11474 // so we need to take that into account 11475 var right; 11476 if ($('span.text_direction', $obj).text() == 'ltr') { 11477 right = 'right'; 11478 } else { 11479 right = 'left'; 11480 } 11481 /** 11482 * var h Height of the button, used to scale the 11483 * background image and position the layers 11484 */ 11485 var h = $obj.height(); 11486 $('img', $obj).height(h); 11487 $('table', $obj).css('bottom', h - 1); 11488 /** 11489 * var on Width of the "ON" part of the toggle switch 11490 * var off Width of the "OFF" part of the toggle switch 11491 */ 11492 var on = $('td.toggleOn', $obj).width(); 11493 var off = $('td.toggleOff', $obj).width(); 11494 // Make the "ON" and "OFF" parts of the switch the same size 11495 // + 2 pixels to avoid overflowed 11496 $('td.toggleOn > div', $obj).width(Math.max(on, off) + 2); 11497 $('td.toggleOff > div', $obj).width(Math.max(on, off) + 2); 11498 /** 11499 * var w Width of the central part of the switch 11500 */ 11501 var w = parseInt(($('img', $obj).height() / 16) * 22, 10); 11502 // Resize the central part of the switch on the top 11503 // layer to match the background 11504 $('table td:nth-child(2) > div', $obj).width(w); 11505 /** 11506 * var imgw Width of the background image 11507 * var tblw Width of the foreground layer 11508 * var offset By how many pixels to move the background 11509 * image, so that it matches the top layer 11510 */ 11511 var imgw = $('img', $obj).width(); 11512 var tblw = $('table', $obj).width(); 11513 var offset = parseInt(((imgw - tblw) / 2), 10); 11514 // Move the background to match the layout of the top layer 11515 $obj.find('img').css(right, offset); 11516 /** 11517 * var offw Outer width of the "ON" part of the toggle switch 11518 * var btnw Outer width of the central part of the switch 11519 */ 11520 var offw = $('td.toggleOff', $obj).outerWidth(); 11521 var btnw = $('table td:nth-child(2)', $obj).outerWidth(); 11522 // Resize the main div so that exactly one side of
11523 // the switch plus the central part fit into it. 11524 $obj.width(offw + btnw + 2); 11525 /** 11526 * var move How many pixels to move the 11527 * switch by when toggling 11528 */ 11529 var move = $('td.toggleOff', $obj).outerWidth(); 11530 // If the switch is initialized to the 11531 // OFF state we need to move it now. 11532 if ($('div.container', $obj).hasClass('off')) { 11533 if (right == 'right') { 11534 $('div.container', $obj).animate({'left': '-=' + move + 'px'}, 0); 11535 } else { 11536 $('div.container', $obj).animate({'left': '+=' + move + 'px'}, 0); 11537 } 11538 } 11539 // Attach an 'onclick' event to the switch 11540 $('div.container', $obj).click(function () { 11541 if ($(this).hasClass('isActive')) { 11542 return false; 11543 } else { 11544 $(this).addClass('isActive'); 11545 } 11546 var $msg = PMA_ajaxShowMessage(); 11547 var $container = $(this); 11548 var callback = $('span.callback', this).text(); 11549 var operator, url, removeClass, addClass; 11550 // Perform the actual toggle 11551 if ($(this).hasClass('on')) { 11552 if (right == 'right') { 11553 operator = '-='; 11554 } else { 11555 operator = '+='; 11556 } 11557 url = $(this).find('td.toggleOff > span').text(); 11558 removeClass = 'on'; 11559 addClass = 'off'; 11560 } else { 11561 if (right == 'right') { 11562 operator = '+='; 11563 } else { 11564 operator = '-='; 11565 } 11566 url = $(this).find('td.toggleOn > span').text(); 11567 removeClass = 'off'; 11568 addClass = 'on'; 11569 } 11570 $.post(url, {'ajax_request': true}, function (data) { 11571 if (typeof data !== 'undefined' && data.success === true) { 11572 PMA_ajaxRemoveMessage($msg); 11573 $container 11574 .removeClass(removeClass) 11575 .addClass(addClass) 11576 .animate({'left': operator + move + 'px'}, function () { 11577 $container.removeClass('isActive'); 11578 }); 11579 eval(callback); 11580 } else { 11581 PMA_ajaxShowMessage(data.error, false); 11582 $container.removeClass('isActive'); 11583 } 11584 }); 11585 }); 11586}; 11587 11588/** 11589 * Unbind all event handlers before tearing down a page 11590 */ 11591AJAX.registerTeardown('functions.js', function () { 11592 $('div.container').unbind('click'); 11593}); 11594/** 11595 * Initialise all toggle buttons 11596 */ 11597AJAX.registerOnload('functions.js', function () { 11598 $('div.toggleAjax').each(function () { 11599 var $button = $(this).show(); 11600 $button.find('img').each(function () { 11601 if (this.complete) { 11602 toggleButton($button); 11603 } else { 11604 $(this).load(function () { 11605 toggleButton($button); 11606 }); 11607 } 11608 }); 11609 }); 11610}); 11611 11612/** 11613 * Unbind all event handlers before tearing down a page 11614 */ 11615AJAX.registerTeardown('functions.js', function () { 11616 $(document).off('change', 'select.pageselector'); 11617 $(document).off('click', 'a.formLinkSubmit'); 11618 $('#update_recent_tables').unbind('ready'); 11619 $('#sync_favorite_tables').unbind('ready'); 11620}); 11621 11622AJAX.registerOnload('functions.js', function () { 11623 11624 /** 11625 * Autosubmit page selector 11626 */ 11627 $(document).on('change', 'select.pageselector', function (event) { 11628 event.stopPropagation(); 11629 // Check where to load the new content 11630 if ($(this).closest("#pma_navigation").length === 0) { 11631 // For the main page we don't need to do anything, 11632 $(this).closest("form").submit(); 11633 } else { 11634 // but for the navigation we need to manually replace the content 11635 PMA_navigationTreePagination($(this)); 11636 } 11637 }); 11638 11639 /** 11640 * Load version information asynchronously. 11641 */ 11642 if ($('li.jsversioncheck').length > 0) { 11643 $.getJSON('version_check.php', {'server' : PMA_commonParams.get('server')}, PMA_current_version); 11644 } 11645 11646 if ($('#is_git_revision').length > 0) { 11647 setTimeout(PMA_display_git_revision, 10); 11648 } 11649 11650 /** 11651 * Slider effect. 11652 */ 11653 PMA_init_slider(); 11654 11655 /** 11656 * Enables the text generated by PMA_Util::linkOrButton() to be clickable 11657 */ 11658 $(document).on('click', 'a.formLinkSubmit', function (e) { 11659 if (! $(this).hasClass('requireConfirm')) { 11660 submitFormLink($(this)); 11661 return false;
11662 } 11663 }); 11664 11665 var $updateRecentTables = $('#update_recent_tables'); 11666 if ($updateRecentTables.length) { 11667 $.get( 11668 $updateRecentTables.attr('href'), 11669 {no_debug: true}, 11670 function (data) { 11671 if (typeof data !== 'undefined' && data.success === true) { 11672 $('#pma_recent_list').html(data.list); 11673 } 11674 } 11675 ); 11676 } 11677 11678 // Sync favorite tables from localStorage to pmadb. 11679 if ($('#sync_favorite_tables').length) { 11680 $.ajax({ 11681 url: $('#sync_favorite_tables').attr("href"), 11682 cache: false, 11683 type: 'POST', 11684 data: { 11685 favorite_tables: (isStorageSupported('localStorage') && typeof window.localStorage.favorite_tables !== 'undefined') 11686 ? window.localStorage.favorite_tables 11687 : '', 11688 no_debug: true 11689 }, 11690 success: function (data) { 11691 // Update localStorage. 11692 if (isStorageSupported('localStorage')) { 11693 window.localStorage.favorite_tables = data.favorite_tables; 11694 } 11695 $('#pma_favorite_list').html(data.list); 11696 } 11697 }); 11698 } 11699}); // end of $() 11700 11701/** 11702 * Submits the form placed in place of a link due to the excessive url length 11703 * 11704 * @param $link anchor 11705 * @returns {Boolean} 11706 */ 11707function submitFormLink($link) 11708{ 11709 if ($link.attr('href').indexOf('=') != -1) { 11710 var data = $link.attr('href').substr($link.attr('href').indexOf('#') + 1).split('=', 2); 11711 $link.parents('form').append('<input type="hidden" name="' + data[0] + '" value="' + data[1] + '"/>'); 11712 } 11713 $link.parents('form').submit(); 11714} 11715 11716/** 11717 * Initializes slider effect. 11718 */ 11719function PMA_init_slider() 11720{ 11721 $('div.pma_auto_slider').each(function () { 11722 var $this = $(this); 11723 if ($this.data('slider_init_done')) { 11724 return; 11725 } 11726 var $wrapper = $('<div>', {'class': 'slide-wrapper'}); 11727 $wrapper.toggle($this.is(':visible')); 11728 $('<a>', {href: '#' + this.id, "class": 'ajax'}) 11729 .text($this.attr('title')) 11730 .prepend($('<span>')) 11731 .insertBefore($this) 11732 .click(function () { 11733 var $wrapper = $this.closest('.slide-wrapper'); 11734 var visible = $this.is(':visible'); 11735 if (!visible) { 11736 $wrapper.show(); 11737 } 11738 $this[visible ? 'hide' : 'show']('blind', function () { 11739 $wrapper.toggle(!visible); 11740 $wrapper.parent().toggleClass("print_ignore", visible); 11741 PMA_set_status_label($this); 11742 }); 11743 return false; 11744 }); 11745 $this.wrap($wrapper); 11746 $this.removeAttr('title'); 11747 PMA_set_status_label($this); 11748 $this.data('slider_init_done', 1); 11749 }); 11750} 11751 11752/** 11753 * Initializes slider effect. 11754 */ 11755AJAX.registerOnload('functions.js', function () { 11756 PMA_init_slider(); 11757}); 11758 11759/** 11760 * Restores sliders to the state they were in before initialisation. 11761 */ 11762AJAX.registerTeardown('functions.js', function () { 11763 $('div.pma_auto_slider').each(function () { 11764 var $this = $(this); 11765 $this.removeData(); 11766 $this.parent().replaceWith($this); 11767 $this.parent().children('a').remove(); 11768 }); 11769}); 11770 11771/** 11772 * Creates a message inside an object with a sliding effect 11773 * 11774 * @param msg A string containing the text to display 11775 * @param $obj a jQuery object containing the reference 11776 * to the element where to put the message 11777 * This is optional, if no element is 11778 * provided, one will be created below the 11779 * navigation links at the top of the page 11780 * 11781 * @return bool True on success, false on failure 11782 */ 11783function PMA_slidingMessage(msg, $obj) 11784{ 11785 if (msg === undefined || msg.length === 0) { 11786 // Don't show an empty message 11787 return false; 11788 } 11789 if ($obj === undefined || ! $obj instanceof jQuery || $obj.length === 0) { 11790 // If the second argument was not supplied, 11791 // we might have to create a new DOM node. 11792 if ($('#PMA_slidingMessage').length === 0) { 11793 $('#page_content').prepend( 11794 '<span id="PMA_slidingMessage" ' + 11795 'style="display: inline-block;"></span>' 11796 ); 11797 } 11798 $obj = $('#PMA_slidingMessage'); 11799 } 11800 if ($obj.has('div').length > 0) { 11801 // If there already is a message inside the 11802 // target object, we must get rid of it 11803 $obj 11804 .find('div') 11805 .first() 11806 .fadeOut(function () { 11807 $obj 11808 .children() 11809 .remove(); 11810 $obj 11811 .append('<div>' + msg + '</div>'); 11812 // highlight any sql before taking height; 11813 PMA_highlightSQL($obj); 11814 $obj.find('div') 11815 .first() 11816 .hide(); 11817 $obj 11818 .animate({ 11819 height: $obj.find('div').first().height() 11820 }) 11821 .find('div') 11822 .first() 11823 .fadeIn(); 11824 }); 11825 } else { 11826 // Object does not already have a message 11827 // inside it, so we simply slide it down 11828 $obj.width('100%') 11829 .html('<div>' + msg + '</div>'); 11830 // highlight any sql before taking height; 11831 PMA_highlightSQL($obj); 11832 var h = $obj 11833 .find('div') 11834 .first() 11835 .hide() 11836 .height(); 11837 $obj 11838 .find('div') 11839 .first() 11840 .css('height', 0) 11841 .show() 11842 .animate({ 11843 height: h 11844 }, function () { 11845 // Set the height of the parent 11846 // to the height of the child 11847 $obj 11848 .height( 11849 $obj 11850 .find('div') 11851 .first() 11852 .height() 11853 ); 11854 }); 11855 } 11856 return true; 11857} // end PMA_slidingMessage() 11858 11859/** 11860 * Attach CodeMirror2 editor to SQL edit area. 11861 */ 11862AJAX.registerOnload('functions.js', function () { 11863 var $elm = $('#sqlquery'); 11864 if ($elm.length > 0) { 11865 if (typeof CodeMirror != 'undefined') { 11866 codemirror_editor = PMA_getSQLEditor($elm); 11867 codemirror_editor.focus(); 11868 codemirror_editor.on("blur", updateQueryParameters); 11869 } else { 11870 // without codemirror 11871 $elm.focus() 11872 .bind('blur', updateQueryParameters); 11873 } 11874 } 11875 PMA_highlightSQL($('body')); 11876}); 11877AJAX.registerTeardown('functions.js', function () { 11878 if (codemirror_editor) { 11879 $('#sqlquery').text(codemirror_editor.getValue()); 11880 codemirror_editor.toTextArea(); 11881 codemirror_editor = false;
11882 } 11883}); 11884AJAX.registerOnload('functions.js', function () { 11885 // initializes all lock-page elements lock-id and 11886 // val-hash data property 11887 $('#page_content form.lock-page textarea, ' + 11888 '#page_content form.lock-page input[type="text"], '+ 11889 '#page_content form.lock-page input[type="number"], '+ 11890 '#page_content form.lock-page select').each(function (i) { 11891 $(this).data('lock-id', i); 11892 // val-hash is the hash of default value of the field 11893 // so that it can be compared with new value hash 11894 // to check whether field was modified or not. 11895 $(this).data('val-hash', AJAX.hash($(this).val())); 11896 }); 11897 11898 // initializes lock-page elements (input types checkbox and radio buttons) 11899 // lock-id and val-hash data property 11900 $('#page_content form.lock-page input[type="checkbox"], ' + 11901 '#page_content form.lock-page input[type="radio"]').each(function (i) { 11902 $(this).data('lock-id', i); 11903 $(this).data('val-hash', AJAX.hash($(this).is(":checked"))); 11904 }); 11905}); 11906/** 11907 * jQuery plugin to cancel selection in HTML code. 11908 */ 11909(function ($) { 11910 $.fn.noSelect = function (p) { //no select plugin by Paulo P.Marinas 11911 var prevent = (p === null) ? true : p; 11912 var is_msie = navigator.userAgent.indexOf('MSIE') > -1 || !!window.navigator.userAgent.match(/Trident.*rv\:11\./); 11913 var is_firefox = navigator.userAgent.indexOf('Firefox') > -1; 11914 var is_safari = navigator.userAgent.indexOf("Safari") > -1; 11915 var is_opera = navigator.userAgent.indexOf("Presto") > -1; 11916 if (prevent) { 11917 return this.each(function () { 11918 if (is_msie || is_safari) { 11919 $(this).bind('selectstart', function () { 11920 return false; 11921 }); 11922 } else if (is_firefox) { 11923 $(this).css('MozUserSelect', 'none'); 11924 $('body').trigger('focus'); 11925 } else if (is_opera) { 11926 $(this).bind('mousedown', function () { 11927 return false; 11928 }); 11929 } else { 11930 $(this).attr('unselectable', 'on'); 11931 } 11932 }); 11933 } else { 11934 return this.each(function () { 11935 if (is_msie || is_safari) { 11936 $(this).unbind('selectstart'); 11937 } else if (is_firefox) { 11938 $(this).css('MozUserSelect', 'inherit'); 11939 } else if (is_opera) { 11940 $(this).unbind('mousedown'); 11941 } else { 11942 $(this).removeAttr('unselectable'); 11943 } 11944 }); 11945 } 11946 }; //end noSelect 11947})(jQuery); 11948 11949/** 11950 * jQuery plugin to correctly filter input fields by value, needed 11951 * because some nasty values may break selector syntax 11952 */ 11953(function ($) { 11954 $.fn.filterByValue = function (value) { 11955 return this.filter(function () { 11956 return $(this).val() === value; 11957 }); 11958 }; 11959})(jQuery); 11960 11961/** 11962 * Return value of a cell in a table. 11963 */ 11964function PMA_getCellValue(td) { 11965 var $td = $(td); 11966 if ($td.is('.null')) { 11967 return ''; 11968 } else if ((! $td.is('.to_be_saved') 11969 || $td.is('.set')) 11970 && $td.data('original_data') 11971 ) { 11972 return $td.data('original_data'); 11973 } else { 11974 return $td.text(); 11975 } 11976} 11977 11978/** 11979 * Unbind all event handlers before tearing down a page 11980 */ 11981AJAX.registerTeardown('functions.js', function () { 11982 $(document).off('click', 'a.themeselect'); 11983 $(document).off('change', '.autosubmit'); 11984 $('a.take_theme').unbind('click'); 11985}); 11986 11987AJAX.registerOnload('functions.js', function () { 11988 /** 11989 * Theme selector. 11990 */ 11991 $(document).on('click', 'a.themeselect', function (e) { 11992 window.open( 11993 e.target, 11994 'themes', 11995 'left=10,top=20,width=510,height=350,scrollbars=yes,status=yes,resizable=yes' 11996 ); 11997 return false; 11998 }); 11999 12000 /** 12001 * Automatic form submission on change. 12002 */ 12003 $(document).on('change', '.autosubmit', function (e) { 12004 $(this).closest('form').submit(); 12005 }); 12006 12007 /** 12008 * Theme changer. 12009 */ 12010 $('a.take_theme').click(function (e) { 12011 var what = this.name; 12012 if (window.opener && window.opener.document.forms.setTheme.elements.set_theme) { 12013 window.opener.document.forms.setTheme.elements.set_theme.value = what; 12014 window.opener.document.forms.setTheme.submit(); 12015 window.close(); 12016 return false;
12017 } 12018 return true; 12019 }); 12020}); 12021 12022/** 12023 * Print button 12024 */ 12025function printPage() 12026{ 12027 // Do print the page 12028 if (typeof(window.print) != 'undefined') { 12029 window.print(); 12030 } 12031} 12032 12033/** 12034 * Unbind all event handlers before tearing down a page 12035 */ 12036AJAX.registerTeardown('functions.js', function () { 12037 $('input#print').unbind('click'); 12038 $(document).off('click', 'a.create_view.ajax'); 12039 $(document).off('keydown', '#createViewDialog input, #createViewDialog select'); 12040 $(document).off('change', '#fkc_checkbox'); 12041}); 12042 12043AJAX.registerOnload('functions.js', function () { 12044 $('input#print').click(printPage); 12045 /** 12046 * Ajaxification for the "Create View" action 12047 */ 12048 $(document).on('click', 'a.create_view.ajax', function (e) { 12049 e.preventDefault(); 12050 PMA_createViewDialog($(this)); 12051 }); 12052 /** 12053 * Attach Ajax event handlers for input fields in the editor 12054 * and used to submit the Ajax request when the ENTER key is pressed. 12055 */ 12056 if ($('#createViewDialog').length !== 0) { 12057 $(document).on('keydown', '#createViewDialog input, #createViewDialog select', function (e) { 12058 if (e.which === 13) { // 13 is the ENTER key 12059 e.preventDefault(); 12060 12061 // with preventing default, selection by <select> tag 12062 // was also prevented in IE 12063 $(this).blur(); 12064 12065 $(this).closest('.ui-dialog').find('.ui-button:first').click(); 12066 } 12067 }); // end $(document).on() 12068 } 12069 12070 syntaxHighlighter = PMA_getSQLEditor($('textarea[name="view[as]"]')); 12071 12072}); 12073 12074function PMA_createViewDialog($this) 12075{ 12076 var $msg = PMA_ajaxShowMessage(); 12077 var syntaxHighlighter = null; 12078 $.get($this.attr('href') + '&ajax_request=1&ajax_dialog=1', function (data) { 12079 if (typeof data !== 'undefined' && data.success === true) { 12080 PMA_ajaxRemoveMessage($msg); 12081 var buttonOptions = {}; 12082 buttonOptions[PMA_messages.strGo] = function () { 12083 if (typeof CodeMirror !== 'undefined') { 12084 syntaxHighlighter.save(); 12085 } 12086 $msg = PMA_ajaxShowMessage(); 12087 $.get('view_create.php', $('#createViewDialog').find('form').serialize(), function (data) { 12088 PMA_ajaxRemoveMessage($msg); 12089 if (typeof data !== 'undefined' && data.success === true) { 12090 $('#createViewDialog').dialog("close"); 12091 $('.result_query').html(data.message); 12092 PMA_reloadNavigation(); 12093 } else { 12094 PMA_ajaxShowMessage(data.error, false); 12095 } 12096 }); 12097 }; 12098 buttonOptions[PMA_messages.strClose] = function () { 12099 $(this).dialog("close"); 12100 }; 12101 var $dialog = $('<div/>').attr('id', 'createViewDialog').append(data.message).dialog({ 12102 width: 600, 12103 minWidth: 400, 12104 modal: true, 12105 buttons: buttonOptions, 12106 title: PMA_messages.strCreateView, 12107 close: function () { 12108 $(this).remove(); 12109 } 12110 }); 12111 // Attach syntax highlighted editor 12112 syntaxHighlighter = PMA_getSQLEditor($dialog.find('textarea')); 12113 $('input:visible[type=text]', $dialog).first().focus(); 12114 } else { 12115 PMA_ajaxShowMessage(data.error); 12116 } 12117 }); 12118} 12119 12120/** 12121 * Makes the breadcrumbs and the menu bar float at the top of the viewport 12122 */ 12123$(function () { 12124 if ($("#floating_menubar").length && $('#PMA_disable_floating_menubar').length === 0) { 12125 var left = $('html').attr('dir') == 'ltr' ? 'left' : 'right'; 12126 $("#floating_menubar") 12127 .css('margin-' + left, $('#pma_navigation').width() + $('#pma_navigation_resizer').width()) 12128 .css(left, 0) 12129 .css({ 12130 'position': 'fixed', 12131 'top': 0, 12132 'width': '100%', 12133 'z-index': 99 12134 }) 12135 .append($('#serverinfo')) 12136 .append($('#topmenucontainer')); 12137 // Allow the DOM to render, then adjust the padding on the body 12138 setTimeout(function () { 12139 $('body').css( 12140 'padding-top', 12141 $('#floating_menubar').outerHeight(true) 12142 ); 12143 $('#topmenu').menuResizer('resize'); 12144 }, 4); 12145 } 12146}); 12147 12148/** 12149 * Scrolls the page to the top if clicking the serverinfo bar 12150 */ 12151$(function () { 12152 $(document).delegate("#serverinfo, #goto_pagetop", "click", function (event) { 12153 event.preventDefault(); 12154 $('html, body').animate({scrollTop: 0}, 'fast'); 12155 }); 12156}); 12157 12158var checkboxes_sel = "input.checkall:checkbox:enabled"; 12159/** 12160 * Watches checkboxes in a form to set the checkall box accordingly 12161 */ 12162var checkboxes_changed = function () { 12163 var $form = $(this.form); 12164 // total number of checkboxes in current form 12165 var total_boxes = $form.find(checkboxes_sel).length; 12166 // number of checkboxes checked in current form 12167 var checked_boxes = $form.find(checkboxes_sel + ":checked").length; 12168 var $checkall = $form.find("input.checkall_box"); 12169 if (total_boxes == checked_boxes) { 12170 $checkall.prop({checked: true, indeterminate: false}); 12171 } 12172 else if (checked_boxes > 0) { 12173 $checkall.prop({checked: true, indeterminate: true}); 12174 } 12175 else {
12176 $checkall.prop({checked: false, indeterminate: false}); 12177 } 12178}; 12179$(document).on("change", checkboxes_sel, checkboxes_changed); 12180 12181$(document).on("change", "input.checkall_box", function () { 12182 var is_checked = $(this).is(":checked"); 12183 $(this.form).find(checkboxes_sel).prop("checked", is_checked) 12184 .parents("tr").toggleClass("marked", is_checked); 12185}); 12186 12187/** 12188 * Watches checkboxes in a sub form to set the sub checkall box accordingly 12189 */ 12190var sub_checkboxes_changed = function () { 12191 var $form = $(this).parent().parent(); 12192 // total number of checkboxes in current sub form 12193 var total_boxes = $form.find(checkboxes_sel).length; 12194 // number of checkboxes checked in current sub form 12195 var checked_boxes = $form.find(checkboxes_sel + ":checked").length; 12196 var $checkall = $form.find("input.sub_checkall_box"); 12197 if (total_boxes == checked_boxes) { 12198 $checkall.prop({checked: true, indeterminate: false}); 12199 } 12200 else if (checked_boxes > 0) { 12201 $checkall.prop({checked: true, indeterminate: true}); 12202 } 12203 else { 12204 $checkall.prop({checked: false, indeterminate: false}); 12205 } 12206}; 12207$(document).on("change", checkboxes_sel + ", input.checkall_box:checkbox:enabled", sub_checkboxes_changed); 12208 12209$(document).on("change", "input.sub_checkall_box", function () { 12210 var is_checked = $(this).is(":checked"); 12211 var $form = $(this).parent().parent(); 12212 $form.find(checkboxes_sel).prop("checked", is_checked) 12213 .parents("tr").toggleClass("marked", is_checked); 12214}); 12215 12216/** 12217 * Toggles row colors of a set of 'tr' elements starting from a given element 12218 * 12219 * @param $start Starting element 12220 */ 12221function toggleRowColors($start) 12222{ 12223 for (var $curr_row = $start; $curr_row.length > 0; $curr_row = $curr_row.next()) { 12224 if ($curr_row.hasClass('odd')) { 12225 $curr_row.removeClass('odd').addClass('even'); 12226 } else if ($curr_row.hasClass('even')) { 12227 $curr_row.removeClass('even').addClass('odd'); 12228 } 12229 } 12230} 12231 12232/** 12233 * Formats a byte number to human-readable form 12234 * 12235 * @param bytes the bytes to format 12236 * @param optional subdecimals the number of digits after the point 12237 * @param optional pointchar the char to use as decimal point 12238 */ 12239function formatBytes(bytes, subdecimals, pointchar) { 12240 if (!subdecimals) { 12241 subdecimals = 0; 12242 } 12243 if (!pointchar) { 12244 pointchar = '.'; 12245 } 12246 var units = ['B', 'KiB', 'MiB', 'GiB']; 12247 for (var i = 0; bytes > 1024 && i < units.length; i++) { 12248 bytes /= 1024; 12249 } 12250 var factor = Math.pow(10, subdecimals); 12251 bytes = Math.round(bytes * factor) / factor; 12252 bytes = bytes.toString().split('.').join(pointchar); 12253 return bytes + ' ' + units[i]; 12254} 12255 12256AJAX.registerOnload('functions.js', function () { 12257 /** 12258 * Opens pma more themes link in themes browser, in new window instead of popup 12259 * This way, we don't break HTML validity 12260 */ 12261 $("a._blank").prop("target", "_blank"); 12262 /** 12263 * Reveal the login form to users with JS enabled 12264 * and focus the appropriate input field 12265 */ 12266 var $loginform = $('#loginform'); 12267 if ($loginform.length) { 12268 $loginform.find('.js-show').show(); 12269 if ($('#input_username').val()) { 12270 $('#input_password').focus(); 12271 } else { 12272 $('#input_username').focus(); 12273 } 12274 } 12275}); 12276 12277/** 12278 * Dynamically adjust the width of the boxes 12279 * on the table and db operations pages 12280 */ 12281(function () { 12282 function DynamicBoxes() { 12283 var $boxContainer = $('#boxContainer'); 12284 if ($boxContainer.length) { 12285 var minWidth = $boxContainer.data('box-width'); 12286 var viewport = $(window).width() - $('#pma_navigation').width(); 12287 var slots = Math.floor(viewport / minWidth); 12288 $boxContainer.children() 12289 .each(function () { 12290 if (viewport < minWidth) { 12291 $(this).width(minWidth); 12292 } else { 12293 $(this).css('width', ((1 / slots) * 100) + "%"); 12294 } 12295 }) 12296 .removeClass('clearfloat') 12297 .filter(':nth-child(' + slots + 'n+1)') 12298 .addClass('clearfloat'); 12299 } 12300 } 12301 AJAX.registerOnload('functions.js', function () { 12302 DynamicBoxes(); 12303 }); 12304 $(function () { 12305 $(window).resize(DynamicBoxes); 12306 }); 12307})(); 12308 12309/** 12310 * Formats timestamp for display 12311 */ 12312function PMA_formatDateTime(date, seconds) { 12313 var result = $.datepicker.formatDate('yy-mm-dd', date); 12314 var timefmt = 'HH:mm'; 12315 if (seconds) { 12316 timefmt = 'HH:mm:ss'; 12317 } 12318 return result + ' ' + $.datepicker.formatTime( 12319 timefmt, { 12320 hour: date.getHours(), 12321 minute: date.getMinutes(), 12322 second: date.getSeconds() 12323 } 12324 ); 12325} 12326 12327/** 12328 * Check than forms have less fields than max allowed by PHP. 12329 */ 12330function checkNumberOfFields() { 12331 if (typeof maxInputVars === 'undefined') { 12332 return false;
12333 } 12334 if (false === maxInputVars) { 12335 return false; 12336 } 12337 $('form').each(function() { 12338 var nbInputs = $(this).find(':input').length; 12339 if (nbInputs > maxInputVars) { 12340 var warning = PMA_sprintf(PMA_messages.strTooManyInputs, maxInputVars); 12341 PMA_ajaxShowMessage(warning); 12342 return false; 12343 } 12344 return true; 12345 }); 12346 12347 return true; 12348} 12349 12350/** 12351 * Ignore the displayed php errors. 12352 * Simply removes the displayed errors. 12353 * 12354 * @param clearPrevErrors whether to clear errors stored 12355 * in $_SESSION['prev_errors'] at server 12356 * 12357 */ 12358function PMA_ignorePhpErrors(clearPrevErrors){ 12359 if (typeof(clearPrevErrors) === "undefined" || 12360 clearPrevErrors === null 12361 ) { 12362 str = false; 12363 } 12364 // send AJAX request to error_report.php with send_error_report=0, exception_type=php & token. 12365 // It clears the prev_errors stored in session. 12366 if(clearPrevErrors){ 12367 var $pmaReportErrorsForm = $('#pma_report_errors_form'); 12368 $pmaReportErrorsForm.find('input[name="send_error_report"]').val(0); // change send_error_report to '0' 12369 $pmaReportErrorsForm.submit(); 12370 } 12371 12372 // remove displayed errors 12373 var $pmaErrors = $('#pma_errors'); 12374 $pmaErrors.fadeOut( "slow"); 12375 $pmaErrors.remove(); 12376} 12377 12378/** 12379 * checks whether browser supports web storage 12380 * 12381 * @param type the type of storage i.e. localStorage or sessionStorage 12382 * 12383 * @returns bool 12384 */ 12385function isStorageSupported(type) 12386{ 12387 try { 12388 window[type].setItem('PMATest', 'test'); 12389 // Check whether key-value pair was set successfully 12390 if (window[type].getItem('PMATest') === 'test') { 12391 // Supported, remove test variable from storage 12392 window[type].removeItem('PMATest'); 12393 return true; 12394 } 12395 } catch(error) { 12396 // Not supported 12397 PMA_ajaxShowMessage(PMA_messages.strNoLocalStorage, false); 12398 } 12399 return false; 12400} 12401 12402/** 12403 * Unbind all event handlers before tearing down a page 12404 */ 12405AJAX.registerTeardown('functions.js', function(){ 12406 $(document).off('keydown', 'form input, form textarea, form select'); 12407}); 12408 12409AJAX.registerOnload('functions.js', function () { 12410 /** 12411 * Handle 'Ctrl/Alt + Enter' form submits 12412 */ 12413 $('form input, form textarea, form select').on('keydown', function(e){ 12414 if((e.ctrlKey && e.which == 13) || (e.altKey && e.which == 13)) { 12415 $form = $(this).closest('form'); 12416 if (! $form.find('input[type="submit"]') || 12417 ! $form.find('input[type="submit"]').click() 12418 ) { 12419 $form.submit(); 12420 } 12421 } 12422 }); 12423}); 12424 12425/** 12426 * Unbind all event handlers before tearing down a page 12427 */ 12428AJAX.registerTeardown('functions.js', function(){ 12429 $(document).off('change', 'input[type=radio][name="pw_hash"]'); 12430}); 12431 12432AJAX.registerOnload('functions.js', function(){ 12433 /* 12434 * Display warning regarding SSL when sha256_password 12435 * method is selected 12436 * Used in user_password.php (Change Password link on index.php) 12437 */ 12438 $(document).on("change", 'select#select_authentication_plugin_cp', function() { 12439 if (this.value === 'sha256_password') { 12440 $('#ssl_reqd_warning_cp').show(); 12441 } else { 12442 $('#ssl_reqd_warning_cp').hide(); 12443 } 12444 }); 12445}); 12446; 12447 12448/* vim: set expandtab sw=4 ts=4 sts=4: */ 12449/** 12450 * function used in or for navigation panel 12451 * 12452 * @package phpMyAdmin-Navigation 12453 */ 12454 12455/** 12456 * Loads child items of a node and executes a given callback 12457 * 12458 * @param isNode 12459 * @param $expandElem expander 12460 * @param callback callback function 12461 * 12462 * @returns void 12463 */ 12464function loadChildNodes(isNode, $expandElem, callback) { 12465 12466 var $destination = null; 12467 var params = null; 12468 12469 if (isNode) { 12470 if (!$expandElem.hasClass('expander')) { 12471 return; 12472 } 12473 $destination = $expandElem.closest('li'); 12474 params = { 12475 aPath: $expandElem.find('span.aPath').text(), 12476 vPath: $expandElem.find('span.vPath').text(), 12477 pos: $expandElem.find('span.pos').text(), 12478 pos2_name: $expandElem.find('span.pos2_name').text(), 12479 pos2_value: $expandElem.find('span.pos2_value').text(), 12480 searchClause: '', 12481 searchClause2: '' 12482 }; 12483 if ($expandElem.closest('ul').hasClass('search_results')) { 12484 params.searchClause = PMA_fastFilter.getSearchClause(); 12485 params.searchClause2 = PMA_fastFilter.getSearchClause2($expandElem); 12486 } 12487 } else { 12488 $destination = $('#pma_navigation_tree_content'); 12489 params = { 12490 aPath: $expandElem.attr('aPath'),
12491 vPath: $expandElem.attr('vPath'), 12492 pos: $expandElem.attr('pos'), 12493 pos2_name: '', 12494 pos2_value: '', 12495 searchClause: '', 12496 searchClause2: '' 12497 }; 12498 } 12499 12500 var url = $('#pma_navigation').find('a.navigation_url').attr('href'); 12501 $.get(url, params, function (data) { 12502 if (typeof data !== 'undefined' && data.success === true) { 12503 $destination.find('div.list_container').remove(); // FIXME: Hack, there shouldn't be a list container there 12504 if (isNode) { 12505 $destination.append(data.message); 12506 $expandElem.addClass('loaded'); 12507 } else { 12508 $destination.html(data.message); 12509 $destination.children() 12510 .first() 12511 .css({ 12512 border: '0px', 12513 margin: '0em', 12514 padding : '0em' 12515 }) 12516 .slideDown('slow'); 12517 } 12518 if (data._errors) { 12519 var $errors = $(data._errors); 12520 if ($errors.children().length > 0) { 12521 $('#pma_errors').replaceWith(data._errors); 12522 } 12523 } 12524 if (callback && typeof callback == 'function') { 12525 callback(data); 12526 } 12527 } else if(data.redirect_flag == "1") { 12528 if (window.location.href.indexOf('?') === -1) { 12529 window.location.href += '?session_expired=1'; 12530 } else { 12531 window.location.href += '&session_expired=1'; 12532 } 12533 window.location.reload(); 12534 } else { 12535 var $throbber = $expandElem.find('img.throbber'); 12536 $throbber.hide(); 12537 var $icon = $expandElem.find('img.ic_b_plus'); 12538 $icon.show(); 12539 PMA_ajaxShowMessage(data.error, false); 12540 } 12541 }); 12542} 12543 12544/** 12545 * Collapses a node in navigation tree. 12546 * 12547 * @param $expandElem expander 12548 * 12549 * @returns void 12550 */ 12551function collapseTreeNode($expandElem) { 12552 var $children = $expandElem.closest('li').children('div.list_container'); 12553 var $icon = $expandElem.find('img'); 12554 if ($expandElem.hasClass('loaded')) { 12555 if ($icon.is('.ic_b_minus')) { 12556 $icon.removeClass('ic_b_minus').addClass('ic_b_plus'); 12557 $children.slideUp('fast'); 12558 } 12559 } 12560 $expandElem.blur(); 12561 $children.promise().done(navTreeStateUpdate); 12562} 12563 12564/** 12565 * Traverse the navigation tree backwards to generate all the actual 12566 * and virtual paths, as well as the positions in the pagination at 12567 * various levels, if necessary. 12568 * 12569 * @return Object 12570 */ 12571function traverseNavigationForPaths() { 12572 var params = { 12573 pos: $('#pma_navigation_tree').find('div.dbselector select').val() 12574 }; 12575 if ($('#navi_db_select').length) { 12576 return params; 12577 } 12578 var count = 0; 12579 $('#pma_navigation_tree').find('a.expander:visible').each(function () { 12580 if ($(this).find('img').is('.ic_b_minus') && 12581 $(this).closest('li').find('div.list_container .ic_b_minus').length === 0 12582 ) { 12583 params['n' + count + '_aPath'] = $(this).find('span.aPath').text(); 12584 params['n' + count + '_vPath'] = $(this).find('span.vPath').text(); 12585 12586 var pos2_name = $(this).find('span.pos2_name').text(); 12587 if (! pos2_name) { 12588 pos2_name = $(this) 12589 .parent() 12590 .parent() 12591 .find('span.pos2_name:last') 12592 .text(); 12593 } 12594 var pos2_value = $(this).find('span.pos2_value').text(); 12595 if (! pos2_value) { 12596 pos2_value = $(this) 12597 .parent() 12598 .parent() 12599 .find('span.pos2_value:last') 12600 .text(); 12601 } 12602 12603 params['n' + count + '_pos2_name'] = pos2_name; 12604 params['n' + count + '_pos2_value'] = pos2_value; 12605 12606 params['n' + count + '_pos3_name'] = $(this).find('span.pos3_name').text(); 12607 params['n' + count + '_pos3_value'] = $(this).find('span.pos3_value').text(); 12608 count++; 12609 } 12610 }); 12611 return params; 12612} 12613 12614/** 12615 * Executed on page load 12616 */ 12617$(function () { 12618 if (! $('#pma_navigation').length) { 12619 // Don't bother running any code if the navigation is not even on the page 12620 return; 12621 } 12622
12623 // Do not let the page reload on submitting the fast filter 12624 $(document).on('submit', '.fast_filter', function (event) { 12625 event.preventDefault(); 12626 }); 12627 12628 // Fire up the resize handlers 12629 new ResizeHandler(); 12630 12631 /** 12632 * opens/closes (hides/shows) tree elements 12633 * loads data via ajax 12634 */ 12635 $(document).on('click', '#pma_navigation_tree a.expander', function (event) { 12636 event.preventDefault(); 12637 event.stopImmediatePropagation(); 12638 var $icon = $(this).find('img'); 12639 if ($icon.is('.ic_b_plus')) { 12640 expandTreeNode($(this)); 12641 } else { 12642 collapseTreeNode($(this)); 12643 } 12644 }); 12645 12646 /** 12647 * Register event handler for click on the reload 12648 * navigation icon at the top of the panel 12649 */ 12650 $(document).on('click', '#pma_navigation_reload', function (event) { 12651 event.preventDefault(); 12652 // reload icon object 12653 var $icon = $(this).find('img'); 12654 // source of the hidden throbber icon 12655 var icon_throbber_src = $('#pma_navigation').find('.throbber').attr('src'); 12656 // source of the reload icon 12657 var icon_reload_src = $icon.attr('src'); 12658 // replace the source of the reload icon with the one for throbber 12659 $icon.attr('src', icon_throbber_src); 12660 PMA_reloadNavigation(); 12661 // after one second, put back the reload icon 12662 setTimeout(function () { 12663 $icon.attr('src', icon_reload_src); 12664 }, 1000); 12665 }); 12666 12667 $(document).on("change", '#navi_db_select', function (event) { 12668 if (! $(this).val()) { 12669 PMA_commonParams.set('db', ''); 12670 PMA_reloadNavigation(); 12671 } 12672 $(this).closest('form').trigger('submit'); 12673 }); 12674 12675 /** 12676 * Register event handler for click on the collapse all 12677 * navigation icon at the top of the navigation tree 12678 */ 12679 $(document).on('click', '#pma_navigation_collapse', function (event) { 12680 event.preventDefault(); 12681 $('#pma_navigation_tree').find('a.expander').each(function() { 12682 var $icon = $(this).find('img'); 12683 if ($icon.is('.ic_b_minus')) { 12684 $(this).click(); 12685 } 12686 }); 12687 }); 12688 12689 /** 12690 * Register event handler to toggle 12691 * the 'link with main panel' icon on mouseenter. 12692 */ 12693 $(document).on('mouseenter', '#pma_navigation_sync', function (event) { 12694 event.preventDefault(); 12695 var synced = $('#pma_navigation_tree').hasClass('synced'); 12696 var $img = $('#pma_navigation_sync').children('img'); 12697 if (synced) { 12698 $img.removeClass('ic_s_link').addClass('ic_s_unlink'); 12699 } else { 12700 $img.removeClass('ic_s_unlink').addClass('ic_s_link'); 12701 } 12702 }); 12703 12704 /** 12705 * Register event handler to toggle 12706 * the 'link with main panel' icon on mouseout. 12707 */ 12708 $(document).on('mouseout', '#pma_navigation_sync', function (event) { 12709 event.preventDefault(); 12710 var synced = $('#pma_navigation_tree').hasClass('synced'); 12711 var $img = $('#pma_navigation_sync').children('img'); 12712 if (synced) { 12713 $img.removeClass('ic_s_unlink').addClass('ic_s_link'); 12714 } else { 12715 $img.removeClass('ic_s_link').addClass('ic_s_unlink'); 12716 } 12717 }); 12718 12719 /** 12720 * Register event handler to toggle 12721 * the linking with main panel behavior 12722 */ 12723 $(document).on('click', '#pma_navigation_sync', function (event) { 12724 event.preventDefault(); 12725 var synced = $('#pma_navigation_tree').hasClass('synced'); 12726 var $img = $('#pma_navigation_sync').children('img'); 12727 if (synced) { 12728 $img 12729 .removeClass('ic_s_unlink') 12730 .addClass('ic_s_link') 12731 .attr('alt', PMA_messages.linkWithMain) 12732 .attr('title', PMA_messages.linkWithMain); 12733 $('#pma_navigation_tree') 12734 .removeClass('synced') 12735 .find('li.selected') 12736 .removeClass('selected'); 12737 } else { 12738 $img 12739 .removeClass('ic_s_link') 12740 .addClass('ic_s_unlink') 12741 .attr('alt', PMA_messages.unlinkWithMain) 12742 .attr('title', PMA_messages.unlinkWithMain); 12743 $('#pma_navigation_tree').addClass('synced'); 12744 PMA_showCurrentNavigation(); 12745 } 12746 }); 12747 12748 /** 12749 * Bind all "fast filter" events 12750 */ 12751 $(document).on('click', '#pma_navigation_tree li.fast_filter span', PMA_fastFilter.events.clear); 12752 $(document).on('focus', '#pma_navigation_tree li.fast_filter input.searchClause', PMA_fastFilter.events.focus); 12753 $(document).on('blur', '#pma_navigation_tree li.fast_filter input.searchClause', PMA_fastFilter.events.blur); 12754 $(document).on('keyup', '#pma_navigation_tree li.fast_filter input.searchClause', PMA_fastFilter.events.keyup); 12755 $(document).on('mouseover', '#pma_navigation_tree li.fast_filter input.searchClause', PMA_fastFilter.events.mouseover); 12756 12757 /** 12758 * Ajax handler for pagination 12759 */ 12760 $(document).on('click', '#pma_navigation_tree div.pageselector a.ajax', function (event) { 12761 event.preventDefault(); 12762 PMA_navigationTreePagination($(this)); 12763 }); 12764 12765 /** 12766 * Node highlighting 12767 */ 12768 $(document).on( 12769 'mouseover', 12770 '#pma_navigation_tree.highlight li:not(.fast_filter)', 12771 function () { 12772 if ($('li:visible', this).length === 0) { 12773 $(this).addClass('activePointer'); 12774 } 12775 } 12776 ); 12777 $(document).on( 12778 'mouseout', 12779 '#pma_navigation_tree.highlight li:not(.fast_filter)', 12780 function () { 12781 $(this).removeClass('activePointer'); 12782 } 12783 ); 12784 12785 /** Create a Routine, Trigger or Event */ 12786 $(document).on('click', 'li.new_procedure a.ajax, li.new_function a.ajax', function (event) { 12787 event.preventDefault(); 12788 var dialog = new RTE.object('routine'); 12789 dialog.editorDialog(1, $(this)); 12790 }); 12791 $(document).on('click', 'li.new_trigger a.ajax', function (event) { 12792 event.preventDefault(); 12793 var dialog = new RTE.object('trigger'); 12794 dialog.editorDialog(1, $(this)); 12795 }); 12796 $(document).on('click', 'li.new_event a.ajax', function (event) { 12797 event.preventDefault(); 12798 var dialog = new RTE.object('event'); 12799 dialog.editorDialog(1, $(this)); 12800 }); 12801 12802 /** Edit Routines, Triggers or Events */ 12803 $(document).on('click', 'li.procedure > a.ajax, li.function > a.ajax', function (event) { 12804 event.preventDefault(); 12805 var dialog = new RTE.object('routine'); 12806 dialog.editorDialog(0, $(this)); 12807 }); 12808 $(document).on('click', 'li.trigger > a.ajax', function (event) { 12809 event.preventDefault(); 12810 var dialog = new RTE.object('trigger'); 12811 dialog.editorDialog(0, $(this)); 12812 }); 12813 $(document).on('click', 'li.event > a.ajax', function (event) { 12814 event.preventDefault(); 12815 var dialog = new RTE.object('event'); 12816 dialog.editorDialog(0, $(this)); 12817 }); 12818 12819 /** Execute Routines */ 12820 $(document).on('click', 'li.procedure div a.ajax img,' + 12821 ' li.function div a.ajax img', function (event) { 12822 event.preventDefault(); 12823 var dialog = new RTE.object('routine'); 12824 dialog.executeDialog($(this).parent()); 12825 }); 12826 /** Export Triggers and Events */ 12827 $(document).on('click', 'li.trigger div:eq(1) a.ajax img,' + 12828 ' li.event div:eq(1) a.ajax img', function (event) { 12829 event.preventDefault(); 12830 var dialog = new RTE.object(); 12831 dialog.exportDialog($(this).parent()); 12832 }); 12833 12834 /** New index */ 12835 $(document).on('click', '#pma_navigation_tree li.new_index a.ajax', function (event) { 12836 event.preventDefault(); 12837 var url = $(this).attr('href').substr( 12838 $(this).attr('href').indexOf('?') + 1 12839 ) + '&ajax_request=true'; 12840 var title = PMA_messages.strAddIndex; 12841 indexEditorDialog(url, title); 12842 }); 12843 12844 /** Edit index */ 12845 $(document).on('click', 'li.index a.ajax', function (event) { 12846 event.preventDefault(); 12847 var url = $(this).attr('href').substr( 12848 $(this).attr('href').indexOf('?') + 1 12849 ) + '&ajax_request=true'; 12850 var title = PMA_messages.strEditIndex; 12851 indexEditorDialog(url, title); 12852 }); 12853 12854 /** New view */ 12855 $(document).on('click', 'li.new_view a.ajax', function (event) { 12856 event.preventDefault(); 12857 PMA_createViewDialog($(this)); 12858 }); 12859 12860 /** Hide navigation tree item */ 12861 $(document).on('click', 'a.hideNavItem.ajax', function (event) { 12862 event.preventDefault(); 12863 $.ajax({ 12864 url: $(this).attr('href') + '&ajax_request=true', 12865 success: function (data) { 12866 if (typeof data !== 'undefined' && data.success === true) { 12867 PMA_reloadNavigation(); 12868 } else { 12869 PMA_ajaxShowMessage(data.error); 12870 } 12871 } 12872 }); 12873 }); 12874
12875 /** Display a dialog to choose hidden navigation items to show */ 12876 $(document).on('click', 'a.showUnhide.ajax', function (event) { 12877 event.preventDefault(); 12878 var $msg = PMA_ajaxShowMessage(); 12879 $.get($(this).attr('href') + '&ajax_request=1', function (data) { 12880 if (typeof data !== 'undefined' && data.success === true) { 12881 PMA_ajaxRemoveMessage($msg); 12882 var buttonOptions = {}; 12883 buttonOptions[PMA_messages.strClose] = function () { 12884 $(this).dialog("close"); 12885 }; 12886 $('<div/>') 12887 .attr('id', 'unhideNavItemDialog') 12888 .append(data.message) 12889 .dialog({ 12890 width: 400, 12891 minWidth: 200, 12892 modal: true, 12893 buttons: buttonOptions, 12894 title: PMA_messages.strUnhideNavItem, 12895 close: function () { 12896 $(this).remove(); 12897 } 12898 }); 12899 } else { 12900 PMA_ajaxShowMessage(data.error); 12901 } 12902 }); 12903 }); 12904 12905 /** Show a hidden navigation tree item */ 12906 $(document).on('click', 'a.unhideNavItem.ajax', function (event) { 12907 event.preventDefault(); 12908 var $tr = $(this).parents('tr'); 12909 var $msg = PMA_ajaxShowMessage(); 12910 $.ajax({ 12911 url: $(this).attr('href') + '&ajax_request=true', 12912 success: function (data) { 12913 PMA_ajaxRemoveMessage($msg); 12914 if (typeof data !== 'undefined' && data.success === true) { 12915 $tr.remove(); 12916 PMA_reloadNavigation(); 12917 } else { 12918 PMA_ajaxShowMessage(data.error); 12919 } 12920 } 12921 }); 12922 }); 12923 12924 // Add/Remove favorite table using Ajax. 12925 $(document).on("click", ".favorite_table_anchor", function (event) { 12926 event.preventDefault(); 12927 $self = $(this); 12928 var anchor_id = $self.attr("id"); 12929 if($self.data("favtargetn") !== null) { 12930 if($('a[data-favtargets="' + $self.data("favtargetn") + '"]').length > 0) 12931 { 12932 $('a[data-favtargets="' + $self.data("favtargetn") + '"]').trigger('click'); 12933 return; 12934 } 12935 } 12936 12937 $.ajax({ 12938 url: $self.attr('href'), 12939 cache: false, 12940 type: 'POST', 12941 data: { 12942 favorite_tables: (isStorageSupported('localStorage') && typeof window.localStorage.favorite_tables !== 'undefined') 12943 ? window.localStorage.favorite_tables 12944 : '' 12945 }, 12946 success: function (data) { 12947 if (data.changes) { 12948 $('#pma_favorite_list').html(data.list); 12949 $('#' + anchor_id).parent().html(data.anchor); 12950 PMA_tooltip( 12951 $('#' + anchor_id), 12952 'a', 12953 $('#' + anchor_id).attr("title") 12954 ); 12955 // Update localStorage. 12956 if (isStorageSupported('localStorage')) { 12957 window.localStorage.favorite_tables = data.favorite_tables; 12958 } 12959 } else { 12960 PMA_ajaxShowMessage(data.message); 12961 } 12962 } 12963 }); 12964 }); 12965}); 12966 12967AJAX.registerOnload('navigation.js', function () { 12968 // Check if session storage is supported 12969 if (isStorageSupported('sessionStorage')) { 12970 var storage = window.sessionStorage; 12971 // remove tree from storage if Navi_panel config form is submitted 12972 $(document).on('submit', 'form.config-form', function(event) { 12973 storage.removeItem('navTreePaths'); 12974 }); 12975 // Initialize if no previous state is defined 12976 if ($('#pma_navigation_tree_content').length && 12977 typeof storage.navTreePaths === 'undefined' 12978 ) { 12979 navTreeStateUpdate(); 12980 } else if (PMA_commonParams.get('server') === storage.server && 12981 PMA_commonParams.get('token') === storage.token 12982 ) { 12983 // Reload the tree to the state before page refresh 12984 PMA_reloadNavigation(null, JSON.parse(storage.navTreePaths)); 12985 } 12986 } 12987}); 12988 12989/** 12990 * updates the tree state in sessionStorage 12991 * 12992 * @returns void 12993 */ 12994function navTreeStateUpdate() { 12995 // update if session storage is supported 12996 if (isStorageSupported('sessionStorage')) { 12997 var storage = window.sessionStorage; 12998 // try catch necessary here to detect whether
12999 // content to be stored exceeds storage capacity 13000 try { 13001 storage.setItem('navTreePaths', JSON.stringify(traverseNavigationForPaths())); 13002 storage.setItem('server', PMA_commonParams.get('server')); 13003 storage.setItem('token', PMA_commonParams.get('token')); 13004 } catch(error) { 13005 // storage capacity exceeded & old navigation tree 13006 // state is no more valid, so remove it 13007 storage.removeItem('navTreePaths'); 13008 storage.removeItem('server'); 13009 storage.removeItem('token'); 13010 } 13011 } 13012} 13013 13014/** 13015 * Expands a node in navigation tree. 13016 * 13017 * @param $expandElem expander 13018 * @param callback callback function 13019 * 13020 * @returns void 13021 */ 13022function expandTreeNode($expandElem, callback) { 13023 var $children = $expandElem.closest('li').children('div.list_container'); 13024 var $icon = $expandElem.find('img'); 13025 if ($expandElem.hasClass('loaded')) { 13026 if ($icon.is('.ic_b_plus')) { 13027 $icon.removeClass('ic_b_plus').addClass('ic_b_minus'); 13028 $children.slideDown('fast'); 13029 } 13030 if (callback && typeof callback == 'function') { 13031 callback.call(); 13032 } 13033 $children.promise().done(navTreeStateUpdate); 13034 } else { 13035 var $throbber = $('#pma_navigation').find('.throbber') 13036 .first() 13037 .clone() 13038 .css({visibility: 'visible', display: 'block'}) 13039 .click(false); 13040 $icon.hide(); 13041 $throbber.insertBefore($icon); 13042 13043 loadChildNodes(true, $expandElem, function (data) { 13044 if (typeof data !== 'undefined' && data.success === true) { 13045 var $destination = $expandElem.closest('li'); 13046 $icon.removeClass('ic_b_plus').addClass('ic_b_minus'); 13047 $children = $destination.children('div.list_container'); 13048 $children.slideDown('fast'); 13049 if ($destination.find('ul > li').length == 1) { 13050 $destination.find('ul > li') 13051 .find('a.expander.container') 13052 .click(); 13053 } 13054 if (callback && typeof callback == 'function') { 13055 callback.call(); 13056 } 13057 PMA_showFullName($destination); 13058 } else { 13059 PMA_ajaxShowMessage(data.error, false); 13060 } 13061 $icon.show(); 13062 $throbber.remove(); 13063 $children.promise().done(navTreeStateUpdate); 13064 }); 13065 } 13066 $expandElem.blur(); 13067} 13068 13069/** 13070 * Auto-scrolls the newly chosen database 13071 * 13072 * @param object $element The element to set to view 13073 * @param boolean $forceToTop Whether to force scroll to top 13074 * 13075 */ 13076function scrollToView($element, $forceToTop) { 13077 var $container = $('#pma_navigation_tree_content'); 13078 var elemTop = $element.offset().top - $container.offset().top; 13079 var textHeight = 20; 13080 var scrollPadding = 20; // extra padding from top of bottom when scrolling to view 13081 if (elemTop < 0 || $forceToTop) { 13082 $container.stop().animate({ 13083 scrollTop: elemTop + $container.scrollTop() - scrollPadding 13084 }); 13085 } else if (elemTop + textHeight > $container.height()) { 13086 $container.stop().animate({ 13087 scrollTop: elemTop + textHeight - $container.height() + $container.scrollTop() + scrollPadding 13088 }); 13089 } 13090} 13091 13092/** 13093 * Expand the navigation and highlight the current database or table/view 13094 * 13095 * @returns void 13096 */ 13097function PMA_showCurrentNavigation() { 13098 var db = PMA_commonParams.get('db'); 13099 var table = PMA_commonParams.get('table'); 13100 $('#pma_navigation_tree') 13101 .find('li.selected') 13102 .removeClass('selected'); 13103 if (db) { 13104 var $dbItem = findLoadedItem( 13105 $('#pma_navigation_tree').find('> div'), db, 'database', !table 13106 ); 13107 if ($('#navi_db_select').length && 13108 $('option:selected', $('#navi_db_select')).length 13109 ) { 13110 if (! PMA_selectCurrentDb()) { 13111 return; 13112 } 13113 // If loaded database in navigation is not same as current one 13114 if ($('#pma_navigation_tree_content').find('span.loaded_db:first').text() 13115 !== $('#navi_db_select').val() 13116 ) { 13117 loadChildNodes(false, $('option:selected', $('#navi_db_select')), function (data) { 13118 handleTableOrDb(table, $('#pma_navigation_tree_content')); 13119 var $children = $('#pma_navigation_tree_content').children('div.list_container'); 13120 $children.promise().done(navTreeStateUpdate); 13121 }); 13122 } else { 13123 handleTableOrDb(table, $('#pma_navigation_tree_content')); 13124 } 13125 } else if ($dbItem) { 13126 var $expander = $dbItem.children('div:first').children('a.expander'); 13127 // if not loaded or loaded but collapsed 13128 if (! $expander.hasClass('loaded') || 13129 $expander.find('img').is('.ic_b_plus') 13130 ) { 13131 expandTreeNode($expander, function () { 13132 handleTableOrDb(table, $dbItem); 13133 }); 13134 } else { 13135 handleTableOrDb(table, $dbItem); 13136 } 13137 } 13138 } else if ($('#navi_db_select').length && $('#navi_db_select').val()) { 13139 $('#navi_db_select').val('').hide().trigger('change'); 13140 } 13141 PMA_showFullName($('#pma_navigation_tree')); 13142 13143 function handleTableOrDb(table, $dbItem) { 13144 if (table) { 13145 loadAndHighlightTableOrView($dbItem, table); 13146 } else { 13147 var $container = $dbItem.children('div.list_container'); 13148 var $tableContainer = $container.children('ul').children('li.tableContainer'); 13149 if ($tableContainer.length > 0) { 13150 var $expander = $tableContainer.children('div:first').children('a.expander'); 13151 $tableContainer.addClass('selected'); 13152 expandTreeNode($expander, function () { 13153 scrollToView($dbItem, true); 13154 }); 13155 } else { 13156 scrollToView($dbItem, true); 13157 } 13158 } 13159 } 13160 13161 function findLoadedItem($container, name, clazz, doSelect) { 13162 var ret = false;
13163 $container.children('ul').children('li').each(function () { 13164 var $li = $(this); 13165 // this is a navigation group, recurse 13166 if ($li.is('.navGroup')) { 13167 var $container = $li.children('div.list_container'); 13168 var $childRet = findLoadedItem( 13169 $container, name, clazz, doSelect 13170 ); 13171 if ($childRet) { 13172 ret = $childRet; 13173 return false; 13174 } 13175 } else { // this is a real navigation item 13176 // name and class matches 13177 if (((clazz && $li.is('.' + clazz)) || ! clazz) && 13178 $li.children('a').text() == name) { 13179 if (doSelect) { 13180 $li.addClass('selected'); 13181 } 13182 // taverse up and expand and parent navigation groups 13183 $li.parents('.navGroup').each(function () { 13184 var $cont = $(this).children('div.list_container'); 13185 if (! $cont.is(':visible')) { 13186 $(this) 13187 .children('div:first') 13188 .children('a.expander') 13189 .click(); 13190 } 13191 }); 13192 ret = $li; 13193 return false; 13194 } 13195 } 13196 }); 13197 return ret; 13198 } 13199 13200 function loadAndHighlightTableOrView($dbItem, itemName) { 13201 var $container = $dbItem.children('div.list_container'); 13202 var $expander; 13203 var $whichItem = isItemInContainer($container, itemName, 'li.table, li.view'); 13204 //If item already there in some container 13205 if ($whichItem) { 13206 //get the relevant container while may also be a subcontainer 13207 var $relatedContainer = $whichItem.closest('li.subContainer').length 13208 ? $whichItem.closest('li.subContainer') 13209 : $dbItem; 13210 $whichItem = findLoadedItem( 13211 $relatedContainer.children('div.list_container'), 13212 itemName, null, true 13213 ); 13214 //Show directly 13215 showTableOrView($whichItem, $relatedContainer.children('div:first').children('a.expander')); 13216 //else if item not there, try loading once 13217 } else { 13218 var $sub_containers = $dbItem.find('.subContainer'); 13219 //If there are subContainers i.e. tableContainer or viewContainer 13220 if($sub_containers.length > 0) { 13221 var $containers = []; 13222 $sub_containers.each(function (index) { 13223 $containers[index] = $(this); 13224 $expander = $containers[index] 13225 .children('div:first') 13226 .children('a.expander'); 13227 if (! $expander.hasClass('loaded')) { 13228 loadAndShowTableOrView($expander, $containers[index], itemName); 13229 } 13230 }); 13231 // else if no subContainers 13232 } else { 13233 $expander = $dbItem 13234 .children('div:first') 13235 .children('a.expander'); 13236 if (! $expander.hasClass('loaded')) { 13237 loadAndShowTableOrView($expander, $dbItem, itemName); 13238 } 13239 } 13240 } 13241 } 13242 13243 function loadAndShowTableOrView($expander, $relatedContainer, itemName) { 13244 loadChildNodes(true, $expander, function (data) { 13245 var $whichItem = findLoadedItem( 13246 $relatedContainer.children('div.list_container'), 13247 itemName, null, true 13248 ); 13249 if ($whichItem) { 13250 showTableOrView($whichItem, $expander); 13251 } 13252 }); 13253 } 13254 13255 function showTableOrView($whichItem, $expander) { 13256 expandTreeNode($expander, function (data) { 13257 if ($whichItem) { 13258 scrollToView($whichItem, false); 13259 } 13260 }); 13261 } 13262 13263 function isItemInContainer($container, name, clazz) 13264 { 13265 var $whichItem = null; 13266 $items = $container.find(clazz); 13267 var found = false;
13268 $items.each(function () { 13269 if ($(this).children('a').text() == name) { 13270 $whichItem = $(this); 13271 return false; 13272 } 13273 }); 13274 return $whichItem; 13275 } 13276} 13277 13278/** 13279 * Disable navigation panel settings 13280 * 13281 * @return void 13282 */ 13283function PMA_disableNaviSettings() { 13284 $('#pma_navigation_settings_icon').addClass('hide'); 13285 $('#pma_navigation_settings').remove(); 13286} 13287 13288/** 13289 * Ensure that navigation panel settings is properly setup. 13290 * If not, set it up 13291 * 13292 * @return void 13293 */ 13294function PMA_ensureNaviSettings(selflink) { 13295 $('#pma_navigation_settings_icon').removeClass('hide'); 13296 13297 if (!$('#pma_navigation_settings').length) { 13298 var params = { 13299 getNaviSettings: true 13300 }; 13301 var url = $('#pma_navigation').find('a.navigation_url').attr('href'); 13302 $.post(url, params, function (data) { 13303 if (typeof data !== 'undefined' && data.success) { 13304 $('#pma_navi_settings_container').html(data.message); 13305 setupRestoreField(); 13306 setupValidation(); 13307 setupConfigTabs(); 13308 $('#pma_navigation_settings').find('form').attr('action', selflink); 13309 } else { 13310 PMA_ajaxShowMessage(data.error); 13311 } 13312 }); 13313 } else { 13314 $('#pma_navigation_settings').find('form').attr('action', selflink); 13315 } 13316} 13317 13318/** 13319 * Reloads the whole navigation tree while preserving its state 13320 * 13321 * @param function the callback function 13322 * @param Object stored navigation paths 13323 * 13324 * @return void 13325 */ 13326function PMA_reloadNavigation(callback, paths) { 13327 var params = { 13328 reload: true, 13329 no_debug: true 13330 }; 13331 paths = paths || traverseNavigationForPaths(); 13332 $.extend(params, paths); 13333 if ($('#navi_db_select').length) { 13334 params.db = PMA_commonParams.get('db'); 13335 requestNaviReload(params); 13336 return; 13337 } 13338 requestNaviReload(params); 13339 13340 function requestNaviReload(params) { 13341 var url = $('#pma_navigation').find('a.navigation_url').attr('href'); 13342 $.post(url, params, function (data) { 13343 if (typeof data !== 'undefined' && data.success) { 13344 $('#pma_navigation_tree').html(data.message).children('div').show(); 13345 if ($('#pma_navigation_tree').hasClass('synced')) { 13346 PMA_selectCurrentDb(); 13347 PMA_showCurrentNavigation(); 13348 } 13349 // Fire the callback, if any 13350 if (typeof callback === 'function') { 13351 callback.call(); 13352 } 13353 navTreeStateUpdate(); 13354 } else { 13355 PMA_ajaxShowMessage(data.error); 13356 } 13357 }); 13358 } 13359} 13360 13361function PMA_selectCurrentDb() { 13362 var $naviDbSelect = $('#navi_db_select'); 13363 13364 if (!$naviDbSelect.length) { 13365 return false; 13366 } 13367 13368 if (PMA_commonParams.get('db')) { // db selected 13369 $naviDbSelect.show(); 13370 } 13371 13372 $naviDbSelect.val(PMA_commonParams.get('db')); 13373 return $naviDbSelect.val() === PMA_commonParams.get('db'); 13374 13375} 13376 13377/** 13378 * Handles any requests to change the page in a branch of a tree 13379 * 13380 * This can be called from link click or select change event handlers 13381 * 13382 * @param object $this A jQuery object that points to the element that 13383 * initiated the action of changing the page 13384 * 13385 * @return void 13386 */ 13387function PMA_navigationTreePagination($this) { 13388 var $msgbox = PMA_ajaxShowMessage(); 13389 var isDbSelector = $this.closest('div.pageselector').is('.dbselector'); 13390 var url, params; 13391 if ($this[0].tagName == 'A') { 13392 url = $this.attr('href'); 13393 params = 'ajax_request=true'; 13394 } else { // tagName == 'SELECT' 13395 url = 'navigation.php'; 13396 params = $this.closest("form").serialize() + '&ajax_request=true'; 13397 } 13398 var searchClause = PMA_fastFilter.getSearchClause(); 13399 if (searchClause) { 13400 params += '&searchClause=' + encodeURIComponent(searchClause); 13401 } 13402 if (isDbSelector) { 13403 params += '&full=true'; 13404 } else { 13405 var searchClause2 = PMA_fastFilter.getSearchClause2($this); 13406 if (searchClause2) { 13407 params += '&searchClause2=' + encodeURIComponent(searchClause2); 13408 } 13409 } 13410 $.post(url, params, function (data) { 13411 if (typeof data !== 'undefined' && data.success) { 13412 PMA_ajaxRemoveMessage($msgbox); 13413 if (isDbSelector) { 13414 var val = PMA_fastFilter.getSearchClause(); 13415 $('#pma_navigation_tree') 13416 .html(data.message) 13417 .children('div') 13418 .show(); 13419 if (val) { 13420 $('#pma_navigation_tree') 13421 .find('li.fast_filter input.searchClause') 13422 .val(val); 13423 } 13424 } else { 13425 var $parent = $this.closest('div.list_container').parent(); 13426 var val = PMA_fastFilter.getSearchClause2($this); 13427 $this.closest('div.list_container').html( 13428 $(data.message).children().show() 13429 ); 13430 if (val) { 13431 $parent.find('li.fast_filter input.searchClause').val(val); 13432 } 13433 $parent.find('span.pos2_value:first').text( 13434 $parent.find('span.pos2_value:last').text() 13435 ); 13436 $parent.find('span.pos3_value:first').text( 13437 $parent.find('span.pos3_value:last').text() 13438 ); 13439 } 13440 } else { 13441 PMA_ajaxShowMessage(data.error); 13442 PMA_handleRedirectAndReload(data); 13443 } 13444 navTreeStateUpdate(); 13445 }); 13446} 13447 13448/** 13449 * @var ResizeHandler Custom object that manages the resizing of the navigation 13450 * 13451 * XXX: Must only be ever instanciated once 13452 * XXX: Inside event handlers the 'this' object is accessed as 'event.data.resize_handler' 13453 */ 13454var ResizeHandler = function () { 13455 /** 13456 * @var int panel_width Used by the collapser to know where to go 13457 * back to when uncollapsing the panel 13458 */ 13459 this.panel_width = 0; 13460 /** 13461 * @var string left Used to provide support for RTL languages 13462 */ 13463 this.left = $('html').attr('dir') == 'ltr' ? 'left' : 'right'; 13464 /** 13465 * Adjusts the width of the navigation panel to the specified value 13466 * 13467 * @param int pos Navigation width in pixels 13468 * 13469 * @return void 13470 */ 13471 this.setWidth = function (pos) { 13472 var $resizer = $('#pma_navigation_resizer'); 13473 var resizer_width = $resizer.width(); 13474 var $collapser = $('#pma_navigation_collapser'); 13475 $('#pma_navigation').width(pos); 13476 $('body').css('margin-' + this.left, pos + 'px'); 13477 $("#floating_menubar, #pma_console") 13478 .css('margin-' + this.left, (pos + resizer_width) + 'px'); 13479 $resizer.css(this.left, pos + 'px'); 13480 if (pos === 0) { 13481 $collapser 13482 .css(this.left, pos + resizer_width) 13483 .html(this.getSymbol(pos)) 13484 .prop('title', PMA_messages.strShowPanel); 13485 } else { 13486 $collapser 13487 .css(this.left, pos) 13488 .html(this.getSymbol(pos)) 13489 .prop('title', PMA_messages.strHidePanel); 13490 } 13491 setTimeout(function () { 13492 $(window).trigger('resize'); 13493 }, 4); 13494 }; 13495 /** 13496 * Returns the horizontal position of the mouse, 13497 * relative to the outer side of the navigation panel 13498 * 13499 * @param int pos Navigation width in pixels 13500 * 13501 * @return void 13502 */ 13503 this.getPos = function (event) { 13504 var pos = event.pageX; 13505 var windowWidth = $(window).width(); 13506 var windowScroll = $(window).scrollLeft(); 13507 pos = pos - windowScroll; 13508 if (this.left != 'left') { 13509 pos = windowWidth - event.pageX; 13510 } 13511 if (pos < 0) { 13512 pos = 0; 13513 } else if (pos + 100 >= windowWidth) { 13514 pos = windowWidth - 100; 13515 } else { 13516 this.panel_width = 0; 13517 } 13518 return pos; 13519 }; 13520 /** 13521 * Returns the HTML code for the arrow symbol used in the collapser 13522 * 13523 * @param int width The width of the panel 13524 * 13525 * @return string 13526 */
13527 this.getSymbol = function (width) { 13528 if (this.left == 'left') { 13529 if (width === 0) { 13530 return '→'; 13531 } else { 13532 return '←'; 13533 } 13534 } else { 13535 if (width === 0) { 13536 return '←'; 13537 } else { 13538 return '→'; 13539 } 13540 } 13541 }; 13542 /** 13543 * Event handler for initiating a resize of the panel 13544 * 13545 * @param object e Event data (contains a reference to resizeHandler) 13546 * 13547 * @return void 13548 */ 13549 this.mousedown = function (event) { 13550 event.preventDefault(); 13551 $(document) 13552 .bind('mousemove', {'resize_handler': event.data.resize_handler}, 13553 $.throttle(event.data.resize_handler.mousemove, 4)) 13554 .bind('mouseup', {'resize_handler': event.data.resize_handler}, 13555 event.data.resize_handler.mouseup); 13556 $('body').css('cursor', 'col-resize'); 13557 }; 13558 /** 13559 * Event handler for terminating a resize of the panel 13560 * 13561 * @param object e Event data (contains a reference to resizeHandler) 13562 * 13563 * @return void 13564 */ 13565 this.mouseup = function (event) { 13566 $('body').css('cursor', ''); 13567 $.cookie('pma_navi_width', event.data.resize_handler.getPos(event)); 13568 $('#topmenu').menuResizer('resize'); 13569 $(document) 13570 .unbind('mousemove') 13571 .unbind('mouseup'); 13572 }; 13573 /** 13574 * Event handler for updating the panel during a resize operation 13575 * 13576 * @param object e Event data (contains a reference to resizeHandler) 13577 * 13578 * @return void 13579 */ 13580 this.mousemove = function (event) { 13581 event.preventDefault(); 13582 var pos = event.data.resize_handler.getPos(event); 13583 event.data.resize_handler.setWidth(pos); 13584 if ($('.sticky_columns').length !== 0) { 13585 handleAllStickyColumns(); 13586 } 13587 }; 13588 /** 13589 * Event handler for collapsing the panel 13590 * 13591 * @param object e Event data (contains a reference to resizeHandler) 13592 * 13593 * @return void 13594 */ 13595 this.collapse = function (event) { 13596 event.preventDefault(); 13597 var panel_width = event.data.resize_handler.panel_width; 13598 var width = $('#pma_navigation').width(); 13599 if (width === 0 && panel_width === 0) { 13600 panel_width = 240; 13601 } 13602 event.data.resize_handler.setWidth(panel_width); 13603 event.data.resize_handler.panel_width = width; 13604 }; 13605 /** 13606 * Event handler for resizing the navigation tree height on window resize 13607 * 13608 * @return void 13609 */ 13610 this.treeResize = function (event) { 13611 var $nav = $("#pma_navigation"), 13612 $nav_tree = $("#pma_navigation_tree"), 13613 $nav_header = $("#pma_navigation_header"), 13614 $nav_tree_content = $("#pma_navigation_tree_content"); 13615 $nav_tree.height($nav.height() - $nav_header.height()); 13616 if ($nav_tree_content.length > 0) { 13617 $nav_tree_content.height($nav_tree.height() - $nav_tree_content.position().top); 13618 } else { 13619 //TODO: in fast filter search response there is no #pma_navigation_tree_content, needs to be added in php 13620 $nav_tree.css({ 13621 'overflow-y': 'auto' 13622 }); 13623 } 13624 // Set content bottom space beacuse of console 13625 $('body').css('margin-bottom', $('#pma_console').height() + 'px'); 13626 }; 13627 /* Initialisation section begins here */ 13628 if ($.cookie('pma_navi_width')) { 13629 // If we have a cookie, set the width of the panel to its value 13630 var pos = Math.abs(parseInt($.cookie('pma_navi_width'), 10) || 0); 13631 this.setWidth(pos); 13632 $('#topmenu').menuResizer('resize'); 13633 } 13634 // Register the events for the resizer and the collapser 13635 $(document).on('mousedown', '#pma_navigation_resizer', {'resize_handler': this}, this.mousedown); 13636 $(document).on('click', '#pma_navigation_collapser', {'resize_handler': this}, this.collapse); 13637 13638 // Add the correct arrow symbol to the collapser 13639 $('#pma_navigation_collapser').html(this.getSymbol($('#pma_navigation').width())); 13640 // Fix navigation tree height 13641 $(window).on('resize', this.treeResize); 13642 // need to call this now and then, browser might decide 13643 // to show/hide horizontal scrollbars depending on page content width 13644 setInterval(this.treeResize, 2000); 13645 this.treeResize(); 13646}; // End of ResizeHandler 13647 13648/** 13649 * @var object PMA_fastFilter Handles the functionality that allows filtering 13650 * of the items in a branch of the navigation tree 13651 */ 13652var PMA_fastFilter = { 13653 /** 13654 * Construct for the asynchronous fast filter functionality 13655 * 13656 * @param object $this A jQuery object pointing to the list container 13657 * which is the nearest parent of the fast filter 13658 * @param string searchClause The query string for the filter 13659 * 13660 * @return new PMA_fastFilter.filter object 13661 */ 13662 filter: function ($this, searchClause) { 13663 /** 13664 * @var object $this A jQuery object pointing to the list container 13665 * which is the nearest parent of the fast filter 13666 */
13667 this.$this = $this; 13668 /** 13669 * @var bool searchClause The query string for the filter 13670 */ 13671 this.searchClause = searchClause; 13672 /** 13673 * @var object $clone A clone of the original contents 13674 * of the navigation branch before 13675 * the fast filter was applied 13676 */ 13677 this.$clone = $this.clone(); 13678 /** 13679 * @var object xhr A reference to the ajax request that is currently running 13680 */ 13681 this.xhr = null; 13682 /** 13683 * @var int timeout Used to delay the request for asynchronous search 13684 */ 13685 this.timeout = null; 13686 13687 var $filterInput = $this.find('li.fast_filter input.searchClause'); 13688 if ($filterInput.length !== 0 && 13689 $filterInput.val() !== '' && 13690 $filterInput.val() != $filterInput[0].defaultValue 13691 ) { 13692 this.request(); 13693 } 13694 }, 13695 /** 13696 * Gets the query string from the database fast filter form 13697 * 13698 * @return string 13699 */ 13700 getSearchClause: function () { 13701 var retval = ''; 13702 var $input = $('#pma_navigation_tree') 13703 .find('li.fast_filter.db_fast_filter input.searchClause'); 13704 if ($input.length && $input.val() != $input[0].defaultValue) { 13705 retval = $input.val(); 13706 } 13707 return retval; 13708 }, 13709 /** 13710 * Gets the query string from a second level item's fast filter form 13711 * The retrieval is done by trasversing the navigation tree backwards 13712 * 13713 * @return string 13714 */ 13715 getSearchClause2: function ($this) { 13716 var $filterContainer = $this.closest('div.list_container'); 13717 var $filterInput = $([]); 13718 if ($filterContainer 13719 .find('li.fast_filter:not(.db_fast_filter) input.searchClause') 13720 .length !== 0) { 13721 $filterInput = $filterContainer 13722 .find('li.fast_filter:not(.db_fast_filter) input.searchClause'); 13723 } 13724 var searchClause2 = ''; 13725 if ($filterInput.length !== 0 && 13726 $filterInput.first().val() != $filterInput[0].defaultValue 13727 ) { 13728 searchClause2 = $filterInput.val(); 13729 } 13730 return searchClause2; 13731 }, 13732 /** 13733 * @var hash events A list of functions that are bound to DOM events 13734 * at the top of this file 13735 */ 13736 events: { 13737 focus: function (event) { 13738 var $obj = $(this).closest('div.list_container'); 13739 if (! $obj.data('fastFilter')) { 13740 $obj.data( 13741 'fastFilter', 13742 new PMA_fastFilter.filter($obj, $(this).val()) 13743 ); 13744 } 13745 if ($(this).val() == this.defaultValue) { 13746 $(this).val(''); 13747 } else { 13748 $(this).select(); 13749 } 13750 }, 13751 blur: function (event) { 13752 if ($(this).val() === '') { 13753 $(this).val(this.defaultValue); 13754 } 13755 var $obj = $(this).closest('div.list_container'); 13756 if ($(this).val() == this.defaultValue && $obj.data('fastFilter')) { 13757 $obj.data('fastFilter').restore(); 13758 } 13759 }, 13760 mouseover: function (event) { 13761 var message = ''; 13762 if ($(this).closest('li.fast_filter').is('.db_fast_filter')) { 13763 message = PMA_messages.strHoverDbFastFilter; 13764 } else { 13765 var node_type = $(this).siblings("input[name='pos2_name']").val(); 13766 var node_name = PMA_messages.strTables; 13767 if (node_type == 'views') { 13768 node_name = PMA_messages.strViews; 13769 } else if (node_type == 'procedures') { 13770 node_name = PMA_messages.strProcedures; 13771 } else if (node_type == 'functions') { 13772 node_name = PMA_messages.strFunctions; 13773 } else if (node_type == 'events') { 13774 node_name = PMA_messages.strEvents; 13775 } 13776 message = PMA_sprintf(PMA_messages.strHoverFastFilter, node_name); 13777 } 13778 PMA_tooltip($(this), 'input', message); 13779 }, 13780 keyup: function (event) { 13781 var $obj = $(this).closest('div.list_container'); 13782 var str = ''; 13783 if ($(this).val() != this.defaultValue && $(this).val() !== '') { 13784 $obj.find('div.pageselector').hide(); 13785 str = $(this).val(); 13786 } 13787 13788 /** 13789 * FIXME at the server level a value match is done while on 13790 * the client side it is a regex match. These two should be aligned 13791 */ 13792 13793 // regex used for filtering. 13794 var regex; 13795 try { 13796 regex = new RegExp(str, 'i'); 13797 } catch (err) { 13798 return; 13799 } 13800 13801 // this is the div that houses the items to be filtered by this filter. 13802 var outerContainer; 13803 if ($(this).closest('li.fast_filter').is('.db_fast_filter')) { 13804 outerContainer = $('#pma_navigation_tree_content'); 13805 } else { 13806 outerContainer = $obj; 13807 } 13808 13809 // filters items that are directly under the div as well as grouped in 13810 // groups. Does not filter child items (i.e. a database search does 13811 // not filter tables) 13812 var item_filter = function($curr) { 13813 $curr.children('ul').children('li.navGroup').each(function() { 13814 $(this).children('div.list_container').each(function() { 13815 item_filter($(this)); // recursive 13816 }); 13817 }); 13818 $curr.children('ul').children('li').children('a').not('.container').each(function() { 13819 if (regex.test($(this).text())) { 13820 $(this).parent().show().removeClass('hidden'); 13821 } else { 13822 $(this).parent().hide().addClass('hidden'); 13823 } 13824 }); 13825 }; 13826 item_filter(outerContainer); 13827 13828 // hides containers that does not have any visible children 13829 var container_filter = function ($curr) { 13830 $curr.children('ul').children('li.navGroup').each(function() { 13831 var $group = $(this); 13832 $group.children('div.list_container').each(function() { 13833 container_filter($(this)); // recursive 13834 }); 13835 $group.show().removeClass('hidden'); 13836 if ($group.children('div.list_container').children('ul') 13837 .children('li').not('.hidden').length === 0) { 13838 $group.hide().addClass('hidden'); 13839 } 13840 }); 13841 }; 13842 container_filter(outerContainer); 13843 13844 if ($(this).val() != this.defaultValue && $(this).val() !== '') { 13845 if (! $obj.data('fastFilter')) { 13846 $obj.data( 13847 'fastFilter', 13848 new PMA_fastFilter.filter($obj, $(this).val()) 13849 ); 13850 } else { 13851 if (event.keyCode == 13) { 13852 $obj.data('fastFilter').update($(this).val()); 13853 } 13854 } 13855 } else if ($obj.data('fastFilter')) { 13856 $obj.data('fastFilter').restore(true); 13857 } 13858 }, 13859 clear: function (event) { 13860 event.stopPropagation(); 13861 // Clear the input and apply the fast filter with empty input 13862 var filter = $(this).closest('div.list_container').data('fastFilter'); 13863 if (filter) {
13864 filter.restore(); 13865 } 13866 var value = $(this).prev()[0].defaultValue; 13867 $(this).prev().val(value).trigger('keyup'); 13868 } 13869 } 13870}; 13871/** 13872 * Handles a change in the search clause 13873 * 13874 * @param string searchClause The query string for the filter 13875 * 13876 * @return void 13877 */ 13878PMA_fastFilter.filter.prototype.update = function (searchClause) { 13879 if (this.searchClause != searchClause) { 13880 this.searchClause = searchClause; 13881 this.request(); 13882 } 13883}; 13884/** 13885 * After a delay of 250mS, initiates a request to retrieve search results 13886 * Multiple calls to this function will always abort the previous request 13887 * 13888 * @return void 13889 */ 13890PMA_fastFilter.filter.prototype.request = function () { 13891 var self = this; 13892 if (self.$this.find('li.fast_filter').find('img.throbber').length === 0) { 13893 self.$this.find('li.fast_filter').append( 13894 $('<div class="throbber"></div>').append( 13895 $('#pma_navigation_content') 13896 .find('img.throbber') 13897 .clone() 13898 .css({visibility: 'visible', display: 'block'}) 13899 ) 13900 ); 13901 } 13902 if (self.xhr) { 13903 self.xhr.abort(); 13904 } 13905 var url = $('#pma_navigation').find('a.navigation_url').attr('href'); 13906 var params = self.$this.find('> ul > li > form.fast_filter').first().serialize(); 13907 if (self.$this.find('> ul > li > form.fast_filter:first input[name=searchClause]').length === 0) { 13908 var $input = $('#pma_navigation_tree').find('li.fast_filter.db_fast_filter input.searchClause'); 13909 if ($input.length && $input.val() != $input[0].defaultValue) { 13910 params += '&searchClause=' + encodeURIComponent($input.val()); 13911 } 13912 } 13913 self.xhr = $.ajax({ 13914 url: url, 13915 type: 'post', 13916 dataType: 'json', 13917 data: params, 13918 complete: function (jqXHR, status) { 13919 if (status != 'abort') { 13920 var data = $.parseJSON(jqXHR.responseText); 13921 self.$this.find('li.fast_filter').find('div.throbber').remove(); 13922 if (data && data.results) { 13923 self.swap.apply(self, [data.message]); 13924 } 13925 } 13926 } 13927 }); 13928}; 13929/** 13930 * Replaces the contents of the navigation branch with the search results 13931 * 13932 * @param string list The search results 13933 * 13934 * @return void 13935 */ 13936PMA_fastFilter.filter.prototype.swap = function (list) { 13937 this.$this 13938 .html($(list).html()) 13939 .children() 13940 .show() 13941 .end() 13942 .find('li.fast_filter input.searchClause') 13943 .val(this.searchClause); 13944 this.$this.data('fastFilter', this); 13945}; 13946/** 13947 * Restores the navigation to the original state after the fast filter is cleared 13948 * 13949 * @param bool focus Whether to also focus the input box of the fast filter 13950 * 13951 * @return void 13952 */ 13953PMA_fastFilter.filter.prototype.restore = function (focus) { 13954 if(this.$this.children('ul').first().hasClass('search_results')) { 13955 this.$this.html(this.$clone.html()).children().show(); 13956 this.$this.data('fastFilter', this); 13957 if (focus) { 13958 this.$this.find('li.fast_filter input.searchClause').focus(); 13959 } 13960 } 13961 this.searchClause = ''; 13962 this.$this.find('div.pageselector').show(); 13963 this.$this.find('div.throbber').remove(); 13964}; 13965 13966/** 13967 * Show full name when cursor hover and name not shown completely 13968 * 13969 * @param object $containerELem Container element 13970 * 13971 * @return void 13972 */ 13973function PMA_showFullName($containerELem) { 13974 13975 $containerELem.find('.hover_show_full').mouseenter(function() { 13976 /** mouseenter */ 13977 var $this = $(this); 13978 var thisOffset = $this.offset(); 13979 if($this.text() === '') { 13980 return; 13981 } 13982 var $parent = $this.parent(); 13983 if( ($parent.offset().left + $parent.outerWidth()) 13984 < (thisOffset.left + $this.outerWidth())) 13985 { 13986 var $fullNameLayer = $('#full_name_layer'); 13987 if($fullNameLayer.length === 0) 13988 { 13989 $('body').append('<div id="full_name_layer" class="hide"></div>'); 13990 $('#full_name_layer').mouseleave(function() { 13991 /** mouseleave */ 13992 $(this).addClass('hide') 13993 .removeClass('hovering'); 13994 }).mouseenter(function() { 13995 /** mouseenter */ 13996 $(this).addClass('hovering'); 13997 }); 13998 $fullNameLayer = $('#full_name_layer'); 13999 } 14000 $fullNameLayer.removeClass('hide'); 14001 $fullNameLayer.css({left: thisOffset.left, top: thisOffset.top}); 14002 $fullNameLayer.html($this.clone()); 14003 setTimeout(function() { 14004 if(! $fullNameLayer.hasClass('hovering')) 14005 { 14006 $fullNameLayer.trigger('mouseleave'); 14007 } 14008 }, 200); 14009 } 14010 }); 14011} 14012; 14013 14014/* vim: set expandtab sw=4 ts=4 sts=4: */ 14015/** 14016 * @fileoverview function used for index manipulation pages 14017 * @name Table Structure 14018 * 14019 * @requires jQuery 14020 * @requires jQueryUI 14021 * @required js/functions.js 14022 */ 14023 14024/** 14025 * Hides/shows the inputs and submits appropriately depending 14026 * on whether the index type chosen is 'SPATIAL' or not. 14027 */ 14028function checkIndexType() 14029{ 14030 /** 14031 * @var Object Dropdown to select the index choice. 14032 */ 14033 var $select_index_choice = $('#select_index_choice'); 14034 /** 14035 * @var Object Dropdown to select the index type. 14036 */ 14037 var $select_index_type = $('#select_index_type'); 14038 /** 14039 * @var Object Table header for the size column. 14040 */ 14041 var $size_header = $('#index_columns').find('thead tr th:nth-child(2)'); 14042 /** 14043 * @var Object Inputs to specify the columns for the index. 14044 */ 14045 var $column_inputs = $('select[name="index[columns][names][]"]'); 14046 /** 14047 * @var Object Inputs to specify sizes for columns of the index. 14048 */ 14049 var $size_inputs = $('input[name="index[columns][sub_parts][]"]'); 14050 /** 14051 * @var Object Footer containg the controllers to add more columns 14052 */
14053 var $add_more = $('#index_frm').find('.add_more'); 14054 14055 if ($select_index_choice.val() == 'SPATIAL') { 14056 // Disable and hide the size column 14057 $size_header.hide(); 14058 $size_inputs.each(function () { 14059 $(this) 14060 .prop('disabled', true) 14061 .parent('td').hide(); 14062 }); 14063 14064 // Disable and hide the columns of the index other than the first one 14065 var initial = true; 14066 $column_inputs.each(function () { 14067 $column_input = $(this); 14068 if (! initial) { 14069 $column_input 14070 .prop('disabled', true) 14071 .parent('td').hide(); 14072 } else { 14073 initial = false; 14074 } 14075 }); 14076 14077 // Hide controllers to add more columns 14078 $add_more.hide(); 14079 } else { 14080 // Enable and show the size column 14081 $size_header.show(); 14082 $size_inputs.each(function () { 14083 $(this) 14084 .prop('disabled', false) 14085 .parent('td').show(); 14086 }); 14087 14088 // Enable and show the columns of the index 14089 $column_inputs.each(function () { 14090 $(this) 14091 .prop('disabled', false) 14092 .parent('td').show(); 14093 }); 14094 14095 // Show controllers to add more columns 14096 $add_more.show(); 14097 } 14098 14099 if ($select_index_choice.val() == 'SPATIAL' || 14100 $select_index_choice.val() == 'FULLTEXT') { 14101 $select_index_type.val('').prop('disabled', true); 14102 } else { 14103 $select_index_type.prop('disabled', false) 14104 } 14105} 14106 14107/** 14108 * Sets current index information into form parameters. 14109 * 14110 * @param array source_array Array containing index columns 14111 * @param string index_choice Choice of index 14112 * 14113 * @return void 14114 */ 14115function PMA_setIndexFormParameters(source_array, index_choice) 14116{ 14117 if (index_choice == 'index') { 14118 $('input[name="indexes"]').val(JSON.stringify(source_array)); 14119 } else { 14120 $('input[name="' + index_choice + '_indexes"]').val(JSON.stringify(source_array)); 14121 } 14122} 14123 14124/** 14125 * Removes a column from an Index. 14126 * 14127 * @param string col_index Index of column in form 14128 * 14129 * @return void 14130 */ 14131function PMA_removeColumnFromIndex(col_index) 14132{ 14133 // Get previous index details. 14134 var previous_index = $('select[name="field_key[' + col_index + ']"]') 14135 .attr('data-index'); 14136 if (previous_index.length) { 14137 previous_index = previous_index.split(','); 14138 var source_array = PMA_getIndexArray(previous_index[0]); 14139 if (source_array == null) { 14140 return; 14141 } 14142 14143 // Remove column from index array. 14144 var source_length = source_array[previous_index[1]].columns.length; 14145 for (var i=0; i<source_length; i++) { 14146 if (source_array[previous_index[1]].columns[i].col_index == col_index) { 14147 source_array[previous_index[1]].columns.splice(i, 1); 14148 } 14149 } 14150 14151 // Remove index completely if no columns left. 14152 if (source_array[previous_index[1]].columns.length === 0) { 14153 source_array.splice(previous_index[1], 1); 14154 } 14155 14156 // Update current index details. 14157 $('select[name="field_key[' + col_index + ']"]').attr('data-index', ''); 14158 // Update form index parameters. 14159 PMA_setIndexFormParameters(source_array, previous_index[0].toLowerCase()); 14160 } 14161} 14162 14163/** 14164 * Adds a column to an Index. 14165 * 14166 * @param array source_array Array holding corresponding indexes 14167 * @param string array_index Index of an INDEX in array 14168 * @param string index_choice Choice of Index 14169 * @param string col_index Index of column on form 14170 * 14171 * @return void 14172 */ 14173function PMA_addColumnToIndex(source_array, array_index, index_choice, col_index) 14174{ 14175 if (col_index >= 0) { 14176 // Remove column from other indexes (if any). 14177 PMA_removeColumnFromIndex(col_index); 14178 } 14179 var index_name = $('input[name="index[Key_name]"]').val(); 14180 var index_comment = $('input[name="index[Index_comment]"]').val(); 14181 var key_block_size = $('input[name="index[Key_block_size]"]').val(); 14182 var parser = $('input[name="index[Parser]"]').val(); 14183 var index_type = $('select[name="index[Index_type]"]').val(); 14184 var columns = []; 14185 $('#index_columns').find('tbody').find('tr').each(function () { 14186 // Get columns in particular order. 14187 var col_index = $(this).find('select[name="index[columns][names][]"]').val(); 14188 var size = $(this).find('input[name="index[columns][sub_parts][]"]').val(); 14189 columns.push({ 14190 'col_index': col_index, 14191 'size': size 14192 }); 14193 }); 14194 14195 // Update or create an index. 14196 source_array[array_index] = { 14197 'Key_name': index_name, 14198 'Index_comment': index_comment, 14199 'Index_choice': index_choice.toUpperCase(), 14200 'Key_block_size': key_block_size, 14201 'Parser': parser, 14202 'Index_type': index_type, 14203 'columns': columns 14204 }; 14205 14206 // Display index name (or column list) 14207 var displayName = index_name; 14208 if (displayName == '') { 14209 var columnNames = []; 14210 $.each(columns, function () { 14211 columnNames.push($('input[name="field_name[' + this.col_index + ']"]').val()); 14212 }); 14213 displayName = '[' + columnNames.join(', ') + ']'; 14214 } 14215 $.each(columns, function () { 14216 var id = 'index_name_' + this.col_index + '_8';
14217 var $name = $('#' + id); 14218 if ($name.length == 0) { 14219 $name = $('<a id="' + id + '" href="#" class="ajax show_index_dialog"></a>'); 14220 $name.insertAfter($('select[name="field_key[' + this.col_index + ']"]')); 14221 } 14222 var $text = $('<small>').text(displayName); 14223 $name.html($text); 14224 }); 14225 14226 if (col_index >= 0) { 14227 // Update index details on form. 14228 $('select[name="field_key[' + col_index + ']"]') 14229 .attr('data-index', index_choice + ',' + array_index); 14230 } 14231 PMA_setIndexFormParameters(source_array, index_choice.toLowerCase()); 14232} 14233 14234/** 14235 * Get choices list for a column to create a composite index with. 14236 * 14237 * @param string index_choice Choice of index 14238 * @param array source_array Array hodling columns for particular index 14239 * 14240 * @return jQuery Object 14241 */ 14242function PMA_getCompositeIndexList(source_array, col_index) 14243{ 14244 // Remove any previous list. 14245 if ($('#composite_index_list').length) { 14246 $('#composite_index_list').remove(); 14247 } 14248 14249 // Html list. 14250 var $composite_index_list = $( 14251 '<ul id="composite_index_list">' + 14252 '<div>' + PMA_messages.strCompositeWith + '</div>' + 14253 '</ul>' 14254 ); 14255 14256 // Add each column to list available for composite index. 14257 var source_length = source_array.length; 14258 var already_present = false; 14259 for (var i=0; i<source_length; i++) { 14260 var sub_array_len = source_array[i].columns.length; 14261 var column_names = []; 14262 for (var j=0; j<sub_array_len; j++) { 14263 column_names.push( 14264 $('input[name="field_name[' + source_array[i].columns[j].col_index + ']"]').val() 14265 ); 14266 14267 if (col_index == source_array[i].columns[j].col_index) { 14268 already_present = true; 14269 } 14270 } 14271 14272 $composite_index_list.append( 14273 '<li>' + 14274 '<input type="radio" name="composite_with" ' + 14275 (already_present ? 'checked="checked"' : '') + 14276 ' id="composite_index_' + i + '" value="' + i + '">' + 14277 '<label for="composite_index_' + i + '">' + column_names.join(', ') + 14278 '</lablel>' + 14279 '</li>' 14280 ); 14281 } 14282 14283 return $composite_index_list; 14284} 14285 14286/** 14287 * Shows 'Add Index' dialog. 14288 * 14289 * @param array source_array Array holding particluar index 14290 * @param string array_index Index of an INDEX in array 14291 * @param array target_columns Columns for an INDEX 14292 * @param string col_index Index of column on form 14293 * @param object index Index detail object 14294 * 14295 * @return void 14296 */ 14297function PMA_showAddIndexDialog(source_array, array_index, target_columns, col_index, index) 14298{ 14299 // Prepare post-data. 14300 var $table = $('input[name="table"]'); 14301 var table = $table.length > 0 ? $table.val() : ''; 14302 var post_data = { 14303 token: $('input[name="token"]').val(), 14304 server: $('input[name="server"]').val(), 14305 db: $('input[name="db"]').val(), 14306 table: table, 14307 ajax_request: 1, 14308 create_edit_table: 1, 14309 index: index 14310 }; 14311 14312 var columns = {}; 14313 for (var i=0; i<target_columns.length; i++) { 14314 var column_name = $('input[name="field_name[' + target_columns[i] + ']"]').val(); 14315 var column_type = $('select[name="field_type[' + target_columns[i] + ']"]').val().toLowerCase(); 14316 columns[column_name] = [column_type, target_columns[i]]; 14317 } 14318 post_data.columns = JSON.stringify(columns); 14319 14320 var button_options = {}; 14321 button_options[PMA_messages.strGo] = function () { 14322 var is_missing_value = false; 14323 $('select[name="index[columns][names][]"]').each(function () { 14324 if ($(this).val() === '') { 14325 is_missing_value = true; 14326 } 14327 }); 14328 14329 if (! is_missing_value) { 14330 PMA_addColumnToIndex( 14331 source_array, 14332 array_index, 14333 index.Index_choice, 14334 col_index 14335 ); 14336 } else { 14337 PMA_ajaxShowMessage( 14338 '<div class="error"><img src="themes/dot.gif" title="" alt=""' + 14339 ' class="icon ic_s_error" /> ' + PMA_messages.strMissingColumn +
14340 ' </div>', false 14341 ); 14342 14343 return false; 14344 } 14345 14346 $(this).dialog('close'); 14347 }; 14348 button_options[PMA_messages.strCancel] = function () { 14349 if (col_index >= 0) { 14350 // Handle state on 'Cancel'. 14351 var $select_list = $('select[name="field_key[' + col_index + ']"]'); 14352 if (! $select_list.attr('data-index').length) { 14353 $select_list.find('option[value*="none"]').attr('selected', 'selected'); 14354 } else { 14355 var previous_index = $select_list.attr('data-index').split(','); 14356 $select_list.find('option[value*="' + previous_index[0].toLowerCase() + '"]') 14357 .attr('selected', 'selected'); 14358 } 14359 } 14360 $(this).dialog('close'); 14361 }; 14362 var $msgbox = PMA_ajaxShowMessage(); 14363 $.post("tbl_indexes.php", post_data, function (data) { 14364 if (data.success === false) { 14365 //in the case of an error, show the error message returned. 14366 PMA_ajaxShowMessage(data.error, false); 14367 } else { 14368 PMA_ajaxRemoveMessage($msgbox); 14369 // Show dialog if the request was successful 14370 var $div = $('<div/>'); 14371 $div 14372 .append(data.message) 14373 .dialog({ 14374 title: PMA_messages.strAddIndex, 14375 width: 450, 14376 minHeight: 250, 14377 open: function () { 14378 checkIndexName("index_frm"); 14379 PMA_showHints($div); 14380 PMA_init_slider(); 14381 $('#index_columns').find('td').each(function () { 14382 $(this).css("width", $(this).width() + 'px'); 14383 }); 14384 $('#index_columns').find('tbody').sortable({ 14385 axis: 'y', 14386 containment: $("#index_columns").find("tbody"), 14387 tolerance: 'pointer' 14388 }); 14389 // We dont need the slider at this moment. 14390 $(this).find('fieldset.tblFooters').remove(); 14391 }, 14392 modal: true, 14393 buttons: button_options, 14394 close: function () { 14395 $(this).remove(); 14396 } 14397 }); 14398 } 14399 }); 14400} 14401 14402/** 14403 * Creates a advanced index type selection dialog. 14404 * 14405 * @param array source_array Array holding a particular type of indexes 14406 * @param string index_choice Choice of index 14407 * @param string col_index Index of new column on form 14408 * 14409 * @return void 14410 */ 14411function PMA_indexTypeSelectionDialog(source_array, index_choice, col_index) 14412{ 14413 var $single_column_radio = $('<input type="radio" id="single_column" name="index_choice"' + 14414 ' checked="checked">' + 14415 '<label for="single_column">' + PMA_messages.strCreateSingleColumnIndex + '</label>'); 14416 var $composite_index_radio = $('<input type="radio" id="composite_index"' + 14417 ' name="index_choice">' + 14418 '<label for="composite_index">' + PMA_messages.strCreateCompositeIndex + '</label>'); 14419 var $dialog_content = $('<fieldset id="advance_index_creator"></fieldset>'); 14420 $dialog_content.append('<legend>' + index_choice.toUpperCase() + '</legend>'); 14421 14422 14423 // For UNIQUE/INDEX type, show choice for single-column and composite index. 14424 $dialog_content.append($single_column_radio); 14425 $dialog_content.append($composite_index_radio); 14426 14427 var button_options = {}; 14428 // 'OK' operation. 14429 button_options[PMA_messages.strGo] = function () { 14430 if ($('#single_column').is(':checked')) { 14431 var index = { 14432 'Key_name': (index_choice == 'primary' ? 'PRIMARY' : ''), 14433 'Index_choice': index_choice.toUpperCase() 14434 }; 14435 PMA_showAddIndexDialog(source_array, (source_array.length), [col_index], col_index, index); 14436 } 14437 14438 if ($('#composite_index').is(':checked')) { 14439 if ($('input[name="composite_with"]').length !== 0 && $('input[name="composite_with"]:checked').length === 0 14440 ) { 14441 PMA_ajaxShowMessage( 14442 '<div class="error"><img src="themes/dot.gif" title=""' + 14443 ' alt="" class="icon ic_s_error" /> ' + 14444 PMA_messages.strFormEmpty +
14445 ' </div>', 14446 false 14447 ); 14448 return false; 14449 } 14450 14451 var array_index = $('input[name="composite_with"]:checked').val(); 14452 var source_length = source_array[array_index].columns.length; 14453 var target_columns = []; 14454 for (var i=0; i<source_length; i++) { 14455 target_columns.push(source_array[array_index].columns[i].col_index); 14456 } 14457 target_columns.push(col_index); 14458 14459 PMA_showAddIndexDialog(source_array, array_index, target_columns, col_index, 14460 source_array[array_index]); 14461 } 14462 14463 $(this).remove(); 14464 }; 14465 button_options[PMA_messages.strCancel] = function () { 14466 // Handle state on 'Cancel'. 14467 var $select_list = $('select[name="field_key[' + col_index + ']"]'); 14468 if (! $select_list.attr('data-index').length) { 14469 $select_list.find('option[value*="none"]').attr('selected', 'selected'); 14470 } else { 14471 var previous_index = $select_list.attr('data-index').split(','); 14472 $select_list.find('option[value*="' + previous_index[0].toLowerCase() + '"]') 14473 .attr('selected', 'selected'); 14474 } 14475 $(this).remove(); 14476 }; 14477 var $dialog = $('<div/>').append($dialog_content).dialog({ 14478 minWidth: 525, 14479 minHeight: 200, 14480 modal: true, 14481 title: PMA_messages.strAddIndex, 14482 resizable: false, 14483 buttons: button_options, 14484 open: function () { 14485 $('#composite_index').on('change', function () { 14486 if ($(this).is(':checked')) { 14487 $dialog_content.append(PMA_getCompositeIndexList(source_array, col_index)); 14488 } 14489 }); 14490 $('#single_column').on('change', function () { 14491 if ($(this).is(':checked')) { 14492 if ($('#composite_index_list').length) { 14493 $('#composite_index_list').remove(); 14494 } 14495 } 14496 }); 14497 }, 14498 close: function () { 14499 $('#composite_index').off('change'); 14500 $('#single_column').off('change'); 14501 $(this).remove(); 14502 } 14503 }); 14504} 14505 14506/** 14507 * Returns the array of indexes based on the index choice 14508 * 14509 * @param index_choice index choice 14510 */ 14511function PMA_getIndexArray(index_choice) 14512{ 14513 var source_array = null; 14514 14515 switch (index_choice.toLowerCase()) { 14516 case 'primary': 14517 source_array = primary_indexes; 14518 break; 14519 case 'unique': 14520 source_array = unique_indexes; 14521 break; 14522 case 'index': 14523 source_array = indexes; 14524 break; 14525 case 'fulltext': 14526 source_array = fulltext_indexes; 14527 break; 14528 case 'spatial': 14529 source_array = spatial_indexes; 14530 break; 14531 default: 14532 return null; 14533 } 14534 return source_array; 14535} 14536 14537 14538/** 14539 * Unbind all event handlers before tearing down a page 14540 */ 14541AJAX.registerTeardown('indexes.js', function () { 14542 $(document).off('click', '#save_index_frm'); 14543 $(document).off('click', '#preview_index_frm'); 14544 $(document).off('change', '#select_index_choice'); 14545 $(document).off('click', 'a.drop_primary_key_index_anchor.ajax'); 14546 $(document).off('click', "#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax"); 14547 $(document).off('click', '#index_frm input[type=submit]'); 14548 $('body').off('change', 'select[name*="field_key"]'); 14549 $(document).off('click', '.show_index_dialog'); 14550}); 14551 14552/** 14553 * @description <p>Ajax scripts for table index page</p> 14554 * 14555 * Actions ajaxified here: 14556 * <ul> 14557 * <li>Showing/hiding inputs depending on the index type chosen</li> 14558 * <li>create/edit/drop indexes</li> 14559 * </ul> 14560 */ 14561AJAX.registerOnload('indexes.js', function () { 14562 // Re-initialize variables. 14563 primary_indexes = []; 14564 unique_indexes = []; 14565 indexes = []; 14566 fulltext_indexes = []; 14567 spatial_indexes = []; 14568 14569 // for table creation form 14570 var $engine_selector = $('.create_table_form select[name=tbl_storage_engine]'); 14571 if ($engine_selector.length) { 14572 PMA_hideShowConnection($engine_selector); 14573 } 14574 14575 var $form = $("#index_frm"); 14576 if ($form.length > 0) { 14577 showIndexEditDialog($form); 14578 } 14579 14580 $(document).on('click', '#save_index_frm', function (event) { 14581 event.preventDefault(); 14582 var $form = $("#index_frm"); 14583 var submitData = $form.serialize() + '&do_save_data=1&ajax_request=true&ajax_page_request=true';
14584 var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); 14585 AJAX.source = $form; 14586 $.post($form.attr('action'), submitData, AJAX.responseHandler); 14587 }); 14588 14589 $(document).on('click', '#preview_index_frm', function (event) { 14590 event.preventDefault(); 14591 PMA_previewSQL($('#index_frm')); 14592 }); 14593 14594 $(document).on('change', '#select_index_choice', function (event) { 14595 event.preventDefault(); 14596 checkIndexType(); 14597 checkIndexName("index_frm"); 14598 }); 14599 14600 /** 14601 * Ajax Event handler for 'Drop Index' 14602 */ 14603 $(document).on('click', 'a.drop_primary_key_index_anchor.ajax', function (event) { 14604 event.preventDefault(); 14605 var $anchor = $(this); 14606 /** 14607 * @var $curr_row Object containing reference to the current field's row 14608 */ 14609 var $curr_row = $anchor.parents('tr'); 14610 /** @var Number of columns in the key */ 14611 var rows = $anchor.parents('td').attr('rowspan') || 1; 14612 /** @var Rows that should be hidden */ 14613 var $rows_to_hide = $curr_row;
14614 for (var i = 1, $last_row = $curr_row.next(); i < rows; i++, $last_row = $last_row.next()) { 14615 $rows_to_hide = $rows_to_hide.add($last_row); 14616 } 14617 14618 var question = escapeHtml( 14619 $curr_row.children('td') 14620 .children('.drop_primary_key_index_msg') 14621 .val() 14622 ); 14623 14624 $anchor.PMA_confirm(question, $anchor.attr('href'), function (url) { 14625 var $msg = PMA_ajaxShowMessage(PMA_messages.strDroppingPrimaryKeyIndex, false); 14626 $.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function (data) { 14627 if (typeof data !== 'undefined' && data.success === true) { 14628 PMA_ajaxRemoveMessage($msg); 14629 var $table_ref = $rows_to_hide.closest('table'); 14630 if ($rows_to_hide.length == $table_ref.find('tbody > tr').length) { 14631 // We are about to remove all rows from the table 14632 $table_ref.hide('medium', function () { 14633 $('div.no_indexes_defined').show('medium'); 14634 $rows_to_hide.remove(); 14635 });
14636 $table_ref.siblings('div.notice').hide('medium'); 14637 } else { 14638 // We are removing some of the rows only 14639 toggleRowColors($rows_to_hide.last().next()); 14640 $rows_to_hide.hide("medium", function () { 14641 $(this).remove(); 14642 }); 14643 } 14644 if ($('.result_query').length) { 14645 $('.result_query').remove(); 14646 } 14647 if (data.sql_query) { 14648 $('<div class="result_query"></div>') 14649 .html(data.sql_query) 14650 .prependTo('#structure_content'); 14651 PMA_highlightSQL($('#page_content')); 14652 } 14653 PMA_commonActions.refreshMain(false, function () { 14654 $("a.ajax[href^=#indexes]").click(); 14655 }); 14656 PMA_reloadNavigation(); 14657 } else { 14658 PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + " : " + data.error, false); 14659 } 14660 }); // end $.get() 14661 }); // end $.PMA_confirm() 14662 }); //end Drop Primary Key/Index 14663 14664 /** 14665 *Ajax event handler for index edit 14666 **/ 14667 $(document).on('click', "#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax", function (event) { 14668 event.preventDefault(); 14669 var url, title; 14670 if ($(this).find("a").length === 0) { 14671 // Add index 14672 var valid = checkFormElementInRange( 14673 $(this).closest('form')[0], 14674 'added_fields', 14675 'Column count has to be larger than zero.' 14676 ); 14677 if (! valid) { 14678 return; 14679 } 14680 url = $(this).closest('form').serialize(); 14681 title = PMA_messages.strAddIndex; 14682 } else { 14683 // Edit index 14684 url = $(this).find("a").attr("href"); 14685 if (url.substring(0, 16) == "tbl_indexes.php?") { 14686 url = url.substring(16, url.length); 14687 } 14688 title = PMA_messages.strEditIndex; 14689 } 14690 url += "&ajax_request=true"; 14691 indexEditorDialog(url, title, function () { 14692 // refresh the page using ajax 14693 PMA_commonActions.refreshMain(false, function () { 14694 $("a.ajax[href^=#indexes]").click(); 14695 }); 14696 }); 14697 }); 14698 14699 /** 14700 * Ajax event handler for advanced index creation during table creation 14701 * and column addition. 14702 */ 14703 $('body').on('change', 'select[name*="field_key"]', function () { 14704 // Index of column on Table edit and create page. 14705 var col_index = /\d+/.exec($(this).attr('name')); 14706 col_index = col_index[0]; 14707 // Choice of selected index. 14708 var index_choice = /[a-z]+/.exec($(this).val()); 14709 index_choice = index_choice[0]; 14710 // Array containing corresponding indexes. 14711 var source_array = null; 14712 14713 if (index_choice == 'none') { 14714 PMA_removeColumnFromIndex(col_index); 14715 return false; 14716 } 14717 14718 // Select a source array. 14719 var source_array = PMA_getIndexArray(index_choice); 14720 if (source_array == null) { 14721 return; 14722 } 14723 14724 if (source_array.length === 0) { 14725 var index = { 14726 'Key_name': (index_choice == 'primary' ? 'PRIMARY' : ''), 14727 'Index_choice': index_choice.toUpperCase() 14728 }; 14729 PMA_showAddIndexDialog(source_array, 0, [col_index], col_index, index); 14730 } else { 14731 if (index_choice == 'primary') { 14732 var array_index = 0; 14733 var source_length = source_array[array_index].columns.length; 14734 var target_columns = []; 14735 for (var i=0; i<source_length; i++) { 14736 target_columns.push(source_array[array_index].columns[i].col_index); 14737 } 14738 target_columns.push(col_index); 14739 14740 PMA_showAddIndexDialog(source_array, array_index, target_columns, col_index, 14741 source_array[array_index]); 14742 } else { 14743 // If there are multiple columns selected for an index, show advanced dialog. 14744 PMA_indexTypeSelectionDialog(source_array, index_choice, col_index); 14745 } 14746 } 14747 }); 14748 14749 $(document).on('click', '.show_index_dialog', function (e) { 14750 e.preventDefault(); 14751 14752 // Get index details. 14753 var previous_index = $(this).prev('select') 14754 .attr('data-index') 14755 .split(','); 14756 14757 var index_choice = previous_index[0]; 14758 var array_index = previous_index[1]; 14759 14760 var source_array = PMA_getIndexArray(index_choice); 14761 var source_length = source_array[array_index].columns.length; 14762 14763 var target_columns = []; 14764 for (var i = 0; i < source_length; i++) { 14765 target_columns.push(source_array[array_index].columns[i].col_index); 14766 } 14767 14768 PMA_showAddIndexDialog(source_array, array_index, target_columns, -1, source_array[array_index]); 14769 }) 14770}); 14771; 14772
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.