You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

13676 lines
891 KiB

  1. /*! jQuery v2.2.4 | (c) jQuery Foundation | 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=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){var b;if("object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype||{},"isPrototypeOf"))return!1;for(b in a);return void 0===b||k.call(a,b)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;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,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(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 oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.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=fa.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=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.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]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!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,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),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 Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(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]=la(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=ma(b);function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(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 ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(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 va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(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 va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;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&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||n.uniqueSort(e),D.test(a)&&e.reverse()),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J),n.ready()}n.ready.promise=function(b){return I||(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J))),I.promise(b)},n.ready.promise();var K=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)K(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;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},L=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function M(){this.expando=n.expando+M.uid++}M.uid=1,M.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!L(a))return{};var b=a[this.expando];return b||(b={},L(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(G)||[])),c=d.length;while(c--)delete f[d[c]]}(void 0===b||n.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!n.isEmptyObject(b)}};var N=new M,O=new M,P=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Q=/[A-Z]/g;function R(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Q,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:P.test(c)?n.parseJSON(c):c;
  3. }catch(e){}O.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=N.get(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=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function W(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&T.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var X=/^(?:checkbox|radio)$/i,Y=/<([\w:-]+)/,Z=/^$|\/(?:java|ecma)script/i,$={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|&#?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",o=0;while(f=m[o++])if(d&&n.inArray(f,d)>-1)e&&e.push(f);else if(j=n.contains(f.ownerDocument,f),g=_(l.appendChild(f),"script"),j&&aa(g),c){k=0;while(f=g[k++])Z.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var da=/^key/,ea=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,fa=/^([^.]*)(?:\.(.+)|)/;function ga(){return!0}function ha(){return!1}function ia(){try{return d.activeElement}catch(a){}}function ja(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ja(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ha;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return"undefined"!=typeof n&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(G)||[""],j=b.length;while(j--)h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.hasData(a)&&N.get(a);if(r&&(i=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&N.remove(a,"handle events")}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(N.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!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&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||d,e=c.documentElement,f=c.body,a.pageX=b.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ea.test(f)?this.mouseHooks:da.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=d),3===a.target.nodeType&&(a.target=a.target.parentNode),h.filter?h.filter(a,g):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==ia()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===ia()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ga:ha):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:ha,isPropagationStopped:ha,isImmediatePropagationStopped:ha,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ga,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ga,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ga,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),n.fn.extend({on:function(a,b,c,d){return ja(this,a,b,c,d)},one:function(a,b,c,d){return ja(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=ha),this.each(function(){n.event.remove(this,a,c,b)})}});var ka=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,la=/<script|<style|<link/i,ma=/checked\s*(?:[^=]|=\s*.checked.)/i,na=/^true\/(.*)/,oa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function pa(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function qa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function ra(a){var b=na.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function sa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(N.hasData(a)&&(f=N.access(a),g=N.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}O.hasData(a)&&(h=O.access(a),i=n.extend({},h),O.set(b,i))}}function ta(a,b){var c=b.nodeName.toLowerCase();"input"===c&&X.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function ua(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&ma.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),ua(f,b,c,d)});if(o&&(e=ca(b,a[0].ownerDocument,!1,a,d),g=e.firstChild,1===e.childNodes.length&&(e=g),g||d)){for(h=n.map(_(e,"script"),qa),i=h.length;o>m;m++)j=e,m!==p&&(j=n.clone(j,!0,!0),i&&n.merge(h,_(j,"script"))),c.call(a[m],j,m);if(i)for(k=h[h.length-1].ownerDocument,n.map(h,ra),m=0;i>m;m++)j=h[m],Z.test(j.type||"")&&!N.access(j,"globalEval")&&n.contains(k,j)&&(j.src?n._evalUrl&&n._evalUrl(j.src):n.globalEval(j.textContent.replace(oa,"")))}return a}function va(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(_(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&aa(_(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(ka,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=_(h),f=_(a),d=0,e=f.length;e>d;d++)ta(f[d],g[d]);if(b)if(c)for(f=f||_(a),g=g||_(h),d=0,e=f.length;e>d;d++)sa(f[d],g[d]);else sa(a,h);return g=_(h,"script"),g.length>0&&aa(g,!i&&_(a,"script")),h},cleanData:function(a){for(var b,c,d,e=n.event.special,f=0;void 0!==(c=a[f]);f++)if(L(c)){if(b=c[N.expando]){if(b.events)for(d in b.events)e[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);c[N.expando]=void 0}c[O.expando]&&(c[O.expando]=void 0)}}}),n.fn.extend({domManip:ua,detach:function(a){return va(this,a,!0)},remove:function(a){return va(this,a)},text:function(a){return K(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.appendChild(a)}})},prepend:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(_(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return K(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!la.test(a)&&!$[(Y.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(_(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return ua(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(_(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var wa,xa={HTML:"block",BODY:"block"};function ya(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function za(a){var b=d,c=xa[a];return c||(c=ya(a,b),"none"!==c&&c||(wa=(wa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=wa[0].contentDocument,b.write(),b.close(),c=ya(a,b),wa.detach()),xa[a]=c),c}var Aa=/^margin/,Ba=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ca=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Da=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},Ea=d.documentElement;!function(){var b,c,e,f,g=d.createElement("div"),h=d.createElement("div");if(h.style){h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,g.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",g.appendChild(h);function i(){h.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",h.innerHTML="",Ea.appendChild(g);var d=a.getComputedStyle(h);b="1%"!==d.top,f="2px"===d.marginLeft,c="4px"===d.width,h.style.marginRight="50%",e="4px"===d.marginRight,Ea.removeChild(g)}n.extend(l,{pixelPosition:function(){return i(),b},boxSizingReliable:function(){return null==c&&i(),c},pixelMarginRight:function(){return null==c&&i(),e},reliableMarginLeft:function(){return null==c&&i(),f},reliableMarginRight:function(){var b,c=h.appendChild(d.createElement("div"));return c.style.cssText=h.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",h.style.width="1px",Ea.appendChild(g),b=!parseFloat(a.getComputedStyle(c).marginRight),Ea.removeChild(g),h.removeChild(c),b}})}}();function Fa(a,b,c){var d,e,f,g,h=a.style;return c=c||Ca(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Ba.test(g)&&Aa.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}function Ga(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Ha=/^(none|table(?!-c[ea]).+)/,Ia={position:"absolute",visibility:"hidden",display:"block"},Ja={letterSpacing:"0",fontWeight:"400"},Ka=["Webkit","O","Moz","ms"],La=d.createElement("div").style;function Ma(a){if(a in La)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ka.length;while(c--)if(a=Ka[c]+b,a in La)return a}function Na(a,b,c){var d=T.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Oa(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+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Pa(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ca(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Fa(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ba.test(e))return e;d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Oa(a,b,c||(g?"border":"content"),d,f)+"px"}function Qa(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=N.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=N.access(d,"olddisplay",za(d.nodeName)))):(e=V(d),"none"===c&&e||N.set(d,"olddisplay",e?c:n.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}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Fa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=T.exec(c))&&e[1]&&(c=W(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Fa(a,b,d)),"normal"===e&&b in Ja&&(e=Ja[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Ha.test(n.css(a,"display"))&&0===a.offsetWidth?Da(a,Ia,function(){return Pa(a,b,d)}):Pa(a,b,d):void 0},set:function(a,c,d){var e,f=d&&Ca(a),g=d&&Oa(a,b,d,"border-box"===n.css(a,"boxSizing",!1,f),f);return g&&(e=T.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=n.css(a,b)),Na(a,c,g)}}}),n.cssHooks.marginLeft=Ga(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Fa(a,"marginLeft"))||a.getBoundingClientRect().left-Da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px":void 0}),n.cssHooks.marginRight=Ga(l.reliableMarginRight,function(a,b){return b?Da(a,{display:"inline-block"},Fa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Aa.test(a)||(n.cssHooks[a+b].set=Na)}),n.fn.extend({css:function(a,b){return K(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ca(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Qa(this,!0)},hide:function(){return Qa(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function Ra(a,b,c,d,e){return new Ra.prototype.init(a,b,c,d,e)}n.Tween=Ra,Ra.prototype={constructor:Ra,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ra.propHooks[this.prop];return a&&a.get?a.get(this):Ra.propHooks._default.get(this)},run:function(a){var b,c=Ra.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ra.propHooks._default.set(this),this}},Ra.prototype.init.prototype=Ra.prototype,Ra.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},Ra.propHooks.scrollTop=Ra.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=Ra.prototype.init,n.fx.step={};var Sa,Ta,Ua=/^(?:toggle|show|hide)$/,Va=/queueHooks$/;function Wa(){return a.setTimeout(function(){Sa=void 0}),Sa=n.now()}function Xa(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=U[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ya(a,b,c){for(var d,e=(_a.tweeners[b]||[]).concat(_a.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Za(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&V(a),q=N.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?N.get(a,"olddisplay")||za(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Ua.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?za(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=N.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;N.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ya(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function $a(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],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 _a(a,b,c){var d,e,f=0,g=_a.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Sa||Wa(),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:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:Sa||Wa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for($a(k,j.opts.specialEasing);g>f;f++)if(d=_a.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,Ya,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(_a,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return W(c.elem,a,T.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++)c=a[d],_a.tweeners[c]=_a.tweeners[c]||[],_a.tweeners[c].unshift(b)},prefilters:[Za],prefilter:function(a,b){b?_a.prefilters.unshift(a):_a.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=_a(this,n.extend({},a),f);(e||N.get(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=n.timers,g=N.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Va.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=N.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Xa(b,!0),a,d,e)}}),n.each({slideDown:Xa("show"),slideUp:Xa("hide"),slideToggle:Xa("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Sa=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Sa=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Ta||(Ta=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(Ta),Ta=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=d.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var ab,bb=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return K(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ab:void 0)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)}}),ab={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=bb[b]||n.find.attr;bb[b]=function(a,b,d){var e,f;return d||(f=bb[b],bb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,bb[b]=f),e}});var cb=/^(?:input|select|textarea|button)$/i,db=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return K(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.propHooks[b]),
  4. void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):cb.test(a.nodeName)||db.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var eb=/[\t\r\n\f]/g;function fb(a){return a.getAttribute&&a.getAttribute("class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,fb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,fb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,fb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=fb(this),b&&N.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":N.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+fb(c)+" ").replace(eb," ").indexOf(b)>-1)return!0;return!1}});var gb=/\r/g,hb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(gb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(hb," ")}},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)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(n.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var ib=/^(?:focusinfocus|focusoutblur)$/;n.extend(n.event,{trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!ib.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),l=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},f||!o.trigger||o.trigger.apply(e,c)!==!1)){if(!f&&!o.noBubble&&!n.isWindow(e)){for(j=o.delegateType||q,ib.test(j+q)||(h=h.parentNode);h;h=h.parentNode)p.push(h),i=h;i===(e.ownerDocument||d)&&p.push(i.defaultView||i.parentWindow||a)}g=0;while((h=p[g++])&&!b.isPropagationStopped())b.type=g>1?j:o.bindType||q,m=(N.get(h,"events")||{})[b.type]&&N.get(h,"handle"),m&&m.apply(h,c),m=l&&h[l],m&&m.apply&&L(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=q,f||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!L(e)||l&&n.isFunction(e[q])&&!n.isWindow(e)&&(i=e[l],i&&(e[l]=null),n.event.triggered=q,e[q](),n.event.triggered=void 0,i&&(e[l]=i)),b.result}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b)}}),n.fn.extend({trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),l.focusin="onfocusin"in a,l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=N.access(d,b);e||d.addEventListener(a,c,!0),N.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=N.access(d,b)-1;e?N.access(d,b,e):(d.removeEventListener(a,c,!0),N.remove(d,b))}}});var jb=a.location,kb=n.now(),lb=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var mb=/#.*$/,nb=/([?&])_=[^&]*/,ob=/^(.*?):[ \t]*([^\r\n]*)$/gm,pb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,qb=/^(?:GET|HEAD)$/,rb=/^\/\//,sb={},tb={},ub="*/".concat("*"),vb=d.createElement("a");vb.href=jb.href;function wb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function xb(a,b,c,d){var e={},f=a===tb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function yb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function zb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Ab(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}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:jb.href,type:"GET",isLocal:pb.test(jb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":ub,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?yb(yb(a,n.ajaxSettings),b):yb(n.ajaxSettings,a)},ajaxPrefilter:wb(sb),ajaxTransport:wb(tb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m=n.ajaxSetup({},c),o=m.context||m,p=m.context&&(o.nodeType||o.jquery)?n(o):n.event,q=n.Deferred(),r=n.Callbacks("once memory"),s=m.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,getResponseHeader:function(a){var b;if(2===v){if(!h){h={};while(b=ob.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===v?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return v||(a=u[c]=u[c]||a,t[a]=b),this},overrideMimeType:function(a){return v||(m.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>v)for(b in a)s[b]=[s[b],a[b]];else x.always(a[x.status]);return this},abort:function(a){var b=a||w;return e&&e.abort(b),z(0,b),this}};if(q.promise(x).complete=r.add,x.success=x.done,x.error=x.fail,m.url=((b||m.url||jb.href)+"").replace(mb,"").replace(rb,jb.protocol+"//"),m.type=c.method||c.type||m.method||m.type,m.dataTypes=n.trim(m.dataType||"*").toLowerCase().match(G)||[""],null==m.crossDomain){j=d.createElement("a");try{j.href=m.url,j.href=j.href,m.crossDomain=vb.protocol+"//"+vb.host!=j.protocol+"//"+j.host}catch(y){m.crossDomain=!0}}if(m.data&&m.processData&&"string"!=typeof m.data&&(m.data=n.param(m.data,m.traditional)),xb(sb,m,c,x),2===v)return x;k=n.event&&m.global,k&&0===n.active++&&n.event.trigger("ajaxStart"),m.type=m.type.toUpperCase(),m.hasContent=!qb.test(m.type),f=m.url,m.hasContent||(m.data&&(f=m.url+=(lb.test(f)?"&":"?")+m.data,delete m.data),m.cache===!1&&(m.url=nb.test(f)?f.replace(nb,"$1_="+kb++):f+(lb.test(f)?"&":"?")+"_="+kb++)),m.ifModified&&(n.lastModified[f]&&x.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&x.setRequestHeader("If-None-Match",n.etag[f])),(m.data&&m.hasContent&&m.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",m.contentType),x.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+ub+"; q=0.01":""):m.accepts["*"]);for(l in m.headers)x.setRequestHeader(l,m.headers[l]);if(m.beforeSend&&(m.beforeSend.call(o,x,m)===!1||2===v))return x.abort();w="abort";for(l in{success:1,error:1,complete:1})x[l](m[l]);if(e=xb(tb,m,c,x)){if(x.readyState=1,k&&p.trigger("ajaxSend",[x,m]),2===v)return x;m.async&&m.timeout>0&&(i=a.setTimeout(function(){x.abort("timeout")},m.timeout));try{v=1,e.send(t,z)}catch(y){if(!(2>v))throw y;z(-1,y)}}else z(-1,"No Transport");function z(b,c,d,h){var j,l,t,u,w,y=c;2!==v&&(v=2,i&&a.clearTimeout(i),e=void 0,g=h||"",x.readyState=b>0?4:0,j=b>=200&&300>b||304===b,d&&(u=zb(m,x,d)),u=Ab(m,u,x,j),j?(m.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(n.lastModified[f]=w),w=x.getResponseHeader("etag"),w&&(n.etag[f]=w)),204===b||"HEAD"===m.type?y="nocontent":304===b?y="notmodified":(y=u.state,l=u.data,t=u.error,j=!t)):(t=y,!b&&y||(y="error",0>b&&(b=0))),x.status=b,x.statusText=(c||y)+"",j?q.resolveWith(o,[l,y,x]):q.rejectWith(o,[x,y,t]),x.statusCode(s),s=void 0,k&&p.trigger(j?"ajaxSuccess":"ajaxError",[x,m,j?l:t]),r.fireWith(o,[x,y]),k&&(p.trigger("ajaxComplete",[x,m]),--n.active||n.event.trigger("ajaxStop")))}return x},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return!n.expr.filters.visible(a)},n.expr.filters.visible=function(a){return a.offsetWidth>0||a.offsetHeight>0||a.getClientRects().length>0};var Bb=/%20/g,Cb=/\[\]$/,Db=/\r?\n/g,Eb=/^(?:submit|button|image|reset|file)$/i,Fb=/^(?:input|select|textarea|keygen)/i;function Gb(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Cb.test(a)?d(a,e):Gb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Gb(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Gb(c,a[c],b,e);return d.join("&").replace(Bb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Fb.test(this.nodeName)&&!Eb.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Db,"\r\n")}}):{name:b.name,value:c.replace(Db,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Hb={0:200,1223:204},Ib=n.ajaxSettings.xhr();l.cors=!!Ib&&"withCredentials"in Ib,l.ajax=Ib=!!Ib,n.ajaxTransport(function(b){var c,d;return l.cors||Ib&&!b.crossDomain?{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Hb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=n("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Jb=[],Kb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Jb.pop()||n.expando+"_"+kb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Kb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Kb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Kb,"$1"+e):b.jsonp!==!1&&(b.url+=(lb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Jb.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ca([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var Lb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Lb)return Lb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function Mb(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(e=d.getBoundingClientRect(),c=Mb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ea})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;n.fn[a]=function(d){return K(this,function(a,d,e){var f=Mb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ga(l.pixelPosition,function(a,c){return c?(c=Fa(a,b),Ba.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return K(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},size:function(){return this.length}}),n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Nb=a.jQuery,Ob=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Ob),b&&a.jQuery===n&&(a.jQuery=Nb),n},b||(a.jQuery=a.$=n),n});
  5. /*!
  6. * Bootstrap v3.4.1 (https://getbootstrap.com/)
  7. * Copyright 2011-2019 Twitter, Inc.
  8. * Licensed under the MIT license
  9. */
  10. if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=jQuery.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||3<e[0])throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(),function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var e=!1,i=this;n(this).one("bsTransitionEnd",function(){e=!0});return setTimeout(function(){e||n(i).trigger(n.support.transition.end)},t),this},n(function(){n.support.transition=function o(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(t.style[i]!==undefined)return{end:e[i]};return!1}(),n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(s){"use strict";var e='[data-dismiss="alert"]',a=function(t){s(t).on("click",e,this.close)};a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.close=function(t){var e=s(this),i=e.attr("data-target");i||(i=(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),i="#"===i?[]:i;var o=s(document).find(i);function n(){o.detach().trigger("closed.bs.alert").remove()}t&&t.preventDefault(),o.length||(o=e.closest(".alert")),o.trigger(t=s.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),s.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(a.TRANSITION_DURATION):n())};var t=s.fn.alert;s.fn.alert=function o(i){return this.each(function(){var t=s(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new a(this)),"string"==typeof i&&e[i].call(t)})},s.fn.alert.Constructor=a,s.fn.alert.noConflict=function(){return s.fn.alert=t,this},s(document).on("click.bs.alert.data-api",e,a.prototype.close)}(jQuery),function(s){"use strict";var n=function(t,e){this.$element=s(t),this.options=s.extend({},n.DEFAULTS,e),this.isLoading=!1};function i(o){return this.each(function(){var t=s(this),e=t.data("bs.button"),i="object"==typeof o&&o;e||t.data("bs.button",e=new n(this,i)),"toggle"==o?e.toggle():o&&e.setState(o)})}n.VERSION="3.4.1",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var e="disabled",i=this.$element,o=i.is("input")?"val":"html",n=i.data();t+="Text",null==n.resetText&&i.data("resetText",i[o]()),setTimeout(s.proxy(function(){i[o](null==n[t]?this.options[t]:n[t]),"loadingText"==t?(this.isLoading=!0,i.addClass(e).attr(e,e).prop(e,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(e).removeAttr(e).prop(e,!1))},this),0)},n.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var t=s.fn.button;s.fn.button=i,s.fn.button.Constructor=n,s.fn.button.noConflict=function(){return s.fn.button=t,this},s(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var e=s(t.target).closest(".btn");i.call(e,"toggle"),s(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),e.is("input,button")?e.trigger("focus"):e.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){s(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(p){"use strict";var c=function(t,e){this.$element=p(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=e,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",p.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",p.proxy(this.pause,this)).on("mouseleave.bs.carousel",p.proxy(this.cycle,this))};function r(n){return this.each(function(){var t=p(this),e=t.data("bs.carousel"),i=p.extend({},c.DEFAULTS,t.data(),"object"==typeof n&&n),o="string"==typeof n?n:i.slide;e||t.data("bs.carousel",e=new c(this,i)),"number"==typeof n?e.to(n):o?e[o]():i.interval&&e.pause().cycle()})}c.VERSION="3.4.1",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},c.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(p.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},c.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e);if(("prev"==t&&0===i||"next"==t&&i==this.$items.length-1)&&!this.options.wrap)return e;var o=(i+("prev"==t?-1:1))%this.$items.length;return this.$items.eq(o)},c.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(i<t?"next":"prev",this.$items.eq(t))},c.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&p.support.transition&&(this.$element.trigger(p.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(t,e){var i=this.$element.find(".item.active"),o=e||this.getItemForDirection(t,i),n=this.interval,s="next"==t?"left":"right",a=this;if(o.hasClass("active"))return this.sliding=!1;var r=o[0],l=p.Event("slide.bs.carousel",{relatedTarget:r,direction:s});if(this.$element.trigger(l),!l.isDefaultPrevented()){if(this.sliding=!0,n&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=p(this.$indicators.children()[this.getItemIndex(o)]);h&&h.addClass("active")}var d=p.Event("slid.bs.carousel",{relatedTarget:r,direction:s});return p.support.transition&&this.$element.hasClass("slide")?(o.addClass(t),"object"==typeof o&&o.length&&o[0].offsetWidth,i.addClass(s),o.addClass(s),i.one("bsTransitionEnd",function(){o.removeClass([t,s].join(" ")).addClass("active"),i.removeClass(["active",s].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger(d)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(i.removeClass("active"),o.addClass("active"),this.sliding=!1,this.$element.trigger(d)),n&&this.cycle(),this}};var t=p.fn.carousel;p.fn.carousel=r,p.fn.carousel.Constructor=c,p.fn.carousel.noConflict=function(){return p.fn.carousel=t,this};var e=function(t){var e=p(this),i=e.attr("href");i&&(i=i.replace(/.*(?=#[^\s]+$)/,""));var o=e.attr("data-target")||i,n=p(document).find(o);if(n.hasClass("carousel")){var s=p.extend({},n.data(),e.data()),a=e.attr("data-slide-to");a&&(s.interval=!1),r.call(n,s),a&&n.data("bs.carousel").to(a),t.preventDefault()}};p(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),p(window).on("load",function(){p('[data-ride="carousel"]').each(function(){var t=p(this);r.call(t,t.data())})})}(jQuery),function(a){"use strict";var r=function(t,e){this.$element=a(t),this.options=a.extend({},r.DEFAULTS,e),this.$trigger=a('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};function n(t){var e,i=t.attr("data-target")||(e=t.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"");return a(document).find(i)}function l(o){return this.each(function(){var t=a(this),e=t.data("bs.collapse"),i=a.extend({},r.DEFAULTS,t.data(),"object"==typeof o&&o);!e&&i.toggle&&/show|hide/.test(o)&&(i.toggle=!1),e||t.data("bs.collapse",e=new r(this,i)),"string"==typeof o&&e[o]()})}r.VERSION="3.4.1",r.TRANSITION_DURATION=350,r.DEFAULTS={toggle:!0},r.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},r.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(t=e.data("bs.collapse"))&&t.transitioning)){var i=a.Event("show.bs.collapse");if(this.$element.trigger(i),!i.isDefaultPrevented()){e&&e.length&&(l.call(e,"hide"),t||e.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var n=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return n.call(this);var s=a.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",a.proxy(n,this)).emulateTransitionEnd(r.TRANSITION_DURATION)[o](this.$element[0][s])}}}},r.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=a.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.dimension();this.$element[e](this.$element[e]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!a.support.transition)return i.call(this);this.$element[e](0).one("bsTransitionEnd",a.proxy(i,this)).emulateTransitionEnd(r.TRANSITION_DURATION)}}},r.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},r.prototype.getParent=function(){return a(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(t,e){var i=a(e);this.addAriaAndCollapsedClass(n(i),i)},this)).end()},r.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var t=a.fn.collapse;a.fn.collapse=l,a.fn.collapse.Constructor=r,a.fn.collapse.noConflict=function(){return a.fn.collapse=t,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var e=a(this);e.attr("data-target")||t.preventDefault();var i=n(e),o=i.data("bs.collapse")?"toggle":e.data();l.call(i,o)})}(jQuery),function(a){"use strict";var r='[data-toggle="dropdown"]',o=function(t){a(t).on("click.bs.dropdown",this.toggle)};function l(t){var e=t.attr("data-target");e||(e=(e=t.attr("href"))&&/#[A-Za-z]/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var i="#"!==e?a(document).find(e):null;return i&&i.length?i:t.parent()}function s(o){o&&3===o.which||(a(".dropdown-backdrop").remove(),a(r).each(function(){var t=a(this),e=l(t),i={relatedTarget:this};e.hasClass("open")&&(o&&"click"==o.type&&/input|textarea/i.test(o.target.tagName)&&a.contains(e[0],o.target)||(e.trigger(o=a.Event("hide.bs.dropdown",i)),o.isDefaultPrevented()||(t.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",i)))))}))}o.VERSION="3.4.1",o.prototype.toggle=function(t){var e=a(this);if(!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(s(),!o){"ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",s);var n={relatedTarget:this};if(i.trigger(t=a.Event("show.bs.dropdown",n)),t.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),i.toggleClass("open").trigger(a.Event("shown.bs.dropdown",n))}return!1}},o.prototype.keydown=function(t){if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)){var e=a(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(!o&&27!=t.which||o&&27==t.which)return 27==t.which&&i.find(r).trigger("focus"),e.trigger("click");var n=i.find(".dropdown-menu li:not(.disabled):visible a");if(n.length){var s=n.index(t.target);38==t.which&&0<s&&s--,40==t.which&&s<n.length-1&&s++,~s||(s=0),n.eq(s).trigger("focus")}}}};var t=a.fn.dropdown;a.fn.dropdown=function e(i){return this.each(function(){var t=a(this),e=t.data("bs.dropdown");e||t.data("bs.dropdown",e=new o(this)),"string"==typeof i&&e[i].call(t)})},a.fn.dropdown.Constructor=o,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=t,this},a(document).on("click.bs.dropdown.data-api",s).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",r,o.prototype.toggle).on("keydown.bs.dropdown.data-api",r,o.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",o.prototype.keydown)}(jQuery),function(a){"use strict";var s=function(t,e){this.options=e,this.$body=a(document.body),this.$element=a(t),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom",this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};function r(o,n){return this.each(function(){var t=a(this),e=t.data("bs.modal"),i=a.extend({},s.DEFAULTS,t.data(),"object"==typeof o&&o);e||t.data("bs.modal",e=new s(this,i)),"string"==typeof o?e[o](n):i.show&&e.show(n)})}s.VERSION="3.4.1",s.TRANSITION_DURATION=300,s.BACKDROP_TRANSITION_DURATION=150,s.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},s.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},s.prototype.show=function(i){var o=this,t=a.Event("show.bs.modal",{relatedTarget:i});this.$element.trigger(t),this.isShown||t.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){o.$element.one("mouseup.dismiss.bs.modal",function(t){a(t.target).is(o.$element)&&(o.ignoreBackdropClick=!0)})}),this.backdrop(function(){var t=a.support.transition&&o.$element.hasClass("fade");o.$element.parent().length||o.$element.appendTo(o.$body),o.$element.show().scrollTop(0),o.adjustDialog(),t&&o.$element[0].offsetWidth,o.$element.addClass("in"),o.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:i});t?o.$dialog.one("bsTransitionEnd",function(){o.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(s.TRANSITION_DURATION):o.$element.trigger("focus").trigger(e)}))},s.prototype.hide=function(t){t&&t.preventDefault(),t=a.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(s.TRANSITION_DURATION):this.hideModal())},s.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},s.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},s.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},s.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},s.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},s.prototype.backdrop=function(t){var e=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var o=a.support.transition&&i;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+i).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),o&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;o?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var n=function(){e.removeBackdrop(),t&&t()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",n).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):n()}else t&&t()},s.prototype.handleUpdate=function(){this.adjustDialog()},s.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},s.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},s.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},s.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"";var n=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",t+n),a(this.fixedContent).each(function(t,e){var i=e.style.paddingRight,o=a(e).css("padding-right");a(e).data("padding-right",i).css("padding-right",parseFloat(o)+n+"px")}))},s.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad),a(this.fixedContent).each(function(t,e){var i=a(e).data("padding-right");a(e).removeData("padding-right"),e.style.paddingRight=i||""})},s.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var t=a.fn.modal;a.fn.modal=r,a.fn.modal.Constructor=s,a.fn.modal.noConflict=function(){return a.fn.modal=t,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var e=a(this),i=e.attr("href"),o=e.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,""),n=a(document).find(o),s=n.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(i)&&i},n.data(),e.data());e.is("a")&&t.preventDefault(),n.one("show.bs.modal",function(t){t.isDefaultPrevented()||n.one("hidden.bs.modal",function(){e.is(":visible")&&e.trigger("focus")})}),r.call(n,s,this)})}(jQuery),function(g){"use strict";var o=["sanitize","whiteList","sanitizeFn"],a=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],t={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},r=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,l=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function u(t,e){var i=t.nodeName.toLowerCase();if(-1!==g.inArray(i,e))return-1===g.inArray(i,a)||Boolean(t.nodeValue.match(r)||t.nodeValue.match(l));for(var o=g(e).filter(function(t,e){return e instanceof RegExp}),n=0,s=o.length;n<s;n++)if(i.match(o[n]))return!0;return!1}function n(t,e,i){if(0===t.length)return t;if(i&&"function"==typeof i)return i(t);if(!document.implementation||!document.implementation.createHTMLDocument)return t;var o=document.implementation.createHTMLDocument("sanitization");o.body.innerHTML=t;for(var n=g.map(e,function(t,e){return e}),s=g(o.body).find("*"),a=0,r=s.length;a<r;a++){var l=s[a],h=l.nodeName.toLowerCase();if(-1!==g.inArray(h,n))for(var d=g.map(l.attributes,function(t){return t}),p=[].concat(e["*"]||[],e[h]||[]),c=0,f=d.length;c<f;c++)u(d[c],p)||l.removeAttribute(d[c].nodeName);else l.parentNode.removeChild(l)}return o.body.innerHTML}var m=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};m.VERSION="3.4.1",m.TRANSITION_DURATION=150,m.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:t},m.prototype.init=function(t,e,i){if(this.enabled=!0,this.type=t,this.$element=g(e),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&g(document).find(g.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var o=this.options.trigger.split(" "),n=o.length;n--;){var s=o[n];if("click"==s)this.$element.on("click."+this.type,this.options.selector,g.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",r="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,g.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,g.proxy(this.leave,this))}}this.options.selector?this._options=g.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},m.prototype.getDefaults=function(){return m.DEFAULTS},m.prototype.getOptions=function(t){var e=this.$element.data();for(var i in e)e.hasOwnProperty(i)&&-1!==g.inArray(i,o)&&delete e[i];return(t=g.extend({},this.getDefaults(),e,t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=n(t.template,t.whiteList,t.sanitizeFn)),t},m.prototype.getDelegateOptions=function(){var i={},o=this.getDefaults();return this._options&&g.each(this._options,function(t,e){o[t]!=e&&(i[t]=e)}),i},m.prototype.enter=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusin"==t.type?"focus":"hover"]=!0),e.tip().hasClass("in")||"in"==e.hoverState)e.hoverState="in";else{if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)}},m.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},m.prototype.leave=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusout"==t.type?"focus":"hover"]=!1),!e.isInStateTrue()){if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)}},m.prototype.show=function(){var t=g.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var e=g.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!e)return;var i=this,o=this.tip(),n=this.getUID(this.type);this.setContent(),o.attr("id",n),this.$element.attr("aria-describedby",n),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,r=a.test(s);r&&(s=s.replace(a,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(g(document).find(this.options.container)):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),h=o[0].offsetWidth,d=o[0].offsetHeight;if(r){var p=s,c=this.getPosition(this.$viewport);s="bottom"==s&&l.bottom+d>c.bottom?"top":"top"==s&&l.top-d<c.top?"bottom":"right"==s&&l.right+h>c.width?"left":"left"==s&&l.left-h<c.left?"right":s,o.removeClass(p).addClass(s)}var f=this.getCalculatedOffset(s,l,h,d);this.applyPlacement(f,s);var u=function(){var t=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==t&&i.leave(i)};g.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",u).emulateTransitionEnd(m.TRANSITION_DURATION):u()}},m.prototype.applyPlacement=function(t,e){var i=this.tip(),o=i[0].offsetWidth,n=i[0].offsetHeight,s=parseInt(i.css("margin-top"),10),a=parseInt(i.css("margin-left"),10);isNaN(s)&&(s=0),isNaN(a)&&(a=0),t.top+=s,t.left+=a,g.offset.setOffset(i[0],g.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},t),0),i.addClass("in");var r=i[0].offsetWidth,l=i[0].offsetHeight;"top"==e&&l!=n&&(t.top=t.top+n-l);var h=this.getViewportAdjustedDelta(e,t,r,l);h.left?t.left+=h.left:t.top+=h.top;var d=/top|bottom/.test(e),p=d?2*h.left-o+r:2*h.top-n+l,c=d?"offsetWidth":"offsetHeight";i.offset(t),this.replaceArrow(p,i[0][c],d)},m.prototype.replaceArrow=function(t,e,i){this.arrow().css(i?"left":"top",50*(1-t/e)+"%").css(i?"top":"left","")},m.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();this.options.html?(this.options.sanitize&&(e=n(e,this.options.whiteList,this.options.sanitizeFn)),t.find(".tooltip-inner").html(e)):t.find(".tooltip-inner").text(e),t.removeClass("fade in top bottom left right")},m.prototype.hide=function(t){var e=this,i=g(this.$tip),o=g.Event("hide.bs."+this.type);function n(){"in"!=e.hoverState&&i.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),t&&t()}if(this.$element.trigger(o),!o.isDefaultPrevented())return i.removeClass("in"),g.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",n).emulateTransitionEnd(m.TRANSITION_DURATION):n(),this.hoverState=null,this},m.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},m.prototype.hasContent=function(){return this.getTitle()},m.prototype.getPosition=function(t){var e=(t=t||this.$element)[0],i="BODY"==e.tagName,o=e.getBoundingClientRect();null==o.width&&(o=g.extend({},o,{width:o.right-o.left,height:o.bottom-o.top}));var n=window.SVGElement&&e instanceof window.SVGElement,s=i?{top:0,left:0}:n?null:t.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},r=i?{width:g(window).width(),height:g(window).height()}:null;return g.extend({},o,a,r,s)},m.prototype.getCalculatedOffset=function(t,e,i,o){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-o,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-o/2,left:e.left-i}:{top:e.top+e.height/2-o/2,left:e.left+e.width}},m.prototype.getViewportAdjustedDelta=function(t,e,i,o){var n={top:0,left:0};if(!this.$viewport)return n;var s=this.options.viewport&&this.options.viewport.padding||0,a=this.getPosition(this.$viewport);if(/right|left/.test(t)){var r=e.top-s-a.scroll,l=e.top+s-a.scroll+o;r<a.top?n.top=a.top-r:l>a.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;h<a.left?n.left=a.left-h:d>a.right&&(n.left=a.left+a.width-d)}return n},m.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},m.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},m.prototype.tip=function(){if(!this.$tip&&(this.$tip=g(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},m.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},m.prototype.enable=function(){this.enabled=!0},m.prototype.disable=function(){this.enabled=!1},m.prototype.toggleEnabled=function(){this.enabled=!this.enabled},m.prototype.toggle=function(t){var e=this;t&&((e=g(t.currentTarget).data("bs."+this.type))||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e))),t?(e.inState.click=!e.inState.click,e.isInStateTrue()?e.enter(e):e.leave(e)):e.tip().hasClass("in")?e.leave(e):e.enter(e)},m.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})},m.prototype.sanitizeHtml=function(t){return n(t,this.options.whiteList,this.options.sanitizeFn)};var e=g.fn.tooltip;g.fn.tooltip=function i(o){return this.each(function(){var t=g(this),e=t.data("bs.tooltip"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.tooltip",e=new m(this,i)),"string"==typeof o&&e[o]())})},g.fn.tooltip.Constructor=m,g.fn.tooltip.noConflict=function(){return g.fn.tooltip=e,this}}(jQuery),function(n){"use strict";var s=function(t,e){this.init("popover",t,e)};if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");s.VERSION="3.4.1",s.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),((s.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=s).prototype.getDefaults=function(){return s.DEFAULTS},s.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();if(this.options.html){var o=typeof i;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===o&&(i=this.sanitizeHtml(i))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===o?"html":"append"](i)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(i);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},s.prototype.hasContent=function(){return this.getTitle()||this.getContent()},s.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},s.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var t=n.fn.popover;n.fn.popover=function e(o){return this.each(function(){var t=n(this),e=t.data("bs.popover"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.popover",e=new s(this,i)),"string"==typeof o&&e[o]())})},n.fn.popover.Constructor=s,n.fn.popover.noConflict=function(){return n.fn.popover=t,this}}(jQuery),function(s){"use strict";function n(t,e){this.$body=s(document.body),this.$scrollElement=s(t).is(document.body)?s(window):s(t),this.options=s.extend({},n.DEFAULTS,e),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",s.proxy(this.process,this)),this.refresh(),this.process()}function e(o){return this.each(function(){var t=s(this),e=t.data("bs.scrollspy"),i="object"==typeof o&&o;e||t.data("bs.scrollspy",e=new n(this,i)),"string"==typeof o&&e[o]()})}n.VERSION="3.4.1",n.DEFAULTS={offset:10},n.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},n.prototype.refresh=function(){var t=this,o="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),s.isWindow(this.$scrollElement[0])||(o="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=s(this),e=t.data("target")||t.attr("href"),i=/^#./.test(e)&&s(e);return i&&i.length&&i.is(":visible")&&[[i[o]().top+n,e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},n.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),o<=e)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e<n[0])return this.activeTarget=null,this.clear();for(t=n.length;t--;)a!=s[t]&&e>=n[t]&&(n[t+1]===undefined||e<n[t+1])&&this.activate(s[t])},n.prototype.activate=function(t){this.activeTarget=t,this.clear();var e=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=s(e).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")},n.prototype.clear=function(){s(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var t=s.fn.scrollspy;s.fn.scrollspy=e,s.fn.scrollspy.Constructor=n,s.fn.scrollspy.noConflict=function(){return s.fn.scrollspy=t,this},s(window).on("load.bs.scrollspy.data-api",function(){s('[data-spy="scroll"]').each(function(){var t=s(this);e.call(t,t.data())})})}(jQuery),function(r){"use strict";var a=function(t){this.element=r(t)};function e(i){return this.each(function(){var t=r(this),e=t.data("bs.tab");e||t.data("bs.tab",e=new a(this)),"string"==typeof i&&e[i]()})}a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.show=function(){var t=this.element,e=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var o=e.find(".active:last a"),n=r.Event("hide.bs.tab",{relatedTarget:t[0]}),s=r.Event("show.bs.tab",{relatedTarget:o[0]});if(o.trigger(n),t.trigger(s),!s.isDefaultPrevented()&&!n.isDefaultPrevented()){var a=r(document).find(i);this.activate(t.closest("li"),e),this.activate(a,a.parent(),function(){o.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:o[0]})})}}},a.prototype.activate=function(t,e,i){var o=e.find("> .active"),n=i&&r.support.transition&&(o.length&&o.hasClass("fade")||!!e.find("> .fade").length);function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),n?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}o.length&&n?o.one("bsTransitionEnd",s).emulateTransitionEnd(a.TRANSITION_DURATION):s(),o.removeClass("in")};var t=r.fn.tab;r.fn.tab=e,r.fn.tab.Constructor=a,r.fn.tab.noConflict=function(){return r.fn.tab=t,this};var i=function(t){t.preventDefault(),e.call(r(this),"show")};r(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(l){"use strict";var h=function(t,e){this.options=l.extend({},h.DEFAULTS,e);var i=this.options.target===h.DEFAULTS.target?l(this.options.target):l(document).find(this.options.target);this.$target=i.on("scroll.bs.affix.data-api",l.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",l.proxy(this.checkPositionWithEventLoop,this)),this.$element=l(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function i(o){return this.each(function(){var t=l(this),e=t.data("bs.affix"),i="object"==typeof o&&o;e||t.data("bs.affix",e=new h(this,i)),"string"==typeof o&&e[o]()})}h.VERSION="3.4.1",h.RESET="affix affix-top affix-bottom",h.DEFAULTS={offset:0,target:window},h.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return n<i&&"top";if("bottom"==this.affixed)return null!=i?!(n+this.unpin<=s.top)&&"bottom":!(n+a<=t-o)&&"bottom";var r=null==this.affixed,l=r?n:s.top;return null!=i&&n<=i?"top":null!=o&&t-o<=l+(r?a:e)&&"bottom"},h.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(h.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},h.prototype.checkPositionWithEventLoop=function(){setTimeout(l.proxy(this.checkPosition,this),1)},h.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),e=this.options.offset,i=e.top,o=e.bottom,n=Math.max(l(document).height(),l(document.body).height());"object"!=typeof e&&(o=i=e),"function"==typeof i&&(i=e.top(this.$element)),"function"==typeof o&&(o=e.bottom(this.$element));var s=this.getState(n,t,i,o);if(this.affixed!=s){null!=this.unpin&&this.$element.css("top","");var a="affix"+(s?"-"+s:""),r=l.Event(a+".bs.affix");if(this.$element.trigger(r),r.isDefaultPrevented())return;this.affixed=s,this.unpin="bottom"==s?this.getPinnedOffset():null,this.$element.removeClass(h.RESET).addClass(a).trigger(a.replace("affix","affixed")+".bs.affix")}"bottom"==s&&this.$element.offset({top:n-t-o})}};var t=l.fn.affix;l.fn.affix=i,l.fn.affix.Constructor=h,l.fn.affix.noConflict=function(){return l.fn.affix=t,this},l(window).on("load",function(){l('[data-spy="affix"]').each(function(){var t=l(this),e=t.data();e.offset=e.offset||{},null!=e.offsetBottom&&(e.offset.bottom=e.offsetBottom),null!=e.offsetTop&&(e.offset.top=e.offsetTop),i.call(t,e)})})}(jQuery);
  11. define("bootstrap", ["jquery"], function(){});
  12. require.config({
  13. urlArgs: "v=" + requirejs.s.contexts._.config.config.site.version,
  14. packages: [{
  15. name: 'moment',
  16. location: '../libs/moment',
  17. main: 'moment'
  18. }
  19. ],
  20. //在打包压缩时将会把include中的模块合并到主文件中
  21. include: ['css', 'layer', 'toastr', 'fast', 'backend', 'backend-init', 'table', 'form', 'dragsort', 'drag', 'drop', 'addtabs', 'selectpage'],
  22. paths: {
  23. 'lang': "empty:",
  24. 'form': 'require-form',
  25. 'table': 'require-table',
  26. 'upload': 'require-upload',
  27. 'validator': 'require-validator',
  28. 'drag': 'jquery.drag.min',
  29. 'drop': 'jquery.drop.min',
  30. 'echarts': 'echarts.min',
  31. 'echarts-theme': 'echarts-theme',
  32. 'adminlte': 'adminlte',
  33. 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch',
  34. 'bootstrap-table-template': 'bootstrap-table-template',
  35. //
  36. // 以下的包从bower的libs目录加载
  37. 'jquery': '../libs/jquery/dist/jquery.min',
  38. 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
  39. 'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
  40. 'bootstrap-daterangepicker': '../libs/bootstrap-daterangepicker/daterangepicker',
  41. 'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
  42. 'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
  43. 'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
  44. 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min',
  45. 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile',
  46. 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN',
  47. 'bootstrap-table-jumpto': '../libs/bootstrap-table/dist/extensions/page-jumpto/bootstrap-table-jumpto',
  48. 'bootstrap-slider': '../libs/bootstrap-slider/bootstrap-slider',
  49. 'tableexport': '../libs/tableExport.jquery.plugin/tableExport.min',
  50. 'dragsort': '../libs/fastadmin-dragsort/jquery.dragsort',
  51. 'sortable': '../libs/Sortable/Sortable.min',
  52. 'addtabs': '../libs/fastadmin-addtabs/jquery.addtabs',
  53. 'slimscroll': '../libs/jquery-slimscroll/jquery.slimscroll',
  54. 'validator-core': '../libs/nice-validator/dist/jquery.validator',
  55. 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
  56. 'plupload': '../libs/plupload/js/plupload.min',
  57. 'toastr': '../libs/toastr/toastr',
  58. 'jstree': '../libs/jstree/dist/jstree.min',
  59. 'layer': '../libs/fastadmin-layer/dist/layer',
  60. 'cookie': '../libs/jquery.cookie/jquery.cookie',
  61. 'cxselect': '../libs/fastadmin-cxselect/js/jquery.cxselect',
  62. 'template': '../libs/art-template/dist/template-native',
  63. 'selectpage': '../libs/fastadmin-selectpage/selectpage',
  64. 'citypicker': '../libs/fastadmin-citypicker/dist/js/city-picker.min',
  65. 'citypicker-data': '../libs/fastadmin-citypicker/dist/js/city-picker.data',
  66. },
  67. // shim依赖配置
  68. shim: {
  69. 'addons': ['backend'],
  70. 'bootstrap': ['jquery'],
  71. 'bootstrap-table': {
  72. deps: [
  73. 'bootstrap',
  74. // 'css!../libs/bootstrap-table/dist/bootstrap-table.min.css'
  75. ],
  76. exports: '$.fn.bootstrapTable'
  77. },
  78. 'bootstrap-table-lang': {
  79. deps: ['bootstrap-table'],
  80. exports: '$.fn.bootstrapTable.defaults'
  81. },
  82. 'bootstrap-table-export': {
  83. deps: ['bootstrap-table', 'tableexport'],
  84. exports: '$.fn.bootstrapTable.defaults'
  85. },
  86. 'bootstrap-table-mobile': {
  87. deps: ['bootstrap-table'],
  88. exports: '$.fn.bootstrapTable.defaults'
  89. },
  90. 'bootstrap-table-advancedsearch': {
  91. deps: ['bootstrap-table'],
  92. exports: '$.fn.bootstrapTable.defaults'
  93. },
  94. 'bootstrap-table-commonsearch': {
  95. deps: ['bootstrap-table'],
  96. exports: '$.fn.bootstrapTable.defaults'
  97. },
  98. 'bootstrap-table-template': {
  99. deps: ['bootstrap-table', 'template'],
  100. exports: '$.fn.bootstrapTable.defaults'
  101. },
  102. 'bootstrap-table-jumpto': {
  103. deps: ['bootstrap-table'],
  104. exports: '$.fn.bootstrapTable.defaults'
  105. },
  106. 'tableexport': {
  107. deps: ['jquery'],
  108. exports: '$.fn.extend'
  109. },
  110. 'slimscroll': {
  111. deps: ['jquery'],
  112. exports: '$.fn.extend'
  113. },
  114. 'adminlte': {
  115. deps: ['bootstrap', 'slimscroll'],
  116. exports: '$.AdminLTE'
  117. },
  118. 'bootstrap-daterangepicker': [
  119. 'moment/locale/zh-cn'
  120. ],
  121. 'bootstrap-datetimepicker': [
  122. 'moment/locale/zh-cn',
  123. // 'css!../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css',
  124. ],
  125. // 'bootstrap-select': ['css!../libs/bootstrap-select/dist/css/bootstrap-select.min.css',],
  126. 'bootstrap-select-lang': ['bootstrap-select'],
  127. // 'toastr': ['css!../libs/toastr/toastr.min.css'],
  128. 'jstree': ['css!../libs/jstree/dist/themes/default/style.css',],
  129. 'plupload': {
  130. deps: ['../libs/plupload/js/moxie.min'],
  131. exports: "plupload"
  132. },
  133. // 'layer': ['css!../libs/fastadmin-layer/dist/theme/default/layer.css'],
  134. // 'validator-core': ['css!../libs/nice-validator/dist/jquery.validator.css'],
  135. 'validator-lang': ['validator-core'],
  136. // 'selectpage': ['css!../libs/fastadmin-selectpage/selectpage.css'],
  137. 'citypicker': ['citypicker-data', 'css!../libs/fastadmin-citypicker/dist/css/city-picker.css']
  138. },
  139. baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/', //资源基础路径
  140. map: {
  141. '*': {
  142. 'css': '../libs/require-css/css.min'
  143. }
  144. },
  145. waitSeconds: 30,
  146. charset: 'utf-8' // 文件编码
  147. });
  148. require(['jquery', 'bootstrap'], function ($, undefined) {
  149. //初始配置
  150. var Config = requirejs.s.contexts._.config.config;
  151. //将Config渲染到全局
  152. window.Config = Config;
  153. // 配置语言包的路径
  154. var paths = {};
  155. paths['lang'] = Config.moduleurl + '/ajax/lang?callback=define&controllername=' + Config.controllername;
  156. // 避免目录冲突
  157. paths['backend/'] = 'backend/';
  158. require.config({paths: paths});
  159. // 初始化
  160. $(function () {
  161. require(['fast'], function (Fast) {
  162. require(['backend', 'backend-init', 'addons'], function (Backend, undefined, Addons) {
  163. //加载相应模块
  164. if (Config.jsname) {
  165. require([Config.jsname], function (Controller) {
  166. if (Controller.hasOwnProperty(Config.actionname)) {
  167. Controller[Config.actionname]();
  168. } else {
  169. if (Controller.hasOwnProperty("_empty")) {
  170. Controller._empty();
  171. }
  172. }
  173. }, function (e) {
  174. console.error(e);
  175. // 这里可捕获模块加载的错误
  176. });
  177. }
  178. });
  179. });
  180. });
  181. });
  182. define("require-backend", function(){});
  183. define('../libs/require-css/css.min',[],function(){if("undefined"==typeof window)return{load:function(a,b,c){c()}};var a=document.getElementsByTagName("head")[0],b=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)|AndroidWebKit\/([^ ;]*)/)||0,c=!1,d=!0;b[1]||b[7]?c=parseInt(b[1])<6||parseInt(b[7])<=9:b[2]||b[8]?d=!1:b[4]&&(c=parseInt(b[4])<18);var e={};e.pluginBuilder="./css-builder";var f,g,h,i=function(){f=document.createElement("style"),a.appendChild(f),g=f.styleSheet||f.sheet},j=0,k=[],l=function(a){g.addImport(a),f.onload=function(){m()},j++,31==j&&(i(),j=0)},m=function(){h();var a=k.shift();return a?(h=a[1],void l(a[0])):void(h=null)},n=function(a,b){if(g&&g.addImport||i(),g&&g.addImport)h?k.push([a,b]):(l(a),h=b);else{f.textContent='@import "'+a+'";';var c=setInterval(function(){try{f.sheet.cssRules,clearInterval(c),b()}catch(a){}},10)}},o=function(b,c){var e=document.createElement("link");if(e.type="text/css",e.rel="stylesheet",d)e.onload=function(){e.onload=function(){},setTimeout(c,7)};else var f=setInterval(function(){for(var a=0;a<document.styleSheets.length;a++){var b=document.styleSheets[a];if(b.href==e.href)return clearInterval(f),c()}},10);e.href=b,a.appendChild(e)};return e.normalize=function(a,b){return".css"==a.substr(a.length-4,4)&&(a=a.substr(0,a.length-4)),b(a)},e.load=function(a,b,d,e){(c?n:o)(b.toUrl(a+".css"),d)},e});
  184. /*! layer-v3.1.4 Web弹层组件 MIT License http://layer.layui.com/ By 贤心 */
  185. ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},f=r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},n.icon!==-1&&n.icon!==t||(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"&#x4FE1;&#x606F;",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,focusBtn:0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'<div class="layui-layer-title" style="'+(f?r.title[1]:"")+'">'+(f?r.title[0]:r.title)+"</div>":"";return r.zIndex=s,t([r.shade?'<div class="layui-layer-shade" id="layui-layer-shade'+a+'" times="'+a+'" style="'+("z-index:"+(s-1)+"; ")+'"></div>':"",'<div class="'+l[0]+(" layui-layer-"+o.type[r.type])+(0!=r.type&&2!=r.type||r.shade?"":" layui-layer-border")+" "+(r.skin||"")+'" id="'+l[0]+a+'" type="'+o.type[r.type]+'" times="'+a+'" showtime="'+r.time+'" conType="'+(e?"object":"string")+'" style="z-index: '+s+"; width:"+r.area[0]+";height:"+r.area[1]+(r.fixed?"":";position:absolute;")+'">'+(e&&2!=r.type?"":u)+'<div id="'+(r.id||"")+'" class="layui-layer-content'+(0==r.type&&r.icon!==-1?" layui-layer-padding":"")+(3==r.type?" layui-layer-loading"+r.icon:"")+'">'+(0==r.type&&r.icon!==-1?'<i class="layui-layer-ico layui-layer-ico'+r.icon+'"></i>':"")+(1==r.type&&e?"":r.content||"")+'</div><span class="layui-layer-setwin">'+function(){var e=c?'<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>':"";return r.closeBtn&&(e+='<a class="layui-layer-ico '+l[7]+" "+l[7]+(r.title?r.closeBtn:4==r.type?"1":"2")+'" href="javascript:;"></a>'),e}()+"</span>"+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t<i;t++)e+='<a class="'+l[6]+t+'" href="javascript:;">'+r.btn[t]+"</a>";return'<div class="'+l[6]+" layui-layer-btn-"+(r.btnAlign||"")+'">'+e+"</div>"}():"")+(r.resize?'<span class="layui-layer-resize"></span>':"")+"</div>"],u,i('<div class="layui-layer-move"></div>')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"http://layer.layui.com","auto"];t.content='<iframe scrolling="'+(t.content[1]||"auto")+'" allowtransparency="true" id="'+l[4]+a+'" name="'+l[4]+a+'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="'+t.content[0]+'"></iframe>';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'<i class="layui-layer-TipsG"></i>',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;a<c.stX&&(a=c.stX),a>f&&(a=f),o<c.stY&&(o=c.stY),o>u&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;if(t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),"number"==typeof a.focusBtn){var s=n.find("."+l[6]).children("a").eq(a.focusBtn);if(s.size()>0){var f=s.position(),c={width:s.outerWidth(),height:s.outerHeight(),left:f.left,top:f.top,marginTop:s.css("marginTop"),marginLeft:s.css("marginLeft")},u=i("<button class='layui-layer-confirm'></button>").css(c);n.find("."+l[6]).after(u),u.focus().click(function(){return s.trigger("click"),!1}).on("focus blur",function(e){s.toggleClass("focus","focus"===e.type)})}}n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isOutAnim")?f():setTimeout(function(){f()},200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'<textarea class="layui-layer-input"'+a+">"+(e.value||"")+"</textarea>":function(){return'<input type="'+(1==e.formType?"password":"text")+'" class="layui-layer-input" value="'+(e.value||"")+'">'}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(e){s=e.find(".layui-layer-input"),s.focus(),"function"==typeof f&&f(e)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("&#x6700;&#x591A;&#x8F93;&#x5165;"+(e.maxlength||500)+"&#x4E2A;&#x5B57;&#x6570;",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a='<span class="'+n+'">'+t[0].title+"</span>";i<e;i++)a+="<span>"+t[i].title+"</span>";return a}(),content:'<ul class="layui-layer-tabmain">'+function(){var e=t.length,i=1,a="";if(e>0)for(a='<li class="layui-layer-tabli '+n+'">'+(t[0].content||"no content")+"</li>";i<e;i++)a+='<li class="layui-layer-tabli">'+(t[i].content||"no content")+"</li>";return a}()+"</ul>",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:"shade"in t?t.shade:.9,scrollbar:"scrollbar"in t&&t.scrollbar}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]<r[1]&&(a[0]=a[0]/r[1],a[1]=a[1]/r[1])}return[a[0]+"px",a[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,isOutAnim:!1,skin:"layui-layer-photos"+c("photos"),content:'<div class="layui-layer-phimg"><img src="'+u[d].src+'" alt="'+(u[d].alt||"")+'" layer-pid="'+u[d].pid+'"><div class="layui-layer-imgsee">'+(u.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(a?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(u[d].alt||"")+"</a><em>"+s.imgIndex+"/"+u.length+"</em></span></div></div></div>",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;",{time:3e4,btn:["&#x4E0B;&#x4E00;&#x5F20;","&#x4E0D;&#x770B;&#x4E86;"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define('layer',["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window);
  186. /*
  187. * Toastr
  188. * Copyright 2012-2015
  189. * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
  190. * All Rights Reserved.
  191. * Use, reproduction, distribution, and modification of this code is subject to the terms and
  192. * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
  193. *
  194. * ARIA Support: Greta Krafsig
  195. *
  196. * Project: https://github.com/CodeSeven/toastr
  197. */
  198. /* global define */
  199. (function (define) {
  200. define('toastr',['jquery'], function ($) {
  201. return (function () {
  202. var $container;
  203. var listener;
  204. var toastId = 0;
  205. var toastType = {
  206. error: 'error',
  207. info: 'info',
  208. success: 'success',
  209. warning: 'warning'
  210. };
  211. var toastr = {
  212. clear: clear,
  213. remove: remove,
  214. error: error,
  215. getContainer: getContainer,
  216. info: info,
  217. options: {},
  218. subscribe: subscribe,
  219. success: success,
  220. version: '2.1.3',
  221. warning: warning
  222. };
  223. var previousToast;
  224. return toastr;
  225. ////////////////
  226. function error(message, title, optionsOverride) {
  227. return notify({
  228. type: toastType.error,
  229. iconClass: getOptions().iconClasses.error,
  230. message: message,
  231. optionsOverride: optionsOverride,
  232. title: title
  233. });
  234. }
  235. function getContainer(options, create) {
  236. if (!options) { options = getOptions(); }
  237. $container = $('#' + options.containerId);
  238. if ($container.length) {
  239. return $container;
  240. }
  241. if (create) {
  242. $container = createContainer(options);
  243. }
  244. return $container;
  245. }
  246. function info(message, title, optionsOverride) {
  247. return notify({
  248. type: toastType.info,
  249. iconClass: getOptions().iconClasses.info,
  250. message: message,
  251. optionsOverride: optionsOverride,
  252. title: title
  253. });
  254. }
  255. function subscribe(callback) {
  256. listener = callback;
  257. }
  258. function success(message, title, optionsOverride) {
  259. return notify({
  260. type: toastType.success,
  261. iconClass: getOptions().iconClasses.success,
  262. message: message,
  263. optionsOverride: optionsOverride,
  264. title: title
  265. });
  266. }
  267. function warning(message, title, optionsOverride) {
  268. return notify({
  269. type: toastType.warning,
  270. iconClass: getOptions().iconClasses.warning,
  271. message: message,
  272. optionsOverride: optionsOverride,
  273. title: title
  274. });
  275. }
  276. function clear($toastElement, clearOptions) {
  277. var options = getOptions();
  278. if (!$container) { getContainer(options); }
  279. if (!clearToast($toastElement, options, clearOptions)) {
  280. clearContainer(options);
  281. }
  282. }
  283. function remove($toastElement) {
  284. var options = getOptions();
  285. if (!$container) { getContainer(options); }
  286. if ($toastElement && $(':focus', $toastElement).length === 0) {
  287. removeToast($toastElement);
  288. return;
  289. }
  290. if ($container.children().length) {
  291. $container.remove();
  292. }
  293. }
  294. // internal functions
  295. function clearContainer (options) {
  296. var toastsToClear = $container.children();
  297. for (var i = toastsToClear.length - 1; i >= 0; i--) {
  298. clearToast($(toastsToClear[i]), options);
  299. }
  300. }
  301. function clearToast ($toastElement, options, clearOptions) {
  302. var force = clearOptions && clearOptions.force ? clearOptions.force : false;
  303. if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
  304. $toastElement[options.hideMethod]({
  305. duration: options.hideDuration,
  306. easing: options.hideEasing,
  307. complete: function () { removeToast($toastElement); }
  308. });
  309. return true;
  310. }
  311. return false;
  312. }
  313. function createContainer(options) {
  314. $container = $('<div/>')
  315. .attr('id', options.containerId)
  316. .addClass(options.positionClass);
  317. $container.appendTo($(options.target));
  318. return $container;
  319. }
  320. function getDefaults() {
  321. return {
  322. tapToDismiss: true,
  323. toastClass: 'toast',
  324. containerId: 'toast-container',
  325. debug: false,
  326. showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
  327. showDuration: 300,
  328. showEasing: 'swing', //swing and linear are built into jQuery
  329. onShown: undefined,
  330. hideMethod: 'fadeOut',
  331. hideDuration: 1000,
  332. hideEasing: 'swing',
  333. onHidden: undefined,
  334. closeMethod: false,
  335. closeDuration: false,
  336. closeEasing: false,
  337. closeOnHover: true,
  338. extendedTimeOut: 1000,
  339. iconClasses: {
  340. error: 'toast-error',
  341. info: 'toast-info',
  342. success: 'toast-success',
  343. warning: 'toast-warning'
  344. },
  345. iconClass: 'toast-info',
  346. positionClass: 'toast-top-right',
  347. timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
  348. titleClass: 'toast-title',
  349. messageClass: 'toast-message',
  350. escapeHtml: false,
  351. target: 'body',
  352. closeHtml: '<button type="button">&times;</button>',
  353. closeClass: 'toast-close-button',
  354. newestOnTop: true,
  355. preventDuplicates: false,
  356. progressBar: false,
  357. progressClass: 'toast-progress',
  358. rtl: false
  359. };
  360. }
  361. function publish(args) {
  362. if (!listener) { return; }
  363. listener(args);
  364. }
  365. function notify(map) {
  366. var options = getOptions();
  367. var iconClass = map.iconClass || options.iconClass;
  368. if (typeof (map.optionsOverride) !== 'undefined') {
  369. options = $.extend(options, map.optionsOverride);
  370. iconClass = map.optionsOverride.iconClass || iconClass;
  371. }
  372. if (shouldExit(options, map)) { return; }
  373. toastId++;
  374. $container = getContainer(options, true);
  375. var intervalId = null;
  376. var $toastElement = $('<div/>');
  377. var $titleElement = $('<div/>');
  378. var $messageElement = $('<div/>');
  379. var $progressElement = $('<div/>');
  380. var $closeElement = $(options.closeHtml);
  381. var progressBar = {
  382. intervalId: null,
  383. hideEta: null,
  384. maxHideTime: null
  385. };
  386. var response = {
  387. toastId: toastId,
  388. state: 'visible',
  389. startTime: new Date(),
  390. options: options,
  391. map: map
  392. };
  393. personalizeToast();
  394. displayToast();
  395. handleEvents();
  396. publish(response);
  397. if (options.debug && console) {
  398. console.log(response);
  399. }
  400. return $toastElement;
  401. function escapeHtml(source) {
  402. if (source == null) {
  403. source = '';
  404. }
  405. return source
  406. .replace(/&/g, '&amp;')
  407. .replace(/"/g, '&quot;')
  408. .replace(/'/g, '&#39;')
  409. .replace(/</g, '&lt;')
  410. .replace(/>/g, '&gt;');
  411. }
  412. function personalizeToast() {
  413. setIcon();
  414. setTitle();
  415. setMessage();
  416. setCloseButton();
  417. setProgressBar();
  418. setRTL();
  419. setSequence();
  420. setAria();
  421. }
  422. function setAria() {
  423. var ariaValue = '';
  424. switch (map.iconClass) {
  425. case 'toast-success':
  426. case 'toast-info':
  427. ariaValue = 'polite';
  428. break;
  429. default:
  430. ariaValue = 'assertive';
  431. }
  432. $toastElement.attr('aria-live', ariaValue);
  433. }
  434. function handleEvents() {
  435. if (options.closeOnHover) {
  436. $toastElement.hover(stickAround, delayedHideToast);
  437. }
  438. if (!options.onclick && options.tapToDismiss) {
  439. $toastElement.click(hideToast);
  440. }
  441. if (options.closeButton && $closeElement) {
  442. $closeElement.click(function (event) {
  443. if (event.stopPropagation) {
  444. event.stopPropagation();
  445. } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
  446. event.cancelBubble = true;
  447. }
  448. if (options.onCloseClick) {
  449. options.onCloseClick(event);
  450. }
  451. hideToast(true);
  452. });
  453. }
  454. if (options.onclick) {
  455. $toastElement.click(function (event) {
  456. options.onclick(event);
  457. hideToast();
  458. });
  459. }
  460. }
  461. function displayToast() {
  462. $toastElement.hide();
  463. $toastElement[options.showMethod](
  464. {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
  465. );
  466. if (options.timeOut > 0) {
  467. intervalId = setTimeout(hideToast, options.timeOut);
  468. progressBar.maxHideTime = parseFloat(options.timeOut);
  469. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  470. if (options.progressBar) {
  471. progressBar.intervalId = setInterval(updateProgress, 10);
  472. }
  473. }
  474. }
  475. function setIcon() {
  476. if (map.iconClass) {
  477. $toastElement.addClass(options.toastClass).addClass(iconClass);
  478. }
  479. }
  480. function setSequence() {
  481. if (options.newestOnTop) {
  482. $container.prepend($toastElement);
  483. } else {
  484. $container.append($toastElement);
  485. }
  486. }
  487. function setTitle() {
  488. if (map.title) {
  489. var suffix = map.title;
  490. if (options.escapeHtml) {
  491. suffix = escapeHtml(map.title);
  492. }
  493. $titleElement.append(suffix).addClass(options.titleClass);
  494. $toastElement.append($titleElement);
  495. }
  496. }
  497. function setMessage() {
  498. if (map.message) {
  499. var suffix = map.message;
  500. if (options.escapeHtml) {
  501. suffix = escapeHtml(map.message);
  502. }
  503. $messageElement.append(suffix).addClass(options.messageClass);
  504. $toastElement.append($messageElement);
  505. }
  506. }
  507. function setCloseButton() {
  508. if (options.closeButton) {
  509. $closeElement.addClass(options.closeClass).attr('role', 'button');
  510. $toastElement.prepend($closeElement);
  511. }
  512. }
  513. function setProgressBar() {
  514. if (options.progressBar) {
  515. $progressElement.addClass(options.progressClass);
  516. $toastElement.prepend($progressElement);
  517. }
  518. }
  519. function setRTL() {
  520. if (options.rtl) {
  521. $toastElement.addClass('rtl');
  522. }
  523. }
  524. function shouldExit(options, map) {
  525. if (options.preventDuplicates) {
  526. if (map.message === previousToast) {
  527. return true;
  528. } else {
  529. previousToast = map.message;
  530. }
  531. }
  532. return false;
  533. }
  534. function hideToast(override) {
  535. var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
  536. var duration = override && options.closeDuration !== false ?
  537. options.closeDuration : options.hideDuration;
  538. var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
  539. if ($(':focus', $toastElement).length && !override) {
  540. return;
  541. }
  542. clearTimeout(progressBar.intervalId);
  543. return $toastElement[method]({
  544. duration: duration,
  545. easing: easing,
  546. complete: function () {
  547. removeToast($toastElement);
  548. clearTimeout(intervalId);
  549. if (options.onHidden && response.state !== 'hidden') {
  550. options.onHidden();
  551. }
  552. response.state = 'hidden';
  553. response.endTime = new Date();
  554. publish(response);
  555. }
  556. });
  557. }
  558. function delayedHideToast() {
  559. if (options.timeOut > 0 || options.extendedTimeOut > 0) {
  560. intervalId = setTimeout(hideToast, options.extendedTimeOut);
  561. progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
  562. progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
  563. }
  564. }
  565. function stickAround() {
  566. clearTimeout(intervalId);
  567. progressBar.hideEta = 0;
  568. $toastElement.stop(true, true)[options.showMethod](
  569. {duration: options.showDuration, easing: options.showEasing}
  570. );
  571. }
  572. function updateProgress() {
  573. var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
  574. $progressElement.width(percentage + '%');
  575. }
  576. }
  577. function getOptions() {
  578. return $.extend({}, getDefaults(), toastr.options);
  579. }
  580. function removeToast($toastElement) {
  581. if (!$container) { $container = getContainer(); }
  582. if ($toastElement.is(':visible')) {
  583. return;
  584. }
  585. $toastElement.remove();
  586. $toastElement = null;
  587. if ($container.children().length === 0) {
  588. $container.remove();
  589. previousToast = undefined;
  590. }
  591. }
  592. })();
  593. });
  594. }(typeof define === 'function' && define.amd ? define : function (deps, factory) {
  595. if (typeof module !== 'undefined' && module.exports) { //Node
  596. module.exports = factory(require('jquery'));
  597. } else {
  598. window.toastr = factory(window.jQuery);
  599. }
  600. }));
  601. define('fast',['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) {
  602. var Fast = {
  603. config: {
  604. //toastr默认配置
  605. toastr: {
  606. "closeButton": true,
  607. "debug": false,
  608. "newestOnTop": false,
  609. "progressBar": false,
  610. "positionClass": "toast-top-center",
  611. "preventDuplicates": false,
  612. "onclick": null,
  613. "showDuration": "300",
  614. "hideDuration": "1000",
  615. "timeOut": "5000",
  616. "extendedTimeOut": "1000",
  617. "showEasing": "swing",
  618. "hideEasing": "linear",
  619. "showMethod": "fadeIn",
  620. "hideMethod": "fadeOut"
  621. }
  622. },
  623. events: {
  624. //请求成功的回调
  625. onAjaxSuccess: function (ret, onAjaxSuccess) {
  626. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  627. var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');
  628. if (typeof onAjaxSuccess === 'function') {
  629. var result = onAjaxSuccess.call(this, data, ret);
  630. if (result === false)
  631. return;
  632. }
  633. Toastr.success(msg);
  634. },
  635. //请求错误的回调
  636. onAjaxError: function (ret, onAjaxError) {
  637. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  638. if (typeof onAjaxError === 'function') {
  639. var result = onAjaxError.call(this, data, ret);
  640. if (result === false) {
  641. return;
  642. }
  643. }
  644. Toastr.error(ret.msg);
  645. },
  646. //服务器响应数据后
  647. onAjaxResponse: function (response) {
  648. try {
  649. var ret = typeof response === 'object' ? response : JSON.parse(response);
  650. if (!ret.hasOwnProperty('code')) {
  651. $.extend(ret, {code: -2, msg: response, data: null});
  652. }
  653. } catch (e) {
  654. var ret = {code: -1, msg: e.message, data: null};
  655. }
  656. return ret;
  657. }
  658. },
  659. api: {
  660. //发送Ajax请求
  661. ajax: function (options, success, error) {
  662. options = typeof options === 'string' ? {url: options} : options;
  663. var index;
  664. if (typeof options.loading === 'undefined' || options.loading) {
  665. index = Layer.load(options.loading || 0);
  666. }
  667. options = $.extend({
  668. type: "POST",
  669. dataType: "json",
  670. success: function (ret) {
  671. index && Layer.close(index);
  672. ret = Fast.events.onAjaxResponse(ret);
  673. if (ret.code === 1) {
  674. Fast.events.onAjaxSuccess(ret, success);
  675. } else {
  676. Fast.events.onAjaxError(ret, error);
  677. }
  678. },
  679. error: function (xhr) {
  680. index && Layer.close(index);
  681. var ret = {code: xhr.status, msg: xhr.statusText, data: null};
  682. Fast.events.onAjaxError(ret, error);
  683. }
  684. }, options);
  685. return $.ajax(options);
  686. },
  687. //修复URL
  688. fixurl: function (url) {
  689. if (url.substr(0, 1) !== "/") {
  690. var r = new RegExp('^(?:[a-z]+:)?//', 'i');
  691. if (!r.test(url)) {
  692. url = Config.moduleurl + "/" + url;
  693. }
  694. } else if (url.substr(0, 8) === "/addons/") {
  695. url = Config.__PUBLIC__.replace(/(\/*$)/g, "") + url;
  696. }
  697. return url;
  698. },
  699. //获取修复后可访问的cdn链接
  700. cdnurl: function (url, domain) {
  701. var rule = new RegExp("^((?:[a-z]+:)?\\/\\/|data:image\\/)", "i");
  702. var url = rule.test(url) ? url : Config.upload.cdnurl + url;
  703. if (domain && !rule.test(url)) {
  704. domain = typeof domain === 'string' ? domain : location.origin;
  705. url = domain + url;
  706. }
  707. return url;
  708. },
  709. //查询Url参数
  710. query: function (name, url) {
  711. if (!url) {
  712. url = window.location.href;
  713. }
  714. name = name.replace(/[\[\]]/g, "\\$&");
  715. var regex = new RegExp("[?&/]" + name + "([=/]([^&#/?]*)|&|#|$)"),
  716. results = regex.exec(url);
  717. if (!results)
  718. return null;
  719. if (!results[2])
  720. return '';
  721. return decodeURIComponent(results[2].replace(/\+/g, " "));
  722. },
  723. //打开一个弹出窗口
  724. open: function (url, title, options) {
  725. title = options && options.title ? options.title : (title ? title : "");
  726. url = Fast.api.fixurl(url);
  727. url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
  728. var area = Fast.config.openArea != undefined ? Fast.config.openArea : [$(window).width() > 800 ? '800px' : '95%', $(window).height() > 600 ? '600px' : '95%'];
  729. options = $.extend({
  730. type: 2,
  731. title: title,
  732. shadeClose: true,
  733. shade: false,
  734. maxmin: true,
  735. moveOut: true,
  736. area: area,
  737. content: url,
  738. zIndex: Layer.zIndex,
  739. success: function (layero, index) {
  740. var that = this;
  741. //存储callback事件
  742. $(layero).data("callback", that.callback);
  743. //$(layero).removeClass("layui-layer-border");
  744. Layer.setTop(layero);
  745. try {
  746. var frame = Layer.getChildFrame('html', index);
  747. var layerfooter = frame.find(".layer-footer");
  748. Fast.api.layerfooter(layero, index, that);
  749. //绑定事件
  750. if (layerfooter.size() > 0) {
  751. // 监听窗口内的元素及属性变化
  752. // Firefox和Chrome早期版本中带有前缀
  753. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  754. if (MutationObserver) {
  755. // 选择目标节点
  756. var target = layerfooter[0];
  757. // 创建观察者对象
  758. var observer = new MutationObserver(function (mutations) {
  759. Fast.api.layerfooter(layero, index, that);
  760. mutations.forEach(function (mutation) {
  761. });
  762. });
  763. // 配置观察选项:
  764. var config = {attributes: true, childList: true, characterData: true, subtree: true}
  765. // 传入目标节点和观察选项
  766. observer.observe(target, config);
  767. // 随后,你还可以停止观察
  768. // observer.disconnect();
  769. }
  770. }
  771. } catch (e) {
  772. }
  773. if ($(layero).height() > $(window).height()) {
  774. //当弹出窗口大于浏览器可视高度时,重定位
  775. Layer.style(index, {
  776. top: 0,
  777. height: $(window).height()
  778. });
  779. }
  780. }
  781. }, options ? options : {});
  782. if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").size() > 0)) {
  783. options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
  784. options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
  785. }
  786. return Layer.open(options);
  787. },
  788. //关闭窗口并回传数据
  789. close: function (data) {
  790. var index = parent.Layer.getFrameIndex(window.name);
  791. var callback = parent.$("#layui-layer" + index).data("callback");
  792. //再执行关闭
  793. parent.Layer.close(index);
  794. //再调用回传函数
  795. if (typeof callback === 'function') {
  796. callback.call(undefined, data);
  797. }
  798. },
  799. layerfooter: function (layero, index, that) {
  800. var frame = Layer.getChildFrame('html', index);
  801. var layerfooter = frame.find(".layer-footer");
  802. if (layerfooter.size() > 0) {
  803. $(".layui-layer-footer", layero).remove();
  804. var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
  805. footer.html(layerfooter.html());
  806. if ($(".row", footer).size() === 0) {
  807. $(">", footer).wrapAll("<div class='row'></div>");
  808. }
  809. footer.insertAfter(layero.find('.layui-layer-content'));
  810. //绑定事件
  811. footer.on("click", ".btn", function () {
  812. if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
  813. return;
  814. }
  815. var index = footer.find('.btn').index(this);
  816. $(".btn:eq(" + index + ")", layerfooter).trigger("click");
  817. });
  818. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  819. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  820. //重设iframe高度
  821. $("iframe", layero).height(layero.height() - titHeight - btnHeight);
  822. }
  823. //修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG
  824. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  825. var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
  826. var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
  827. $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
  828. $("iframe", layero).css("height", "100%");
  829. }
  830. },
  831. success: function (options, callback) {
  832. var type = typeof options === 'function';
  833. if (type) {
  834. callback = options;
  835. }
  836. return Layer.msg(__('Operation completed'), $.extend({
  837. offset: 0, icon: 1
  838. }, type ? {} : options), callback);
  839. },
  840. error: function (options, callback) {
  841. var type = typeof options === 'function';
  842. if (type) {
  843. callback = options;
  844. }
  845. return Layer.msg(__('Operation failed'), $.extend({
  846. offset: 0, icon: 2
  847. }, type ? {} : options), callback);
  848. },
  849. msg: function (message, url) {
  850. var callback = typeof url === 'function' ? url : function () {
  851. if (typeof url !== 'undefined' && url) {
  852. location.href = url;
  853. }
  854. };
  855. Layer.msg(message, {
  856. time: 2000
  857. }, callback);
  858. },
  859. toastr: Toastr,
  860. layer: Layer
  861. },
  862. lang: function () {
  863. var args = arguments,
  864. string = args[0],
  865. i = 1;
  866. string = string.toLowerCase();
  867. //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
  868. if (typeof Lang !== 'undefined' && typeof Lang[string] !== 'undefined') {
  869. if (typeof Lang[string] == 'object')
  870. return Lang[string];
  871. string = Lang[string];
  872. } else if (string.indexOf('.') !== -1 && false) {
  873. var arr = string.split('.');
  874. var current = Lang[arr[0]];
  875. for (var i = 1; i < arr.length; i++) {
  876. current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
  877. if (typeof current != 'object')
  878. break;
  879. }
  880. if (typeof current == 'object')
  881. return current;
  882. string = current;
  883. } else {
  884. string = args[0];
  885. }
  886. return string.replace(/%((%)|s|d)/g, function (m) {
  887. // m is the matched format, e.g. %s, %d
  888. var val = null;
  889. if (m[2]) {
  890. val = m[2];
  891. } else {
  892. val = args[i];
  893. // A switch statement so that the formatter can be extended. Default is %s
  894. switch (m) {
  895. case '%d':
  896. val = parseFloat(val);
  897. if (isNaN(val)) {
  898. val = 0;
  899. }
  900. break;
  901. }
  902. i++;
  903. }
  904. return val;
  905. });
  906. },
  907. init: function () {
  908. // 对相对地址进行处理
  909. $.ajaxSetup({
  910. beforeSend: function (xhr, setting) {
  911. setting.url = Fast.api.fixurl(setting.url);
  912. }
  913. });
  914. Layer.config({
  915. skin: 'layui-layer-fast'
  916. });
  917. // 绑定ESC关闭窗口事件
  918. $(window).keyup(function (e) {
  919. if (e.keyCode == 27) {
  920. if ($(".layui-layer").size() > 0) {
  921. var index = 0;
  922. $(".layui-layer").each(function () {
  923. index = Math.max(index, parseInt($(this).attr("times")));
  924. });
  925. if (index) {
  926. Layer.close(index);
  927. }
  928. }
  929. }
  930. });
  931. //公共代码
  932. //配置Toastr的参数
  933. Toastr.options = Fast.config.toastr;
  934. }
  935. };
  936. //将Layer暴露到全局中去
  937. window.Layer = Layer;
  938. //将Toastr暴露到全局中去
  939. window.Toastr = Toastr;
  940. //将语言方法暴露到全局中去
  941. window.__ = Fast.lang;
  942. //将Fast渲染至全局
  943. window.Fast = Fast;
  944. //默认初始化执行的代码
  945. Fast.init();
  946. return Fast;
  947. });
  948. /*!art-template - Template Engine | http://aui.github.com/artTemplate/*/
  949. !function(){function a(a){return a.replace(t,"").replace(u,",").replace(v,"").replace(w,"").replace(x,"").split(y)}function b(a){return"'"+a.replace(/('|\\)/g,"\\$1").replace(/\r/g,"\\r").replace(/\n/g,"\\n")+"'"}function c(c,d){function e(a){return m+=a.split(/\n/).length-1,k&&(a=a.replace(/\s+/g," ").replace(/<!--[\w\W]*?-->/g,"")),a&&(a=s[1]+b(a)+s[2]+"\n"),a}function f(b){var c=m;if(j?b=j(b,d):g&&(b=b.replace(/\n/g,function(){return m++,"$line="+m+";"})),0===b.indexOf("=")){var e=l&&!/^=[=#]/.test(b);if(b=b.replace(/^=[=#]?|[\s;]*$/g,""),e){var f=b.replace(/\s*\([^\)]+\)/,"");n[f]||/^(include|print)$/.test(f)||(b="$escape("+b+")")}else b="$string("+b+")";b=s[1]+b+s[2]}return g&&(b="$line="+c+";"+b),r(a(b),function(a){if(a&&!p[a]){var b;b="print"===a?u:"include"===a?v:n[a]?"$utils."+a:o[a]?"$helpers."+a:"$data."+a,w+=a+"="+b+",",p[a]=!0}}),b+"\n"}var g=d.debug,h=d.openTag,i=d.closeTag,j=d.parser,k=d.compress,l=d.escape,m=1,p={$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1},q="".trim,s=q?["$out='';","$out+=",";","$out"]:["$out=[];","$out.push(",");","$out.join('')"],t=q?"$out+=text;return $out;":"$out.push(text);",u="function(){var text=''.concat.apply('',arguments);"+t+"}",v="function(filename,data){data=data||$data;var text=$utils.$include(filename,data,$filename);"+t+"}",w="'use strict';var $utils=this,$helpers=$utils.$helpers,"+(g?"$line=0,":""),x=s[0],y="return new String("+s[3]+");";r(c.split(h),function(a){a=a.split(i);var b=a[0],c=a[1];1===a.length?x+=e(b):(x+=f(b),c&&(x+=e(c)))});var z=w+x+y;g&&(z="try{"+z+"}catch(e){throw {filename:$filename,name:'Render Error',message:e.message,line:$line,source:"+b(c)+".split(/\\n/)[$line-1].replace(/^\\s+/,'')};}");try{var A=new Function("$data","$filename",z);return A.prototype=n,A}catch(a){throw a.temp="function anonymous($data,$filename) {"+z+"}",a}}var d=function(a,b){return"string"==typeof b?q(b,{filename:a}):g(a,b)};d.version="3.0.0",d.config=function(a,b){e[a]=b};var e=d.defaults={openTag:"<%",closeTag:"%>",escape:!0,cache:!0,compress:!1,parser:null},f=d.cache={};d.render=function(a,b){return q(a)(b)};var g=d.renderFile=function(a,b){var c=d.get(a)||p({filename:a,name:"Render Error",message:"Template not found"});return b?c(b):c};d.get=function(a){var b;if(f[a])b=f[a];else if("object"==typeof document){var c=document.getElementById(a);if(c){var d=(c.value||c.innerHTML).replace(/^\s*|\s*$/g,"");b=q(d,{filename:a})}}return b};var h=function(a,b){return"string"!=typeof a&&(b=typeof a,"number"===b?a+="":a="function"===b?h(a.call(a)):""),a},i={"<":"&#60;",">":"&#62;",'"':"&#34;","'":"&#39;","&":"&#38;"},j=function(a){return i[a]},k=function(a){return h(a).replace(/&(?![\w#]+;)|[<>"']/g,j)},l=Array.isArray||function(a){return"[object Array]"==={}.toString.call(a)},m=function(a,b){var c,d;if(l(a))for(c=0,d=a.length;c<d;c++)b.call(a,a[c],c,a);else for(c in a)b.call(a,a[c],c)},n=d.utils={$helpers:{},$include:g,$string:h,$escape:k,$each:m};d.helper=function(a,b){o[a]=b};var o=d.helpers=n.$helpers;d.onerror=function(a){var b="Template Error\n\n";for(var c in a)b+="<"+c+">\n"+a[c]+"\n\n";"object"==typeof console&&console.error(b)};var p=function(a){return d.onerror(a),function(){return"{Template Error}"}},q=d.compile=function(a,b){function d(c){try{return new i(c,h)+""}catch(d){return b.debug?p(d)():(b.debug=!0,q(a,b)(c))}}b=b||{};for(var g in e)void 0===b[g]&&(b[g]=e[g]);var h=b.filename;try{var i=c(a,b)}catch(a){return a.filename=h||"anonymous",a.name="Syntax Error",p(a)}return d.prototype=i.prototype,d.toString=function(){return i.toString()},h&&b.cache&&(f[h]=d),d},r=n.$each,s="break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined",t=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g,u=/[^\w$]+/g,v=new RegExp(["\\b"+s.replace(/,/g,"\\b|\\b")+"\\b"].join("|"),"g"),w=/^\d[^,]*|,\d[^,]*/g,x=/^,+|,+$/g,y=/^$|,+/;"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define?define('template',[],function(){return d}):this.template=d}();
  950. //! moment.js
  951. ;(function (global, factory) {
  952. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  953. typeof define === 'function' && define.amd ? define('moment/moment',factory) :
  954. global.moment = factory()
  955. }(this, (function () { 'use strict';
  956. var hookCallback;
  957. function hooks () {
  958. return hookCallback.apply(null, arguments);
  959. }
  960. // This is done to register the method called with moment()
  961. // without creating circular dependencies.
  962. function setHookCallback (callback) {
  963. hookCallback = callback;
  964. }
  965. function isArray(input) {
  966. return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
  967. }
  968. function isObject(input) {
  969. // IE8 will treat undefined and null as object if it wasn't for
  970. // input != null
  971. return input != null && Object.prototype.toString.call(input) === '[object Object]';
  972. }
  973. function isObjectEmpty(obj) {
  974. if (Object.getOwnPropertyNames) {
  975. return (Object.getOwnPropertyNames(obj).length === 0);
  976. } else {
  977. var k;
  978. for (k in obj) {
  979. if (obj.hasOwnProperty(k)) {
  980. return false;
  981. }
  982. }
  983. return true;
  984. }
  985. }
  986. function isUndefined(input) {
  987. return input === void 0;
  988. }
  989. function isNumber(input) {
  990. return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
  991. }
  992. function isDate(input) {
  993. return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
  994. }
  995. function map(arr, fn) {
  996. var res = [], i;
  997. for (i = 0; i < arr.length; ++i) {
  998. res.push(fn(arr[i], i));
  999. }
  1000. return res;
  1001. }
  1002. function hasOwnProp(a, b) {
  1003. return Object.prototype.hasOwnProperty.call(a, b);
  1004. }
  1005. function extend(a, b) {
  1006. for (var i in b) {
  1007. if (hasOwnProp(b, i)) {
  1008. a[i] = b[i];
  1009. }
  1010. }
  1011. if (hasOwnProp(b, 'toString')) {
  1012. a.toString = b.toString;
  1013. }
  1014. if (hasOwnProp(b, 'valueOf')) {
  1015. a.valueOf = b.valueOf;
  1016. }
  1017. return a;
  1018. }
  1019. function createUTC (input, format, locale, strict) {
  1020. return createLocalOrUTC(input, format, locale, strict, true).utc();
  1021. }
  1022. function defaultParsingFlags() {
  1023. // We need to deep clone this object.
  1024. return {
  1025. empty : false,
  1026. unusedTokens : [],
  1027. unusedInput : [],
  1028. overflow : -2,
  1029. charsLeftOver : 0,
  1030. nullInput : false,
  1031. invalidMonth : null,
  1032. invalidFormat : false,
  1033. userInvalidated : false,
  1034. iso : false,
  1035. parsedDateParts : [],
  1036. meridiem : null,
  1037. rfc2822 : false,
  1038. weekdayMismatch : false
  1039. };
  1040. }
  1041. function getParsingFlags(m) {
  1042. if (m._pf == null) {
  1043. m._pf = defaultParsingFlags();
  1044. }
  1045. return m._pf;
  1046. }
  1047. var some;
  1048. if (Array.prototype.some) {
  1049. some = Array.prototype.some;
  1050. } else {
  1051. some = function (fun) {
  1052. var t = Object(this);
  1053. var len = t.length >>> 0;
  1054. for (var i = 0; i < len; i++) {
  1055. if (i in t && fun.call(this, t[i], i, t)) {
  1056. return true;
  1057. }
  1058. }
  1059. return false;
  1060. };
  1061. }
  1062. function isValid(m) {
  1063. if (m._isValid == null) {
  1064. var flags = getParsingFlags(m);
  1065. var parsedParts = some.call(flags.parsedDateParts, function (i) {
  1066. return i != null;
  1067. });
  1068. var isNowValid = !isNaN(m._d.getTime()) &&
  1069. flags.overflow < 0 &&
  1070. !flags.empty &&
  1071. !flags.invalidMonth &&
  1072. !flags.invalidWeekday &&
  1073. !flags.weekdayMismatch &&
  1074. !flags.nullInput &&
  1075. !flags.invalidFormat &&
  1076. !flags.userInvalidated &&
  1077. (!flags.meridiem || (flags.meridiem && parsedParts));
  1078. if (m._strict) {
  1079. isNowValid = isNowValid &&
  1080. flags.charsLeftOver === 0 &&
  1081. flags.unusedTokens.length === 0 &&
  1082. flags.bigHour === undefined;
  1083. }
  1084. if (Object.isFrozen == null || !Object.isFrozen(m)) {
  1085. m._isValid = isNowValid;
  1086. }
  1087. else {
  1088. return isNowValid;
  1089. }
  1090. }
  1091. return m._isValid;
  1092. }
  1093. function createInvalid (flags) {
  1094. var m = createUTC(NaN);
  1095. if (flags != null) {
  1096. extend(getParsingFlags(m), flags);
  1097. }
  1098. else {
  1099. getParsingFlags(m).userInvalidated = true;
  1100. }
  1101. return m;
  1102. }
  1103. // Plugins that add properties should also add the key here (null value),
  1104. // so we can properly clone ourselves.
  1105. var momentProperties = hooks.momentProperties = [];
  1106. function copyConfig(to, from) {
  1107. var i, prop, val;
  1108. if (!isUndefined(from._isAMomentObject)) {
  1109. to._isAMomentObject = from._isAMomentObject;
  1110. }
  1111. if (!isUndefined(from._i)) {
  1112. to._i = from._i;
  1113. }
  1114. if (!isUndefined(from._f)) {
  1115. to._f = from._f;
  1116. }
  1117. if (!isUndefined(from._l)) {
  1118. to._l = from._l;
  1119. }
  1120. if (!isUndefined(from._strict)) {
  1121. to._strict = from._strict;
  1122. }
  1123. if (!isUndefined(from._tzm)) {
  1124. to._tzm = from._tzm;
  1125. }
  1126. if (!isUndefined(from._isUTC)) {
  1127. to._isUTC = from._isUTC;
  1128. }
  1129. if (!isUndefined(from._offset)) {
  1130. to._offset = from._offset;
  1131. }
  1132. if (!isUndefined(from._pf)) {
  1133. to._pf = getParsingFlags(from);
  1134. }
  1135. if (!isUndefined(from._locale)) {
  1136. to._locale = from._locale;
  1137. }
  1138. if (momentProperties.length > 0) {
  1139. for (i = 0; i < momentProperties.length; i++) {
  1140. prop = momentProperties[i];
  1141. val = from[prop];
  1142. if (!isUndefined(val)) {
  1143. to[prop] = val;
  1144. }
  1145. }
  1146. }
  1147. return to;
  1148. }
  1149. var updateInProgress = false;
  1150. // Moment prototype object
  1151. function Moment(config) {
  1152. copyConfig(this, config);
  1153. this._d = new Date(config._d != null ? config._d.getTime() : NaN);
  1154. if (!this.isValid()) {
  1155. this._d = new Date(NaN);
  1156. }
  1157. // Prevent infinite loop in case updateOffset creates new moment
  1158. // objects.
  1159. if (updateInProgress === false) {
  1160. updateInProgress = true;
  1161. hooks.updateOffset(this);
  1162. updateInProgress = false;
  1163. }
  1164. }
  1165. function isMoment (obj) {
  1166. return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
  1167. }
  1168. function absFloor (number) {
  1169. if (number < 0) {
  1170. // -0 -> 0
  1171. return Math.ceil(number) || 0;
  1172. } else {
  1173. return Math.floor(number);
  1174. }
  1175. }
  1176. function toInt(argumentForCoercion) {
  1177. var coercedNumber = +argumentForCoercion,
  1178. value = 0;
  1179. if (coercedNumber !== 0 && isFinite(coercedNumber)) {
  1180. value = absFloor(coercedNumber);
  1181. }
  1182. return value;
  1183. }
  1184. // compare two arrays, return the number of differences
  1185. function compareArrays(array1, array2, dontConvert) {
  1186. var len = Math.min(array1.length, array2.length),
  1187. lengthDiff = Math.abs(array1.length - array2.length),
  1188. diffs = 0,
  1189. i;
  1190. for (i = 0; i < len; i++) {
  1191. if ((dontConvert && array1[i] !== array2[i]) ||
  1192. (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
  1193. diffs++;
  1194. }
  1195. }
  1196. return diffs + lengthDiff;
  1197. }
  1198. function warn(msg) {
  1199. if (hooks.suppressDeprecationWarnings === false &&
  1200. (typeof console !== 'undefined') && console.warn) {
  1201. console.warn('Deprecation warning: ' + msg);
  1202. }
  1203. }
  1204. function deprecate(msg, fn) {
  1205. var firstTime = true;
  1206. return extend(function () {
  1207. if (hooks.deprecationHandler != null) {
  1208. hooks.deprecationHandler(null, msg);
  1209. }
  1210. if (firstTime) {
  1211. var args = [];
  1212. var arg;
  1213. for (var i = 0; i < arguments.length; i++) {
  1214. arg = '';
  1215. if (typeof arguments[i] === 'object') {
  1216. arg += '\n[' + i + '] ';
  1217. for (var key in arguments[0]) {
  1218. arg += key + ': ' + arguments[0][key] + ', ';
  1219. }
  1220. arg = arg.slice(0, -2); // Remove trailing comma and space
  1221. } else {
  1222. arg = arguments[i];
  1223. }
  1224. args.push(arg);
  1225. }
  1226. warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
  1227. firstTime = false;
  1228. }
  1229. return fn.apply(this, arguments);
  1230. }, fn);
  1231. }
  1232. var deprecations = {};
  1233. function deprecateSimple(name, msg) {
  1234. if (hooks.deprecationHandler != null) {
  1235. hooks.deprecationHandler(name, msg);
  1236. }
  1237. if (!deprecations[name]) {
  1238. warn(msg);
  1239. deprecations[name] = true;
  1240. }
  1241. }
  1242. hooks.suppressDeprecationWarnings = false;
  1243. hooks.deprecationHandler = null;
  1244. function isFunction(input) {
  1245. return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
  1246. }
  1247. function set (config) {
  1248. var prop, i;
  1249. for (i in config) {
  1250. prop = config[i];
  1251. if (isFunction(prop)) {
  1252. this[i] = prop;
  1253. } else {
  1254. this['_' + i] = prop;
  1255. }
  1256. }
  1257. this._config = config;
  1258. // Lenient ordinal parsing accepts just a number in addition to
  1259. // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
  1260. // TODO: Remove "ordinalParse" fallback in next major release.
  1261. this._dayOfMonthOrdinalParseLenient = new RegExp(
  1262. (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
  1263. '|' + (/\d{1,2}/).source);
  1264. }
  1265. function mergeConfigs(parentConfig, childConfig) {
  1266. var res = extend({}, parentConfig), prop;
  1267. for (prop in childConfig) {
  1268. if (hasOwnProp(childConfig, prop)) {
  1269. if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
  1270. res[prop] = {};
  1271. extend(res[prop], parentConfig[prop]);
  1272. extend(res[prop], childConfig[prop]);
  1273. } else if (childConfig[prop] != null) {
  1274. res[prop] = childConfig[prop];
  1275. } else {
  1276. delete res[prop];
  1277. }
  1278. }
  1279. }
  1280. for (prop in parentConfig) {
  1281. if (hasOwnProp(parentConfig, prop) &&
  1282. !hasOwnProp(childConfig, prop) &&
  1283. isObject(parentConfig[prop])) {
  1284. // make sure changes to properties don't modify parent config
  1285. res[prop] = extend({}, res[prop]);
  1286. }
  1287. }
  1288. return res;
  1289. }
  1290. function Locale(config) {
  1291. if (config != null) {
  1292. this.set(config);
  1293. }
  1294. }
  1295. var keys;
  1296. if (Object.keys) {
  1297. keys = Object.keys;
  1298. } else {
  1299. keys = function (obj) {
  1300. var i, res = [];
  1301. for (i in obj) {
  1302. if (hasOwnProp(obj, i)) {
  1303. res.push(i);
  1304. }
  1305. }
  1306. return res;
  1307. };
  1308. }
  1309. var defaultCalendar = {
  1310. sameDay : '[Today at] LT',
  1311. nextDay : '[Tomorrow at] LT',
  1312. nextWeek : 'dddd [at] LT',
  1313. lastDay : '[Yesterday at] LT',
  1314. lastWeek : '[Last] dddd [at] LT',
  1315. sameElse : 'L'
  1316. };
  1317. function calendar (key, mom, now) {
  1318. var output = this._calendar[key] || this._calendar['sameElse'];
  1319. return isFunction(output) ? output.call(mom, now) : output;
  1320. }
  1321. var defaultLongDateFormat = {
  1322. LTS : 'h:mm:ss A',
  1323. LT : 'h:mm A',
  1324. L : 'MM/DD/YYYY',
  1325. LL : 'MMMM D, YYYY',
  1326. LLL : 'MMMM D, YYYY h:mm A',
  1327. LLLL : 'dddd, MMMM D, YYYY h:mm A'
  1328. };
  1329. function longDateFormat (key) {
  1330. var format = this._longDateFormat[key],
  1331. formatUpper = this._longDateFormat[key.toUpperCase()];
  1332. if (format || !formatUpper) {
  1333. return format;
  1334. }
  1335. this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
  1336. return val.slice(1);
  1337. });
  1338. return this._longDateFormat[key];
  1339. }
  1340. var defaultInvalidDate = 'Invalid date';
  1341. function invalidDate () {
  1342. return this._invalidDate;
  1343. }
  1344. var defaultOrdinal = '%d';
  1345. var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
  1346. function ordinal (number) {
  1347. return this._ordinal.replace('%d', number);
  1348. }
  1349. var defaultRelativeTime = {
  1350. future : 'in %s',
  1351. past : '%s ago',
  1352. s : 'a few seconds',
  1353. ss : '%d seconds',
  1354. m : 'a minute',
  1355. mm : '%d minutes',
  1356. h : 'an hour',
  1357. hh : '%d hours',
  1358. d : 'a day',
  1359. dd : '%d days',
  1360. M : 'a month',
  1361. MM : '%d months',
  1362. y : 'a year',
  1363. yy : '%d years'
  1364. };
  1365. function relativeTime (number, withoutSuffix, string, isFuture) {
  1366. var output = this._relativeTime[string];
  1367. return (isFunction(output)) ?
  1368. output(number, withoutSuffix, string, isFuture) :
  1369. output.replace(/%d/i, number);
  1370. }
  1371. function pastFuture (diff, output) {
  1372. var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
  1373. return isFunction(format) ? format(output) : format.replace(/%s/i, output);
  1374. }
  1375. var aliases = {};
  1376. function addUnitAlias (unit, shorthand) {
  1377. var lowerCase = unit.toLowerCase();
  1378. aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
  1379. }
  1380. function normalizeUnits(units) {
  1381. return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
  1382. }
  1383. function normalizeObjectUnits(inputObject) {
  1384. var normalizedInput = {},
  1385. normalizedProp,
  1386. prop;
  1387. for (prop in inputObject) {
  1388. if (hasOwnProp(inputObject, prop)) {
  1389. normalizedProp = normalizeUnits(prop);
  1390. if (normalizedProp) {
  1391. normalizedInput[normalizedProp] = inputObject[prop];
  1392. }
  1393. }
  1394. }
  1395. return normalizedInput;
  1396. }
  1397. var priorities = {};
  1398. function addUnitPriority(unit, priority) {
  1399. priorities[unit] = priority;
  1400. }
  1401. function getPrioritizedUnits(unitsObj) {
  1402. var units = [];
  1403. for (var u in unitsObj) {
  1404. units.push({unit: u, priority: priorities[u]});
  1405. }
  1406. units.sort(function (a, b) {
  1407. return a.priority - b.priority;
  1408. });
  1409. return units;
  1410. }
  1411. function zeroFill(number, targetLength, forceSign) {
  1412. var absNumber = '' + Math.abs(number),
  1413. zerosToFill = targetLength - absNumber.length,
  1414. sign = number >= 0;
  1415. return (sign ? (forceSign ? '+' : '') : '-') +
  1416. Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
  1417. }
  1418. var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
  1419. var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
  1420. var formatFunctions = {};
  1421. var formatTokenFunctions = {};
  1422. // token: 'M'
  1423. // padded: ['MM', 2]
  1424. // ordinal: 'Mo'
  1425. // callback: function () { this.month() + 1 }
  1426. function addFormatToken (token, padded, ordinal, callback) {
  1427. var func = callback;
  1428. if (typeof callback === 'string') {
  1429. func = function () {
  1430. return this[callback]();
  1431. };
  1432. }
  1433. if (token) {
  1434. formatTokenFunctions[token] = func;
  1435. }
  1436. if (padded) {
  1437. formatTokenFunctions[padded[0]] = function () {
  1438. return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
  1439. };
  1440. }
  1441. if (ordinal) {
  1442. formatTokenFunctions[ordinal] = function () {
  1443. return this.localeData().ordinal(func.apply(this, arguments), token);
  1444. };
  1445. }
  1446. }
  1447. function removeFormattingTokens(input) {
  1448. if (input.match(/\[[\s\S]/)) {
  1449. return input.replace(/^\[|\]$/g, '');
  1450. }
  1451. return input.replace(/\\/g, '');
  1452. }
  1453. function makeFormatFunction(format) {
  1454. var array = format.match(formattingTokens), i, length;
  1455. for (i = 0, length = array.length; i < length; i++) {
  1456. if (formatTokenFunctions[array[i]]) {
  1457. array[i] = formatTokenFunctions[array[i]];
  1458. } else {
  1459. array[i] = removeFormattingTokens(array[i]);
  1460. }
  1461. }
  1462. return function (mom) {
  1463. var output = '', i;
  1464. for (i = 0; i < length; i++) {
  1465. output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
  1466. }
  1467. return output;
  1468. };
  1469. }
  1470. // format date using native date object
  1471. function formatMoment(m, format) {
  1472. if (!m.isValid()) {
  1473. return m.localeData().invalidDate();
  1474. }
  1475. format = expandFormat(format, m.localeData());
  1476. formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
  1477. return formatFunctions[format](m);
  1478. }
  1479. function expandFormat(format, locale) {
  1480. var i = 5;
  1481. function replaceLongDateFormatTokens(input) {
  1482. return locale.longDateFormat(input) || input;
  1483. }
  1484. localFormattingTokens.lastIndex = 0;
  1485. while (i >= 0 && localFormattingTokens.test(format)) {
  1486. format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
  1487. localFormattingTokens.lastIndex = 0;
  1488. i -= 1;
  1489. }
  1490. return format;
  1491. }
  1492. var match1 = /\d/; // 0 - 9
  1493. var match2 = /\d\d/; // 00 - 99
  1494. var match3 = /\d{3}/; // 000 - 999
  1495. var match4 = /\d{4}/; // 0000 - 9999
  1496. var match6 = /[+-]?\d{6}/; // -999999 - 999999
  1497. var match1to2 = /\d\d?/; // 0 - 99
  1498. var match3to4 = /\d\d\d\d?/; // 999 - 9999
  1499. var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
  1500. var match1to3 = /\d{1,3}/; // 0 - 999
  1501. var match1to4 = /\d{1,4}/; // 0 - 9999
  1502. var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
  1503. var matchUnsigned = /\d+/; // 0 - inf
  1504. var matchSigned = /[+-]?\d+/; // -inf - inf
  1505. var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
  1506. var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
  1507. var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
  1508. // any word (or two) characters or numbers including two/three word month in arabic.
  1509. // includes scottish gaelic two word and hyphenated months
  1510. var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
  1511. var regexes = {};
  1512. function addRegexToken (token, regex, strictRegex) {
  1513. regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
  1514. return (isStrict && strictRegex) ? strictRegex : regex;
  1515. };
  1516. }
  1517. function getParseRegexForToken (token, config) {
  1518. if (!hasOwnProp(regexes, token)) {
  1519. return new RegExp(unescapeFormat(token));
  1520. }
  1521. return regexes[token](config._strict, config._locale);
  1522. }
  1523. // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
  1524. function unescapeFormat(s) {
  1525. return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
  1526. return p1 || p2 || p3 || p4;
  1527. }));
  1528. }
  1529. function regexEscape(s) {
  1530. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  1531. }
  1532. var tokens = {};
  1533. function addParseToken (token, callback) {
  1534. var i, func = callback;
  1535. if (typeof token === 'string') {
  1536. token = [token];
  1537. }
  1538. if (isNumber(callback)) {
  1539. func = function (input, array) {
  1540. array[callback] = toInt(input);
  1541. };
  1542. }
  1543. for (i = 0; i < token.length; i++) {
  1544. tokens[token[i]] = func;
  1545. }
  1546. }
  1547. function addWeekParseToken (token, callback) {
  1548. addParseToken(token, function (input, array, config, token) {
  1549. config._w = config._w || {};
  1550. callback(input, config._w, config, token);
  1551. });
  1552. }
  1553. function addTimeToArrayFromToken(token, input, config) {
  1554. if (input != null && hasOwnProp(tokens, token)) {
  1555. tokens[token](input, config._a, config, token);
  1556. }
  1557. }
  1558. var YEAR = 0;
  1559. var MONTH = 1;
  1560. var DATE = 2;
  1561. var HOUR = 3;
  1562. var MINUTE = 4;
  1563. var SECOND = 5;
  1564. var MILLISECOND = 6;
  1565. var WEEK = 7;
  1566. var WEEKDAY = 8;
  1567. // FORMATTING
  1568. addFormatToken('Y', 0, 0, function () {
  1569. var y = this.year();
  1570. return y <= 9999 ? '' + y : '+' + y;
  1571. });
  1572. addFormatToken(0, ['YY', 2], 0, function () {
  1573. return this.year() % 100;
  1574. });
  1575. addFormatToken(0, ['YYYY', 4], 0, 'year');
  1576. addFormatToken(0, ['YYYYY', 5], 0, 'year');
  1577. addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
  1578. // ALIASES
  1579. addUnitAlias('year', 'y');
  1580. // PRIORITIES
  1581. addUnitPriority('year', 1);
  1582. // PARSING
  1583. addRegexToken('Y', matchSigned);
  1584. addRegexToken('YY', match1to2, match2);
  1585. addRegexToken('YYYY', match1to4, match4);
  1586. addRegexToken('YYYYY', match1to6, match6);
  1587. addRegexToken('YYYYYY', match1to6, match6);
  1588. addParseToken(['YYYYY', 'YYYYYY'], YEAR);
  1589. addParseToken('YYYY', function (input, array) {
  1590. array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
  1591. });
  1592. addParseToken('YY', function (input, array) {
  1593. array[YEAR] = hooks.parseTwoDigitYear(input);
  1594. });
  1595. addParseToken('Y', function (input, array) {
  1596. array[YEAR] = parseInt(input, 10);
  1597. });
  1598. // HELPERS
  1599. function daysInYear(year) {
  1600. return isLeapYear(year) ? 366 : 365;
  1601. }
  1602. function isLeapYear(year) {
  1603. return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
  1604. }
  1605. // HOOKS
  1606. hooks.parseTwoDigitYear = function (input) {
  1607. return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
  1608. };
  1609. // MOMENTS
  1610. var getSetYear = makeGetSet('FullYear', true);
  1611. function getIsLeapYear () {
  1612. return isLeapYear(this.year());
  1613. }
  1614. function makeGetSet (unit, keepTime) {
  1615. return function (value) {
  1616. if (value != null) {
  1617. set$1(this, unit, value);
  1618. hooks.updateOffset(this, keepTime);
  1619. return this;
  1620. } else {
  1621. return get(this, unit);
  1622. }
  1623. };
  1624. }
  1625. function get (mom, unit) {
  1626. return mom.isValid() ?
  1627. mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
  1628. }
  1629. function set$1 (mom, unit, value) {
  1630. if (mom.isValid() && !isNaN(value)) {
  1631. if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
  1632. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
  1633. }
  1634. else {
  1635. mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
  1636. }
  1637. }
  1638. }
  1639. // MOMENTS
  1640. function stringGet (units) {
  1641. units = normalizeUnits(units);
  1642. if (isFunction(this[units])) {
  1643. return this[units]();
  1644. }
  1645. return this;
  1646. }
  1647. function stringSet (units, value) {
  1648. if (typeof units === 'object') {
  1649. units = normalizeObjectUnits(units);
  1650. var prioritized = getPrioritizedUnits(units);
  1651. for (var i = 0; i < prioritized.length; i++) {
  1652. this[prioritized[i].unit](units[prioritized[i].unit]);
  1653. }
  1654. } else {
  1655. units = normalizeUnits(units);
  1656. if (isFunction(this[units])) {
  1657. return this[units](value);
  1658. }
  1659. }
  1660. return this;
  1661. }
  1662. function mod(n, x) {
  1663. return ((n % x) + x) % x;
  1664. }
  1665. var indexOf;
  1666. if (Array.prototype.indexOf) {
  1667. indexOf = Array.prototype.indexOf;
  1668. } else {
  1669. indexOf = function (o) {
  1670. // I know
  1671. var i;
  1672. for (i = 0; i < this.length; ++i) {
  1673. if (this[i] === o) {
  1674. return i;
  1675. }
  1676. }
  1677. return -1;
  1678. };
  1679. }
  1680. function daysInMonth(year, month) {
  1681. if (isNaN(year) || isNaN(month)) {
  1682. return NaN;
  1683. }
  1684. var modMonth = mod(month, 12);
  1685. year += (month - modMonth) / 12;
  1686. return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2);
  1687. }
  1688. // FORMATTING
  1689. addFormatToken('M', ['MM', 2], 'Mo', function () {
  1690. return this.month() + 1;
  1691. });
  1692. addFormatToken('MMM', 0, 0, function (format) {
  1693. return this.localeData().monthsShort(this, format);
  1694. });
  1695. addFormatToken('MMMM', 0, 0, function (format) {
  1696. return this.localeData().months(this, format);
  1697. });
  1698. // ALIASES
  1699. addUnitAlias('month', 'M');
  1700. // PRIORITY
  1701. addUnitPriority('month', 8);
  1702. // PARSING
  1703. addRegexToken('M', match1to2);
  1704. addRegexToken('MM', match1to2, match2);
  1705. addRegexToken('MMM', function (isStrict, locale) {
  1706. return locale.monthsShortRegex(isStrict);
  1707. });
  1708. addRegexToken('MMMM', function (isStrict, locale) {
  1709. return locale.monthsRegex(isStrict);
  1710. });
  1711. addParseToken(['M', 'MM'], function (input, array) {
  1712. array[MONTH] = toInt(input) - 1;
  1713. });
  1714. addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
  1715. var month = config._locale.monthsParse(input, token, config._strict);
  1716. // if we didn't find a month name, mark the date as invalid.
  1717. if (month != null) {
  1718. array[MONTH] = month;
  1719. } else {
  1720. getParsingFlags(config).invalidMonth = input;
  1721. }
  1722. });
  1723. // LOCALES
  1724. var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
  1725. var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
  1726. function localeMonths (m, format) {
  1727. if (!m) {
  1728. return isArray(this._months) ? this._months :
  1729. this._months['standalone'];
  1730. }
  1731. return isArray(this._months) ? this._months[m.month()] :
  1732. this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
  1733. }
  1734. var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
  1735. function localeMonthsShort (m, format) {
  1736. if (!m) {
  1737. return isArray(this._monthsShort) ? this._monthsShort :
  1738. this._monthsShort['standalone'];
  1739. }
  1740. return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
  1741. this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
  1742. }
  1743. function handleStrictParse(monthName, format, strict) {
  1744. var i, ii, mom, llc = monthName.toLocaleLowerCase();
  1745. if (!this._monthsParse) {
  1746. // this is not used
  1747. this._monthsParse = [];
  1748. this._longMonthsParse = [];
  1749. this._shortMonthsParse = [];
  1750. for (i = 0; i < 12; ++i) {
  1751. mom = createUTC([2000, i]);
  1752. this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
  1753. this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
  1754. }
  1755. }
  1756. if (strict) {
  1757. if (format === 'MMM') {
  1758. ii = indexOf.call(this._shortMonthsParse, llc);
  1759. return ii !== -1 ? ii : null;
  1760. } else {
  1761. ii = indexOf.call(this._longMonthsParse, llc);
  1762. return ii !== -1 ? ii : null;
  1763. }
  1764. } else {
  1765. if (format === 'MMM') {
  1766. ii = indexOf.call(this._shortMonthsParse, llc);
  1767. if (ii !== -1) {
  1768. return ii;
  1769. }
  1770. ii = indexOf.call(this._longMonthsParse, llc);
  1771. return ii !== -1 ? ii : null;
  1772. } else {
  1773. ii = indexOf.call(this._longMonthsParse, llc);
  1774. if (ii !== -1) {
  1775. return ii;
  1776. }
  1777. ii = indexOf.call(this._shortMonthsParse, llc);
  1778. return ii !== -1 ? ii : null;
  1779. }
  1780. }
  1781. }
  1782. function localeMonthsParse (monthName, format, strict) {
  1783. var i, mom, regex;
  1784. if (this._monthsParseExact) {
  1785. return handleStrictParse.call(this, monthName, format, strict);
  1786. }
  1787. if (!this._monthsParse) {
  1788. this._monthsParse = [];
  1789. this._longMonthsParse = [];
  1790. this._shortMonthsParse = [];
  1791. }
  1792. // TODO: add sorting
  1793. // Sorting makes sure if one month (or abbr) is a prefix of another
  1794. // see sorting in computeMonthsParse
  1795. for (i = 0; i < 12; i++) {
  1796. // make the regex if we don't have it already
  1797. mom = createUTC([2000, i]);
  1798. if (strict && !this._longMonthsParse[i]) {
  1799. this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
  1800. this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
  1801. }
  1802. if (!strict && !this._monthsParse[i]) {
  1803. regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
  1804. this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
  1805. }
  1806. // test the regex
  1807. if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
  1808. return i;
  1809. } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
  1810. return i;
  1811. } else if (!strict && this._monthsParse[i].test(monthName)) {
  1812. return i;
  1813. }
  1814. }
  1815. }
  1816. // MOMENTS
  1817. function setMonth (mom, value) {
  1818. var dayOfMonth;
  1819. if (!mom.isValid()) {
  1820. // No op
  1821. return mom;
  1822. }
  1823. if (typeof value === 'string') {
  1824. if (/^\d+$/.test(value)) {
  1825. value = toInt(value);
  1826. } else {
  1827. value = mom.localeData().monthsParse(value);
  1828. // TODO: Another silent failure?
  1829. if (!isNumber(value)) {
  1830. return mom;
  1831. }
  1832. }
  1833. }
  1834. dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
  1835. mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
  1836. return mom;
  1837. }
  1838. function getSetMonth (value) {
  1839. if (value != null) {
  1840. setMonth(this, value);
  1841. hooks.updateOffset(this, true);
  1842. return this;
  1843. } else {
  1844. return get(this, 'Month');
  1845. }
  1846. }
  1847. function getDaysInMonth () {
  1848. return daysInMonth(this.year(), this.month());
  1849. }
  1850. var defaultMonthsShortRegex = matchWord;
  1851. function monthsShortRegex (isStrict) {
  1852. if (this._monthsParseExact) {
  1853. if (!hasOwnProp(this, '_monthsRegex')) {
  1854. computeMonthsParse.call(this);
  1855. }
  1856. if (isStrict) {
  1857. return this._monthsShortStrictRegex;
  1858. } else {
  1859. return this._monthsShortRegex;
  1860. }
  1861. } else {
  1862. if (!hasOwnProp(this, '_monthsShortRegex')) {
  1863. this._monthsShortRegex = defaultMonthsShortRegex;
  1864. }
  1865. return this._monthsShortStrictRegex && isStrict ?
  1866. this._monthsShortStrictRegex : this._monthsShortRegex;
  1867. }
  1868. }
  1869. var defaultMonthsRegex = matchWord;
  1870. function monthsRegex (isStrict) {
  1871. if (this._monthsParseExact) {
  1872. if (!hasOwnProp(this, '_monthsRegex')) {
  1873. computeMonthsParse.call(this);
  1874. }
  1875. if (isStrict) {
  1876. return this._monthsStrictRegex;
  1877. } else {
  1878. return this._monthsRegex;
  1879. }
  1880. } else {
  1881. if (!hasOwnProp(this, '_monthsRegex')) {
  1882. this._monthsRegex = defaultMonthsRegex;
  1883. }
  1884. return this._monthsStrictRegex && isStrict ?
  1885. this._monthsStrictRegex : this._monthsRegex;
  1886. }
  1887. }
  1888. function computeMonthsParse () {
  1889. function cmpLenRev(a, b) {
  1890. return b.length - a.length;
  1891. }
  1892. var shortPieces = [], longPieces = [], mixedPieces = [],
  1893. i, mom;
  1894. for (i = 0; i < 12; i++) {
  1895. // make the regex if we don't have it already
  1896. mom = createUTC([2000, i]);
  1897. shortPieces.push(this.monthsShort(mom, ''));
  1898. longPieces.push(this.months(mom, ''));
  1899. mixedPieces.push(this.months(mom, ''));
  1900. mixedPieces.push(this.monthsShort(mom, ''));
  1901. }
  1902. // Sorting makes sure if one month (or abbr) is a prefix of another it
  1903. // will match the longer piece.
  1904. shortPieces.sort(cmpLenRev);
  1905. longPieces.sort(cmpLenRev);
  1906. mixedPieces.sort(cmpLenRev);
  1907. for (i = 0; i < 12; i++) {
  1908. shortPieces[i] = regexEscape(shortPieces[i]);
  1909. longPieces[i] = regexEscape(longPieces[i]);
  1910. }
  1911. for (i = 0; i < 24; i++) {
  1912. mixedPieces[i] = regexEscape(mixedPieces[i]);
  1913. }
  1914. this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  1915. this._monthsShortRegex = this._monthsRegex;
  1916. this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  1917. this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  1918. }
  1919. function createDate (y, m, d, h, M, s, ms) {
  1920. // can't just apply() to create a date:
  1921. // https://stackoverflow.com/q/181348
  1922. var date;
  1923. // the date constructor remaps years 0-99 to 1900-1999
  1924. if (y < 100 && y >= 0) {
  1925. // preserve leap years using a full 400 year cycle, then reset
  1926. date = new Date(y + 400, m, d, h, M, s, ms);
  1927. if (isFinite(date.getFullYear())) {
  1928. date.setFullYear(y);
  1929. }
  1930. } else {
  1931. date = new Date(y, m, d, h, M, s, ms);
  1932. }
  1933. return date;
  1934. }
  1935. function createUTCDate (y) {
  1936. var date;
  1937. // the Date.UTC function remaps years 0-99 to 1900-1999
  1938. if (y < 100 && y >= 0) {
  1939. var args = Array.prototype.slice.call(arguments);
  1940. // preserve leap years using a full 400 year cycle, then reset
  1941. args[0] = y + 400;
  1942. date = new Date(Date.UTC.apply(null, args));
  1943. if (isFinite(date.getUTCFullYear())) {
  1944. date.setUTCFullYear(y);
  1945. }
  1946. } else {
  1947. date = new Date(Date.UTC.apply(null, arguments));
  1948. }
  1949. return date;
  1950. }
  1951. // start-of-first-week - start-of-year
  1952. function firstWeekOffset(year, dow, doy) {
  1953. var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
  1954. fwd = 7 + dow - doy,
  1955. // first-week day local weekday -- which local weekday is fwd
  1956. fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  1957. return -fwdlw + fwd - 1;
  1958. }
  1959. // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
  1960. function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  1961. var localWeekday = (7 + weekday - dow) % 7,
  1962. weekOffset = firstWeekOffset(year, dow, doy),
  1963. dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
  1964. resYear, resDayOfYear;
  1965. if (dayOfYear <= 0) {
  1966. resYear = year - 1;
  1967. resDayOfYear = daysInYear(resYear) + dayOfYear;
  1968. } else if (dayOfYear > daysInYear(year)) {
  1969. resYear = year + 1;
  1970. resDayOfYear = dayOfYear - daysInYear(year);
  1971. } else {
  1972. resYear = year;
  1973. resDayOfYear = dayOfYear;
  1974. }
  1975. return {
  1976. year: resYear,
  1977. dayOfYear: resDayOfYear
  1978. };
  1979. }
  1980. function weekOfYear(mom, dow, doy) {
  1981. var weekOffset = firstWeekOffset(mom.year(), dow, doy),
  1982. week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
  1983. resWeek, resYear;
  1984. if (week < 1) {
  1985. resYear = mom.year() - 1;
  1986. resWeek = week + weeksInYear(resYear, dow, doy);
  1987. } else if (week > weeksInYear(mom.year(), dow, doy)) {
  1988. resWeek = week - weeksInYear(mom.year(), dow, doy);
  1989. resYear = mom.year() + 1;
  1990. } else {
  1991. resYear = mom.year();
  1992. resWeek = week;
  1993. }
  1994. return {
  1995. week: resWeek,
  1996. year: resYear
  1997. };
  1998. }
  1999. function weeksInYear(year, dow, doy) {
  2000. var weekOffset = firstWeekOffset(year, dow, doy),
  2001. weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  2002. return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
  2003. }
  2004. // FORMATTING
  2005. addFormatToken('w', ['ww', 2], 'wo', 'week');
  2006. addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
  2007. // ALIASES
  2008. addUnitAlias('week', 'w');
  2009. addUnitAlias('isoWeek', 'W');
  2010. // PRIORITIES
  2011. addUnitPriority('week', 5);
  2012. addUnitPriority('isoWeek', 5);
  2013. // PARSING
  2014. addRegexToken('w', match1to2);
  2015. addRegexToken('ww', match1to2, match2);
  2016. addRegexToken('W', match1to2);
  2017. addRegexToken('WW', match1to2, match2);
  2018. addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
  2019. week[token.substr(0, 1)] = toInt(input);
  2020. });
  2021. // HELPERS
  2022. // LOCALES
  2023. function localeWeek (mom) {
  2024. return weekOfYear(mom, this._week.dow, this._week.doy).week;
  2025. }
  2026. var defaultLocaleWeek = {
  2027. dow : 0, // Sunday is the first day of the week.
  2028. doy : 6 // The week that contains Jan 6th is the first week of the year.
  2029. };
  2030. function localeFirstDayOfWeek () {
  2031. return this._week.dow;
  2032. }
  2033. function localeFirstDayOfYear () {
  2034. return this._week.doy;
  2035. }
  2036. // MOMENTS
  2037. function getSetWeek (input) {
  2038. var week = this.localeData().week(this);
  2039. return input == null ? week : this.add((input - week) * 7, 'd');
  2040. }
  2041. function getSetISOWeek (input) {
  2042. var week = weekOfYear(this, 1, 4).week;
  2043. return input == null ? week : this.add((input - week) * 7, 'd');
  2044. }
  2045. // FORMATTING
  2046. addFormatToken('d', 0, 'do', 'day');
  2047. addFormatToken('dd', 0, 0, function (format) {
  2048. return this.localeData().weekdaysMin(this, format);
  2049. });
  2050. addFormatToken('ddd', 0, 0, function (format) {
  2051. return this.localeData().weekdaysShort(this, format);
  2052. });
  2053. addFormatToken('dddd', 0, 0, function (format) {
  2054. return this.localeData().weekdays(this, format);
  2055. });
  2056. addFormatToken('e', 0, 0, 'weekday');
  2057. addFormatToken('E', 0, 0, 'isoWeekday');
  2058. // ALIASES
  2059. addUnitAlias('day', 'd');
  2060. addUnitAlias('weekday', 'e');
  2061. addUnitAlias('isoWeekday', 'E');
  2062. // PRIORITY
  2063. addUnitPriority('day', 11);
  2064. addUnitPriority('weekday', 11);
  2065. addUnitPriority('isoWeekday', 11);
  2066. // PARSING
  2067. addRegexToken('d', match1to2);
  2068. addRegexToken('e', match1to2);
  2069. addRegexToken('E', match1to2);
  2070. addRegexToken('dd', function (isStrict, locale) {
  2071. return locale.weekdaysMinRegex(isStrict);
  2072. });
  2073. addRegexToken('ddd', function (isStrict, locale) {
  2074. return locale.weekdaysShortRegex(isStrict);
  2075. });
  2076. addRegexToken('dddd', function (isStrict, locale) {
  2077. return locale.weekdaysRegex(isStrict);
  2078. });
  2079. addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
  2080. var weekday = config._locale.weekdaysParse(input, token, config._strict);
  2081. // if we didn't get a weekday name, mark the date as invalid
  2082. if (weekday != null) {
  2083. week.d = weekday;
  2084. } else {
  2085. getParsingFlags(config).invalidWeekday = input;
  2086. }
  2087. });
  2088. addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
  2089. week[token] = toInt(input);
  2090. });
  2091. // HELPERS
  2092. function parseWeekday(input, locale) {
  2093. if (typeof input !== 'string') {
  2094. return input;
  2095. }
  2096. if (!isNaN(input)) {
  2097. return parseInt(input, 10);
  2098. }
  2099. input = locale.weekdaysParse(input);
  2100. if (typeof input === 'number') {
  2101. return input;
  2102. }
  2103. return null;
  2104. }
  2105. function parseIsoWeekday(input, locale) {
  2106. if (typeof input === 'string') {
  2107. return locale.weekdaysParse(input) % 7 || 7;
  2108. }
  2109. return isNaN(input) ? null : input;
  2110. }
  2111. // LOCALES
  2112. function shiftWeekdays (ws, n) {
  2113. return ws.slice(n, 7).concat(ws.slice(0, n));
  2114. }
  2115. var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
  2116. function localeWeekdays (m, format) {
  2117. var weekdays = isArray(this._weekdays) ? this._weekdays :
  2118. this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone'];
  2119. return (m === true) ? shiftWeekdays(weekdays, this._week.dow)
  2120. : (m) ? weekdays[m.day()] : weekdays;
  2121. }
  2122. var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
  2123. function localeWeekdaysShort (m) {
  2124. return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow)
  2125. : (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
  2126. }
  2127. var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
  2128. function localeWeekdaysMin (m) {
  2129. return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow)
  2130. : (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
  2131. }
  2132. function handleStrictParse$1(weekdayName, format, strict) {
  2133. var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
  2134. if (!this._weekdaysParse) {
  2135. this._weekdaysParse = [];
  2136. this._shortWeekdaysParse = [];
  2137. this._minWeekdaysParse = [];
  2138. for (i = 0; i < 7; ++i) {
  2139. mom = createUTC([2000, 1]).day(i);
  2140. this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
  2141. this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
  2142. this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
  2143. }
  2144. }
  2145. if (strict) {
  2146. if (format === 'dddd') {
  2147. ii = indexOf.call(this._weekdaysParse, llc);
  2148. return ii !== -1 ? ii : null;
  2149. } else if (format === 'ddd') {
  2150. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2151. return ii !== -1 ? ii : null;
  2152. } else {
  2153. ii = indexOf.call(this._minWeekdaysParse, llc);
  2154. return ii !== -1 ? ii : null;
  2155. }
  2156. } else {
  2157. if (format === 'dddd') {
  2158. ii = indexOf.call(this._weekdaysParse, llc);
  2159. if (ii !== -1) {
  2160. return ii;
  2161. }
  2162. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2163. if (ii !== -1) {
  2164. return ii;
  2165. }
  2166. ii = indexOf.call(this._minWeekdaysParse, llc);
  2167. return ii !== -1 ? ii : null;
  2168. } else if (format === 'ddd') {
  2169. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2170. if (ii !== -1) {
  2171. return ii;
  2172. }
  2173. ii = indexOf.call(this._weekdaysParse, llc);
  2174. if (ii !== -1) {
  2175. return ii;
  2176. }
  2177. ii = indexOf.call(this._minWeekdaysParse, llc);
  2178. return ii !== -1 ? ii : null;
  2179. } else {
  2180. ii = indexOf.call(this._minWeekdaysParse, llc);
  2181. if (ii !== -1) {
  2182. return ii;
  2183. }
  2184. ii = indexOf.call(this._weekdaysParse, llc);
  2185. if (ii !== -1) {
  2186. return ii;
  2187. }
  2188. ii = indexOf.call(this._shortWeekdaysParse, llc);
  2189. return ii !== -1 ? ii : null;
  2190. }
  2191. }
  2192. }
  2193. function localeWeekdaysParse (weekdayName, format, strict) {
  2194. var i, mom, regex;
  2195. if (this._weekdaysParseExact) {
  2196. return handleStrictParse$1.call(this, weekdayName, format, strict);
  2197. }
  2198. if (!this._weekdaysParse) {
  2199. this._weekdaysParse = [];
  2200. this._minWeekdaysParse = [];
  2201. this._shortWeekdaysParse = [];
  2202. this._fullWeekdaysParse = [];
  2203. }
  2204. for (i = 0; i < 7; i++) {
  2205. // make the regex if we don't have it already
  2206. mom = createUTC([2000, 1]).day(i);
  2207. if (strict && !this._fullWeekdaysParse[i]) {
  2208. this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
  2209. this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
  2210. this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
  2211. }
  2212. if (!this._weekdaysParse[i]) {
  2213. regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
  2214. this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
  2215. }
  2216. // test the regex
  2217. if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
  2218. return i;
  2219. } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
  2220. return i;
  2221. } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
  2222. return i;
  2223. } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
  2224. return i;
  2225. }
  2226. }
  2227. }
  2228. // MOMENTS
  2229. function getSetDayOfWeek (input) {
  2230. if (!this.isValid()) {
  2231. return input != null ? this : NaN;
  2232. }
  2233. var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
  2234. if (input != null) {
  2235. input = parseWeekday(input, this.localeData());
  2236. return this.add(input - day, 'd');
  2237. } else {
  2238. return day;
  2239. }
  2240. }
  2241. function getSetLocaleDayOfWeek (input) {
  2242. if (!this.isValid()) {
  2243. return input != null ? this : NaN;
  2244. }
  2245. var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  2246. return input == null ? weekday : this.add(input - weekday, 'd');
  2247. }
  2248. function getSetISODayOfWeek (input) {
  2249. if (!this.isValid()) {
  2250. return input != null ? this : NaN;
  2251. }
  2252. // behaves the same as moment#day except
  2253. // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
  2254. // as a setter, sunday should belong to the previous week.
  2255. if (input != null) {
  2256. var weekday = parseIsoWeekday(input, this.localeData());
  2257. return this.day(this.day() % 7 ? weekday : weekday - 7);
  2258. } else {
  2259. return this.day() || 7;
  2260. }
  2261. }
  2262. var defaultWeekdaysRegex = matchWord;
  2263. function weekdaysRegex (isStrict) {
  2264. if (this._weekdaysParseExact) {
  2265. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2266. computeWeekdaysParse.call(this);
  2267. }
  2268. if (isStrict) {
  2269. return this._weekdaysStrictRegex;
  2270. } else {
  2271. return this._weekdaysRegex;
  2272. }
  2273. } else {
  2274. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2275. this._weekdaysRegex = defaultWeekdaysRegex;
  2276. }
  2277. return this._weekdaysStrictRegex && isStrict ?
  2278. this._weekdaysStrictRegex : this._weekdaysRegex;
  2279. }
  2280. }
  2281. var defaultWeekdaysShortRegex = matchWord;
  2282. function weekdaysShortRegex (isStrict) {
  2283. if (this._weekdaysParseExact) {
  2284. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2285. computeWeekdaysParse.call(this);
  2286. }
  2287. if (isStrict) {
  2288. return this._weekdaysShortStrictRegex;
  2289. } else {
  2290. return this._weekdaysShortRegex;
  2291. }
  2292. } else {
  2293. if (!hasOwnProp(this, '_weekdaysShortRegex')) {
  2294. this._weekdaysShortRegex = defaultWeekdaysShortRegex;
  2295. }
  2296. return this._weekdaysShortStrictRegex && isStrict ?
  2297. this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
  2298. }
  2299. }
  2300. var defaultWeekdaysMinRegex = matchWord;
  2301. function weekdaysMinRegex (isStrict) {
  2302. if (this._weekdaysParseExact) {
  2303. if (!hasOwnProp(this, '_weekdaysRegex')) {
  2304. computeWeekdaysParse.call(this);
  2305. }
  2306. if (isStrict) {
  2307. return this._weekdaysMinStrictRegex;
  2308. } else {
  2309. return this._weekdaysMinRegex;
  2310. }
  2311. } else {
  2312. if (!hasOwnProp(this, '_weekdaysMinRegex')) {
  2313. this._weekdaysMinRegex = defaultWeekdaysMinRegex;
  2314. }
  2315. return this._weekdaysMinStrictRegex && isStrict ?
  2316. this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
  2317. }
  2318. }
  2319. function computeWeekdaysParse () {
  2320. function cmpLenRev(a, b) {
  2321. return b.length - a.length;
  2322. }
  2323. var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
  2324. i, mom, minp, shortp, longp;
  2325. for (i = 0; i < 7; i++) {
  2326. // make the regex if we don't have it already
  2327. mom = createUTC([2000, 1]).day(i);
  2328. minp = this.weekdaysMin(mom, '');
  2329. shortp = this.weekdaysShort(mom, '');
  2330. longp = this.weekdays(mom, '');
  2331. minPieces.push(minp);
  2332. shortPieces.push(shortp);
  2333. longPieces.push(longp);
  2334. mixedPieces.push(minp);
  2335. mixedPieces.push(shortp);
  2336. mixedPieces.push(longp);
  2337. }
  2338. // Sorting makes sure if one weekday (or abbr) is a prefix of another it
  2339. // will match the longer piece.
  2340. minPieces.sort(cmpLenRev);
  2341. shortPieces.sort(cmpLenRev);
  2342. longPieces.sort(cmpLenRev);
  2343. mixedPieces.sort(cmpLenRev);
  2344. for (i = 0; i < 7; i++) {
  2345. shortPieces[i] = regexEscape(shortPieces[i]);
  2346. longPieces[i] = regexEscape(longPieces[i]);
  2347. mixedPieces[i] = regexEscape(mixedPieces[i]);
  2348. }
  2349. this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
  2350. this._weekdaysShortRegex = this._weekdaysRegex;
  2351. this._weekdaysMinRegex = this._weekdaysRegex;
  2352. this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
  2353. this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
  2354. this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
  2355. }
  2356. // FORMATTING
  2357. function hFormat() {
  2358. return this.hours() % 12 || 12;
  2359. }
  2360. function kFormat() {
  2361. return this.hours() || 24;
  2362. }
  2363. addFormatToken('H', ['HH', 2], 0, 'hour');
  2364. addFormatToken('h', ['hh', 2], 0, hFormat);
  2365. addFormatToken('k', ['kk', 2], 0, kFormat);
  2366. addFormatToken('hmm', 0, 0, function () {
  2367. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
  2368. });
  2369. addFormatToken('hmmss', 0, 0, function () {
  2370. return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
  2371. zeroFill(this.seconds(), 2);
  2372. });
  2373. addFormatToken('Hmm', 0, 0, function () {
  2374. return '' + this.hours() + zeroFill(this.minutes(), 2);
  2375. });
  2376. addFormatToken('Hmmss', 0, 0, function () {
  2377. return '' + this.hours() + zeroFill(this.minutes(), 2) +
  2378. zeroFill(this.seconds(), 2);
  2379. });
  2380. function meridiem (token, lowercase) {
  2381. addFormatToken(token, 0, 0, function () {
  2382. return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
  2383. });
  2384. }
  2385. meridiem('a', true);
  2386. meridiem('A', false);
  2387. // ALIASES
  2388. addUnitAlias('hour', 'h');
  2389. // PRIORITY
  2390. addUnitPriority('hour', 13);
  2391. // PARSING
  2392. function matchMeridiem (isStrict, locale) {
  2393. return locale._meridiemParse;
  2394. }
  2395. addRegexToken('a', matchMeridiem);
  2396. addRegexToken('A', matchMeridiem);
  2397. addRegexToken('H', match1to2);
  2398. addRegexToken('h', match1to2);
  2399. addRegexToken('k', match1to2);
  2400. addRegexToken('HH', match1to2, match2);
  2401. addRegexToken('hh', match1to2, match2);
  2402. addRegexToken('kk', match1to2, match2);
  2403. addRegexToken('hmm', match3to4);
  2404. addRegexToken('hmmss', match5to6);
  2405. addRegexToken('Hmm', match3to4);
  2406. addRegexToken('Hmmss', match5to6);
  2407. addParseToken(['H', 'HH'], HOUR);
  2408. addParseToken(['k', 'kk'], function (input, array, config) {
  2409. var kInput = toInt(input);
  2410. array[HOUR] = kInput === 24 ? 0 : kInput;
  2411. });
  2412. addParseToken(['a', 'A'], function (input, array, config) {
  2413. config._isPm = config._locale.isPM(input);
  2414. config._meridiem = input;
  2415. });
  2416. addParseToken(['h', 'hh'], function (input, array, config) {
  2417. array[HOUR] = toInt(input);
  2418. getParsingFlags(config).bigHour = true;
  2419. });
  2420. addParseToken('hmm', function (input, array, config) {
  2421. var pos = input.length - 2;
  2422. array[HOUR] = toInt(input.substr(0, pos));
  2423. array[MINUTE] = toInt(input.substr(pos));
  2424. getParsingFlags(config).bigHour = true;
  2425. });
  2426. addParseToken('hmmss', function (input, array, config) {
  2427. var pos1 = input.length - 4;
  2428. var pos2 = input.length - 2;
  2429. array[HOUR] = toInt(input.substr(0, pos1));
  2430. array[MINUTE] = toInt(input.substr(pos1, 2));
  2431. array[SECOND] = toInt(input.substr(pos2));
  2432. getParsingFlags(config).bigHour = true;
  2433. });
  2434. addParseToken('Hmm', function (input, array, config) {
  2435. var pos = input.length - 2;
  2436. array[HOUR] = toInt(input.substr(0, pos));
  2437. array[MINUTE] = toInt(input.substr(pos));
  2438. });
  2439. addParseToken('Hmmss', function (input, array, config) {
  2440. var pos1 = input.length - 4;
  2441. var pos2 = input.length - 2;
  2442. array[HOUR] = toInt(input.substr(0, pos1));
  2443. array[MINUTE] = toInt(input.substr(pos1, 2));
  2444. array[SECOND] = toInt(input.substr(pos2));
  2445. });
  2446. // LOCALES
  2447. function localeIsPM (input) {
  2448. // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
  2449. // Using charAt should be more compatible.
  2450. return ((input + '').toLowerCase().charAt(0) === 'p');
  2451. }
  2452. var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
  2453. function localeMeridiem (hours, minutes, isLower) {
  2454. if (hours > 11) {
  2455. return isLower ? 'pm' : 'PM';
  2456. } else {
  2457. return isLower ? 'am' : 'AM';
  2458. }
  2459. }
  2460. // MOMENTS
  2461. // Setting the hour should keep the time, because the user explicitly
  2462. // specified which hour they want. So trying to maintain the same hour (in
  2463. // a new timezone) makes sense. Adding/subtracting hours does not follow
  2464. // this rule.
  2465. var getSetHour = makeGetSet('Hours', true);
  2466. var baseConfig = {
  2467. calendar: defaultCalendar,
  2468. longDateFormat: defaultLongDateFormat,
  2469. invalidDate: defaultInvalidDate,
  2470. ordinal: defaultOrdinal,
  2471. dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  2472. relativeTime: defaultRelativeTime,
  2473. months: defaultLocaleMonths,
  2474. monthsShort: defaultLocaleMonthsShort,
  2475. week: defaultLocaleWeek,
  2476. weekdays: defaultLocaleWeekdays,
  2477. weekdaysMin: defaultLocaleWeekdaysMin,
  2478. weekdaysShort: defaultLocaleWeekdaysShort,
  2479. meridiemParse: defaultLocaleMeridiemParse
  2480. };
  2481. // internal storage for locale config files
  2482. var locales = {};
  2483. var localeFamilies = {};
  2484. var globalLocale;
  2485. function normalizeLocale(key) {
  2486. return key ? key.toLowerCase().replace('_', '-') : key;
  2487. }
  2488. // pick the locale from the array
  2489. // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
  2490. // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
  2491. function chooseLocale(names) {
  2492. var i = 0, j, next, locale, split;
  2493. while (i < names.length) {
  2494. split = normalizeLocale(names[i]).split('-');
  2495. j = split.length;
  2496. next = normalizeLocale(names[i + 1]);
  2497. next = next ? next.split('-') : null;
  2498. while (j > 0) {
  2499. locale = loadLocale(split.slice(0, j).join('-'));
  2500. if (locale) {
  2501. return locale;
  2502. }
  2503. if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
  2504. //the next array item is better than a shallower substring of this one
  2505. break;
  2506. }
  2507. j--;
  2508. }
  2509. i++;
  2510. }
  2511. return globalLocale;
  2512. }
  2513. function loadLocale(name) {
  2514. var oldLocale = null;
  2515. // TODO: Find a better way to register and load all the locales in Node
  2516. if (!locales[name] && (typeof module !== 'undefined') &&
  2517. module && module.exports) {
  2518. try {
  2519. oldLocale = globalLocale._abbr;
  2520. var aliasedRequire = require;
  2521. aliasedRequire('./locale/' + name);
  2522. getSetGlobalLocale(oldLocale);
  2523. } catch (e) {}
  2524. }
  2525. return locales[name];
  2526. }
  2527. // This function will load locale and then set the global locale. If
  2528. // no arguments are passed in, it will simply return the current global
  2529. // locale key.
  2530. function getSetGlobalLocale (key, values) {
  2531. var data;
  2532. if (key) {
  2533. if (isUndefined(values)) {
  2534. data = getLocale(key);
  2535. }
  2536. else {
  2537. data = defineLocale(key, values);
  2538. }
  2539. if (data) {
  2540. // moment.duration._locale = moment._locale = data;
  2541. globalLocale = data;
  2542. }
  2543. else {
  2544. if ((typeof console !== 'undefined') && console.warn) {
  2545. //warn user if arguments are passed but the locale could not be set
  2546. console.warn('Locale ' + key + ' not found. Did you forget to load it?');
  2547. }
  2548. }
  2549. }
  2550. return globalLocale._abbr;
  2551. }
  2552. function defineLocale (name, config) {
  2553. if (config !== null) {
  2554. var locale, parentConfig = baseConfig;
  2555. config.abbr = name;
  2556. if (locales[name] != null) {
  2557. deprecateSimple('defineLocaleOverride',
  2558. 'use moment.updateLocale(localeName, config) to change ' +
  2559. 'an existing locale. moment.defineLocale(localeName, ' +
  2560. 'config) should only be used for creating a new locale ' +
  2561. 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
  2562. parentConfig = locales[name]._config;
  2563. } else if (config.parentLocale != null) {
  2564. if (locales[config.parentLocale] != null) {
  2565. parentConfig = locales[config.parentLocale]._config;
  2566. } else {
  2567. locale = loadLocale(config.parentLocale);
  2568. if (locale != null) {
  2569. parentConfig = locale._config;
  2570. } else {
  2571. if (!localeFamilies[config.parentLocale]) {
  2572. localeFamilies[config.parentLocale] = [];
  2573. }
  2574. localeFamilies[config.parentLocale].push({
  2575. name: name,
  2576. config: config
  2577. });
  2578. return null;
  2579. }
  2580. }
  2581. }
  2582. locales[name] = new Locale(mergeConfigs(parentConfig, config));
  2583. if (localeFamilies[name]) {
  2584. localeFamilies[name].forEach(function (x) {
  2585. defineLocale(x.name, x.config);
  2586. });
  2587. }
  2588. // backwards compat for now: also set the locale
  2589. // make sure we set the locale AFTER all child locales have been
  2590. // created, so we won't end up with the child locale set.
  2591. getSetGlobalLocale(name);
  2592. return locales[name];
  2593. } else {
  2594. // useful for testing
  2595. delete locales[name];
  2596. return null;
  2597. }
  2598. }
  2599. function updateLocale(name, config) {
  2600. if (config != null) {
  2601. var locale, tmpLocale, parentConfig = baseConfig;
  2602. // MERGE
  2603. tmpLocale = loadLocale(name);
  2604. if (tmpLocale != null) {
  2605. parentConfig = tmpLocale._config;
  2606. }
  2607. config = mergeConfigs(parentConfig, config);
  2608. locale = new Locale(config);
  2609. locale.parentLocale = locales[name];
  2610. locales[name] = locale;
  2611. // backwards compat for now: also set the locale
  2612. getSetGlobalLocale(name);
  2613. } else {
  2614. // pass null for config to unupdate, useful for tests
  2615. if (locales[name] != null) {
  2616. if (locales[name].parentLocale != null) {
  2617. locales[name] = locales[name].parentLocale;
  2618. } else if (locales[name] != null) {
  2619. delete locales[name];
  2620. }
  2621. }
  2622. }
  2623. return locales[name];
  2624. }
  2625. // returns locale data
  2626. function getLocale (key) {
  2627. var locale;
  2628. if (key && key._locale && key._locale._abbr) {
  2629. key = key._locale._abbr;
  2630. }
  2631. if (!key) {
  2632. return globalLocale;
  2633. }
  2634. if (!isArray(key)) {
  2635. //short-circuit everything else
  2636. locale = loadLocale(key);
  2637. if (locale) {
  2638. return locale;
  2639. }
  2640. key = [key];
  2641. }
  2642. return chooseLocale(key);
  2643. }
  2644. function listLocales() {
  2645. return keys(locales);
  2646. }
  2647. function checkOverflow (m) {
  2648. var overflow;
  2649. var a = m._a;
  2650. if (a && getParsingFlags(m).overflow === -2) {
  2651. overflow =
  2652. a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
  2653. a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
  2654. a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
  2655. a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
  2656. a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
  2657. a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
  2658. -1;
  2659. if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
  2660. overflow = DATE;
  2661. }
  2662. if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
  2663. overflow = WEEK;
  2664. }
  2665. if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
  2666. overflow = WEEKDAY;
  2667. }
  2668. getParsingFlags(m).overflow = overflow;
  2669. }
  2670. return m;
  2671. }
  2672. // Pick the first defined of two or three arguments.
  2673. function defaults(a, b, c) {
  2674. if (a != null) {
  2675. return a;
  2676. }
  2677. if (b != null) {
  2678. return b;
  2679. }
  2680. return c;
  2681. }
  2682. function currentDateArray(config) {
  2683. // hooks is actually the exported moment object
  2684. var nowValue = new Date(hooks.now());
  2685. if (config._useUTC) {
  2686. return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
  2687. }
  2688. return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
  2689. }
  2690. // convert an array to a date.
  2691. // the array should mirror the parameters below
  2692. // note: all values past the year are optional and will default to the lowest possible value.
  2693. // [year, month, day , hour, minute, second, millisecond]
  2694. function configFromArray (config) {
  2695. var i, date, input = [], currentDate, expectedWeekday, yearToUse;
  2696. if (config._d) {
  2697. return;
  2698. }
  2699. currentDate = currentDateArray(config);
  2700. //compute day of the year from weeks and weekdays
  2701. if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
  2702. dayOfYearFromWeekInfo(config);
  2703. }
  2704. //if the day of the year is set, figure out what it is
  2705. if (config._dayOfYear != null) {
  2706. yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
  2707. if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
  2708. getParsingFlags(config)._overflowDayOfYear = true;
  2709. }
  2710. date = createUTCDate(yearToUse, 0, config._dayOfYear);
  2711. config._a[MONTH] = date.getUTCMonth();
  2712. config._a[DATE] = date.getUTCDate();
  2713. }
  2714. // Default to current date.
  2715. // * if no year, month, day of month are given, default to today
  2716. // * if day of month is given, default month and year
  2717. // * if month is given, default only year
  2718. // * if year is given, don't default anything
  2719. for (i = 0; i < 3 && config._a[i] == null; ++i) {
  2720. config._a[i] = input[i] = currentDate[i];
  2721. }
  2722. // Zero out whatever was not defaulted, including time
  2723. for (; i < 7; i++) {
  2724. config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
  2725. }
  2726. // Check for 24:00:00.000
  2727. if (config._a[HOUR] === 24 &&
  2728. config._a[MINUTE] === 0 &&
  2729. config._a[SECOND] === 0 &&
  2730. config._a[MILLISECOND] === 0) {
  2731. config._nextDay = true;
  2732. config._a[HOUR] = 0;
  2733. }
  2734. config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
  2735. expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
  2736. // Apply timezone offset from input. The actual utcOffset can be changed
  2737. // with parseZone.
  2738. if (config._tzm != null) {
  2739. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  2740. }
  2741. if (config._nextDay) {
  2742. config._a[HOUR] = 24;
  2743. }
  2744. // check for mismatching day of week
  2745. if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
  2746. getParsingFlags(config).weekdayMismatch = true;
  2747. }
  2748. }
  2749. function dayOfYearFromWeekInfo(config) {
  2750. var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
  2751. w = config._w;
  2752. if (w.GG != null || w.W != null || w.E != null) {
  2753. dow = 1;
  2754. doy = 4;
  2755. // TODO: We need to take the current isoWeekYear, but that depends on
  2756. // how we interpret now (local, utc, fixed offset). So create
  2757. // a now version of current config (take local/utc/offset flags, and
  2758. // create now).
  2759. weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
  2760. week = defaults(w.W, 1);
  2761. weekday = defaults(w.E, 1);
  2762. if (weekday < 1 || weekday > 7) {
  2763. weekdayOverflow = true;
  2764. }
  2765. } else {
  2766. dow = config._locale._week.dow;
  2767. doy = config._locale._week.doy;
  2768. var curWeek = weekOfYear(createLocal(), dow, doy);
  2769. weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
  2770. // Default to current week.
  2771. week = defaults(w.w, curWeek.week);
  2772. if (w.d != null) {
  2773. // weekday -- low day numbers are considered next week
  2774. weekday = w.d;
  2775. if (weekday < 0 || weekday > 6) {
  2776. weekdayOverflow = true;
  2777. }
  2778. } else if (w.e != null) {
  2779. // local weekday -- counting starts from beginning of week
  2780. weekday = w.e + dow;
  2781. if (w.e < 0 || w.e > 6) {
  2782. weekdayOverflow = true;
  2783. }
  2784. } else {
  2785. // default to beginning of week
  2786. weekday = dow;
  2787. }
  2788. }
  2789. if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
  2790. getParsingFlags(config)._overflowWeeks = true;
  2791. } else if (weekdayOverflow != null) {
  2792. getParsingFlags(config)._overflowWeekday = true;
  2793. } else {
  2794. temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
  2795. config._a[YEAR] = temp.year;
  2796. config._dayOfYear = temp.dayOfYear;
  2797. }
  2798. }
  2799. // iso 8601 regex
  2800. // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
  2801. var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
  2802. var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
  2803. var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
  2804. var isoDates = [
  2805. ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
  2806. ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
  2807. ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
  2808. ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
  2809. ['YYYY-DDD', /\d{4}-\d{3}/],
  2810. ['YYYY-MM', /\d{4}-\d\d/, false],
  2811. ['YYYYYYMMDD', /[+-]\d{10}/],
  2812. ['YYYYMMDD', /\d{8}/],
  2813. // YYYYMM is NOT allowed by the standard
  2814. ['GGGG[W]WWE', /\d{4}W\d{3}/],
  2815. ['GGGG[W]WW', /\d{4}W\d{2}/, false],
  2816. ['YYYYDDD', /\d{7}/]
  2817. ];
  2818. // iso time formats and regexes
  2819. var isoTimes = [
  2820. ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
  2821. ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
  2822. ['HH:mm:ss', /\d\d:\d\d:\d\d/],
  2823. ['HH:mm', /\d\d:\d\d/],
  2824. ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
  2825. ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
  2826. ['HHmmss', /\d\d\d\d\d\d/],
  2827. ['HHmm', /\d\d\d\d/],
  2828. ['HH', /\d\d/]
  2829. ];
  2830. var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
  2831. // date from iso format
  2832. function configFromISO(config) {
  2833. var i, l,
  2834. string = config._i,
  2835. match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
  2836. allowTime, dateFormat, timeFormat, tzFormat;
  2837. if (match) {
  2838. getParsingFlags(config).iso = true;
  2839. for (i = 0, l = isoDates.length; i < l; i++) {
  2840. if (isoDates[i][1].exec(match[1])) {
  2841. dateFormat = isoDates[i][0];
  2842. allowTime = isoDates[i][2] !== false;
  2843. break;
  2844. }
  2845. }
  2846. if (dateFormat == null) {
  2847. config._isValid = false;
  2848. return;
  2849. }
  2850. if (match[3]) {
  2851. for (i = 0, l = isoTimes.length; i < l; i++) {
  2852. if (isoTimes[i][1].exec(match[3])) {
  2853. // match[2] should be 'T' or space
  2854. timeFormat = (match[2] || ' ') + isoTimes[i][0];
  2855. break;
  2856. }
  2857. }
  2858. if (timeFormat == null) {
  2859. config._isValid = false;
  2860. return;
  2861. }
  2862. }
  2863. if (!allowTime && timeFormat != null) {
  2864. config._isValid = false;
  2865. return;
  2866. }
  2867. if (match[4]) {
  2868. if (tzRegex.exec(match[4])) {
  2869. tzFormat = 'Z';
  2870. } else {
  2871. config._isValid = false;
  2872. return;
  2873. }
  2874. }
  2875. config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
  2876. configFromStringAndFormat(config);
  2877. } else {
  2878. config._isValid = false;
  2879. }
  2880. }
  2881. // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
  2882. var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
  2883. function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
  2884. var result = [
  2885. untruncateYear(yearStr),
  2886. defaultLocaleMonthsShort.indexOf(monthStr),
  2887. parseInt(dayStr, 10),
  2888. parseInt(hourStr, 10),
  2889. parseInt(minuteStr, 10)
  2890. ];
  2891. if (secondStr) {
  2892. result.push(parseInt(secondStr, 10));
  2893. }
  2894. return result;
  2895. }
  2896. function untruncateYear(yearStr) {
  2897. var year = parseInt(yearStr, 10);
  2898. if (year <= 49) {
  2899. return 2000 + year;
  2900. } else if (year <= 999) {
  2901. return 1900 + year;
  2902. }
  2903. return year;
  2904. }
  2905. function preprocessRFC2822(s) {
  2906. // Remove comments and folding whitespace and replace multiple-spaces with a single space
  2907. return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  2908. }
  2909. function checkWeekday(weekdayStr, parsedInput, config) {
  2910. if (weekdayStr) {
  2911. // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
  2912. var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
  2913. weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
  2914. if (weekdayProvided !== weekdayActual) {
  2915. getParsingFlags(config).weekdayMismatch = true;
  2916. config._isValid = false;
  2917. return false;
  2918. }
  2919. }
  2920. return true;
  2921. }
  2922. var obsOffsets = {
  2923. UT: 0,
  2924. GMT: 0,
  2925. EDT: -4 * 60,
  2926. EST: -5 * 60,
  2927. CDT: -5 * 60,
  2928. CST: -6 * 60,
  2929. MDT: -6 * 60,
  2930. MST: -7 * 60,
  2931. PDT: -7 * 60,
  2932. PST: -8 * 60
  2933. };
  2934. function calculateOffset(obsOffset, militaryOffset, numOffset) {
  2935. if (obsOffset) {
  2936. return obsOffsets[obsOffset];
  2937. } else if (militaryOffset) {
  2938. // the only allowed military tz is Z
  2939. return 0;
  2940. } else {
  2941. var hm = parseInt(numOffset, 10);
  2942. var m = hm % 100, h = (hm - m) / 100;
  2943. return h * 60 + m;
  2944. }
  2945. }
  2946. // date and time from ref 2822 format
  2947. function configFromRFC2822(config) {
  2948. var match = rfc2822.exec(preprocessRFC2822(config._i));
  2949. if (match) {
  2950. var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
  2951. if (!checkWeekday(match[1], parsedArray, config)) {
  2952. return;
  2953. }
  2954. config._a = parsedArray;
  2955. config._tzm = calculateOffset(match[8], match[9], match[10]);
  2956. config._d = createUTCDate.apply(null, config._a);
  2957. config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
  2958. getParsingFlags(config).rfc2822 = true;
  2959. } else {
  2960. config._isValid = false;
  2961. }
  2962. }
  2963. // date from iso format or fallback
  2964. function configFromString(config) {
  2965. var matched = aspNetJsonRegex.exec(config._i);
  2966. if (matched !== null) {
  2967. config._d = new Date(+matched[1]);
  2968. return;
  2969. }
  2970. configFromISO(config);
  2971. if (config._isValid === false) {
  2972. delete config._isValid;
  2973. } else {
  2974. return;
  2975. }
  2976. configFromRFC2822(config);
  2977. if (config._isValid === false) {
  2978. delete config._isValid;
  2979. } else {
  2980. return;
  2981. }
  2982. // Final attempt, use Input Fallback
  2983. hooks.createFromInputFallback(config);
  2984. }
  2985. hooks.createFromInputFallback = deprecate(
  2986. 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
  2987. 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
  2988. 'discouraged and will be removed in an upcoming major release. Please refer to ' +
  2989. 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
  2990. function (config) {
  2991. config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
  2992. }
  2993. );
  2994. // constant that refers to the ISO standard
  2995. hooks.ISO_8601 = function () {};
  2996. // constant that refers to the RFC 2822 form
  2997. hooks.RFC_2822 = function () {};
  2998. // date from string and format string
  2999. function configFromStringAndFormat(config) {
  3000. // TODO: Move this to another part of the creation flow to prevent circular deps
  3001. if (config._f === hooks.ISO_8601) {
  3002. configFromISO(config);
  3003. return;
  3004. }
  3005. if (config._f === hooks.RFC_2822) {
  3006. configFromRFC2822(config);
  3007. return;
  3008. }
  3009. config._a = [];
  3010. getParsingFlags(config).empty = true;
  3011. // This array is used to make a Date, either with `new Date` or `Date.UTC`
  3012. var string = '' + config._i,
  3013. i, parsedInput, tokens, token, skipped,
  3014. stringLength = string.length,
  3015. totalParsedInputLength = 0;
  3016. tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
  3017. for (i = 0; i < tokens.length; i++) {
  3018. token = tokens[i];
  3019. parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
  3020. // console.log('token', token, 'parsedInput', parsedInput,
  3021. // 'regex', getParseRegexForToken(token, config));
  3022. if (parsedInput) {
  3023. skipped = string.substr(0, string.indexOf(parsedInput));
  3024. if (skipped.length > 0) {
  3025. getParsingFlags(config).unusedInput.push(skipped);
  3026. }
  3027. string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
  3028. totalParsedInputLength += parsedInput.length;
  3029. }
  3030. // don't parse if it's not a known token
  3031. if (formatTokenFunctions[token]) {
  3032. if (parsedInput) {
  3033. getParsingFlags(config).empty = false;
  3034. }
  3035. else {
  3036. getParsingFlags(config).unusedTokens.push(token);
  3037. }
  3038. addTimeToArrayFromToken(token, parsedInput, config);
  3039. }
  3040. else if (config._strict && !parsedInput) {
  3041. getParsingFlags(config).unusedTokens.push(token);
  3042. }
  3043. }
  3044. // add remaining unparsed input length to the string
  3045. getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
  3046. if (string.length > 0) {
  3047. getParsingFlags(config).unusedInput.push(string);
  3048. }
  3049. // clear _12h flag if hour is <= 12
  3050. if (config._a[HOUR] <= 12 &&
  3051. getParsingFlags(config).bigHour === true &&
  3052. config._a[HOUR] > 0) {
  3053. getParsingFlags(config).bigHour = undefined;
  3054. }
  3055. getParsingFlags(config).parsedDateParts = config._a.slice(0);
  3056. getParsingFlags(config).meridiem = config._meridiem;
  3057. // handle meridiem
  3058. config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
  3059. configFromArray(config);
  3060. checkOverflow(config);
  3061. }
  3062. function meridiemFixWrap (locale, hour, meridiem) {
  3063. var isPm;
  3064. if (meridiem == null) {
  3065. // nothing to do
  3066. return hour;
  3067. }
  3068. if (locale.meridiemHour != null) {
  3069. return locale.meridiemHour(hour, meridiem);
  3070. } else if (locale.isPM != null) {
  3071. // Fallback
  3072. isPm = locale.isPM(meridiem);
  3073. if (isPm && hour < 12) {
  3074. hour += 12;
  3075. }
  3076. if (!isPm && hour === 12) {
  3077. hour = 0;
  3078. }
  3079. return hour;
  3080. } else {
  3081. // this is not supposed to happen
  3082. return hour;
  3083. }
  3084. }
  3085. // date from string and array of format strings
  3086. function configFromStringAndArray(config) {
  3087. var tempConfig,
  3088. bestMoment,
  3089. scoreToBeat,
  3090. i,
  3091. currentScore;
  3092. if (config._f.length === 0) {
  3093. getParsingFlags(config).invalidFormat = true;
  3094. config._d = new Date(NaN);
  3095. return;
  3096. }
  3097. for (i = 0; i < config._f.length; i++) {
  3098. currentScore = 0;
  3099. tempConfig = copyConfig({}, config);
  3100. if (config._useUTC != null) {
  3101. tempConfig._useUTC = config._useUTC;
  3102. }
  3103. tempConfig._f = config._f[i];
  3104. configFromStringAndFormat(tempConfig);
  3105. if (!isValid(tempConfig)) {
  3106. continue;
  3107. }
  3108. // if there is any input that was not parsed add a penalty for that format
  3109. currentScore += getParsingFlags(tempConfig).charsLeftOver;
  3110. //or tokens
  3111. currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
  3112. getParsingFlags(tempConfig).score = currentScore;
  3113. if (scoreToBeat == null || currentScore < scoreToBeat) {
  3114. scoreToBeat = currentScore;
  3115. bestMoment = tempConfig;
  3116. }
  3117. }
  3118. extend(config, bestMoment || tempConfig);
  3119. }
  3120. function configFromObject(config) {
  3121. if (config._d) {
  3122. return;
  3123. }
  3124. var i = normalizeObjectUnits(config._i);
  3125. config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
  3126. return obj && parseInt(obj, 10);
  3127. });
  3128. configFromArray(config);
  3129. }
  3130. function createFromConfig (config) {
  3131. var res = new Moment(checkOverflow(prepareConfig(config)));
  3132. if (res._nextDay) {
  3133. // Adding is smart enough around DST
  3134. res.add(1, 'd');
  3135. res._nextDay = undefined;
  3136. }
  3137. return res;
  3138. }
  3139. function prepareConfig (config) {
  3140. var input = config._i,
  3141. format = config._f;
  3142. config._locale = config._locale || getLocale(config._l);
  3143. if (input === null || (format === undefined && input === '')) {
  3144. return createInvalid({nullInput: true});
  3145. }
  3146. if (typeof input === 'string') {
  3147. config._i = input = config._locale.preparse(input);
  3148. }
  3149. if (isMoment(input)) {
  3150. return new Moment(checkOverflow(input));
  3151. } else if (isDate(input)) {
  3152. config._d = input;
  3153. } else if (isArray(format)) {
  3154. configFromStringAndArray(config);
  3155. } else if (format) {
  3156. configFromStringAndFormat(config);
  3157. } else {
  3158. configFromInput(config);
  3159. }
  3160. if (!isValid(config)) {
  3161. config._d = null;
  3162. }
  3163. return config;
  3164. }
  3165. function configFromInput(config) {
  3166. var input = config._i;
  3167. if (isUndefined(input)) {
  3168. config._d = new Date(hooks.now());
  3169. } else if (isDate(input)) {
  3170. config._d = new Date(input.valueOf());
  3171. } else if (typeof input === 'string') {
  3172. configFromString(config);
  3173. } else if (isArray(input)) {
  3174. config._a = map(input.slice(0), function (obj) {
  3175. return parseInt(obj, 10);
  3176. });
  3177. configFromArray(config);
  3178. } else if (isObject(input)) {
  3179. configFromObject(config);
  3180. } else if (isNumber(input)) {
  3181. // from milliseconds
  3182. config._d = new Date(input);
  3183. } else {
  3184. hooks.createFromInputFallback(config);
  3185. }
  3186. }
  3187. function createLocalOrUTC (input, format, locale, strict, isUTC) {
  3188. var c = {};
  3189. if (locale === true || locale === false) {
  3190. strict = locale;
  3191. locale = undefined;
  3192. }
  3193. if ((isObject(input) && isObjectEmpty(input)) ||
  3194. (isArray(input) && input.length === 0)) {
  3195. input = undefined;
  3196. }
  3197. // object construction must be done this way.
  3198. // https://github.com/moment/moment/issues/1423
  3199. c._isAMomentObject = true;
  3200. c._useUTC = c._isUTC = isUTC;
  3201. c._l = locale;
  3202. c._i = input;
  3203. c._f = format;
  3204. c._strict = strict;
  3205. return createFromConfig(c);
  3206. }
  3207. function createLocal (input, format, locale, strict) {
  3208. return createLocalOrUTC(input, format, locale, strict, false);
  3209. }
  3210. var prototypeMin = deprecate(
  3211. 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
  3212. function () {
  3213. var other = createLocal.apply(null, arguments);
  3214. if (this.isValid() && other.isValid()) {
  3215. return other < this ? this : other;
  3216. } else {
  3217. return createInvalid();
  3218. }
  3219. }
  3220. );
  3221. var prototypeMax = deprecate(
  3222. 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
  3223. function () {
  3224. var other = createLocal.apply(null, arguments);
  3225. if (this.isValid() && other.isValid()) {
  3226. return other > this ? this : other;
  3227. } else {
  3228. return createInvalid();
  3229. }
  3230. }
  3231. );
  3232. // Pick a moment m from moments so that m[fn](other) is true for all
  3233. // other. This relies on the function fn to be transitive.
  3234. //
  3235. // moments should either be an array of moment objects or an array, whose
  3236. // first element is an array of moment objects.
  3237. function pickBy(fn, moments) {
  3238. var res, i;
  3239. if (moments.length === 1 && isArray(moments[0])) {
  3240. moments = moments[0];
  3241. }
  3242. if (!moments.length) {
  3243. return createLocal();
  3244. }
  3245. res = moments[0];
  3246. for (i = 1; i < moments.length; ++i) {
  3247. if (!moments[i].isValid() || moments[i][fn](res)) {
  3248. res = moments[i];
  3249. }
  3250. }
  3251. return res;
  3252. }
  3253. // TODO: Use [].sort instead?
  3254. function min () {
  3255. var args = [].slice.call(arguments, 0);
  3256. return pickBy('isBefore', args);
  3257. }
  3258. function max () {
  3259. var args = [].slice.call(arguments, 0);
  3260. return pickBy('isAfter', args);
  3261. }
  3262. var now = function () {
  3263. return Date.now ? Date.now() : +(new Date());
  3264. };
  3265. var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
  3266. function isDurationValid(m) {
  3267. for (var key in m) {
  3268. if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
  3269. return false;
  3270. }
  3271. }
  3272. var unitHasDecimal = false;
  3273. for (var i = 0; i < ordering.length; ++i) {
  3274. if (m[ordering[i]]) {
  3275. if (unitHasDecimal) {
  3276. return false; // only allow non-integers for smallest unit
  3277. }
  3278. if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
  3279. unitHasDecimal = true;
  3280. }
  3281. }
  3282. }
  3283. return true;
  3284. }
  3285. function isValid$1() {
  3286. return this._isValid;
  3287. }
  3288. function createInvalid$1() {
  3289. return createDuration(NaN);
  3290. }
  3291. function Duration (duration) {
  3292. var normalizedInput = normalizeObjectUnits(duration),
  3293. years = normalizedInput.year || 0,
  3294. quarters = normalizedInput.quarter || 0,
  3295. months = normalizedInput.month || 0,
  3296. weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
  3297. days = normalizedInput.day || 0,
  3298. hours = normalizedInput.hour || 0,
  3299. minutes = normalizedInput.minute || 0,
  3300. seconds = normalizedInput.second || 0,
  3301. milliseconds = normalizedInput.millisecond || 0;
  3302. this._isValid = isDurationValid(normalizedInput);
  3303. // representation for dateAddRemove
  3304. this._milliseconds = +milliseconds +
  3305. seconds * 1e3 + // 1000
  3306. minutes * 6e4 + // 1000 * 60
  3307. hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
  3308. // Because of dateAddRemove treats 24 hours as different from a
  3309. // day when working around DST, we need to store them separately
  3310. this._days = +days +
  3311. weeks * 7;
  3312. // It is impossible to translate months into days without knowing
  3313. // which months you are are talking about, so we have to store
  3314. // it separately.
  3315. this._months = +months +
  3316. quarters * 3 +
  3317. years * 12;
  3318. this._data = {};
  3319. this._locale = getLocale();
  3320. this._bubble();
  3321. }
  3322. function isDuration (obj) {
  3323. return obj instanceof Duration;
  3324. }
  3325. function absRound (number) {
  3326. if (number < 0) {
  3327. return Math.round(-1 * number) * -1;
  3328. } else {
  3329. return Math.round(number);
  3330. }
  3331. }
  3332. // FORMATTING
  3333. function offset (token, separator) {
  3334. addFormatToken(token, 0, 0, function () {
  3335. var offset = this.utcOffset();
  3336. var sign = '+';
  3337. if (offset < 0) {
  3338. offset = -offset;
  3339. sign = '-';
  3340. }
  3341. return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
  3342. });
  3343. }
  3344. offset('Z', ':');
  3345. offset('ZZ', '');
  3346. // PARSING
  3347. addRegexToken('Z', matchShortOffset);
  3348. addRegexToken('ZZ', matchShortOffset);
  3349. addParseToken(['Z', 'ZZ'], function (input, array, config) {
  3350. config._useUTC = true;
  3351. config._tzm = offsetFromString(matchShortOffset, input);
  3352. });
  3353. // HELPERS
  3354. // timezone chunker
  3355. // '+10:00' > ['10', '00']
  3356. // '-1530' > ['-15', '30']
  3357. var chunkOffset = /([\+\-]|\d\d)/gi;
  3358. function offsetFromString(matcher, string) {
  3359. var matches = (string || '').match(matcher);
  3360. if (matches === null) {
  3361. return null;
  3362. }
  3363. var chunk = matches[matches.length - 1] || [];
  3364. var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
  3365. var minutes = +(parts[1] * 60) + toInt(parts[2]);
  3366. return minutes === 0 ?
  3367. 0 :
  3368. parts[0] === '+' ? minutes : -minutes;
  3369. }
  3370. // Return a moment from input, that is local/utc/zone equivalent to model.
  3371. function cloneWithOffset(input, model) {
  3372. var res, diff;
  3373. if (model._isUTC) {
  3374. res = model.clone();
  3375. diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
  3376. // Use low-level api, because this fn is low-level api.
  3377. res._d.setTime(res._d.valueOf() + diff);
  3378. hooks.updateOffset(res, false);
  3379. return res;
  3380. } else {
  3381. return createLocal(input).local();
  3382. }
  3383. }
  3384. function getDateOffset (m) {
  3385. // On Firefox.24 Date#getTimezoneOffset returns a floating point.
  3386. // https://github.com/moment/moment/pull/1871
  3387. return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
  3388. }
  3389. // HOOKS
  3390. // This function will be called whenever a moment is mutated.
  3391. // It is intended to keep the offset in sync with the timezone.
  3392. hooks.updateOffset = function () {};
  3393. // MOMENTS
  3394. // keepLocalTime = true means only change the timezone, without
  3395. // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
  3396. // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
  3397. // +0200, so we adjust the time as needed, to be valid.
  3398. //
  3399. // Keeping the time actually adds/subtracts (one hour)
  3400. // from the actual represented time. That is why we call updateOffset
  3401. // a second time. In case it wants us to change the offset again
  3402. // _changeInProgress == true case, then we have to adjust, because
  3403. // there is no such time in the given timezone.
  3404. function getSetOffset (input, keepLocalTime, keepMinutes) {
  3405. var offset = this._offset || 0,
  3406. localAdjust;
  3407. if (!this.isValid()) {
  3408. return input != null ? this : NaN;
  3409. }
  3410. if (input != null) {
  3411. if (typeof input === 'string') {
  3412. input = offsetFromString(matchShortOffset, input);
  3413. if (input === null) {
  3414. return this;
  3415. }
  3416. } else if (Math.abs(input) < 16 && !keepMinutes) {
  3417. input = input * 60;
  3418. }
  3419. if (!this._isUTC && keepLocalTime) {
  3420. localAdjust = getDateOffset(this);
  3421. }
  3422. this._offset = input;
  3423. this._isUTC = true;
  3424. if (localAdjust != null) {
  3425. this.add(localAdjust, 'm');
  3426. }
  3427. if (offset !== input) {
  3428. if (!keepLocalTime || this._changeInProgress) {
  3429. addSubtract(this, createDuration(input - offset, 'm'), 1, false);
  3430. } else if (!this._changeInProgress) {
  3431. this._changeInProgress = true;
  3432. hooks.updateOffset(this, true);
  3433. this._changeInProgress = null;
  3434. }
  3435. }
  3436. return this;
  3437. } else {
  3438. return this._isUTC ? offset : getDateOffset(this);
  3439. }
  3440. }
  3441. function getSetZone (input, keepLocalTime) {
  3442. if (input != null) {
  3443. if (typeof input !== 'string') {
  3444. input = -input;
  3445. }
  3446. this.utcOffset(input, keepLocalTime);
  3447. return this;
  3448. } else {
  3449. return -this.utcOffset();
  3450. }
  3451. }
  3452. function setOffsetToUTC (keepLocalTime) {
  3453. return this.utcOffset(0, keepLocalTime);
  3454. }
  3455. function setOffsetToLocal (keepLocalTime) {
  3456. if (this._isUTC) {
  3457. this.utcOffset(0, keepLocalTime);
  3458. this._isUTC = false;
  3459. if (keepLocalTime) {
  3460. this.subtract(getDateOffset(this), 'm');
  3461. }
  3462. }
  3463. return this;
  3464. }
  3465. function setOffsetToParsedOffset () {
  3466. if (this._tzm != null) {
  3467. this.utcOffset(this._tzm, false, true);
  3468. } else if (typeof this._i === 'string') {
  3469. var tZone = offsetFromString(matchOffset, this._i);
  3470. if (tZone != null) {
  3471. this.utcOffset(tZone);
  3472. }
  3473. else {
  3474. this.utcOffset(0, true);
  3475. }
  3476. }
  3477. return this;
  3478. }
  3479. function hasAlignedHourOffset (input) {
  3480. if (!this.isValid()) {
  3481. return false;
  3482. }
  3483. input = input ? createLocal(input).utcOffset() : 0;
  3484. return (this.utcOffset() - input) % 60 === 0;
  3485. }
  3486. function isDaylightSavingTime () {
  3487. return (
  3488. this.utcOffset() > this.clone().month(0).utcOffset() ||
  3489. this.utcOffset() > this.clone().month(5).utcOffset()
  3490. );
  3491. }
  3492. function isDaylightSavingTimeShifted () {
  3493. if (!isUndefined(this._isDSTShifted)) {
  3494. return this._isDSTShifted;
  3495. }
  3496. var c = {};
  3497. copyConfig(c, this);
  3498. c = prepareConfig(c);
  3499. if (c._a) {
  3500. var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
  3501. this._isDSTShifted = this.isValid() &&
  3502. compareArrays(c._a, other.toArray()) > 0;
  3503. } else {
  3504. this._isDSTShifted = false;
  3505. }
  3506. return this._isDSTShifted;
  3507. }
  3508. function isLocal () {
  3509. return this.isValid() ? !this._isUTC : false;
  3510. }
  3511. function isUtcOffset () {
  3512. return this.isValid() ? this._isUTC : false;
  3513. }
  3514. function isUtc () {
  3515. return this.isValid() ? this._isUTC && this._offset === 0 : false;
  3516. }
  3517. // ASP.NET json date format regex
  3518. var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
  3519. // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
  3520. // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
  3521. // and further modified to allow for strings containing both week and day
  3522. var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
  3523. function createDuration (input, key) {
  3524. var duration = input,
  3525. // matching against regexp is expensive, do it on demand
  3526. match = null,
  3527. sign,
  3528. ret,
  3529. diffRes;
  3530. if (isDuration(input)) {
  3531. duration = {
  3532. ms : input._milliseconds,
  3533. d : input._days,
  3534. M : input._months
  3535. };
  3536. } else if (isNumber(input)) {
  3537. duration = {};
  3538. if (key) {
  3539. duration[key] = input;
  3540. } else {
  3541. duration.milliseconds = input;
  3542. }
  3543. } else if (!!(match = aspNetRegex.exec(input))) {
  3544. sign = (match[1] === '-') ? -1 : 1;
  3545. duration = {
  3546. y : 0,
  3547. d : toInt(match[DATE]) * sign,
  3548. h : toInt(match[HOUR]) * sign,
  3549. m : toInt(match[MINUTE]) * sign,
  3550. s : toInt(match[SECOND]) * sign,
  3551. ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
  3552. };
  3553. } else if (!!(match = isoRegex.exec(input))) {
  3554. sign = (match[1] === '-') ? -1 : 1;
  3555. duration = {
  3556. y : parseIso(match[2], sign),
  3557. M : parseIso(match[3], sign),
  3558. w : parseIso(match[4], sign),
  3559. d : parseIso(match[5], sign),
  3560. h : parseIso(match[6], sign),
  3561. m : parseIso(match[7], sign),
  3562. s : parseIso(match[8], sign)
  3563. };
  3564. } else if (duration == null) {// checks for null or undefined
  3565. duration = {};
  3566. } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
  3567. diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
  3568. duration = {};
  3569. duration.ms = diffRes.milliseconds;
  3570. duration.M = diffRes.months;
  3571. }
  3572. ret = new Duration(duration);
  3573. if (isDuration(input) && hasOwnProp(input, '_locale')) {
  3574. ret._locale = input._locale;
  3575. }
  3576. return ret;
  3577. }
  3578. createDuration.fn = Duration.prototype;
  3579. createDuration.invalid = createInvalid$1;
  3580. function parseIso (inp, sign) {
  3581. // We'd normally use ~~inp for this, but unfortunately it also
  3582. // converts floats to ints.
  3583. // inp may be undefined, so careful calling replace on it.
  3584. var res = inp && parseFloat(inp.replace(',', '.'));
  3585. // apply sign while we're at it
  3586. return (isNaN(res) ? 0 : res) * sign;
  3587. }
  3588. function positiveMomentsDifference(base, other) {
  3589. var res = {};
  3590. res.months = other.month() - base.month() +
  3591. (other.year() - base.year()) * 12;
  3592. if (base.clone().add(res.months, 'M').isAfter(other)) {
  3593. --res.months;
  3594. }
  3595. res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
  3596. return res;
  3597. }
  3598. function momentsDifference(base, other) {
  3599. var res;
  3600. if (!(base.isValid() && other.isValid())) {
  3601. return {milliseconds: 0, months: 0};
  3602. }
  3603. other = cloneWithOffset(other, base);
  3604. if (base.isBefore(other)) {
  3605. res = positiveMomentsDifference(base, other);
  3606. } else {
  3607. res = positiveMomentsDifference(other, base);
  3608. res.milliseconds = -res.milliseconds;
  3609. res.months = -res.months;
  3610. }
  3611. return res;
  3612. }
  3613. // TODO: remove 'name' arg after deprecation is removed
  3614. function createAdder(direction, name) {
  3615. return function (val, period) {
  3616. var dur, tmp;
  3617. //invert the arguments, but complain about it
  3618. if (period !== null && !isNaN(+period)) {
  3619. deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
  3620. 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
  3621. tmp = val; val = period; period = tmp;
  3622. }
  3623. val = typeof val === 'string' ? +val : val;
  3624. dur = createDuration(val, period);
  3625. addSubtract(this, dur, direction);
  3626. return this;
  3627. };
  3628. }
  3629. function addSubtract (mom, duration, isAdding, updateOffset) {
  3630. var milliseconds = duration._milliseconds,
  3631. days = absRound(duration._days),
  3632. months = absRound(duration._months);
  3633. if (!mom.isValid()) {
  3634. // No op
  3635. return;
  3636. }
  3637. updateOffset = updateOffset == null ? true : updateOffset;
  3638. if (months) {
  3639. setMonth(mom, get(mom, 'Month') + months * isAdding);
  3640. }
  3641. if (days) {
  3642. set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
  3643. }
  3644. if (milliseconds) {
  3645. mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
  3646. }
  3647. if (updateOffset) {
  3648. hooks.updateOffset(mom, days || months);
  3649. }
  3650. }
  3651. var add = createAdder(1, 'add');
  3652. var subtract = createAdder(-1, 'subtract');
  3653. function getCalendarFormat(myMoment, now) {
  3654. var diff = myMoment.diff(now, 'days', true);
  3655. return diff < -6 ? 'sameElse' :
  3656. diff < -1 ? 'lastWeek' :
  3657. diff < 0 ? 'lastDay' :
  3658. diff < 1 ? 'sameDay' :
  3659. diff < 2 ? 'nextDay' :
  3660. diff < 7 ? 'nextWeek' : 'sameElse';
  3661. }
  3662. function calendar$1 (time, formats) {
  3663. // We want to compare the start of today, vs this.
  3664. // Getting start-of-today depends on whether we're local/utc/offset or not.
  3665. var now = time || createLocal(),
  3666. sod = cloneWithOffset(now, this).startOf('day'),
  3667. format = hooks.calendarFormat(this, sod) || 'sameElse';
  3668. var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
  3669. return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
  3670. }
  3671. function clone () {
  3672. return new Moment(this);
  3673. }
  3674. function isAfter (input, units) {
  3675. var localInput = isMoment(input) ? input : createLocal(input);
  3676. if (!(this.isValid() && localInput.isValid())) {
  3677. return false;
  3678. }
  3679. units = normalizeUnits(units) || 'millisecond';
  3680. if (units === 'millisecond') {
  3681. return this.valueOf() > localInput.valueOf();
  3682. } else {
  3683. return localInput.valueOf() < this.clone().startOf(units).valueOf();
  3684. }
  3685. }
  3686. function isBefore (input, units) {
  3687. var localInput = isMoment(input) ? input : createLocal(input);
  3688. if (!(this.isValid() && localInput.isValid())) {
  3689. return false;
  3690. }
  3691. units = normalizeUnits(units) || 'millisecond';
  3692. if (units === 'millisecond') {
  3693. return this.valueOf() < localInput.valueOf();
  3694. } else {
  3695. return this.clone().endOf(units).valueOf() < localInput.valueOf();
  3696. }
  3697. }
  3698. function isBetween (from, to, units, inclusivity) {
  3699. var localFrom = isMoment(from) ? from : createLocal(from),
  3700. localTo = isMoment(to) ? to : createLocal(to);
  3701. if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
  3702. return false;
  3703. }
  3704. inclusivity = inclusivity || '()';
  3705. return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) &&
  3706. (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
  3707. }
  3708. function isSame (input, units) {
  3709. var localInput = isMoment(input) ? input : createLocal(input),
  3710. inputMs;
  3711. if (!(this.isValid() && localInput.isValid())) {
  3712. return false;
  3713. }
  3714. units = normalizeUnits(units) || 'millisecond';
  3715. if (units === 'millisecond') {
  3716. return this.valueOf() === localInput.valueOf();
  3717. } else {
  3718. inputMs = localInput.valueOf();
  3719. return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
  3720. }
  3721. }
  3722. function isSameOrAfter (input, units) {
  3723. return this.isSame(input, units) || this.isAfter(input, units);
  3724. }
  3725. function isSameOrBefore (input, units) {
  3726. return this.isSame(input, units) || this.isBefore(input, units);
  3727. }
  3728. function diff (input, units, asFloat) {
  3729. var that,
  3730. zoneDelta,
  3731. output;
  3732. if (!this.isValid()) {
  3733. return NaN;
  3734. }
  3735. that = cloneWithOffset(input, this);
  3736. if (!that.isValid()) {
  3737. return NaN;
  3738. }
  3739. zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  3740. units = normalizeUnits(units);
  3741. switch (units) {
  3742. case 'year': output = monthDiff(this, that) / 12; break;
  3743. case 'month': output = monthDiff(this, that); break;
  3744. case 'quarter': output = monthDiff(this, that) / 3; break;
  3745. case 'second': output = (this - that) / 1e3; break; // 1000
  3746. case 'minute': output = (this - that) / 6e4; break; // 1000 * 60
  3747. case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60
  3748. case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst
  3749. case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst
  3750. default: output = this - that;
  3751. }
  3752. return asFloat ? output : absFloor(output);
  3753. }
  3754. function monthDiff (a, b) {
  3755. // difference in months
  3756. var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
  3757. // b is in (anchor - 1 month, anchor + 1 month)
  3758. anchor = a.clone().add(wholeMonthDiff, 'months'),
  3759. anchor2, adjust;
  3760. if (b - anchor < 0) {
  3761. anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
  3762. // linear across the month
  3763. adjust = (b - anchor) / (anchor - anchor2);
  3764. } else {
  3765. anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
  3766. // linear across the month
  3767. adjust = (b - anchor) / (anchor2 - anchor);
  3768. }
  3769. //check for negative zero, return zero if negative zero
  3770. return -(wholeMonthDiff + adjust) || 0;
  3771. }
  3772. hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
  3773. hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
  3774. function toString () {
  3775. return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
  3776. }
  3777. function toISOString(keepOffset) {
  3778. if (!this.isValid()) {
  3779. return null;
  3780. }
  3781. var utc = keepOffset !== true;
  3782. var m = utc ? this.clone().utc() : this;
  3783. if (m.year() < 0 || m.year() > 9999) {
  3784. return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
  3785. }
  3786. if (isFunction(Date.prototype.toISOString)) {
  3787. // native implementation is ~50x faster, use it when we can
  3788. if (utc) {
  3789. return this.toDate().toISOString();
  3790. } else {
  3791. return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z'));
  3792. }
  3793. }
  3794. return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
  3795. }
  3796. /**
  3797. * Return a human readable representation of a moment that can
  3798. * also be evaluated to get a new moment which is the same
  3799. *
  3800. * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
  3801. */
  3802. function inspect () {
  3803. if (!this.isValid()) {
  3804. return 'moment.invalid(/* ' + this._i + ' */)';
  3805. }
  3806. var func = 'moment';
  3807. var zone = '';
  3808. if (!this.isLocal()) {
  3809. func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
  3810. zone = 'Z';
  3811. }
  3812. var prefix = '[' + func + '("]';
  3813. var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
  3814. var datetime = '-MM-DD[T]HH:mm:ss.SSS';
  3815. var suffix = zone + '[")]';
  3816. return this.format(prefix + year + datetime + suffix);
  3817. }
  3818. function format (inputString) {
  3819. if (!inputString) {
  3820. inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
  3821. }
  3822. var output = formatMoment(this, inputString);
  3823. return this.localeData().postformat(output);
  3824. }
  3825. function from (time, withoutSuffix) {
  3826. if (this.isValid() &&
  3827. ((isMoment(time) && time.isValid()) ||
  3828. createLocal(time).isValid())) {
  3829. return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
  3830. } else {
  3831. return this.localeData().invalidDate();
  3832. }
  3833. }
  3834. function fromNow (withoutSuffix) {
  3835. return this.from(createLocal(), withoutSuffix);
  3836. }
  3837. function to (time, withoutSuffix) {
  3838. if (this.isValid() &&
  3839. ((isMoment(time) && time.isValid()) ||
  3840. createLocal(time).isValid())) {
  3841. return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
  3842. } else {
  3843. return this.localeData().invalidDate();
  3844. }
  3845. }
  3846. function toNow (withoutSuffix) {
  3847. return this.to(createLocal(), withoutSuffix);
  3848. }
  3849. // If passed a locale key, it will set the locale for this
  3850. // instance. Otherwise, it will return the locale configuration
  3851. // variables for this instance.
  3852. function locale (key) {
  3853. var newLocaleData;
  3854. if (key === undefined) {
  3855. return this._locale._abbr;
  3856. } else {
  3857. newLocaleData = getLocale(key);
  3858. if (newLocaleData != null) {
  3859. this._locale = newLocaleData;
  3860. }
  3861. return this;
  3862. }
  3863. }
  3864. var lang = deprecate(
  3865. 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
  3866. function (key) {
  3867. if (key === undefined) {
  3868. return this.localeData();
  3869. } else {
  3870. return this.locale(key);
  3871. }
  3872. }
  3873. );
  3874. function localeData () {
  3875. return this._locale;
  3876. }
  3877. var MS_PER_SECOND = 1000;
  3878. var MS_PER_MINUTE = 60 * MS_PER_SECOND;
  3879. var MS_PER_HOUR = 60 * MS_PER_MINUTE;
  3880. var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
  3881. // actual modulo - handles negative numbers (for dates before 1970):
  3882. function mod$1(dividend, divisor) {
  3883. return (dividend % divisor + divisor) % divisor;
  3884. }
  3885. function localStartOfDate(y, m, d) {
  3886. // the date constructor remaps years 0-99 to 1900-1999
  3887. if (y < 100 && y >= 0) {
  3888. // preserve leap years using a full 400 year cycle, then reset
  3889. return new Date(y + 400, m, d) - MS_PER_400_YEARS;
  3890. } else {
  3891. return new Date(y, m, d).valueOf();
  3892. }
  3893. }
  3894. function utcStartOfDate(y, m, d) {
  3895. // Date.UTC remaps years 0-99 to 1900-1999
  3896. if (y < 100 && y >= 0) {
  3897. // preserve leap years using a full 400 year cycle, then reset
  3898. return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
  3899. } else {
  3900. return Date.UTC(y, m, d);
  3901. }
  3902. }
  3903. function startOf (units) {
  3904. var time;
  3905. units = normalizeUnits(units);
  3906. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  3907. return this;
  3908. }
  3909. var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  3910. switch (units) {
  3911. case 'year':
  3912. time = startOfDate(this.year(), 0, 1);
  3913. break;
  3914. case 'quarter':
  3915. time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
  3916. break;
  3917. case 'month':
  3918. time = startOfDate(this.year(), this.month(), 1);
  3919. break;
  3920. case 'week':
  3921. time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
  3922. break;
  3923. case 'isoWeek':
  3924. time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
  3925. break;
  3926. case 'day':
  3927. case 'date':
  3928. time = startOfDate(this.year(), this.month(), this.date());
  3929. break;
  3930. case 'hour':
  3931. time = this._d.valueOf();
  3932. time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
  3933. break;
  3934. case 'minute':
  3935. time = this._d.valueOf();
  3936. time -= mod$1(time, MS_PER_MINUTE);
  3937. break;
  3938. case 'second':
  3939. time = this._d.valueOf();
  3940. time -= mod$1(time, MS_PER_SECOND);
  3941. break;
  3942. }
  3943. this._d.setTime(time);
  3944. hooks.updateOffset(this, true);
  3945. return this;
  3946. }
  3947. function endOf (units) {
  3948. var time;
  3949. units = normalizeUnits(units);
  3950. if (units === undefined || units === 'millisecond' || !this.isValid()) {
  3951. return this;
  3952. }
  3953. var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  3954. switch (units) {
  3955. case 'year':
  3956. time = startOfDate(this.year() + 1, 0, 1) - 1;
  3957. break;
  3958. case 'quarter':
  3959. time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
  3960. break;
  3961. case 'month':
  3962. time = startOfDate(this.year(), this.month() + 1, 1) - 1;
  3963. break;
  3964. case 'week':
  3965. time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
  3966. break;
  3967. case 'isoWeek':
  3968. time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
  3969. break;
  3970. case 'day':
  3971. case 'date':
  3972. time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
  3973. break;
  3974. case 'hour':
  3975. time = this._d.valueOf();
  3976. time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
  3977. break;
  3978. case 'minute':
  3979. time = this._d.valueOf();
  3980. time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
  3981. break;
  3982. case 'second':
  3983. time = this._d.valueOf();
  3984. time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
  3985. break;
  3986. }
  3987. this._d.setTime(time);
  3988. hooks.updateOffset(this, true);
  3989. return this;
  3990. }
  3991. function valueOf () {
  3992. return this._d.valueOf() - ((this._offset || 0) * 60000);
  3993. }
  3994. function unix () {
  3995. return Math.floor(this.valueOf() / 1000);
  3996. }
  3997. function toDate () {
  3998. return new Date(this.valueOf());
  3999. }
  4000. function toArray () {
  4001. var m = this;
  4002. return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
  4003. }
  4004. function toObject () {
  4005. var m = this;
  4006. return {
  4007. years: m.year(),
  4008. months: m.month(),
  4009. date: m.date(),
  4010. hours: m.hours(),
  4011. minutes: m.minutes(),
  4012. seconds: m.seconds(),
  4013. milliseconds: m.milliseconds()
  4014. };
  4015. }
  4016. function toJSON () {
  4017. // new Date(NaN).toJSON() === null
  4018. return this.isValid() ? this.toISOString() : null;
  4019. }
  4020. function isValid$2 () {
  4021. return isValid(this);
  4022. }
  4023. function parsingFlags () {
  4024. return extend({}, getParsingFlags(this));
  4025. }
  4026. function invalidAt () {
  4027. return getParsingFlags(this).overflow;
  4028. }
  4029. function creationData() {
  4030. return {
  4031. input: this._i,
  4032. format: this._f,
  4033. locale: this._locale,
  4034. isUTC: this._isUTC,
  4035. strict: this._strict
  4036. };
  4037. }
  4038. // FORMATTING
  4039. addFormatToken(0, ['gg', 2], 0, function () {
  4040. return this.weekYear() % 100;
  4041. });
  4042. addFormatToken(0, ['GG', 2], 0, function () {
  4043. return this.isoWeekYear() % 100;
  4044. });
  4045. function addWeekYearFormatToken (token, getter) {
  4046. addFormatToken(0, [token, token.length], 0, getter);
  4047. }
  4048. addWeekYearFormatToken('gggg', 'weekYear');
  4049. addWeekYearFormatToken('ggggg', 'weekYear');
  4050. addWeekYearFormatToken('GGGG', 'isoWeekYear');
  4051. addWeekYearFormatToken('GGGGG', 'isoWeekYear');
  4052. // ALIASES
  4053. addUnitAlias('weekYear', 'gg');
  4054. addUnitAlias('isoWeekYear', 'GG');
  4055. // PRIORITY
  4056. addUnitPriority('weekYear', 1);
  4057. addUnitPriority('isoWeekYear', 1);
  4058. // PARSING
  4059. addRegexToken('G', matchSigned);
  4060. addRegexToken('g', matchSigned);
  4061. addRegexToken('GG', match1to2, match2);
  4062. addRegexToken('gg', match1to2, match2);
  4063. addRegexToken('GGGG', match1to4, match4);
  4064. addRegexToken('gggg', match1to4, match4);
  4065. addRegexToken('GGGGG', match1to6, match6);
  4066. addRegexToken('ggggg', match1to6, match6);
  4067. addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
  4068. week[token.substr(0, 2)] = toInt(input);
  4069. });
  4070. addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
  4071. week[token] = hooks.parseTwoDigitYear(input);
  4072. });
  4073. // MOMENTS
  4074. function getSetWeekYear (input) {
  4075. return getSetWeekYearHelper.call(this,
  4076. input,
  4077. this.week(),
  4078. this.weekday(),
  4079. this.localeData()._week.dow,
  4080. this.localeData()._week.doy);
  4081. }
  4082. function getSetISOWeekYear (input) {
  4083. return getSetWeekYearHelper.call(this,
  4084. input, this.isoWeek(), this.isoWeekday(), 1, 4);
  4085. }
  4086. function getISOWeeksInYear () {
  4087. return weeksInYear(this.year(), 1, 4);
  4088. }
  4089. function getWeeksInYear () {
  4090. var weekInfo = this.localeData()._week;
  4091. return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
  4092. }
  4093. function getSetWeekYearHelper(input, week, weekday, dow, doy) {
  4094. var weeksTarget;
  4095. if (input == null) {
  4096. return weekOfYear(this, dow, doy).year;
  4097. } else {
  4098. weeksTarget = weeksInYear(input, dow, doy);
  4099. if (week > weeksTarget) {
  4100. week = weeksTarget;
  4101. }
  4102. return setWeekAll.call(this, input, week, weekday, dow, doy);
  4103. }
  4104. }
  4105. function setWeekAll(weekYear, week, weekday, dow, doy) {
  4106. var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
  4107. date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  4108. this.year(date.getUTCFullYear());
  4109. this.month(date.getUTCMonth());
  4110. this.date(date.getUTCDate());
  4111. return this;
  4112. }
  4113. // FORMATTING
  4114. addFormatToken('Q', 0, 'Qo', 'quarter');
  4115. // ALIASES
  4116. addUnitAlias('quarter', 'Q');
  4117. // PRIORITY
  4118. addUnitPriority('quarter', 7);
  4119. // PARSING
  4120. addRegexToken('Q', match1);
  4121. addParseToken('Q', function (input, array) {
  4122. array[MONTH] = (toInt(input) - 1) * 3;
  4123. });
  4124. // MOMENTS
  4125. function getSetQuarter (input) {
  4126. return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
  4127. }
  4128. // FORMATTING
  4129. addFormatToken('D', ['DD', 2], 'Do', 'date');
  4130. // ALIASES
  4131. addUnitAlias('date', 'D');
  4132. // PRIORITY
  4133. addUnitPriority('date', 9);
  4134. // PARSING
  4135. addRegexToken('D', match1to2);
  4136. addRegexToken('DD', match1to2, match2);
  4137. addRegexToken('Do', function (isStrict, locale) {
  4138. // TODO: Remove "ordinalParse" fallback in next major release.
  4139. return isStrict ?
  4140. (locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
  4141. locale._dayOfMonthOrdinalParseLenient;
  4142. });
  4143. addParseToken(['D', 'DD'], DATE);
  4144. addParseToken('Do', function (input, array) {
  4145. array[DATE] = toInt(input.match(match1to2)[0]);
  4146. });
  4147. // MOMENTS
  4148. var getSetDayOfMonth = makeGetSet('Date', true);
  4149. // FORMATTING
  4150. addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
  4151. // ALIASES
  4152. addUnitAlias('dayOfYear', 'DDD');
  4153. // PRIORITY
  4154. addUnitPriority('dayOfYear', 4);
  4155. // PARSING
  4156. addRegexToken('DDD', match1to3);
  4157. addRegexToken('DDDD', match3);
  4158. addParseToken(['DDD', 'DDDD'], function (input, array, config) {
  4159. config._dayOfYear = toInt(input);
  4160. });
  4161. // HELPERS
  4162. // MOMENTS
  4163. function getSetDayOfYear (input) {
  4164. var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
  4165. return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
  4166. }
  4167. // FORMATTING
  4168. addFormatToken('m', ['mm', 2], 0, 'minute');
  4169. // ALIASES
  4170. addUnitAlias('minute', 'm');
  4171. // PRIORITY
  4172. addUnitPriority('minute', 14);
  4173. // PARSING
  4174. addRegexToken('m', match1to2);
  4175. addRegexToken('mm', match1to2, match2);
  4176. addParseToken(['m', 'mm'], MINUTE);
  4177. // MOMENTS
  4178. var getSetMinute = makeGetSet('Minutes', false);
  4179. // FORMATTING
  4180. addFormatToken('s', ['ss', 2], 0, 'second');
  4181. // ALIASES
  4182. addUnitAlias('second', 's');
  4183. // PRIORITY
  4184. addUnitPriority('second', 15);
  4185. // PARSING
  4186. addRegexToken('s', match1to2);
  4187. addRegexToken('ss', match1to2, match2);
  4188. addParseToken(['s', 'ss'], SECOND);
  4189. // MOMENTS
  4190. var getSetSecond = makeGetSet('Seconds', false);
  4191. // FORMATTING
  4192. addFormatToken('S', 0, 0, function () {
  4193. return ~~(this.millisecond() / 100);
  4194. });
  4195. addFormatToken(0, ['SS', 2], 0, function () {
  4196. return ~~(this.millisecond() / 10);
  4197. });
  4198. addFormatToken(0, ['SSS', 3], 0, 'millisecond');
  4199. addFormatToken(0, ['SSSS', 4], 0, function () {
  4200. return this.millisecond() * 10;
  4201. });
  4202. addFormatToken(0, ['SSSSS', 5], 0, function () {
  4203. return this.millisecond() * 100;
  4204. });
  4205. addFormatToken(0, ['SSSSSS', 6], 0, function () {
  4206. return this.millisecond() * 1000;
  4207. });
  4208. addFormatToken(0, ['SSSSSSS', 7], 0, function () {
  4209. return this.millisecond() * 10000;
  4210. });
  4211. addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
  4212. return this.millisecond() * 100000;
  4213. });
  4214. addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
  4215. return this.millisecond() * 1000000;
  4216. });
  4217. // ALIASES
  4218. addUnitAlias('millisecond', 'ms');
  4219. // PRIORITY
  4220. addUnitPriority('millisecond', 16);
  4221. // PARSING
  4222. addRegexToken('S', match1to3, match1);
  4223. addRegexToken('SS', match1to3, match2);
  4224. addRegexToken('SSS', match1to3, match3);
  4225. var token;
  4226. for (token = 'SSSS'; token.length <= 9; token += 'S') {
  4227. addRegexToken(token, matchUnsigned);
  4228. }
  4229. function parseMs(input, array) {
  4230. array[MILLISECOND] = toInt(('0.' + input) * 1000);
  4231. }
  4232. for (token = 'S'; token.length <= 9; token += 'S') {
  4233. addParseToken(token, parseMs);
  4234. }
  4235. // MOMENTS
  4236. var getSetMillisecond = makeGetSet('Milliseconds', false);
  4237. // FORMATTING
  4238. addFormatToken('z', 0, 0, 'zoneAbbr');
  4239. addFormatToken('zz', 0, 0, 'zoneName');
  4240. // MOMENTS
  4241. function getZoneAbbr () {
  4242. return this._isUTC ? 'UTC' : '';
  4243. }
  4244. function getZoneName () {
  4245. return this._isUTC ? 'Coordinated Universal Time' : '';
  4246. }
  4247. var proto = Moment.prototype;
  4248. proto.add = add;
  4249. proto.calendar = calendar$1;
  4250. proto.clone = clone;
  4251. proto.diff = diff;
  4252. proto.endOf = endOf;
  4253. proto.format = format;
  4254. proto.from = from;
  4255. proto.fromNow = fromNow;
  4256. proto.to = to;
  4257. proto.toNow = toNow;
  4258. proto.get = stringGet;
  4259. proto.invalidAt = invalidAt;
  4260. proto.isAfter = isAfter;
  4261. proto.isBefore = isBefore;
  4262. proto.isBetween = isBetween;
  4263. proto.isSame = isSame;
  4264. proto.isSameOrAfter = isSameOrAfter;
  4265. proto.isSameOrBefore = isSameOrBefore;
  4266. proto.isValid = isValid$2;
  4267. proto.lang = lang;
  4268. proto.locale = locale;
  4269. proto.localeData = localeData;
  4270. proto.max = prototypeMax;
  4271. proto.min = prototypeMin;
  4272. proto.parsingFlags = parsingFlags;
  4273. proto.set = stringSet;
  4274. proto.startOf = startOf;
  4275. proto.subtract = subtract;
  4276. proto.toArray = toArray;
  4277. proto.toObject = toObject;
  4278. proto.toDate = toDate;
  4279. proto.toISOString = toISOString;
  4280. proto.inspect = inspect;
  4281. proto.toJSON = toJSON;
  4282. proto.toString = toString;
  4283. proto.unix = unix;
  4284. proto.valueOf = valueOf;
  4285. proto.creationData = creationData;
  4286. proto.year = getSetYear;
  4287. proto.isLeapYear = getIsLeapYear;
  4288. proto.weekYear = getSetWeekYear;
  4289. proto.isoWeekYear = getSetISOWeekYear;
  4290. proto.quarter = proto.quarters = getSetQuarter;
  4291. proto.month = getSetMonth;
  4292. proto.daysInMonth = getDaysInMonth;
  4293. proto.week = proto.weeks = getSetWeek;
  4294. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  4295. proto.weeksInYear = getWeeksInYear;
  4296. proto.isoWeeksInYear = getISOWeeksInYear;
  4297. proto.date = getSetDayOfMonth;
  4298. proto.day = proto.days = getSetDayOfWeek;
  4299. proto.weekday = getSetLocaleDayOfWeek;
  4300. proto.isoWeekday = getSetISODayOfWeek;
  4301. proto.dayOfYear = getSetDayOfYear;
  4302. proto.hour = proto.hours = getSetHour;
  4303. proto.minute = proto.minutes = getSetMinute;
  4304. proto.second = proto.seconds = getSetSecond;
  4305. proto.millisecond = proto.milliseconds = getSetMillisecond;
  4306. proto.utcOffset = getSetOffset;
  4307. proto.utc = setOffsetToUTC;
  4308. proto.local = setOffsetToLocal;
  4309. proto.parseZone = setOffsetToParsedOffset;
  4310. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  4311. proto.isDST = isDaylightSavingTime;
  4312. proto.isLocal = isLocal;
  4313. proto.isUtcOffset = isUtcOffset;
  4314. proto.isUtc = isUtc;
  4315. proto.isUTC = isUtc;
  4316. proto.zoneAbbr = getZoneAbbr;
  4317. proto.zoneName = getZoneName;
  4318. proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
  4319. proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
  4320. proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
  4321. proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
  4322. proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
  4323. function createUnix (input) {
  4324. return createLocal(input * 1000);
  4325. }
  4326. function createInZone () {
  4327. return createLocal.apply(null, arguments).parseZone();
  4328. }
  4329. function preParsePostFormat (string) {
  4330. return string;
  4331. }
  4332. var proto$1 = Locale.prototype;
  4333. proto$1.calendar = calendar;
  4334. proto$1.longDateFormat = longDateFormat;
  4335. proto$1.invalidDate = invalidDate;
  4336. proto$1.ordinal = ordinal;
  4337. proto$1.preparse = preParsePostFormat;
  4338. proto$1.postformat = preParsePostFormat;
  4339. proto$1.relativeTime = relativeTime;
  4340. proto$1.pastFuture = pastFuture;
  4341. proto$1.set = set;
  4342. proto$1.months = localeMonths;
  4343. proto$1.monthsShort = localeMonthsShort;
  4344. proto$1.monthsParse = localeMonthsParse;
  4345. proto$1.monthsRegex = monthsRegex;
  4346. proto$1.monthsShortRegex = monthsShortRegex;
  4347. proto$1.week = localeWeek;
  4348. proto$1.firstDayOfYear = localeFirstDayOfYear;
  4349. proto$1.firstDayOfWeek = localeFirstDayOfWeek;
  4350. proto$1.weekdays = localeWeekdays;
  4351. proto$1.weekdaysMin = localeWeekdaysMin;
  4352. proto$1.weekdaysShort = localeWeekdaysShort;
  4353. proto$1.weekdaysParse = localeWeekdaysParse;
  4354. proto$1.weekdaysRegex = weekdaysRegex;
  4355. proto$1.weekdaysShortRegex = weekdaysShortRegex;
  4356. proto$1.weekdaysMinRegex = weekdaysMinRegex;
  4357. proto$1.isPM = localeIsPM;
  4358. proto$1.meridiem = localeMeridiem;
  4359. function get$1 (format, index, field, setter) {
  4360. var locale = getLocale();
  4361. var utc = createUTC().set(setter, index);
  4362. return locale[field](utc, format);
  4363. }
  4364. function listMonthsImpl (format, index, field) {
  4365. if (isNumber(format)) {
  4366. index = format;
  4367. format = undefined;
  4368. }
  4369. format = format || '';
  4370. if (index != null) {
  4371. return get$1(format, index, field, 'month');
  4372. }
  4373. var i;
  4374. var out = [];
  4375. for (i = 0; i < 12; i++) {
  4376. out[i] = get$1(format, i, field, 'month');
  4377. }
  4378. return out;
  4379. }
  4380. // ()
  4381. // (5)
  4382. // (fmt, 5)
  4383. // (fmt)
  4384. // (true)
  4385. // (true, 5)
  4386. // (true, fmt, 5)
  4387. // (true, fmt)
  4388. function listWeekdaysImpl (localeSorted, format, index, field) {
  4389. if (typeof localeSorted === 'boolean') {
  4390. if (isNumber(format)) {
  4391. index = format;
  4392. format = undefined;
  4393. }
  4394. format = format || '';
  4395. } else {
  4396. format = localeSorted;
  4397. index = format;
  4398. localeSorted = false;
  4399. if (isNumber(format)) {
  4400. index = format;
  4401. format = undefined;
  4402. }
  4403. format = format || '';
  4404. }
  4405. var locale = getLocale(),
  4406. shift = localeSorted ? locale._week.dow : 0;
  4407. if (index != null) {
  4408. return get$1(format, (index + shift) % 7, field, 'day');
  4409. }
  4410. var i;
  4411. var out = [];
  4412. for (i = 0; i < 7; i++) {
  4413. out[i] = get$1(format, (i + shift) % 7, field, 'day');
  4414. }
  4415. return out;
  4416. }
  4417. function listMonths (format, index) {
  4418. return listMonthsImpl(format, index, 'months');
  4419. }
  4420. function listMonthsShort (format, index) {
  4421. return listMonthsImpl(format, index, 'monthsShort');
  4422. }
  4423. function listWeekdays (localeSorted, format, index) {
  4424. return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
  4425. }
  4426. function listWeekdaysShort (localeSorted, format, index) {
  4427. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
  4428. }
  4429. function listWeekdaysMin (localeSorted, format, index) {
  4430. return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
  4431. }
  4432. getSetGlobalLocale('en', {
  4433. dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  4434. ordinal : function (number) {
  4435. var b = number % 10,
  4436. output = (toInt(number % 100 / 10) === 1) ? 'th' :
  4437. (b === 1) ? 'st' :
  4438. (b === 2) ? 'nd' :
  4439. (b === 3) ? 'rd' : 'th';
  4440. return number + output;
  4441. }
  4442. });
  4443. // Side effect imports
  4444. hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
  4445. hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
  4446. var mathAbs = Math.abs;
  4447. function abs () {
  4448. var data = this._data;
  4449. this._milliseconds = mathAbs(this._milliseconds);
  4450. this._days = mathAbs(this._days);
  4451. this._months = mathAbs(this._months);
  4452. data.milliseconds = mathAbs(data.milliseconds);
  4453. data.seconds = mathAbs(data.seconds);
  4454. data.minutes = mathAbs(data.minutes);
  4455. data.hours = mathAbs(data.hours);
  4456. data.months = mathAbs(data.months);
  4457. data.years = mathAbs(data.years);
  4458. return this;
  4459. }
  4460. function addSubtract$1 (duration, input, value, direction) {
  4461. var other = createDuration(input, value);
  4462. duration._milliseconds += direction * other._milliseconds;
  4463. duration._days += direction * other._days;
  4464. duration._months += direction * other._months;
  4465. return duration._bubble();
  4466. }
  4467. // supports only 2.0-style add(1, 's') or add(duration)
  4468. function add$1 (input, value) {
  4469. return addSubtract$1(this, input, value, 1);
  4470. }
  4471. // supports only 2.0-style subtract(1, 's') or subtract(duration)
  4472. function subtract$1 (input, value) {
  4473. return addSubtract$1(this, input, value, -1);
  4474. }
  4475. function absCeil (number) {
  4476. if (number < 0) {
  4477. return Math.floor(number);
  4478. } else {
  4479. return Math.ceil(number);
  4480. }
  4481. }
  4482. function bubble () {
  4483. var milliseconds = this._milliseconds;
  4484. var days = this._days;
  4485. var months = this._months;
  4486. var data = this._data;
  4487. var seconds, minutes, hours, years, monthsFromDays;
  4488. // if we have a mix of positive and negative values, bubble down first
  4489. // check: https://github.com/moment/moment/issues/2166
  4490. if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
  4491. (milliseconds <= 0 && days <= 0 && months <= 0))) {
  4492. milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
  4493. days = 0;
  4494. months = 0;
  4495. }
  4496. // The following code bubbles up values, see the tests for
  4497. // examples of what that means.
  4498. data.milliseconds = milliseconds % 1000;
  4499. seconds = absFloor(milliseconds / 1000);
  4500. data.seconds = seconds % 60;
  4501. minutes = absFloor(seconds / 60);
  4502. data.minutes = minutes % 60;
  4503. hours = absFloor(minutes / 60);
  4504. data.hours = hours % 24;
  4505. days += absFloor(hours / 24);
  4506. // convert days to months
  4507. monthsFromDays = absFloor(daysToMonths(days));
  4508. months += monthsFromDays;
  4509. days -= absCeil(monthsToDays(monthsFromDays));
  4510. // 12 months -> 1 year
  4511. years = absFloor(months / 12);
  4512. months %= 12;
  4513. data.days = days;
  4514. data.months = months;
  4515. data.years = years;
  4516. return this;
  4517. }
  4518. function daysToMonths (days) {
  4519. // 400 years have 146097 days (taking into account leap year rules)
  4520. // 400 years have 12 months === 4800
  4521. return days * 4800 / 146097;
  4522. }
  4523. function monthsToDays (months) {
  4524. // the reverse of daysToMonths
  4525. return months * 146097 / 4800;
  4526. }
  4527. function as (units) {
  4528. if (!this.isValid()) {
  4529. return NaN;
  4530. }
  4531. var days;
  4532. var months;
  4533. var milliseconds = this._milliseconds;
  4534. units = normalizeUnits(units);
  4535. if (units === 'month' || units === 'quarter' || units === 'year') {
  4536. days = this._days + milliseconds / 864e5;
  4537. months = this._months + daysToMonths(days);
  4538. switch (units) {
  4539. case 'month': return months;
  4540. case 'quarter': return months / 3;
  4541. case 'year': return months / 12;
  4542. }
  4543. } else {
  4544. // handle milliseconds separately because of floating point math errors (issue #1867)
  4545. days = this._days + Math.round(monthsToDays(this._months));
  4546. switch (units) {
  4547. case 'week' : return days / 7 + milliseconds / 6048e5;
  4548. case 'day' : return days + milliseconds / 864e5;
  4549. case 'hour' : return days * 24 + milliseconds / 36e5;
  4550. case 'minute' : return days * 1440 + milliseconds / 6e4;
  4551. case 'second' : return days * 86400 + milliseconds / 1000;
  4552. // Math.floor prevents floating point math errors here
  4553. case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
  4554. default: throw new Error('Unknown unit ' + units);
  4555. }
  4556. }
  4557. }
  4558. // TODO: Use this.as('ms')?
  4559. function valueOf$1 () {
  4560. if (!this.isValid()) {
  4561. return NaN;
  4562. }
  4563. return (
  4564. this._milliseconds +
  4565. this._days * 864e5 +
  4566. (this._months % 12) * 2592e6 +
  4567. toInt(this._months / 12) * 31536e6
  4568. );
  4569. }
  4570. function makeAs (alias) {
  4571. return function () {
  4572. return this.as(alias);
  4573. };
  4574. }
  4575. var asMilliseconds = makeAs('ms');
  4576. var asSeconds = makeAs('s');
  4577. var asMinutes = makeAs('m');
  4578. var asHours = makeAs('h');
  4579. var asDays = makeAs('d');
  4580. var asWeeks = makeAs('w');
  4581. var asMonths = makeAs('M');
  4582. var asQuarters = makeAs('Q');
  4583. var asYears = makeAs('y');
  4584. function clone$1 () {
  4585. return createDuration(this);
  4586. }
  4587. function get$2 (units) {
  4588. units = normalizeUnits(units);
  4589. return this.isValid() ? this[units + 's']() : NaN;
  4590. }
  4591. function makeGetter(name) {
  4592. return function () {
  4593. return this.isValid() ? this._data[name] : NaN;
  4594. };
  4595. }
  4596. var milliseconds = makeGetter('milliseconds');
  4597. var seconds = makeGetter('seconds');
  4598. var minutes = makeGetter('minutes');
  4599. var hours = makeGetter('hours');
  4600. var days = makeGetter('days');
  4601. var months = makeGetter('months');
  4602. var years = makeGetter('years');
  4603. function weeks () {
  4604. return absFloor(this.days() / 7);
  4605. }
  4606. var round = Math.round;
  4607. var thresholds = {
  4608. ss: 44, // a few seconds to seconds
  4609. s : 45, // seconds to minute
  4610. m : 45, // minutes to hour
  4611. h : 22, // hours to day
  4612. d : 26, // days to month
  4613. M : 11 // months to year
  4614. };
  4615. // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
  4616. function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
  4617. return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
  4618. }
  4619. function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
  4620. var duration = createDuration(posNegDuration).abs();
  4621. var seconds = round(duration.as('s'));
  4622. var minutes = round(duration.as('m'));
  4623. var hours = round(duration.as('h'));
  4624. var days = round(duration.as('d'));
  4625. var months = round(duration.as('M'));
  4626. var years = round(duration.as('y'));
  4627. var a = seconds <= thresholds.ss && ['s', seconds] ||
  4628. seconds < thresholds.s && ['ss', seconds] ||
  4629. minutes <= 1 && ['m'] ||
  4630. minutes < thresholds.m && ['mm', minutes] ||
  4631. hours <= 1 && ['h'] ||
  4632. hours < thresholds.h && ['hh', hours] ||
  4633. days <= 1 && ['d'] ||
  4634. days < thresholds.d && ['dd', days] ||
  4635. months <= 1 && ['M'] ||
  4636. months < thresholds.M && ['MM', months] ||
  4637. years <= 1 && ['y'] || ['yy', years];
  4638. a[2] = withoutSuffix;
  4639. a[3] = +posNegDuration > 0;
  4640. a[4] = locale;
  4641. return substituteTimeAgo.apply(null, a);
  4642. }
  4643. // This function allows you to set the rounding function for relative time strings
  4644. function getSetRelativeTimeRounding (roundingFunction) {
  4645. if (roundingFunction === undefined) {
  4646. return round;
  4647. }
  4648. if (typeof(roundingFunction) === 'function') {
  4649. round = roundingFunction;
  4650. return true;
  4651. }
  4652. return false;
  4653. }
  4654. // This function allows you to set a threshold for relative time strings
  4655. function getSetRelativeTimeThreshold (threshold, limit) {
  4656. if (thresholds[threshold] === undefined) {
  4657. return false;
  4658. }
  4659. if (limit === undefined) {
  4660. return thresholds[threshold];
  4661. }
  4662. thresholds[threshold] = limit;
  4663. if (threshold === 's') {
  4664. thresholds.ss = limit - 1;
  4665. }
  4666. return true;
  4667. }
  4668. function humanize (withSuffix) {
  4669. if (!this.isValid()) {
  4670. return this.localeData().invalidDate();
  4671. }
  4672. var locale = this.localeData();
  4673. var output = relativeTime$1(this, !withSuffix, locale);
  4674. if (withSuffix) {
  4675. output = locale.pastFuture(+this, output);
  4676. }
  4677. return locale.postformat(output);
  4678. }
  4679. var abs$1 = Math.abs;
  4680. function sign(x) {
  4681. return ((x > 0) - (x < 0)) || +x;
  4682. }
  4683. function toISOString$1() {
  4684. // for ISO strings we do not use the normal bubbling rules:
  4685. // * milliseconds bubble up until they become hours
  4686. // * days do not bubble at all
  4687. // * months bubble up until they become years
  4688. // This is because there is no context-free conversion between hours and days
  4689. // (think of clock changes)
  4690. // and also not between days and months (28-31 days per month)
  4691. if (!this.isValid()) {
  4692. return this.localeData().invalidDate();
  4693. }
  4694. var seconds = abs$1(this._milliseconds) / 1000;
  4695. var days = abs$1(this._days);
  4696. var months = abs$1(this._months);
  4697. var minutes, hours, years;
  4698. // 3600 seconds -> 60 minutes -> 1 hour
  4699. minutes = absFloor(seconds / 60);
  4700. hours = absFloor(minutes / 60);
  4701. seconds %= 60;
  4702. minutes %= 60;
  4703. // 12 months -> 1 year
  4704. years = absFloor(months / 12);
  4705. months %= 12;
  4706. // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
  4707. var Y = years;
  4708. var M = months;
  4709. var D = days;
  4710. var h = hours;
  4711. var m = minutes;
  4712. var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
  4713. var total = this.asSeconds();
  4714. if (!total) {
  4715. // this is the same as C#'s (Noda) and python (isodate)...
  4716. // but not other JS (goog.date)
  4717. return 'P0D';
  4718. }
  4719. var totalSign = total < 0 ? '-' : '';
  4720. var ymSign = sign(this._months) !== sign(total) ? '-' : '';
  4721. var daysSign = sign(this._days) !== sign(total) ? '-' : '';
  4722. var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
  4723. return totalSign + 'P' +
  4724. (Y ? ymSign + Y + 'Y' : '') +
  4725. (M ? ymSign + M + 'M' : '') +
  4726. (D ? daysSign + D + 'D' : '') +
  4727. ((h || m || s) ? 'T' : '') +
  4728. (h ? hmsSign + h + 'H' : '') +
  4729. (m ? hmsSign + m + 'M' : '') +
  4730. (s ? hmsSign + s + 'S' : '');
  4731. }
  4732. var proto$2 = Duration.prototype;
  4733. proto$2.isValid = isValid$1;
  4734. proto$2.abs = abs;
  4735. proto$2.add = add$1;
  4736. proto$2.subtract = subtract$1;
  4737. proto$2.as = as;
  4738. proto$2.asMilliseconds = asMilliseconds;
  4739. proto$2.asSeconds = asSeconds;
  4740. proto$2.asMinutes = asMinutes;
  4741. proto$2.asHours = asHours;
  4742. proto$2.asDays = asDays;
  4743. proto$2.asWeeks = asWeeks;
  4744. proto$2.asMonths = asMonths;
  4745. proto$2.asQuarters = asQuarters;
  4746. proto$2.asYears = asYears;
  4747. proto$2.valueOf = valueOf$1;
  4748. proto$2._bubble = bubble;
  4749. proto$2.clone = clone$1;
  4750. proto$2.get = get$2;
  4751. proto$2.milliseconds = milliseconds;
  4752. proto$2.seconds = seconds;
  4753. proto$2.minutes = minutes;
  4754. proto$2.hours = hours;
  4755. proto$2.days = days;
  4756. proto$2.weeks = weeks;
  4757. proto$2.months = months;
  4758. proto$2.years = years;
  4759. proto$2.humanize = humanize;
  4760. proto$2.toISOString = toISOString$1;
  4761. proto$2.toString = toISOString$1;
  4762. proto$2.toJSON = toISOString$1;
  4763. proto$2.locale = locale;
  4764. proto$2.localeData = localeData;
  4765. proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
  4766. proto$2.lang = lang;
  4767. // Side effect imports
  4768. // FORMATTING
  4769. addFormatToken('X', 0, 0, 'unix');
  4770. addFormatToken('x', 0, 0, 'valueOf');
  4771. // PARSING
  4772. addRegexToken('x', matchSigned);
  4773. addRegexToken('X', matchTimestamp);
  4774. addParseToken('X', function (input, array, config) {
  4775. config._d = new Date(parseFloat(input, 10) * 1000);
  4776. });
  4777. addParseToken('x', function (input, array, config) {
  4778. config._d = new Date(toInt(input));
  4779. });
  4780. // Side effect imports
  4781. hooks.version = '2.24.0';
  4782. setHookCallback(createLocal);
  4783. hooks.fn = proto;
  4784. hooks.min = min;
  4785. hooks.max = max;
  4786. hooks.now = now;
  4787. hooks.utc = createUTC;
  4788. hooks.unix = createUnix;
  4789. hooks.months = listMonths;
  4790. hooks.isDate = isDate;
  4791. hooks.locale = getSetGlobalLocale;
  4792. hooks.invalid = createInvalid;
  4793. hooks.duration = createDuration;
  4794. hooks.isMoment = isMoment;
  4795. hooks.weekdays = listWeekdays;
  4796. hooks.parseZone = createInZone;
  4797. hooks.localeData = getLocale;
  4798. hooks.isDuration = isDuration;
  4799. hooks.monthsShort = listMonthsShort;
  4800. hooks.weekdaysMin = listWeekdaysMin;
  4801. hooks.defineLocale = defineLocale;
  4802. hooks.updateLocale = updateLocale;
  4803. hooks.locales = listLocales;
  4804. hooks.weekdaysShort = listWeekdaysShort;
  4805. hooks.normalizeUnits = normalizeUnits;
  4806. hooks.relativeTimeRounding = getSetRelativeTimeRounding;
  4807. hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
  4808. hooks.calendarFormat = getCalendarFormat;
  4809. hooks.prototype = proto;
  4810. // currently HTML5 input type only supports 24-hour formats
  4811. hooks.HTML5_FMT = {
  4812. DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
  4813. DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
  4814. DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
  4815. DATE: 'YYYY-MM-DD', // <input type="date" />
  4816. TIME: 'HH:mm', // <input type="time" />
  4817. TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
  4818. TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
  4819. WEEK: 'GGGG-[W]WW', // <input type="week" />
  4820. MONTH: 'YYYY-MM' // <input type="month" />
  4821. };
  4822. return hooks;
  4823. })));
  4824. define('moment', ['moment/moment'], function (main) { return main; });
  4825. define('backend',['fast', 'template', 'moment'], function (Fast, Template, Moment) {
  4826. var Backend = {
  4827. api: {
  4828. sidebar: function (params) {
  4829. colorArr = ['red', 'green', 'yellow', 'blue', 'teal', 'orange', 'purple'];
  4830. $colorNums = colorArr.length;
  4831. badgeList = {};
  4832. $.each(params, function (k, v) {
  4833. $url = Fast.api.fixurl(k);
  4834. if ($.isArray(v)) {
  4835. $nums = typeof v[0] !== 'undefined' ? v[0] : 0;
  4836. $color = typeof v[1] !== 'undefined' ? v[1] : colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  4837. $class = typeof v[2] !== 'undefined' ? v[2] : 'label';
  4838. } else {
  4839. $nums = v;
  4840. $color = colorArr[(!isNaN($nums) ? $nums : $nums.length) % $colorNums];
  4841. $class = 'label';
  4842. }
  4843. //必须nums大于0才显示
  4844. badgeList[$url] = $nums > 0 ? '<small class="' + $class + ' pull-right bg-' + $color + '">' + $nums + '</small>' : '';
  4845. });
  4846. $.each(badgeList, function (k, v) {
  4847. var anchor = top.window.$("li a[addtabs][url='" + k + "']");
  4848. if (anchor) {
  4849. top.window.$(".pull-right-container", anchor).html(v);
  4850. top.window.$(".nav-addtabs li a[node-id='" + anchor.attr("addtabs") + "'] .pull-right-container").html(v);
  4851. }
  4852. });
  4853. },
  4854. addtabs: function (url, title, icon) {
  4855. var dom = "a[url='{url}']"
  4856. var leftlink = top.window.$(dom.replace(/\{url\}/, url));
  4857. if (leftlink.size() > 0) {
  4858. leftlink.trigger("click");
  4859. } else {
  4860. url = Fast.api.fixurl(url);
  4861. leftlink = top.window.$(dom.replace(/\{url\}/, url));
  4862. if (leftlink.size() > 0) {
  4863. var event = leftlink.parent().hasClass("active") ? "dblclick" : "click";
  4864. leftlink.trigger(event);
  4865. } else {
  4866. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  4867. leftlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  4868. //能找到相对地址
  4869. if (leftlink.size() > 0) {
  4870. icon = typeof icon !== 'undefined' ? icon : leftlink.find("i").attr("class");
  4871. title = typeof title !== 'undefined' ? title : leftlink.find("span:first").text();
  4872. leftlink.trigger("fa.event.toggleitem");
  4873. }
  4874. var navnode = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  4875. if (navnode.size() > 0) {
  4876. navnode.trigger("click");
  4877. } else {
  4878. //追加新的tab
  4879. var id = Math.floor(new Date().valueOf() * Math.random());
  4880. icon = typeof icon !== 'undefined' ? icon : 'fa fa-circle-o';
  4881. title = typeof title !== 'undefined' ? title : '';
  4882. top.window.$("<a />").append('<i class="' + icon + '"></i> <span>' + title + '</span>').prop("href", url).attr({
  4883. url: url,
  4884. addtabs: id
  4885. }).addClass("hide").appendTo(top.window.document.body).trigger("click");
  4886. }
  4887. }
  4888. }
  4889. },
  4890. closetabs: function (url) {
  4891. if (typeof url === 'undefined') {
  4892. top.window.$("ul.nav-addtabs li.active .close-tab").trigger("click");
  4893. } else {
  4894. var dom = "a[url='{url}']"
  4895. var navlink = top.window.$(dom.replace(/\{url\}/, url));
  4896. if (navlink.size() === 0) {
  4897. url = Fast.api.fixurl(url);
  4898. navlink = top.window.$(dom.replace(/\{url\}/, url));
  4899. if (navlink.size() === 0) {
  4900. } else {
  4901. var baseurl = url.substr(0, url.indexOf("?") > -1 ? url.indexOf("?") : url.length);
  4902. navlink = top.window.$(dom.replace(/\{url\}/, baseurl));
  4903. //能找到相对地址
  4904. if (navlink.size() === 0) {
  4905. navlink = top.window.$(".nav-tabs ul li a[node-url='" + url + "']");
  4906. }
  4907. }
  4908. }
  4909. if (navlink.size() > 0 && navlink.attr('addtabs')) {
  4910. top.window.$("ul.nav-addtabs li#tab_" + navlink.attr('addtabs') + " .close-tab").trigger("click");
  4911. }
  4912. }
  4913. },
  4914. replaceids: function (elem, url) {
  4915. //如果有需要替换ids的
  4916. if (url.indexOf("{ids}") > -1) {
  4917. var ids = 0;
  4918. var tableId = $(elem).data("table-id");
  4919. if (tableId && $("#" + tableId).size() > 0 && $("#" + tableId).data("bootstrap.table")) {
  4920. var Table = require("table");
  4921. ids = Table.api.selectedids($("#" + tableId)).join(",");
  4922. }
  4923. url = url.replace(/\{ids\}/g, ids);
  4924. }
  4925. return url;
  4926. },
  4927. refreshmenu: function () {
  4928. top.window.$(".sidebar-menu").trigger("refresh");
  4929. },
  4930. gettablecolumnbutton: function (options) {
  4931. if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') {
  4932. var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions');
  4933. if (tableOptions) {
  4934. var columnObj = null;
  4935. $.each(tableOptions.columns, function (i, columns) {
  4936. $.each(columns, function (j, column) {
  4937. if (typeof column.fieldIndex !== 'undefined' && column.fieldIndex === options.fieldIndex) {
  4938. columnObj = column;
  4939. return false;
  4940. }
  4941. });
  4942. if (columnObj) {
  4943. return false;
  4944. }
  4945. });
  4946. if (columnObj) {
  4947. return columnObj['buttons'][options.buttonIndex];
  4948. }
  4949. }
  4950. }
  4951. return null;
  4952. },
  4953. },
  4954. init: function () {
  4955. //公共代码
  4956. //添加ios-fix兼容iOS下的iframe
  4957. if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
  4958. $("html").addClass("ios-fix");
  4959. }
  4960. //配置Toastr的参数
  4961. Toastr.options.positionClass = Config.controllername === 'index' ? "toast-top-right-index" : "toast-top-right";
  4962. //点击包含.btn-dialog的元素时弹出dialog
  4963. $(document).on('click', '.btn-dialog,.dialogit', function (e) {
  4964. var that = this;
  4965. var options = $.extend({}, $(that).data() || {});
  4966. var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
  4967. var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
  4968. var button = Backend.api.gettablecolumnbutton(options);
  4969. if (button && typeof button.callback === 'function') {
  4970. options.callback = button.callback;
  4971. }
  4972. if (typeof options.confirm !== 'undefined') {
  4973. Layer.confirm(options.confirm, function (index) {
  4974. Backend.api.open(url, title, options);
  4975. Layer.close(index);
  4976. });
  4977. } else {
  4978. window[$(that).data("window") || 'self'].Backend.api.open(url, title, options);
  4979. }
  4980. return false;
  4981. });
  4982. //点击包含.btn-addtabs的元素时新增选项卡
  4983. $(document).on('click', '.btn-addtabs,.addtabsit', function (e) {
  4984. var that = this;
  4985. var options = $.extend({}, $(that).data() || {});
  4986. var url = Backend.api.replaceids(that, $(that).data("url") || $(that).attr('href'));
  4987. var title = $(that).attr("title") || $(that).data("title") || $(that).data('original-title');
  4988. var icon = $(that).attr("icon") || $(that).data("icon");
  4989. if (typeof options.confirm !== 'undefined') {
  4990. Layer.confirm(options.confirm, function (index) {
  4991. Backend.api.addtabs(url, title, icon);
  4992. Layer.close(index);
  4993. });
  4994. } else {
  4995. Backend.api.addtabs(url, title, icon);
  4996. }
  4997. return false;
  4998. });
  4999. //点击包含.btn-ajax的元素时发送Ajax请求
  5000. $(document).on('click', '.btn-ajax,.ajaxit', function (e) {
  5001. var that = this;
  5002. var options = $.extend({}, $(that).data() || {});
  5003. if (typeof options.url === 'undefined' && $(that).attr("href")) {
  5004. options.url = $(that).attr("href");
  5005. }
  5006. options.url = Backend.api.replaceids(this, options.url);
  5007. var success = typeof options.success === 'function' ? options.success : null;
  5008. var error = typeof options.error === 'function' ? options.error : null;
  5009. delete options.success;
  5010. delete options.error;
  5011. var button = Backend.api.gettablecolumnbutton(options);
  5012. if (button) {
  5013. if (typeof button.success === 'function') {
  5014. success = button.success;
  5015. }
  5016. if (typeof button.error === 'function') {
  5017. error = button.error;
  5018. }
  5019. }
  5020. //如果未设备成功的回调,设定了自动刷新的情况下自动进行刷新
  5021. if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {
  5022. success = function () {
  5023. $("#" + options.tableId).bootstrapTable('refresh');
  5024. }
  5025. }
  5026. if (typeof options.confirm !== 'undefined') {
  5027. Layer.confirm(options.confirm, function (index) {
  5028. Backend.api.ajax(options, success, error);
  5029. Layer.close(index);
  5030. });
  5031. } else {
  5032. Backend.api.ajax(options, success, error);
  5033. }
  5034. return false;
  5035. });
  5036. $(document).on('click', '.btn-click,.clickit', function (e) {
  5037. var that = this;
  5038. var options = $.extend({}, $(that).data() || {});
  5039. var row = {};
  5040. if (typeof options.tableId !== 'undefined') {
  5041. var index = parseInt(options.rowIndex);
  5042. var data = $("#" + options.tableId).bootstrapTable('getData');
  5043. row = typeof data[index] !== 'undefined' ? data[index] : {};
  5044. }
  5045. var button = Backend.api.gettablecolumnbutton(options);
  5046. var click = typeof button.click === 'function' ? button.click : $.noop;
  5047. if (typeof options.confirm !== 'undefined') {
  5048. Layer.confirm(options.confirm, function (index) {
  5049. click.apply(that, [options, row, button]);
  5050. Layer.close(index);
  5051. });
  5052. } else {
  5053. click.apply(that, [options, row, button]);
  5054. }
  5055. return false;
  5056. });
  5057. //修复含有fixed-footer类的body边距
  5058. if ($(".fixed-footer").size() > 0) {
  5059. $(document.body).css("padding-bottom", $(".fixed-footer").outerHeight());
  5060. }
  5061. //修复不在iframe时layer-footer隐藏的问题
  5062. if ($(".layer-footer").size() > 0 && self === top) {
  5063. $(".layer-footer").show();
  5064. }
  5065. //tooltip和popover
  5066. if (!('ontouchstart' in document.documentElement)) {
  5067. $('body').tooltip({selector: '[data-toggle="tooltip"]'});
  5068. }
  5069. $('body').popover({selector: '[data-toggle="popover"]'});
  5070. }
  5071. };
  5072. Backend.api = $.extend(Fast.api, Backend.api);
  5073. //将Template渲染至全局,以便于在子框架中调用
  5074. window.Template = Template;
  5075. //将Moment渲染至全局,以便于在子框架中调用
  5076. window.Moment = Moment;
  5077. //将Backend渲染至全局,以便于在子框架中调用
  5078. window.Backend = Backend;
  5079. Backend.init();
  5080. return Backend;
  5081. });
  5082. define('backend-init',['backend'], function (Backend) {
  5083. });
  5084. //! moment.js locale configuration
  5085. ;(function (global, factory) {
  5086. typeof exports === 'object' && typeof module !== 'undefined'
  5087. && typeof require === 'function' ? factory(require('../moment')) :
  5088. typeof define === 'function' && define.amd ? define('moment/locale/zh-cn',['../moment'], factory) :
  5089. factory(global.moment)
  5090. }(this, (function (moment) { 'use strict';
  5091. var zhCn = moment.defineLocale('zh-cn', {
  5092. months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  5093. monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  5094. weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  5095. weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  5096. weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
  5097. longDateFormat : {
  5098. LT : 'HH:mm',
  5099. LTS : 'HH:mm:ss',
  5100. L : 'YYYY/MM/DD',
  5101. LL : 'YYYY年M月D日',
  5102. LLL : 'YYYY年M月D日Ah点mm分',
  5103. LLLL : 'YYYY年M月D日ddddAh点mm分',
  5104. l : 'YYYY/M/D',
  5105. ll : 'YYYY年M月D日',
  5106. lll : 'YYYY年M月D日 HH:mm',
  5107. llll : 'YYYY年M月D日dddd HH:mm'
  5108. },
  5109. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  5110. meridiemHour: function (hour, meridiem) {
  5111. if (hour === 12) {
  5112. hour = 0;
  5113. }
  5114. if (meridiem === '凌晨' || meridiem === '早上' ||
  5115. meridiem === '上午') {
  5116. return hour;
  5117. } else if (meridiem === '下午' || meridiem === '晚上') {
  5118. return hour + 12;
  5119. } else {
  5120. // '中午'
  5121. return hour >= 11 ? hour : hour + 12;
  5122. }
  5123. },
  5124. meridiem : function (hour, minute, isLower) {
  5125. var hm = hour * 100 + minute;
  5126. if (hm < 600) {
  5127. return '凌晨';
  5128. } else if (hm < 900) {
  5129. return '早上';
  5130. } else if (hm < 1130) {
  5131. return '上午';
  5132. } else if (hm < 1230) {
  5133. return '中午';
  5134. } else if (hm < 1800) {
  5135. return '下午';
  5136. } else {
  5137. return '晚上';
  5138. }
  5139. },
  5140. calendar : {
  5141. sameDay : '[今天]LT',
  5142. nextDay : '[明天]LT',
  5143. nextWeek : '[下]ddddLT',
  5144. lastDay : '[昨天]LT',
  5145. lastWeek : '[上]ddddLT',
  5146. sameElse : 'L'
  5147. },
  5148. dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
  5149. ordinal : function (number, period) {
  5150. switch (period) {
  5151. case 'd':
  5152. case 'D':
  5153. case 'DDD':
  5154. return number + '日';
  5155. case 'M':
  5156. return number + '月';
  5157. case 'w':
  5158. case 'W':
  5159. return number + '周';
  5160. default:
  5161. return number;
  5162. }
  5163. },
  5164. relativeTime : {
  5165. future : '%s内',
  5166. past : '%s前',
  5167. s : '几秒',
  5168. ss : '%d 秒',
  5169. m : '1 分钟',
  5170. mm : '%d 分钟',
  5171. h : '1 小时',
  5172. hh : '%d 小时',
  5173. d : '1 天',
  5174. dd : '%d 天',
  5175. M : '1 个月',
  5176. MM : '%d 个月',
  5177. y : '1 年',
  5178. yy : '%d 年'
  5179. },
  5180. week : {
  5181. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  5182. dow : 1, // Monday is the first day of the week.
  5183. doy : 4 // The week that contains Jan 4th is the first week of the year.
  5184. }
  5185. });
  5186. return zhCn;
  5187. })));
  5188. (function($){"use strict";var cachedWidth=null;var sprintf=function(str){var args=arguments,flag=true,i=1;str=str.replace(/%s/g,function(){var arg=args[i++];if(typeof arg==="undefined"){flag=false;return""}return arg});return flag?str:""};var getPropertyFromOther=function(list,from,to,value){var result="";$.each(list,function(i,item){if(item[from]===value){result=item[to];return false}return true});return result};var getFieldIndex=function(columns,field){var index=-1;$.each(columns,function(i,column){if(column.field===field){index=i;return false}return true});return index};var setFieldIndex=function(columns){var i,j,k,totalCol=0,flag=[];for(i=0;i<columns[0].length;i++){totalCol+=columns[0][i].colspan||1}for(i=0;i<columns.length;i++){flag[i]=[];for(j=0;j<totalCol;j++){flag[i][j]=false}}for(i=0;i<columns.length;i++){for(j=0;j<columns[i].length;j++){var r=columns[i][j],rowspan=r.rowspan||1,colspan=r.colspan||1,index=$.inArray(false,flag[i]);if(colspan===1){r.fieldIndex=index;if(typeof r.field==="undefined"){r.field=index}}for(k=0;k<rowspan;k++){flag[i+k][index]=true}for(k=0;k<colspan;k++){flag[i][index+k]=true}}}};var getScrollBarWidth=function(){if(cachedWidth===null){var inner=$("<p/>").addClass("fixed-table-scroll-inner"),outer=$("<div/>").addClass("fixed-table-scroll-outer"),w1,w2;outer.append(inner);$("body").append(outer);w1=inner[0].offsetWidth;outer.css("overflow","scroll");w2=inner[0].offsetWidth;if(w1===w2){w2=outer[0].clientWidth}outer.remove();cachedWidth=w1-w2}return cachedWidth};var calculateObjectValue=function(self,name,args,defaultValue){var func=name;if(typeof name==="string"){var names=name.split(".");if(names.length>1){func=window;$.each(names,function(i,f){func=func[f]})}else{func=window[name]}}if(typeof func==="object"){return func}if(typeof func==="function"){return func.apply(self,args||[])}if(!func&&typeof name==="string"&&sprintf.apply(this,[name].concat(args))){return sprintf.apply(this,[name].concat(args))}return defaultValue};var compareObjects=function(objectA,objectB,compareLength){var objectAProperties=Object.getOwnPropertyNames(objectA),objectBProperties=Object.getOwnPropertyNames(objectB),propName="";if(compareLength){if(objectAProperties.length!==objectBProperties.length){return false}}for(var i=0;i<objectAProperties.length;i++){propName=objectAProperties[i];if($.inArray(propName,objectBProperties)>-1){if(objectA[propName]!==objectB[propName]){return false}}}return true};var escapeHTML=function(text){if(typeof text==="string"){return text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/`/g,"&#x60;")}return text};var getRealDataAttr=function(dataAttr){for(var attr in dataAttr){var auxAttr=attr.split(/(?=[A-Z])/).join("-").toLowerCase();if(auxAttr!==attr){dataAttr[auxAttr]=dataAttr[attr];delete dataAttr[attr]}}return dataAttr};var getItemField=function(item,field,escape){var value=item;if(typeof field!=="string"||item.hasOwnProperty(field)){return escape?escapeHTML(item[field]):item[field]}var props=field.split(".");for(var p in props){if(props.hasOwnProperty(p)){value=value&&value[props[p]]}}return escape?escapeHTML(value):value};var isIEBrowser=function(){return!!(navigator.userAgent.indexOf("MSIE ")>0||!!navigator.userAgent.match(/Trident.*rv\:11\./))};var objectKeys=function(){if(!Object.keys){Object.keys=function(){var hasOwnProperty=Object.prototype.hasOwnProperty,hasDontEnumBug=!{toString:null}.propertyIsEnumerable("toString"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;return function(obj){if(typeof obj!=="object"&&(typeof obj!=="function"||obj===null)){throw new TypeError("Object.keys called on non-object")}var result=[],prop,i;for(prop in obj){if(hasOwnProperty.call(obj,prop)){result.push(prop)}}if(hasDontEnumBug){for(i=0;i<dontEnumsLength;i++){if(hasOwnProperty.call(obj,dontEnums[i])){result.push(dontEnums[i])}}}return result}}()}};var BootstrapTable=function(el,options){this.options=options;this.$el=$(el);this.$el_=this.$el.clone();this.timeoutId_=0;this.timeoutFooter_=0;this.init()};BootstrapTable.DEFAULTS={classes:"table table-hover",sortClass:undefined,locale:undefined,height:undefined,undefinedText:"-",sortName:undefined,sortOrder:"asc",sortStable:false,striped:false,columns:[[]],data:[],totalField:"total",dataField:"rows",method:"get",url:undefined,ajax:undefined,cache:true,contentType:"application/json",dataType:"json",ajaxOptions:{},queryParams:function(params){return params},queryParamsType:"limit",responseHandler:function(res){return res},pagination:false,onlyInfoPagination:false,paginationLoop:true,sidePagination:"client",totalRows:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"&lsaquo;",paginationNextText:"&rsaquo;",search:false,searchOnEnterKey:false,strictSearch:false,searchAlign:"right",selectItemName:"btSelectItem",showHeader:true,showFooter:false,showColumns:false,showPaginationSwitch:false,showRefresh:false,showToggle:false,buttonsAlign:"right",smartDisplay:true,escape:false,minimumCountColumns:1,idField:undefined,uniqueId:undefined,cardView:false,detailView:false,detailFormatter:function(index,row){return""},trimOnSearch:true,clickToSelect:false,singleSelect:false,toolbar:undefined,toolbarAlign:"left",checkboxHeader:true,sortable:true,silentSort:true,maintainSelected:false,searchTimeOut:500,searchText:"",iconSize:undefined,buttonsClass:"default",iconsPrefix:"glyphicon",icons:{paginationSwitchDown:"glyphicon-collapse-down icon-chevron-down",paginationSwitchUp:"glyphicon-collapse-up icon-chevron-up",refresh:"glyphicon-refresh icon-refresh",toggle:"glyphicon-list-alt icon-list-alt",columns:"glyphicon-th icon-th",detailOpen:"glyphicon-plus icon-plus",detailClose:"glyphicon-minus icon-minus"},customSearch:$.noop,customSort:$.noop,rowStyle:function(row,index){return{}},rowAttributes:function(row,index){return{}},footerStyle:function(row,index){return{}},onAll:function(name,args){return false},onClickCell:function(field,value,row,$element){return false},onDblClickCell:function(field,value,row,$element){return false},onClickRow:function(item,$element){return false},onDblClickRow:function(item,$element){return false},onSort:function(name,order){return false},onCheck:function(row){return false},onUncheck:function(row){return false},onCheckAll:function(rows){return false},onUncheckAll:function(rows){return false},onCheckSome:function(rows){return false},onUncheckSome:function(rows){return false},onLoadSuccess:function(data){return false},onLoadError:function(status){return false},onColumnSwitch:function(field,checked){return false},onPageChange:function(number,size){return false},onSearch:function(text){return false},onToggle:function(cardView){return false},onPreBody:function(data){return false},onPostBody:function(){return false},onPostHeader:function(){return false},onExpandRow:function(index,row,$detail){return false},onCollapseRow:function(index,row){return false},onRefreshOptions:function(options){return false},onRefresh:function(params){return false},onResetView:function(){return false}};BootstrapTable.LOCALES={};BootstrapTable.LOCALES["en-US"]=BootstrapTable.LOCALES.en={formatLoadingMessage:function(){return"Loading, please wait..."},formatRecordsPerPage:function(pageNumber){return sprintf("%s rows per page",pageNumber)},formatShowingRows:function(pageFrom,pageTo,totalRows){return sprintf("Showing %s to %s of %s rows",pageFrom,pageTo,totalRows)},formatDetailPagination:function(totalRows){return sprintf("Showing %s rows",totalRows)},formatSearch:function(){return"Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatColumns:function(){return"Columns"},formatAllRows:function(){return"All"}};$.extend(BootstrapTable.DEFAULTS,BootstrapTable.LOCALES["en-US"]);BootstrapTable.COLUMN_DEFAULTS={radio:false,checkbox:false,checkboxEnabled:true,field:undefined,title:undefined,titleTooltip:undefined,class:undefined,align:undefined,halign:undefined,falign:undefined,valign:undefined,width:undefined,sortable:false,order:"asc",visible:true,switchable:true,clickToSelect:true,formatter:undefined,footerFormatter:undefined,events:undefined,sorter:undefined,sortName:undefined,cellStyle:undefined,searchable:true,searchFormatter:true,cardVisible:true,escape:false};BootstrapTable.EVENTS={"all.bs.table":"onAll","click-cell.bs.table":"onClickCell","dbl-click-cell.bs.table":"onDblClickCell","click-row.bs.table":"onClickRow","dbl-click-row.bs.table":"onDblClickRow","sort.bs.table":"onSort","check.bs.table":"onCheck","uncheck.bs.table":"onUncheck","check-all.bs.table":"onCheckAll","uncheck-all.bs.table":"onUncheckAll","check-some.bs.table":"onCheckSome","uncheck-some.bs.table":"onUncheckSome","load-success.bs.table":"onLoadSuccess","load-error.bs.table":"onLoadError","column-switch.bs.table":"onColumnSwitch","page-change.bs.table":"onPageChange","search.bs.table":"onSearch","toggle.bs.table":"onToggle","pre-body.bs.table":"onPreBody","post-body.bs.table":"onPostBody","post-header.bs.table":"onPostHeader","expand-row.bs.table":"onExpandRow","collapse-row.bs.table":"onCollapseRow","refresh-options.bs.table":"onRefreshOptions","reset-view.bs.table":"onResetView","refresh.bs.table":"onRefresh"};BootstrapTable.prototype.init=function(){this.initLocale();this.initContainer();this.initTable();this.initHeader();this.initData();this.initHiddenRows();this.initFooter();this.initToolbar();this.initPagination();this.initBody();this.initSearchText();this.initServer()};BootstrapTable.prototype.initLocale=function(){if(this.options.locale){var parts=this.options.locale.split(/-|_/);parts[0].toLowerCase();if(parts[1])parts[1].toUpperCase();if($.fn.bootstrapTable.locales[this.options.locale]){$.extend(this.options,$.fn.bootstrapTable.locales[this.options.locale])}else if($.fn.bootstrapTable.locales[parts.join("-")]){$.extend(this.options,$.fn.bootstrapTable.locales[parts.join("-")])}else if($.fn.bootstrapTable.locales[parts[0]]){$.extend(this.options,$.fn.bootstrapTable.locales[parts[0]])}}};BootstrapTable.prototype.initContainer=function(){this.$container=$(['<div class="bootstrap-table">','<div class="fixed-table-toolbar"></div>',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?'<div class="fixed-table-pagination" style="clear: both;"></div>':"",'<div class="fixed-table-container">','<div class="fixed-table-header"><table></table></div>','<div class="fixed-table-body">','<div class="fixed-table-loading">',this.options.formatLoadingMessage(),"</div>","</div>",'<div class="fixed-table-footer"><table><tr></tr></table></div>',this.options.paginationVAlign==="bottom"||this.options.paginationVAlign==="both"?'<div class="fixed-table-pagination"></div>':"","</div>","</div>"].join(""));this.$container.insertAfter(this.$el);this.$tableContainer=this.$container.find(".fixed-table-container");this.$tableHeader=this.$container.find(".fixed-table-header");this.$tableBody=this.$container.find(".fixed-table-body");this.$tableLoading=this.$container.find(".fixed-table-loading");this.$tableFooter=this.$container.find(".fixed-table-footer");this.$toolbar=this.$container.find(".fixed-table-toolbar");this.$pagination=this.$container.find(".fixed-table-pagination");this.$tableBody.append(this.$el);this.$container.after('<div class="clearfix"></div>');this.$el.addClass(this.options.classes);if(this.options.striped){this.$el.addClass("table-striped")}if($.inArray("table-no-bordered",this.options.classes.split(" "))!==-1){this.$tableContainer.addClass("table-no-bordered")}};BootstrapTable.prototype.initTable=function(){var that=this,columns=[],data=[];this.$header=this.$el.find(">thead");if(!this.$header.length){this.$header=$("<thead></thead>").appendTo(this.$el)}this.$header.find("tr").each(function(){var column=[];$(this).find("th").each(function(){if(typeof $(this).data("field")!=="undefined"){$(this).data("field",$(this).data("field")+"")}column.push($.extend({},{title:$(this).html(),class:$(this).attr("class"),titleTooltip:$(this).attr("title"),rowspan:$(this).attr("rowspan")?+$(this).attr("rowspan"):undefined,colspan:$(this).attr("colspan")?+$(this).attr("colspan"):undefined},$(this).data()))});columns.push(column)});if(!$.isArray(this.options.columns[0])){this.options.columns=[this.options.columns]}this.options.columns=$.extend(true,[],columns,this.options.columns);this.columns=[];setFieldIndex(this.options.columns);$.each(this.options.columns,function(i,columns){$.each(columns,function(j,column){column=$.extend({},BootstrapTable.COLUMN_DEFAULTS,column);if(typeof column.fieldIndex!=="undefined"){that.columns[column.fieldIndex]=column}that.options.columns[i][j]=column})});if(this.options.data.length){return}var m=[];this.$el.find(">tbody>tr").each(function(y){var row={};row._id=$(this).attr("id");row._class=$(this).attr("class");row._data=getRealDataAttr($(this).data());$(this).find(">td").each(function(x){var $this=$(this),cspan=+$this.attr("colspan")||1,rspan=+$this.attr("rowspan")||1,tx,ty;for(;m[y]&&m[y][x];x++);for(tx=x;tx<x+cspan;tx++){for(ty=y;ty<y+rspan;ty++){if(!m[ty]){m[ty]=[]}m[ty][tx]=true}}var field=that.columns[x].field;row[field]=$(this).html();row["_"+field+"_id"]=$(this).attr("id");row["_"+field+"_class"]=$(this).attr("class");row["_"+field+"_rowspan"]=$(this).attr("rowspan");row["_"+field+"_colspan"]=$(this).attr("colspan");row["_"+field+"_title"]=$(this).attr("title");row["_"+field+"_data"]=getRealDataAttr($(this).data())});data.push(row)});this.options.data=data;if(data.length)this.fromHtml=true};BootstrapTable.prototype.initHeader=function(){var that=this,visibleColumns={},html=[];this.header={fields:[],styles:[],classes:[],formatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]};$.each(this.options.columns,function(i,columns){html.push("<tr>");if(i===0&&!that.options.cardView&&that.options.detailView){html.push(sprintf('<th class="detail" rowspan="%s"><div class="fht-cell"></div></th>',that.options.columns.length))}$.each(columns,function(j,column){var text="",halign="",align="",style="",class_=sprintf(' class="%s"',column["class"]),order=that.options.sortOrder||column.order,unitWidth="px",width=column.width;if(column.width!==undefined&&!that.options.cardView){if(typeof column.width==="string"){if(column.width.indexOf("%")!==-1){unitWidth="%"}}}if(column.width&&typeof column.width==="string"){width=column.width.replace("%","").replace("px","")}halign=sprintf("text-align: %s; ",column.halign?column.halign:column.align);align=sprintf("text-align: %s; ",column.align);style=sprintf("vertical-align: %s; ",column.valign);style+=sprintf("width: %s; ",(column.checkbox||column.radio)&&!width?"36px":width?width+unitWidth:undefined);if(typeof column.fieldIndex!=="undefined"){that.header.fields[column.fieldIndex]=column.field;that.header.styles[column.fieldIndex]=align+style;that.header.classes[column.fieldIndex]=class_;that.header.formatters[column.fieldIndex]=column.formatter;that.header.events[column.fieldIndex]=column.events;that.header.sorters[column.fieldIndex]=column.sorter;that.header.sortNames[column.fieldIndex]=column.sortName;that.header.cellStyles[column.fieldIndex]=column.cellStyle;that.header.searchables[column.fieldIndex]=column.searchable;if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}visibleColumns[column.field]=column}html.push("<th"+sprintf(' title="%s"',column.titleTooltip),column.checkbox||column.radio?sprintf(' class="bs-checkbox %s"',column["class"]||""):class_,sprintf(' style="%s"',halign+style),sprintf(' rowspan="%s"',column.rowspan),sprintf(' colspan="%s"',column.colspan),sprintf(' data-field="%s"',column.field),">");html.push(sprintf('<div class="th-inner %s">',that.options.sortable&&column.sortable?"sortable both":""));text=that.options.escape?escapeHTML(column.title):column.title;if(column.checkbox){if(!that.options.singleSelect&&that.options.checkboxHeader){text='<input name="btSelectAll" type="checkbox" />'}that.header.stateField=column.field}if(column.radio){text="";that.header.stateField=column.field;that.options.singleSelect=true}html.push(text);html.push("</div>");html.push('<div class="fht-cell"></div>');html.push("</div>");html.push("</th>")});html.push("</tr>")});this.$header.html(html.join(""));this.$header.find("th[data-field]").each(function(i){$(this).data(visibleColumns[$(this).data("field")])});this.$container.off("click",".th-inner").on("click",".th-inner",function(event){var target=$(this);if(that.options.detailView){if(target.closest(".bootstrap-table")[0]!==that.$container[0])return false}if(that.options.sortable&&target.parent().data().sortable){that.onSort(event)}});this.$header.children().children().off("keypress").on("keypress",function(event){if(that.options.sortable&&$(this).data().sortable){var code=event.keyCode||event.which;if(code==13){that.onSort(event)}}});$(window).off("resize.bootstrap-table");if(!this.options.showHeader||this.options.cardView){this.$header.hide();this.$tableHeader.hide();this.$tableLoading.css("top",0)}else{this.$header.show();this.$tableHeader.show();this.$tableLoading.css("top",this.$header.outerHeight()+1);this.getCaret();$(window).on("resize.bootstrap-table",$.proxy(this.resetWidth,this))}this.$selectAll=this.$header.find('[name="btSelectAll"]');this.$selectAll.off("click").on("click",function(){var checked=$(this).prop("checked");that[checked?"checkAll":"uncheckAll"]();that.updateSelected()})};BootstrapTable.prototype.initFooter=function(){if(!this.options.showFooter||this.options.cardView){this.$tableFooter.hide()}else{this.$tableFooter.show()}};BootstrapTable.prototype.initData=function(data,type){if(type==="append"){this.data=this.data.concat(data)}else if(type==="prepend"){this.data=[].concat(data).concat(this.data)}else{this.data=data||this.options.data}if(type==="append"){this.options.data=this.options.data.concat(data)}else if(type==="prepend"){this.options.data=[].concat(data).concat(this.options.data)}else{this.options.data=this.data}if(this.options.sidePagination==="server"){return}this.initSort()};BootstrapTable.prototype.initSort=function(){var that=this,name=this.options.sortName,order=this.options.sortOrder==="desc"?-1:1,index=$.inArray(this.options.sortName,this.header.fields),timeoutId=0;if(this.options.customSort!==$.noop){this.options.customSort.apply(this,[this.options.sortName,this.options.sortOrder]);return}if(index!==-1){if(this.options.sortStable){$.each(this.data,function(i,row){if(!row.hasOwnProperty("_position"))row._position=i})}this.data.sort(function(a,b){if(that.header.sortNames[index]){name=that.header.sortNames[index]}var aa=getItemField(a,name,that.options.escape),bb=getItemField(b,name,that.options.escape),value=calculateObjectValue(that.header,that.header.sorters[index],[aa,bb]);if(value!==undefined){return order*value}if(aa===undefined||aa===null){aa=""}if(bb===undefined||bb===null){bb=""}if(that.options.sortStable&&aa===bb){aa=a._position;bb=b._position}if($.isNumeric(aa)&&$.isNumeric(bb)){aa=parseFloat(aa);bb=parseFloat(bb);if(aa<bb){return order*-1}return order}if(aa===bb){return 0}if(typeof aa!=="string"){aa=aa.toString()}if(aa.localeCompare(bb)===-1){return order*-1}return order});if(this.options.sortClass!==undefined){clearTimeout(timeoutId);timeoutId=setTimeout(function(){that.$el.removeClass(that.options.sortClass);var index=that.$header.find(sprintf('[data-field="%s"]',that.options.sortName).index()+1);that.$el.find(sprintf("tr td:nth-child(%s)",index)).addClass(that.options.sortClass)},250)}}};BootstrapTable.prototype.onSort=function(event){var $this=event.type==="keypress"?$(event.currentTarget):$(event.currentTarget).parent(),$this_=this.$header.find("th").eq($this.index());this.$header.add(this.$header_).find("span.order").remove();if(this.options.sortName===$this.data("field")){this.options.sortOrder=this.options.sortOrder==="asc"?"desc":"asc"}else{this.options.sortName=$this.data("field");this.options.sortOrder=$this.data("order")==="asc"?"desc":"asc"}this.trigger("sort",this.options.sortName,this.options.sortOrder);$this.add($this_).data("order",this.options.sortOrder);this.getCaret();if(this.options.sidePagination==="server"){this.initServer(this.options.silentSort);return}this.initSort();this.initBody()};BootstrapTable.prototype.initToolbar=function(){var that=this,html=[],timeoutId=0,$keepOpen,$search,switchableCount=0;if(this.$toolbar.find(".bs-bars").children().length){$("body").append($(this.options.toolbar))}this.$toolbar.html("");if(typeof this.options.toolbar==="string"||typeof this.options.toolbar==="object"){$(sprintf('<div class="bs-bars pull-%s"></div>',this.options.toolbarAlign)).appendTo(this.$toolbar).append($(this.options.toolbar))}html=[sprintf('<div class="columns columns-%s btn-group pull-%s">',this.options.buttonsAlign,this.options.buttonsAlign)];if(typeof this.options.icons==="string"){this.options.icons=calculateObjectValue(null,this.options.icons)}if(this.options.showPaginationSwitch){html.push(sprintf('<button class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',this.options.formatPaginationSwitch()),sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.paginationSwitchDown),"</button>")}if(this.options.showRefresh){html.push(sprintf('<button class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+'" type="button" name="refresh" aria-label="refresh" title="%s">',this.options.formatRefresh()),sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.refresh),"</button>")}if(this.options.showToggle){html.push(sprintf('<button class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+'" type="button" name="toggle" aria-label="toggle" title="%s">',this.options.formatToggle()),sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.toggle),"</button>")}if(this.options.showColumns){html.push(sprintf('<div class="keep-open btn-group" title="%s">',this.options.formatColumns()),'<button type="button" aria-label="columns" class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">',sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.columns),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">');$.each(this.columns,function(i,column){if(column.radio||column.checkbox){return}if(that.options.cardView&&!column.cardVisible){return}var checked=column.visible?' checked="checked"':"";if(column.switchable){html.push(sprintf('<li role="menuitem">'+'<label><input type="checkbox" data-field="%s" value="%s"%s> %s</label>'+"</li>",column.field,i,checked,column.title));switchableCount++}});html.push("</ul>","</div>")}html.push("</div>");if(this.showToolbar||html.length>2){this.$toolbar.append(html.join(""))}if(this.options.showPaginationSwitch){this.$toolbar.find('button[name="paginationSwitch"]').off("click").on("click",$.proxy(this.togglePagination,this))}if(this.options.showRefresh){this.$toolbar.find('button[name="refresh"]').off("click").on("click",$.proxy(this.refresh,this))}if(this.options.showToggle){this.$toolbar.find('button[name="toggle"]').off("click").on("click",function(){that.toggleView()})}if(this.options.showColumns){$keepOpen=this.$toolbar.find(".keep-open");if(switchableCount<=this.options.minimumCountColumns){$keepOpen.find("input").prop("disabled",true)}$keepOpen.find("li").off("click").on("click",function(event){event.stopImmediatePropagation()});$keepOpen.find("input").off("click").on("click",function(){var $this=$(this);that.toggleColumn($(this).val(),$this.prop("checked"),false);that.trigger("column-switch",$(this).data("field"),$this.prop("checked"))})}if(this.options.search){html=[];html.push('<div class="pull-'+this.options.searchAlign+' search">',sprintf('<input class="form-control'+sprintf(" input-%s",this.options.iconSize)+'" type="text" placeholder="%s">',this.options.formatSearch()),"</div>");this.$toolbar.append(html.join(""));$search=this.$toolbar.find(".search input");$search.off("keyup drop blur").on("keyup drop blur",function(event){if(that.options.searchOnEnterKey&&event.keyCode!==13){return}if($.inArray(event.keyCode,[37,38,39,40])>-1){return}clearTimeout(timeoutId);timeoutId=setTimeout(function(){that.onSearch(event)},that.options.searchTimeOut)});if(isIEBrowser()){$search.off("mouseup").on("mouseup",function(event){clearTimeout(timeoutId);timeoutId=setTimeout(function(){that.onSearch(event)},that.options.searchTimeOut)})}}};BootstrapTable.prototype.onSearch=function(event){var text=$.trim($(event.currentTarget).val());if(this.options.trimOnSearch&&$(event.currentTarget).val()!==text){$(event.currentTarget).val(text)}if(text===this.searchText){return}this.searchText=text;this.options.searchText=text;this.options.pageNumber=1;this.initSearch();this.updatePagination();this.trigger("search",text)};BootstrapTable.prototype.initSearch=function(){var that=this;if(this.options.sidePagination!=="server"){if(this.options.customSearch!==$.noop){this.options.customSearch.apply(this,[this.searchText]);return}var s=this.searchText&&(this.options.escape?escapeHTML(this.searchText):this.searchText).toLowerCase();var f=$.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.data=f?$.grep(this.options.data,function(item,i){for(var key in f){if($.isArray(f[key])&&$.inArray(item[key],f[key])===-1||!$.isArray(f[key])&&item[key]!==f[key]){return false}}return true}):this.options.data;this.data=s?$.grep(this.data,function(item,i){for(var j=0;j<that.header.fields.length;j++){if(!that.header.searchables[j]){continue}var key=$.isNumeric(that.header.fields[j])?parseInt(that.header.fields[j],10):that.header.fields[j];var column=that.columns[getFieldIndex(that.columns,key)];var value;if(typeof key==="string"){value=item;var props=key.split(".");for(var prop_index=0;prop_index<props.length;prop_index++){value=value[props[prop_index]]}if(column&&column.searchFormatter){value=calculateObjectValue(column,that.header.formatters[j],[value,item,i],value)}}else{value=item[key]}if(typeof value==="string"||typeof value==="number"){if(that.options.strictSearch){if((value+"").toLowerCase()===s){return true}}else{if((value+"").toLowerCase().indexOf(s)!==-1){return true}}}}return false}):this.data}};BootstrapTable.prototype.initPagination=function(){if(!this.options.pagination){this.$pagination.hide();return}else{this.$pagination.show()}var that=this,html=[],$allSelected=false,i,from,to,$pageList,$first,$pre,$next,$last,$number,data=this.getData(),pageList=this.options.pageList;if(this.options.sidePagination!=="server"){this.options.totalRows=data.length}this.totalPages=0;if(this.options.totalRows){if(this.options.pageSize===this.options.formatAllRows()){this.options.pageSize=this.options.totalRows;$allSelected=true}else if(this.options.pageSize===this.options.totalRows){var pageLst=typeof this.options.pageList==="string"?this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").toLowerCase().split(","):this.options.pageList;if($.inArray(this.options.formatAllRows().toLowerCase(),pageLst)>-1){$allSelected=true}}this.totalPages=~~((this.options.totalRows-1)/this.options.pageSize)+1;this.options.totalPages=this.totalPages}if(this.totalPages>0&&this.options.pageNumber>this.totalPages){this.options.pageNumber=this.totalPages}this.pageFrom=(this.options.pageNumber-1)*this.options.pageSize+1;this.pageTo=this.options.pageNumber*this.options.pageSize;if(this.pageTo>this.options.totalRows){this.pageTo=this.options.totalRows}html.push('<div class="pull-'+this.options.paginationDetailHAlign+' pagination-detail">','<span class="pagination-info">',this.options.onlyInfoPagination?this.options.formatDetailPagination(this.options.totalRows):this.options.formatShowingRows(this.pageFrom,this.pageTo,this.options.totalRows),"</span>");if(!this.options.onlyInfoPagination){html.push('<span class="page-list">');var pageNumber=[sprintf('<span class="btn-group %s">',this.options.paginationVAlign==="top"||this.options.paginationVAlign==="both"?"dropdown":"dropup"),'<button type="button" class="btn'+sprintf(" btn-%s",this.options.buttonsClass)+sprintf(" btn-%s",this.options.iconSize)+' dropdown-toggle" data-toggle="dropdown">','<span class="page-size">',$allSelected?this.options.formatAllRows():this.options.pageSize,"</span>",' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">'];if(typeof this.options.pageList==="string"){var list=this.options.pageList.replace("[","").replace("]","").replace(/ /g,"").split(",");pageList=[];$.each(list,function(i,value){pageList.push(value.toUpperCase()===that.options.formatAllRows().toUpperCase()?that.options.formatAllRows():+value)})}$.each(pageList,function(i,page){if(!that.options.smartDisplay||i===0||pageList[i-1]<that.options.totalRows){var active;if($allSelected){active=page===that.options.formatAllRows()?' class="active"':""}else{active=page===that.options.pageSize?' class="active"':""}pageNumber.push(sprintf('<li role="menuitem"%s><a href="#">%s</a></li>',active,page))}});pageNumber.push("</ul></span>");html.push(this.options.formatRecordsPerPage(pageNumber.join("")));html.push("</span>");html.push("</div>",'<div class="pull-'+this.options.paginationHAlign+' pagination">','<ul class="pagination'+sprintf(" pagination-%s",this.options.iconSize)+'">','<li class="page-pre"><a href="#">'+this.options.paginationPreText+"</a></li>");if(this.totalPages<5){from=1;to=this.totalPages}else{from=this.options.pageNumber-2;to=from+4;if(from<1){from=1;to=5}if(to>this.totalPages){to=this.totalPages;from=to-4}}if(this.totalPages>=6){if(this.options.pageNumber>=3){html.push('<li class="page-first'+(1===this.options.pageNumber?" active":"")+'">','<a href="#">',1,"</a>","</li>");from++}if(this.options.pageNumber>=4){if(this.options.pageNumber==4||this.totalPages==6||this.totalPages==7){from--}else{html.push('<li class="page-first-separator disabled">','<a href="#">...</a>',"</li>")}to--}}if(this.totalPages>=7){if(this.options.pageNumber>=this.totalPages-2){from--}}if(this.totalPages==6){if(this.options.pageNumber>=this.totalPages-2){to++}}else if(this.totalPages>=7){if(this.totalPages==7||this.options.pageNumber>=this.totalPages-3){to++}}for(i=from;i<=to;i++){html.push('<li class="page-number'+(i===this.options.pageNumber?" active":"")+'">','<a href="#">',i,"</a>","</li>")}if(this.totalPages>=8){if(this.options.pageNumber<=this.totalPages-4){html.push('<li class="page-last-separator disabled">','<a href="#">...</a>',"</li>")}}if(this.totalPages>=6){if(this.options.pageNumber<=this.totalPages-3){html.push('<li class="page-last'+(this.totalPages===this.options.pageNumber?" active":"")+'">','<a href="#">',this.totalPages,"</a>","</li>")}}html.push('<li class="page-next"><a href="#">'+this.options.paginationNextText+"</a></li>","</ul>","</div>")}this.$pagination.html(html.join(""));if(!this.options.onlyInfoPagination){$pageList=this.$pagination.find(".page-list a");$first=this.$pagination.find(".page-first");$pre=this.$pagination.find(".page-pre");$next=this.$pagination.find(".page-next");$last=this.$pagination.find(".page-last");$number=this.$pagination.find(".page-number");if(this.options.smartDisplay){if(this.totalPages<=1){this.$pagination.find("div.pagination").hide()}if(pageList.length<2||this.options.totalRows<=pageList[0]){this.$pagination.find("span.page-list").hide()}this.$pagination[this.getData().length?"show":"hide"]()}if(!this.options.paginationLoop){if(this.options.pageNumber===1){$pre.addClass("disabled")}if(this.options.pageNumber===this.totalPages){$next.addClass("disabled")}}if($allSelected){this.options.pageSize=this.options.formatAllRows()}$pageList.off("click").on("click",$.proxy(this.onPageListChange,this));$first.off("click").on("click",$.proxy(this.onPageFirst,this));$pre.off("click").on("click",$.proxy(this.onPagePre,this));$next.off("click").on("click",$.proxy(this.onPageNext,this));$last.off("click").on("click",$.proxy(this.onPageLast,this));$number.off("click").on("click",$.proxy(this.onPageNumber,this))}};BootstrapTable.prototype.updatePagination=function(event){if(event&&$(event.currentTarget).hasClass("disabled")){return}if(!this.options.maintainSelected){this.resetRows()}this.initPagination();if(this.options.sidePagination==="server"){this.initServer()}else{this.initBody()}this.trigger("page-change",this.options.pageNumber,this.options.pageSize)};BootstrapTable.prototype.onPageListChange=function(event){var $this=$(event.currentTarget);$this.parent().addClass("active").siblings().removeClass("active");this.options.pageSize=$this.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+$this.text();this.$toolbar.find(".page-size").text(this.options.pageSize);this.updatePagination(event);return false};BootstrapTable.prototype.onPageFirst=function(event){this.options.pageNumber=1;this.updatePagination(event);return false};BootstrapTable.prototype.onPagePre=function(event){if(this.options.pageNumber-1===0){this.options.pageNumber=this.options.totalPages}else{this.options.pageNumber--}this.updatePagination(event);return false};BootstrapTable.prototype.onPageNext=function(event){if(this.options.pageNumber+1>this.options.totalPages){this.options.pageNumber=1}else{this.options.pageNumber++}this.updatePagination(event);return false};BootstrapTable.prototype.onPageLast=function(event){this.options.pageNumber=this.totalPages;this.updatePagination(event);return false};BootstrapTable.prototype.onPageNumber=function(event){if(this.options.pageNumber===+$(event.currentTarget).text()){return}this.options.pageNumber=+$(event.currentTarget).text();this.updatePagination(event);return false};BootstrapTable.prototype.initRow=function(item,i,data,parentDom){var that=this,key,html=[],style={},csses=[],data_="",attributes={},htmlAttributes=[];if($.inArray(item,this.hiddenRows)>-1){return}style=calculateObjectValue(this.options,this.options.rowStyle,[item,i],style);if(style&&style.css){for(key in style.css){csses.push(key+": "+style.css[key])}}attributes=calculateObjectValue(this.options,this.options.rowAttributes,[item,i],attributes);if(attributes){for(key in attributes){htmlAttributes.push(sprintf('%s="%s"',key,escapeHTML(attributes[key])))}}if(item._data&&!$.isEmptyObject(item._data)){$.each(item._data,function(k,v){if(k==="index"){return}data_+=sprintf(' data-%s="%s"',k,v)})}html.push("<tr",sprintf(" %s",htmlAttributes.join(" ")),sprintf(' id="%s"',$.isArray(item)?undefined:item._id),sprintf(' class="%s"',style.classes||($.isArray(item)?undefined:item._class)),sprintf(' data-index="%s"',i),sprintf(' data-uniqueid="%s"',item[this.options.uniqueId]),sprintf("%s",data_),">");if(this.options.cardView){html.push(sprintf('<td colspan="%s"><div class="card-views">',this.header.fields.length))}if(!this.options.cardView&&this.options.detailView){html.push("<td>",'<a class="detail-icon" href="#">',sprintf('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.detailOpen),"</a>","</td>")}$.each(this.header.fields,function(j,field){var text="",value_=getItemField(item,field,that.options.escape),value="",type="",cellStyle={},id_="",class_=that.header.classes[j],data_="",rowspan_="",colspan_="",title_="",column=that.columns[j];if(that.fromHtml&&typeof value_==="undefined"){return}if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}if(column.escape){value_=escapeHTML(value_)}style=sprintf('style="%s"',csses.concat(that.header.styles[j]).join("; "));if(item["_"+field+"_id"]){id_=sprintf(' id="%s"',item["_"+field+"_id"])}if(item["_"+field+"_class"]){class_=sprintf(' class="%s"',item["_"+field+"_class"])}if(item["_"+field+"_rowspan"]){rowspan_=sprintf(' rowspan="%s"',item["_"+field+"_rowspan"])}if(item["_"+field+"_colspan"]){colspan_=sprintf(' colspan="%s"',item["_"+field+"_colspan"])}if(item["_"+field+"_title"]){title_=sprintf(' title="%s"',item["_"+field+"_title"])}cellStyle=calculateObjectValue(that.header,that.header.cellStyles[j],[value_,item,i,field],cellStyle);if(cellStyle.classes){class_=sprintf(' class="%s"',cellStyle.classes)}if(cellStyle.css){var csses_=[];for(var key in cellStyle.css){csses_.push(key+": "+cellStyle.css[key])}style=sprintf('style="%s"',csses_.concat(that.header.styles[j]).join("; "))}value=calculateObjectValue(column,that.header.formatters[j],[value_,item,i],value_);if(item["_"+field+"_data"]&&!$.isEmptyObject(item["_"+field+"_data"])){$.each(item["_"+field+"_data"],function(k,v){if(k==="index"){return}data_+=sprintf(' data-%s="%s"',k,v)})}if(column.checkbox||column.radio){type=column.checkbox?"checkbox":type;type=column.radio?"radio":type;text=[sprintf(that.options.cardView?'<div class="card-view %s">':'<td class="bs-checkbox %s">',column["class"]||""),"<input"+sprintf(' data-index="%s"',i)+sprintf(' name="%s"',that.options.selectItemName)+sprintf(' type="%s"',type)+sprintf(' value="%s"',item[that.options.idField])+sprintf(' checked="%s"',value===true||(value_||value&&value.checked)?"checked":undefined)+sprintf(' disabled="%s"',!column.checkboxEnabled||value&&value.disabled?"disabled":undefined)+" />",that.header.formatters[j]&&typeof value==="string"?value:"",that.options.cardView?"</div>":"</td>"].join("");item[that.header.stateField]=value===true||value&&value.checked}else{value=typeof value==="undefined"||value===null?that.options.undefinedText:value;text=that.options.cardView?['<div class="card-view">',that.options.showHeader?sprintf('<span class="title" %s>%s</span>',style,getPropertyFromOther(that.columns,"field","title",field)):"",sprintf('<span class="value">%s</span>',value),"</div>"].join(""):[sprintf("<td%s %s %s %s %s %s %s>",id_,class_,style,data_,rowspan_,colspan_,title_),value,"</td>"].join("");if(that.options.cardView&&that.options.smartDisplay&&value===""){text='<div class="card-view"></div>'}}html.push(text)});if(this.options.cardView){html.push("</div></td>")}html.push("</tr>");return html.join(" ")};BootstrapTable.prototype.initBody=function(fixedScroll){var that=this,html=[],data=this.getData();this.trigger("pre-body",data);this.$body=this.$el.find(">tbody");if(!this.$body.length){this.$body=$("<tbody></tbody>").appendTo(this.$el)}if(!this.options.pagination||this.options.sidePagination==="server"){this.pageFrom=1;this.pageTo=data.length}var trFragments=$(document.createDocumentFragment());var hasTr;for(var i=this.pageFrom-1;i<this.pageTo;i++){var item=data[i];var tr=this.initRow(item,i,data,trFragments);hasTr=hasTr||!!tr;if(tr&&tr!==true){trFragments.append(tr)}}if(!hasTr){trFragments.append('<tr class="no-records-found">'+sprintf('<td colspan="%s">%s</td>',this.$header.find("th").length,this.options.formatNoMatches())+"</tr>")}this.$body.html(trFragments);if(!fixedScroll){this.scrollTo(0)}this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(e){var $td=$(this),$tr=$td.parent(),item=that.data[$tr.data("index")],index=$td[0].cellIndex,fields=that.getVisibleFields(),field=fields[that.options.detailView&&!that.options.cardView?index-1:index],column=that.columns[getFieldIndex(that.columns,field)],value=getItemField(item,field,that.options.escape);if($td.find(".detail-icon").length){return}that.trigger(e.type==="click"?"click-cell":"dbl-click-cell",field,value,item,$td);that.trigger(e.type==="click"?"click-row":"dbl-click-row",item,$tr,field);if(e.type==="click"&&that.options.clickToSelect&&column.clickToSelect){var $selectItem=$tr.find(sprintf('[name="%s"]',that.options.selectItemName));if($selectItem.length){$selectItem[0].click()}}});this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(){var $this=$(this),$tr=$this.parent().parent(),index=$tr.data("index"),row=data[index];if($tr.next().is("tr.detail-view")){$this.find("i").attr("class",sprintf("%s %s",that.options.iconsPrefix,that.options.icons.detailOpen));that.trigger("collapse-row",index,row);$tr.next().remove()}else{$this.find("i").attr("class",sprintf("%s %s",that.options.iconsPrefix,that.options.icons.detailClose));$tr.after(sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>',$tr.find("td").length));var $element=$tr.next().find("td");var content=calculateObjectValue(that.options,that.options.detailFormatter,[index,row,$element],"");if($element.length===1){$element.append(content)}that.trigger("expand-row",index,row,$element)}that.resetView();return false});this.$selectItem=this.$body.find(sprintf('[name="%s"]',this.options.selectItemName));this.$selectItem.off("click").on("click",function(event){event.stopImmediatePropagation();var $this=$(this),checked=$this.prop("checked"),row=that.data[$this.data("index")];if(that.options.maintainSelected&&$(this).is(":radio")){$.each(that.options.data,function(i,row){row[that.header.stateField]=false})}row[that.header.stateField]=checked;if(that.options.singleSelect){that.$selectItem.not(this).each(function(){that.data[$(this).data("index")][that.header.stateField]=false});that.$selectItem.filter(":checked").not(this).prop("checked",false)}that.updateSelected();that.trigger(checked?"check":"uncheck",row,$this)});$.each(this.header.events,function(i,events){if(!events){return}if(typeof events==="string"){events=calculateObjectValue(null,events)}var field=that.header.fields[i],fieldIndex=$.inArray(field,that.getVisibleFields());if(that.options.detailView&&!that.options.cardView){fieldIndex+=1}for(var key in events){that.$body.find(">tr:not(.no-records-found)").each(function(){var $tr=$(this),$td=$tr.find(that.options.cardView?".card-view":"td").eq(fieldIndex),index=key.indexOf(" "),name=key.substring(0,index),el=key.substring(index+1),func=events[key];$td.find(el).off(name).on(name,function(e){var index=$tr.data("index"),row=that.data[index],value=row[field];var props=field.split(".");if(props.length>1){value=row;for(var prop_index=0;prop_index<props.length;prop_index++){value=value[props[prop_index]]}}func.apply(this,[e,value,row,index])})})}});this.updateSelected();this.resetView();this.trigger("post-body",data)};BootstrapTable.prototype.initServer=function(silent,query,url){var that=this,data={},params={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder},request;if(this.options.pagination){params.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize;params.pageNumber=this.options.pageNumber}if(!(url||this.options.url)&&!this.options.ajax){return}if(this.options.queryParamsType==="limit"){params={search:params.searchText,sort:params.sortName,order:params.sortOrder};if(this.options.pagination){params.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1);params.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize}}if(!$.isEmptyObject(this.filterColumnsPartial)){params.filter=JSON.stringify(this.filterColumnsPartial,null)}data=calculateObjectValue(this.options,this.options.queryParams,[params],data);$.extend(data,query||{});if(data===false){return}if(!silent){this.$tableLoading.show()}request=$.extend({},calculateObjectValue(null,this.options.ajaxOptions),{type:this.options.method,url:url||this.options.url,data:this.options.contentType==="application/json"&&this.options.method==="post"?JSON.stringify(data):data,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(res){res=calculateObjectValue(that.options,that.options.responseHandler,[res],res);that.load(res);that.trigger("load-success",res);if(!silent)that.$tableLoading.hide()},error:function(res){that.trigger("load-error",res.status,res);if(!silent)that.$tableLoading.hide()}});if(this.options.ajax){calculateObjectValue(this,this.options.ajax,[request],null)}else{if(this._xhr&&this._xhr.readyState!==4){this._xhr.abort()}this._xhr=$.ajax(request)}};BootstrapTable.prototype.initSearchText=function(){if(this.options.search){if(this.options.searchText!==""){var $search=this.$toolbar.find(".search input");$search.val(this.options.searchText);this.onSearch({currentTarget:$search})}}};BootstrapTable.prototype.getCaret=function(){var that=this;$.each(this.$header.find("th"),function(i,th){$(th).find(".sortable").removeClass("desc asc").addClass($(th).data("field")===that.options.sortName?that.options.sortOrder:"both")})};BootstrapTable.prototype.updateSelected=function(){var checkAll=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",checkAll);this.$selectItem.each(function(){$(this).closest("tr")[$(this).prop("checked")?"addClass":"removeClass"]("selected")})};BootstrapTable.prototype.updateRows=function(){var that=this;this.$selectItem.each(function(){that.data[$(this).data("index")][that.header.stateField]=$(this).prop("checked")})};BootstrapTable.prototype.resetRows=function(){var that=this;$.each(this.data,function(i,row){that.$selectAll.prop("checked",false);that.$selectItem.prop("checked",false);if(that.header.stateField){row[that.header.stateField]=false}});this.initHiddenRows()};BootstrapTable.prototype.trigger=function(name){var args=Array.prototype.slice.call(arguments,1);name+=".bs.table";this.options[BootstrapTable.EVENTS[name]].apply(this.options,args);this.$el.trigger($.Event(name),args);this.options.onAll(name,args);this.$el.trigger($.Event("all.bs.table"),[name,args])};BootstrapTable.prototype.resetHeader=function(){clearTimeout(this.timeoutId_);this.timeoutId_=setTimeout($.proxy(this.fitHeader,this),this.$el.is(":hidden")?100:0)};BootstrapTable.prototype.fitHeader=function(){var that=this,fixedBody,scrollWidth,focused,focusedTemp;if(that.$el.is(":hidden")){that.timeoutId_=setTimeout($.proxy(that.fitHeader,that),100);return}fixedBody=this.$tableBody.get(0);scrollWidth=fixedBody.scrollWidth>fixedBody.clientWidth&&fixedBody.scrollHeight>fixedBody.clientHeight+this.$header.outerHeight()?getScrollBarWidth():0;this.$el.css("margin-top",-this.$header.outerHeight());focused=$(":focus");if(focused.length>0){var $th=focused.parents("th");if($th.length>0){var dataField=$th.attr("data-field");if(dataField!==undefined){var $headerTh=this.$header.find("[data-field='"+dataField+"']");if($headerTh.length>0){$headerTh.find(":input").addClass("focus-temp")}}}}this.$header_=this.$header.clone(true,true);this.$selectAll_=this.$header_.find('[name="btSelectAll"]');this.$tableHeader.css({"margin-right":scrollWidth}).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_);focusedTemp=$(".focus-temp:visible:eq(0)");if(focusedTemp.length>0){focusedTemp.focus();this.$header.find(".focus-temp").removeClass("focus-temp")}this.$header.find("th[data-field]").each(function(i){that.$header_.find(sprintf('th[data-field="%s"]',$(this).data("field"))).data($(this).data())});var visibleFields=this.getVisibleFields(),$ths=this.$header_.find("th");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(i){var $this=$(this),index=i;if(that.options.detailView&&!that.options.cardView){if(i===0){that.$header_.find("th.detail").find(".fht-cell").width($this.innerWidth())}index=i-1}var $th=that.$header_.find(sprintf('th[data-field="%s"]',visibleFields[index]));if($th.length>1){$th=$($ths[$this[0].cellIndex])}$th.find(".fht-cell").width($this.innerWidth())});this.$tableBody.off("scroll").on("scroll",function(){that.$tableHeader.scrollLeft($(this).scrollLeft());if(that.options.showFooter&&!that.options.cardView){that.$tableFooter.scrollLeft($(this).scrollLeft())}});that.trigger("post-header")};BootstrapTable.prototype.resetFooter=function(){var that=this,data=that.getData(),html=[];if(!this.options.showFooter||this.options.cardView){return}if(!this.options.cardView&&this.options.detailView){html.push('<td><div class="th-inner">&nbsp;</div><div class="fht-cell"></div></td>')}$.each(this.columns,function(i,column){var key,falign="",valign="",csses=[],style={},class_=sprintf(' class="%s"',column["class"]);if(!column.visible){return}if(that.options.cardView&&!column.cardVisible){return}falign=sprintf("text-align: %s; ",column.falign?column.falign:column.align);valign=sprintf("vertical-align: %s; ",column.valign);style=calculateObjectValue(null,that.options.footerStyle);if(style&&style.css){for(key in style.css){csses.push(key+": "+style.css[key])}}html.push("<td",class_,sprintf(' style="%s"',falign+valign+csses.concat().join("; ")),">");html.push('<div class="th-inner">');html.push(calculateObjectValue(column,column.footerFormatter,[data],"&nbsp;")||"&nbsp;");html.push("</div>");html.push('<div class="fht-cell"></div>');html.push("</div>");html.push("</td>")});this.$tableFooter.find("tr").html(html.join(""));this.$tableFooter.show();clearTimeout(this.timeoutFooter_);this.timeoutFooter_=setTimeout($.proxy(this.fitFooter,this),this.$el.is(":hidden")?100:0)};BootstrapTable.prototype.fitFooter=function(){var that=this,$footerTd,elWidth,scrollWidth;clearTimeout(this.timeoutFooter_);if(this.$el.is(":hidden")){this.timeoutFooter_=setTimeout($.proxy(this.fitFooter,this),100);return}elWidth=this.$el.css("width");scrollWidth=elWidth>this.$tableBody.width()?getScrollBarWidth():0;this.$tableFooter.css({"margin-right":scrollWidth}).find("table").css("width",elWidth).attr("class",this.$el.attr("class"));$footerTd=this.$tableFooter.find("td");this.$body.find(">tr:first-child:not(.no-records-found) > *").each(function(i){var $this=$(this);$footerTd.eq(i).find(".fht-cell").width($this.innerWidth())})};BootstrapTable.prototype.toggleColumn=function(index,checked,needUpdate){if(index===-1){return}this.columns[index].visible=checked;this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var $items=this.$toolbar.find(".keep-open input").prop("disabled",false);if(needUpdate){$items.filter(sprintf('[value="%s"]',index)).prop("checked",checked)}if($items.filter(":checked").length<=this.options.minimumCountColumns){$items.filter(":checked").prop("disabled",true)}}};BootstrapTable.prototype.getVisibleFields=function(){var that=this,visibleFields=[];$.each(this.header.fields,function(j,field){var column=that.columns[getFieldIndex(that.columns,field)];if(!column.visible){return}visibleFields.push(field)});return visibleFields};BootstrapTable.prototype.resetView=function(params){var padding=0;if(params&&params.height){this.options.height=params.height}this.$selectAll.prop("checked",this.$selectItem.length>0&&this.$selectItem.length===this.$selectItem.filter(":checked").length);if(this.options.height){var toolbarHeight=this.$toolbar.outerHeight(true),paginationHeight=this.$pagination.outerHeight(true),height=this.options.height-toolbarHeight-paginationHeight;this.$tableContainer.css("height",height+"px")}if(this.options.cardView){this.$el.css("margin-top","0");this.$tableContainer.css("padding-bottom","0");this.$tableFooter.hide();return}if(this.options.showHeader&&this.options.height){this.$tableHeader.show();this.resetHeader();padding+=this.$header.outerHeight()}else{this.$tableHeader.hide();this.trigger("post-header")}if(this.options.showFooter){this.resetFooter();if(this.options.height){padding+=this.$tableFooter.outerHeight()+1}}this.getCaret();this.$tableContainer.css("padding-bottom",padding+"px");this.trigger("reset-view")};BootstrapTable.prototype.getData=function(useCurrentPage){return this.searchText||!$.isEmptyObject(this.filterColumns)||!$.isEmptyObject(this.filterColumnsPartial)?useCurrentPage?this.data.slice(this.pageFrom-1,this.pageTo):this.data:useCurrentPage?this.options.data.slice(this.pageFrom-1,this.pageTo):this.options.data};BootstrapTable.prototype.load=function(data){var fixedScroll=false;if(this.options.sidePagination==="server"){this.options.totalRows=data[this.options.totalField];fixedScroll=data.fixedScroll;data=data[this.options.dataField]}else if(!$.isArray(data)){fixedScroll=data.fixedScroll;data=data.data}this.initData(data);this.initSearch();this.initPagination();this.initBody(fixedScroll)};BootstrapTable.prototype.append=function(data){this.initData(data,"append");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.prepend=function(data){this.initData(data,"prepend");this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.remove=function(params){var len=this.options.data.length,i,row;if(!params.hasOwnProperty("field")||!params.hasOwnProperty("values")){return}for(i=len-1;i>=0;i--){row=this.options.data[i];if(!row.hasOwnProperty(params.field)){continue}if($.inArray(row[params.field],params.values)!==-1){this.options.data.splice(i,1);if(this.options.sidePagination==="server"){this.options.totalRows-=1}}}if(len===this.options.data.length){return}this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.removeAll=function(){if(this.options.data.length>0){this.options.data.splice(0,this.options.data.length);this.initSearch();this.initPagination();this.initBody(true)}};BootstrapTable.prototype.getRowByUniqueId=function(id){var uniqueId=this.options.uniqueId,len=this.options.data.length,dataRow=null,i,row,rowUniqueId;for(i=len-1;i>=0;i--){row=this.options.data[i];if(row.hasOwnProperty(uniqueId)){rowUniqueId=row[uniqueId]}else if(row._data.hasOwnProperty(uniqueId)){rowUniqueId=row._data[uniqueId]}else{continue}if(typeof rowUniqueId==="string"){id=id.toString()}else if(typeof rowUniqueId==="number"){if(Number(rowUniqueId)===rowUniqueId&&rowUniqueId%1===0){id=parseInt(id)}else if(rowUniqueId===Number(rowUniqueId)&&rowUniqueId!==0){id=parseFloat(id)}}if(rowUniqueId===id){dataRow=row;break}}return dataRow};BootstrapTable.prototype.removeByUniqueId=function(id){var len=this.options.data.length,row=this.getRowByUniqueId(id);if(row){this.options.data.splice(this.options.data.indexOf(row),1)}if(len===this.options.data.length){return}this.initSearch();this.initPagination();this.initBody(true)};BootstrapTable.prototype.updateByUniqueId=function(params){var that=this;var allParams=$.isArray(params)?params:[params];$.each(allParams,function(i,params){var rowId;if(!params.hasOwnProperty("id")||!params.hasOwnProperty("row")){return}rowId=$.inArray(that.getRowByUniqueId(params.id),that.options.data);if(rowId===-1){return}$.extend(that.options.data[rowId],params.row)});this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.insertRow=function(params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("row")){return}this.data.splice(params.index,0,params.row);this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.updateRow=function(params){var that=this;var allParams=$.isArray(params)?params:[params];$.each(allParams,function(i,params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("row")){return}$.extend(that.options.data[params.index],params.row)});this.initSearch();this.initPagination();this.initSort();this.initBody(true)};BootstrapTable.prototype.initHiddenRows=function(){this.hiddenRows=[]};BootstrapTable.prototype.showRow=function(params){this.toggleRow(params,true)};BootstrapTable.prototype.hideRow=function(params){this.toggleRow(params,false)};BootstrapTable.prototype.toggleRow=function(params,visible){var row,index;if(params.hasOwnProperty("index")){row=this.getData()[params.index]}else if(params.hasOwnProperty("uniqueId")){row=this.getRowByUniqueId(params.uniqueId)}if(!row){return}index=$.inArray(row,this.hiddenRows);if(!visible&&index===-1){this.hiddenRows.push(row)}else if(visible&&index>-1){this.hiddenRows.splice(index,1)}this.initBody(true)};BootstrapTable.prototype.getHiddenRows=function(show){var that=this,data=this.getData(),rows=[];$.each(data,function(i,row){if($.inArray(row,that.hiddenRows)>-1){rows.push(row)}});this.hiddenRows=rows;return rows};BootstrapTable.prototype.mergeCells=function(options){var row=options.index,col=$.inArray(options.field,this.getVisibleFields()),rowspan=options.rowspan||1,colspan=options.colspan||1,i,j,$tr=this.$body.find(">tr"),$td;if(this.options.detailView&&!this.options.cardView){col+=1}$td=$tr.eq(row).find(">td").eq(col);if(row<0||col<0||row>=this.data.length){return}for(i=row;i<row+rowspan;i++){for(j=col;j<col+colspan;j++){$tr.eq(i).find(">td").eq(j).hide()}}$td.attr("rowspan",rowspan).attr("colspan",colspan).show()};BootstrapTable.prototype.updateCell=function(params){if(!params.hasOwnProperty("index")||!params.hasOwnProperty("field")||!params.hasOwnProperty("value")){return}this.data[params.index][params.field]=params.value;if(params.reinit===false){return}this.initSort();this.initBody(true)};BootstrapTable.prototype.getOptions=function(){return this.options};BootstrapTable.prototype.getSelections=function(){var that=this;return $.grep(this.options.data,function(row){return row[that.header.stateField]===true})};BootstrapTable.prototype.getAllSelections=function(){var that=this;return $.grep(this.options.data,function(row){return row[that.header.stateField]})};BootstrapTable.prototype.checkAll=function(){this.checkAll_(true)};BootstrapTable.prototype.uncheckAll=function(){this.checkAll_(false)};BootstrapTable.prototype.checkInvert=function(){var that=this;var rows=that.$selectItem.filter(":enabled");var checked=rows.filter(":checked");rows.each(function(){$(this).prop("checked",!$(this).prop("checked"))});that.updateRows();that.updateSelected();that.trigger("uncheck-some",checked);checked=that.getSelections();that.trigger("check-some",checked)};BootstrapTable.prototype.checkAll_=function(checked){var rows;if(!checked){rows=this.getSelections()}this.$selectAll.add(this.$selectAll_).prop("checked",checked);this.$selectItem.filter(":enabled").prop("checked",checked);this.updateRows();if(checked){rows=this.getSelections()}this.trigger(checked?"check-all":"uncheck-all",rows)};BootstrapTable.prototype.check=function(index){this.check_(true,index)};BootstrapTable.prototype.uncheck=function(index){this.check_(false,index)};BootstrapTable.prototype.check_=function(checked,index){var $el=this.$selectItem.filter(sprintf('[data-index="%s"]',index)).prop("checked",checked);this.data[index][this.header.stateField]=checked;this.updateSelected();this.trigger(checked?"check":"uncheck",this.data[index],$el)};BootstrapTable.prototype.checkBy=function(obj){this.checkBy_(true,obj)};BootstrapTable.prototype.uncheckBy=function(obj){this.checkBy_(false,obj)};BootstrapTable.prototype.checkBy_=function(checked,obj){if(!obj.hasOwnProperty("field")||!obj.hasOwnProperty("values")){return}var that=this,rows=[];$.each(this.options.data,function(index,row){if(!row.hasOwnProperty(obj.field)){return false}if($.inArray(row[obj.field],obj.values)!==-1){var $el=that.$selectItem.filter(":enabled").filter(sprintf('[data-index="%s"]',index)).prop("checked",checked);row[that.header.stateField]=checked;rows.push(row);that.trigger(checked?"check":"uncheck",row,$el)}});this.updateSelected();this.trigger(checked?"check-some":"uncheck-some",rows)};BootstrapTable.prototype.destroy=function(){this.$el.insertBefore(this.$container);$(this.options.toolbar).insertBefore(this.$el);this.$container.next().remove();this.$container.remove();this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")};BootstrapTable.prototype.showLoading=function(){this.$tableLoading.show()};BootstrapTable.prototype.hideLoading=function(){this.$tableLoading.hide()};BootstrapTable.prototype.togglePagination=function(){this.options.pagination=!this.options.pagination;var button=this.$toolbar.find('button[name="paginationSwitch"] i');if(this.options.pagination){button.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchDown)}else{button.attr("class",this.options.iconsPrefix+" "+this.options.icons.paginationSwitchUp)}this.updatePagination()};BootstrapTable.prototype.refresh=function(params){if(params&&params.url){this.options.url=params.url}if(params&&params.pageNumber){this.options.pageNumber=params.pageNumber}if(params&&params.pageSize){this.options.pageSize=params.pageSize}this.initServer(params&&params.silent,params&&params.query,params&&params.url);this.trigger("refresh",params)};BootstrapTable.prototype.resetWidth=function(){if(this.options.showHeader&&this.options.height){this.fitHeader()}if(this.options.showFooter){this.fitFooter()}};BootstrapTable.prototype.showColumn=function(field){this.toggleColumn(getFieldIndex(this.columns,field),true,true)};BootstrapTable.prototype.hideColumn=function(field){this.toggleColumn(getFieldIndex(this.columns,field),false,true)};BootstrapTable.prototype.getHiddenColumns=function(){return $.grep(this.columns,function(column){return!column.visible})};BootstrapTable.prototype.getVisibleColumns=function(){return $.grep(this.columns,function(column){return column.visible})};BootstrapTable.prototype.toggleAllColumns=function(visible){$.each(this.columns,function(i,column){this.columns[i].visible=visible});this.initHeader();this.initSearch();this.initPagination();this.initBody();if(this.options.showColumns){var $items=this.$toolbar.find(".keep-open input").prop("disabled",false);if($items.filter(":checked").length<=this.options.minimumCountColumns){$items.filter(":checked").prop("disabled",true)}}};BootstrapTable.prototype.showAllColumns=function(){this.toggleAllColumns(true)};BootstrapTable.prototype.hideAllColumns=function(){this.toggleAllColumns(false)};BootstrapTable.prototype.filterBy=function(columns){this.filterColumns=$.isEmptyObject(columns)?{}:columns;this.options.pageNumber=1;this.initSearch();this.updatePagination()};BootstrapTable.prototype.scrollTo=function(value){if(typeof value==="string"){value=value==="bottom"?this.$tableBody[0].scrollHeight:0}if(typeof value==="number"){this.$tableBody.scrollTop(value)}if(typeof value==="undefined"){return this.$tableBody.scrollTop()}};BootstrapTable.prototype.getScrollPosition=function(){return this.scrollTo()};BootstrapTable.prototype.selectPage=function(page){if(page>0&&page<=this.options.totalPages){this.options.pageNumber=page;this.updatePagination()}};BootstrapTable.prototype.prevPage=function(){if(this.options.pageNumber>1){this.options.pageNumber--;this.updatePagination()}};BootstrapTable.prototype.nextPage=function(){if(this.options.pageNumber<this.options.totalPages){this.options.pageNumber++;this.updatePagination()}};BootstrapTable.prototype.toggleView=function(){this.options.cardView=!this.options.cardView;this.initHeader();this.initBody();this.trigger("toggle",this.options.cardView)};BootstrapTable.prototype.refreshOptions=function(options){if(compareObjects(this.options,options,true)){return}this.options=$.extend(this.options,options);this.trigger("refresh-options",this.options);this.destroy();this.init()};BootstrapTable.prototype.resetSearch=function(text){var $search=this.$toolbar.find(".search input");$search.val(text||"");this.onSearch({currentTarget:$search})};BootstrapTable.prototype.expandRow_=function(expand,index){var $tr=this.$body.find(sprintf('> tr[data-index="%s"]',index));if($tr.next().is("tr.detail-view")===(expand?false:true)){$tr.find("> td > .detail-icon").click()}};BootstrapTable.prototype.expandRow=function(index){this.expandRow_(true,index)};BootstrapTable.prototype.collapseRow=function(index){this.expandRow_(false,index)};BootstrapTable.prototype.expandAllRows=function(isSubTable){if(isSubTable){var $tr=this.$body.find(sprintf('> tr[data-index="%s"]',0)),that=this,detailIcon=null,executeInterval=false,idInterval=-1;if(!$tr.next().is("tr.detail-view")){$tr.find("> td > .detail-icon").click();executeInterval=true}else if(!$tr.next().next().is("tr.detail-view")){$tr.next().find(".detail-icon").click();executeInterval=true}if(executeInterval){try{idInterval=setInterval(function(){detailIcon=that.$body.find("tr.detail-view").last().find(".detail-icon");if(detailIcon.length>0){detailIcon.click()}else{clearInterval(idInterval)}},1)}catch(ex){clearInterval(idInterval)}}}else{var trs=this.$body.children();for(var i=0;i<trs.length;i++){this.expandRow_(true,$(trs[i]).data("index"))}}};BootstrapTable.prototype.collapseAllRows=function(isSubTable){if(isSubTable){this.expandRow_(false,0)}else{var trs=this.$body.children();for(var i=0;i<trs.length;i++){this.expandRow_(false,$(trs[i]).data("index"))}}};BootstrapTable.prototype.updateFormatText=function(name,text){if(this.options[sprintf("format%s",name)]){if(typeof text==="string"){this.options[sprintf("format%s",name)]=function(){return text}}else if(typeof text==="function"){this.options[sprintf("format%s",name)]=text}}this.initToolbar();this.initPagination();this.initBody()};var allowedMethods=["getOptions","getSelections","getAllSelections","getData","load","append","prepend","remove","removeAll","insertRow","updateRow","updateCell","updateByUniqueId","removeByUniqueId","getRowByUniqueId","showRow","hideRow","getHiddenRows","mergeCells","checkAll","uncheckAll","checkInvert","check","uncheck","checkBy","uncheckBy","refresh","resetView","resetWidth","destroy","showLoading","hideLoading","showColumn","hideColumn","getHiddenColumns","getVisibleColumns","showAllColumns","hideAllColumns","filterBy","scrollTo","getScrollPosition","selectPage","prevPage","nextPage","togglePagination","toggleView","refreshOptions","resetSearch","expandRow","collapseRow","expandAllRows","collapseAllRows","updateFormatText"];$.fn.bootstrapTable=function(option){var value,args=Array.prototype.slice.call(arguments,1);this.each(function(){var $this=$(this),data=$this.data("bootstrap.table"),options=$.extend({},BootstrapTable.DEFAULTS,$this.data(),typeof option==="object"&&option);if(typeof option==="string"){if($.inArray(option,allowedMethods)<0){throw new Error("Unknown method: "+option)}if(!data){return}value=data[option].apply(data,args);if(option==="destroy"){$this.removeData("bootstrap.table")}}if(!data){$this.data("bootstrap.table",data=new BootstrapTable(this,options))}});return typeof value==="undefined"?this:value};$.fn.bootstrapTable.Constructor=BootstrapTable;$.fn.bootstrapTable.defaults=BootstrapTable.DEFAULTS;$.fn.bootstrapTable.columnDefaults=BootstrapTable.COLUMN_DEFAULTS;$.fn.bootstrapTable.locales=BootstrapTable.LOCALES;$.fn.bootstrapTable.methods=allowedMethods;$.fn.bootstrapTable.utils={sprintf:sprintf,getFieldIndex:getFieldIndex,compareObjects:compareObjects,calculateObjectValue:calculateObjectValue,getItemField:getItemField,objectKeys:objectKeys,isIEBrowser:isIEBrowser};$(function(){$('[data-toggle="table"]').bootstrapTable()})})(jQuery);
  5189. define("bootstrap-table", ["bootstrap"], (function (global) {
  5190. return function () {
  5191. var ret, fn;
  5192. return ret || global.$.fn.bootstrapTable;
  5193. };
  5194. }(this)));
  5195. /**
  5196. * Bootstrap Table Chinese translation
  5197. * Author: Zhixin Wen<wenzhixin2010@gmail.com>
  5198. */
  5199. (function ($) {
  5200. 'use strict';
  5201. $.fn.bootstrapTable.locales['zh-CN'] = {
  5202. formatLoadingMessage: function () {
  5203. return '正在努力地加载数据中,请稍候……';
  5204. },
  5205. formatRecordsPerPage: function (pageNumber) {
  5206. return '每页显示 ' + pageNumber + ' 条记录';
  5207. },
  5208. formatShowingRows: function (pageFrom, pageTo, totalRows) {
  5209. return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
  5210. },
  5211. formatSearch: function () {
  5212. return '搜索';
  5213. },
  5214. formatNoMatches: function () {
  5215. return '没有找到匹配的记录';
  5216. },
  5217. formatPaginationSwitch: function () {
  5218. return '隐藏/显示分页';
  5219. },
  5220. formatRefresh: function () {
  5221. return '刷新';
  5222. },
  5223. formatToggle: function () {
  5224. return '切换';
  5225. },
  5226. formatColumns: function () {
  5227. return '列';
  5228. },
  5229. formatExport: function () {
  5230. return '导出数据';
  5231. },
  5232. formatClearFilters: function () {
  5233. return '清空过滤';
  5234. }
  5235. };
  5236. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
  5237. })(jQuery);
  5238. define("bootstrap-table-lang", ["bootstrap-table"], (function (global) {
  5239. return function () {
  5240. var ret, fn;
  5241. return ret || global.$.fn.bootstrapTable.defaults;
  5242. };
  5243. }(this)));
  5244. /*
  5245. tableExport.jquery.plugin
  5246. Version 1.10.11
  5247. Copyright (c) 2015-2019 hhurz, https://github.com/hhurz
  5248. Original Work Copyright (c) 2014 Giri Raj
  5249. Licensed under the MIT License
  5250. */
  5251. var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,h,x){c instanceof String&&(c=String(c));for(var B=c.length,D=0;D<B;D++){var T=c[D];if(h.call(x,T,D,c))return{i:D,v:T}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,h,x){c!=Array.prototype&&c!=Object.prototype&&(c[h]=x.value)};
  5252. $jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(c,h,x,B){if(h){x=$jscomp.global;c=c.split(".");for(B=0;B<c.length-1;B++){var D=c[B];D in x||(x[D]={});x=x[D]}c=c[c.length-1];B=x[c];h=h(B);h!=B&&null!=h&&$jscomp.defineProperty(x,c,{configurable:!0,writable:!0,value:h})}};
  5253. $jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(c,x){return $jscomp.findInternal(this,c,x).v}},"es6","es3");
  5254. (function(c){c.fn.tableExport=function(h){function x(b){var d=[];D(b,"thead").each(function(){d.push.apply(d,D(c(this),a.theadSelector).toArray())});return d}function B(b){var d=[];D(b,"tbody").each(function(){d.push.apply(d,D(c(this),a.tbodySelector).toArray())});a.tfootSelector.length&&D(b,"tfoot").each(function(){d.push.apply(d,D(c(this),a.tfootSelector).toArray())});return d}function D(b,a){var d=b[0].tagName,q=b.parents(d).length;return b.find(a).filter(function(){return q===c(this).closest(d).parents(d).length})}
  5255. function T(b){var a=[];c(b).find("thead").first().find("th").each(function(b,d){void 0!==c(d).attr("data-field")?a[b]=c(d).attr("data-field"):a[b]=b.toString()});return a}function J(b){var a="undefined"!==typeof b[0].rowIndex,e=!1===a&&"undefined"!==typeof b[0].cellIndex,q=e||a?La(b):b.is(":visible"),f=b.attr("data-tableexport-display");e&&"none"!==f&&"always"!==f&&(b=c(b[0].parentNode),a="undefined"!==typeof b[0].rowIndex,f=b.attr("data-tableexport-display"));a&&"none"!==f&&"always"!==f&&(f=b.closest("table").attr("data-tableexport-display"));
  5256. return"none"!==f&&(!0===q||"always"===f)}function La(b){var a=[];W&&(a=K.filter(function(){var a=!1;this.nodeType===b[0].nodeType&&("undefined"!==typeof this.rowIndex&&this.rowIndex===b[0].rowIndex?a=!0:"undefined"!==typeof this.cellIndex&&this.cellIndex===b[0].cellIndex&&"undefined"!==typeof this.parentNode.rowIndex&&"undefined"!==typeof b[0].parentNode.rowIndex&&this.parentNode.rowIndex===b[0].parentNode.rowIndex&&(a=!0));return a}));return!1===W||0===a.length}function ua(b,d,e){var q=!1;J(b)?0<
  5257. a.ignoreColumn.length&&(-1!==c.inArray(e,a.ignoreColumn)||-1!==c.inArray(e-d,a.ignoreColumn)||U.length>e&&"undefined"!==typeof U[e]&&-1!==c.inArray(U[e],a.ignoreColumn))&&(q=!0):q=!0;return q}function C(b,d,e,q,f){if("function"===typeof f){var m=!1;"function"===typeof a.onIgnoreRow&&(m=a.onIgnoreRow(c(b),e));if(!1===m&&(0===a.ignoreRow.length||-1===c.inArray(e,a.ignoreRow)&&-1===c.inArray(e-q,a.ignoreRow))&&J(c(b))){var r=D(c(b),d),k=0;r.each(function(b){var a=c(this),d,m=P(this),q=V(this);c.each(H,
  5258. function(){if(e>=this.s.r&&e<=this.e.r&&k>=this.s.c&&k<=this.e.c)for(d=0;d<=this.e.c-this.s.c;++d)f(null,e,k++)});if(!1===ua(a,r.length,b)){if(q||m)m=m||1,H.push({s:{r:e,c:k},e:{r:e+(q||1)-1,c:k+m-1}});f(this,e,k++)}if(m)for(d=0;d<m-1;++d)f(null,e,k++)});c.each(H,function(){if(e>=this.s.r&&e<=this.e.r&&k>=this.s.c&&k<=this.e.c)for(da=0;da<=this.e.c-this.s.c;++da)f(null,e,k++)})}}}function va(b,a,e,c){if("undefined"!==typeof c.images&&(e=c.images[e],"undefined"!==typeof e)){a=a.getBoundingClientRect();
  5259. var d=b.width/b.height,m=a.width/a.height,q=b.width,k=b.height,y=19.049976/25.4,g=0;m<=d?(k=Math.min(b.height,a.height),q=a.width*k/a.height):m>d&&(q=Math.min(b.width,a.width),k=a.height*q/a.width);q*=y;k*=y;k<b.height&&(g=(b.height-k)/2);try{c.doc.addImage(e.src,b.textPos.x,b.y+g,q,k)}catch(Qa){}b.textPos.x+=q}}function wa(b,d){if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return L(b.output());if("window"===a.outputMode)window.URL=window.URL||window.webkitURL,window.open(window.URL.createObjectURL(b.output("blob")));
  5260. else try{var e=b.output("blob");saveAs(e,a.fileName+".pdf")}catch(q){ka(a.fileName+".pdf","data:application/pdf"+(d?"":";base64")+",",d?b.output("blob"):b.output())}}function xa(b,a,e){var d=0;"undefined"!==typeof e&&(d=e.colspan);if(0<=d){for(var f=b.width,c=b.textPos.x,r=a.table.columns.indexOf(a.column),k=1;k<d;k++)f+=a.table.columns[r+k].width;1<d&&("right"===b.styles.halign?c=b.textPos.x+f-b.width:"center"===b.styles.halign&&(c=b.textPos.x+(f-b.width)/2));b.width=f;b.textPos.x=c;"undefined"!==
  5261. typeof e&&1<e.rowspan&&(b.height*=e.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)e=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<e&&(b.textPos.y-=(2-1.15)/2*a.row.styles.fontSize*(e-2)/3);return!0}return!1}function ya(b,a,e){"undefined"!==typeof b&&null!==b&&(b.hasAttribute("data-tableexport-canvas")?(a=(new Date).getTime(),c(b).attr("data-tableexport-canvas",a),e.images[a]={url:'[data-tableexport-canvas="'+a+'"]',src:null}):"undefined"!==a&&null!=
  5262. a&&a.each(function(){if(c(this).is("img")){var a=za(this.src);e.images[a]={url:this.src,src:this.src}}ya(b,c(this).children(),e)}))}function Ma(b,a){function d(b){if(b.url)if(b.src){var d=new Image;q=++f;d.crossOrigin="Anonymous";d.onerror=d.onload=function(){if(d.complete&&(0===d.src.indexOf("data:image/")&&(d.width=b.width||d.width||0,d.height=b.height||d.height||0),d.width+d.height)){var e=document.createElement("canvas"),c=e.getContext("2d");e.width=d.width;e.height=d.height;c.drawImage(d,0,0);
  5263. b.src=e.toDataURL("image/png")}--f||a(q)};d.src=b.url}else{var e=c(b.url);e.length&&(q=++f,html2canvas(e[0]).then(function(d){b.src=d.toDataURL("image/png");--f||a(q)}))}}var q=0,f=0;if("undefined"!==typeof b.images)for(var m in b.images)b.images.hasOwnProperty(m)&&d(b.images[m]);(b=f)||(a(q),b=void 0);return b}function Aa(b,d,e){d.each(function(){if(c(this).is("div")){var d=ea(M(this,"background-color"),[255,255,255]),f=ea(M(this,"border-top-color"),[0,0,0]),m=fa(this,"border-top-width",a.jspdf.unit),
  5264. r=this.getBoundingClientRect(),k=this.offsetLeft*e.wScaleFactor,y=this.offsetTop*e.hScaleFactor,g=r.width*e.wScaleFactor;r=r.height*e.hScaleFactor;e.doc.setDrawColor.apply(void 0,f);e.doc.setFillColor.apply(void 0,d);e.doc.setLineWidth(m);e.doc.rect(b.x+k,b.y+y,g,r,m?"FD":"F")}else c(this).is("img")&&(d=za(this.src),va(b,this,d,e));Aa(b,c(this).children(),e)})}function Ba(b,d,e){if("function"===typeof e.onAutotableText)e.onAutotableText(e.doc,b,d);else{var q=b.textPos.x,f=b.textPos.y,m={halign:b.styles.halign,
  5265. valign:b.styles.valign};if(d.length){for(d=d[0];d.previousSibling;)d=d.previousSibling;for(var r=!1,k=!1;d;){var y=d.innerText||d.textContent||"",g=y.length&&" "===y[0]?" ":"",h=1<y.length&&" "===y[y.length-1]?" ":"";!0!==a.preserve.leadingWS&&(y=g+la(y));!0!==a.preserve.trailingWS&&(y=ma(y)+h);c(d).is("br")&&(q=b.textPos.x,f+=e.doc.internal.getFontSize());c(d).is("b")?r=!0:c(d).is("i")&&(k=!0);(r||k)&&e.doc.setFontType(r&&k?"bolditalic":r?"bold":"italic");if(g=e.doc.getStringUnitWidth(y)*e.doc.internal.getFontSize()){"linebreak"===
  5266. b.styles.overflow&&q>b.textPos.x&&q+g>b.textPos.x+b.width&&(0<=".,!%*;:=-".indexOf(y.charAt(0))&&(h=y.charAt(0),g=e.doc.getStringUnitWidth(h)*e.doc.internal.getFontSize(),q+g<=b.textPos.x+b.width&&(e.doc.autoTableText(h,q,f,m),y=y.substring(1,y.length)),g=e.doc.getStringUnitWidth(y)*e.doc.internal.getFontSize()),q=b.textPos.x,f+=e.doc.internal.getFontSize());if("visible"!==b.styles.overflow)for(;y.length&&q+g>b.textPos.x+b.width;)y=y.substring(0,y.length-1),g=e.doc.getStringUnitWidth(y)*e.doc.internal.getFontSize();
  5267. e.doc.autoTableText(y,q,f,m);q+=g}if(r||k)c(d).is("b")?r=!1:c(d).is("i")&&(k=!1),e.doc.setFontType(r||k?r?"bold":"italic":"normal");d=d.nextSibling}b.textPos.x=q;b.textPos.y=f}else e.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,m)}}function ha(b,a,e){return null==b?"":b.toString().replace(new RegExp(null==a?"":a.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function la(b){return null==b?"":b.toString().replace(/^\s+/,"")}function ma(b){return null==b?"":b.toString().replace(/\s+$/,
  5268. "")}function Ca(b){a.date.pattern.lastIndex=0;var d=a.date.pattern.exec(b);if(null==d)return!1;b=+d[a.date.match_y];if(0>b||8099<b)return!1;var e=1*d[a.date.match_m];d=1*d[a.date.match_d];if(isNaN(d))return!1;var c=new Date(b,e-1,d);return c.getFullYear()===b&&c.getMonth()===e-1&&c.getDate()===d?c:!1}function na(b){b=b||"0";""!==a.numbers.html.thousandsSeparator&&(b=ha(b,a.numbers.html.thousandsSeparator,""));"."!==a.numbers.html.decimalMark&&(b=ha(b,a.numbers.html.decimalMark,"."));return"number"===
  5269. typeof b||!1!==jQuery.isNumeric(b)?b:!1}function Na(b){-1<b.indexOf("%")?(b=na(b.replace(/%/g,"")),!1!==b&&(b/=100)):b=!1;return b}function F(b,d,e,q){var f="",m="text";if(null!==b){var r=c(b);if(r[0].hasAttribute("data-tableexport-canvas"))var k="";else if(r[0].hasAttribute("data-tableexport-value"))k=(k=r.attr("data-tableexport-value"))?k+"":"";else if(k=r.html(),"function"===typeof a.onCellHtmlData)k=a.onCellHtmlData(r,d,e,k);else if(""!==k){b=c.parseHTML(k);var g=0,h=0;k="";c.each(b,function(){if(c(this).is("input"))k+=
  5270. r.find("input").eq(g++).val();else if(c(this).is("select"))k+=r.find("select option:selected").eq(h++).text();else if(c(this).is("br"))k+="<br>";else{if("undefined"===typeof c(this).html())k+=c(this).text();else if(void 0===jQuery().bootstrapTable||!1===c(this).hasClass("fht-cell")&&!1===c(this).hasClass("filterControl")&&0===r.parents(".detail-view").length)k+=c(this).html();if(c(this).is("a")){var b=r.find("a").attr("href")||"";f="function"===typeof a.onCellHtmlHyperlink?a.onCellHtmlHyperlink(r,
  5271. d,e,b,k):"href"===a.htmlHyperlink?b:k;k=""}}})}if(k&&""!==k&&!0===a.htmlContent)f=c.trim(k);else if(k&&""!==k)if(""!==r.attr("data-tableexport-cellformat")){var l=k.replace(/\n/g,"\u2028").replace(/(<\s*br([^>]*)>)/gi,"\u2060"),p=c("<div/>").html(l).contents();b=!1;l="";c.each(p.text().split("\u2028"),function(b,d){0<b&&(l+=" ");!0!==a.preserve.leadingWS&&(d=la(d));l+=!0!==a.preserve.trailingWS?ma(d):d});c.each(l.split("\u2060"),function(b,d){0<b&&(f+="\n");!0!==a.preserve.leadingWS&&(d=la(d));!0!==
  5272. a.preserve.trailingWS&&(d=ma(d));f+=d.replace(/\u00AD/g,"")});f=f.replace(/\u00A0/g," ");if("json"===a.type||"excel"===a.type&&"xmlss"===a.mso.fileFormat||!1===a.numbers.output)b=na(f),!1!==b&&(m="number",f=Number(b));else if(a.numbers.html.decimalMark!==a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!==a.numbers.output.thousandsSeparator)if(b=na(f),!1!==b){p=(""+b.substr(0>b?1:0)).split(".");1===p.length&&(p[1]="");var n=3<p[0].length?p[0].length%3:0;m="number";f=(0>b?"-":"")+(a.numbers.output.thousandsSeparator?
  5273. (n?p[0].substr(0,n)+a.numbers.output.thousandsSeparator:"")+p[0].substr(n).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):p[0])+(p[1].length?a.numbers.output.decimalMark+p[1]:"")}}else f=k;!0===a.escape&&(f=escape(f));"function"===typeof a.onCellData&&(f=a.onCellData(r,d,e,f,m))}void 0!==q&&(q.type=m);return f}function Da(b){return 0<b.length&&!0===a.preventInjection&&0<="=+-@".indexOf(b.charAt(0))?"'"+b:b}function Oa(b,a,e){return a+"-"+e.toLowerCase()}function ea(b,a){(b=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b))&&
  5274. (a=[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]);return a}function Ea(b){var a=M(b,"text-align"),e=M(b,"font-weight"),c=M(b,"font-style"),f="";"start"===a&&(a="rtl"===M(b,"direction")?"right":"left");700<=e&&(f="bold");"italic"===c&&(f+=c);""===f&&(f="normal");a={style:{align:a,bcolor:ea(M(b,"background-color"),[255,255,255]),color:ea(M(b,"color"),[0,0,0]),fstyle:f},colspan:P(b),rowspan:V(b)};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function P(b){var a=
  5275. c(b).attr("data-tableexport-colspan");"undefined"===typeof a&&c(b).is("[colspan]")&&(a=c(b).attr("colspan"));return parseInt(a)||0}function V(b){var a=c(b).attr("data-tableexport-rowspan");"undefined"===typeof a&&c(b).is("[rowspan]")&&(a=c(b).attr("rowspan"));return parseInt(a)||0}function M(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,Oa),window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:b.style[a]}catch(e){}return""}function fa(a,d,e){d=
  5276. M(a,d).match(/\d+/);if(null!==d){d=d[0];a=a.parentElement;var b=document.createElement("div");b.style.overflow="hidden";b.style.visibility="hidden";a.appendChild(b);b.style.width=100+e;e=100/b.offsetWidth;a.removeChild(b);return d*e}return 0}function Pa(a){for(var b=new ArrayBuffer(a.length),e=new Uint8Array(b),c=0;c!==a.length;++c)e[c]=a.charCodeAt(c)&255;return b}function oa(a){var b=a.c,e="";for(++b;b;b=Math.floor((b-1)/26))e=String.fromCharCode((b-1)%26+65)+e;return e+(""+(a.r+1))}function pa(a,
  5277. d){if("undefined"===typeof d||"number"===typeof d)return pa(a.s,a.e);"string"!==typeof a&&(a=oa(a));"string"!==typeof d&&(d=oa(d));return a===d?a:a+":"+d}function Fa(a,d){var b=Number(a);if(!isNaN(b))return b;var c=1;""!==d.thousandsSeparator&&(a=a.replace(new RegExp("([\\d])"+d.thousandsSeparator+"([\\d])","g"),"$1$2"));"."!==d.decimalMark&&(a=a.replace(new RegExp("([\\d])"+d.decimalMark+"([\\d])","g"),"$1.$2"));a=a.replace(/[$]/g,"").replace(/[%]/g,function(){c*=100;return""});if(!isNaN(b=Number(a)))return b/
  5278. c;a=a.replace(/[(](.*)[)]/,function(a,b){c=-c;return b});return isNaN(b=Number(a))?b:b/c}function za(a){var b=0,c;if(0===a.length)return b;var q=0;for(c=a.length;q<c;q++){var f=a.charCodeAt(q);b=(b<<5)-b+f;b|=0}return b}function N(b,d,c,q,f,m){var e=!0;"function"===typeof a.onBeforeSaveToFile&&(e=a.onBeforeSaveToFile(b,d,c,q,f),"boolean"!==typeof e&&(e=!0));if(e)try{if(Ga=new Blob([b],{type:c+";charset="+q}),saveAs(Ga,d,!1===m),"function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(b,d)}catch(k){ka(d,
  5279. "data:"+c+(q.length?";charset="+q:"")+(f.length?";"+f:"")+",",m?"\ufeff"+b:b)}}function ka(b,d,c){var e=window.navigator.userAgent;if(!1!==b&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([c]),b);else if(!1!==b&&(0<e.indexOf("MSIE ")||e.match(/Trident.*rv\:11\./))){if(d=document.createElement("iframe")){document.body.appendChild(d);d.setAttribute("style","display:none");d.contentDocument.open("txt/plain","replace");d.contentDocument.write(c);d.contentDocument.close();
  5280. d.contentWindow.focus();switch(b.substr(b.lastIndexOf(".")+1)){case "doc":case "json":case "png":case "pdf":case "xls":case "xlsx":b+=".txt"}d.contentDocument.execCommand("SaveAs",!0,b);document.body.removeChild(d)}}else{var f=document.createElement("a");if(f){var m=null;f.style.display="none";!1!==b?f.download=b:f.target="_blank";"object"===typeof c?(window.URL=window.URL||window.webkitURL,e=[],e.push(c),m=window.URL.createObjectURL(new Blob(e,{type:d})),f.href=m):0<=d.toLowerCase().indexOf("base64,")?
  5281. f.href=d+L(c):f.href=d+encodeURIComponent(c);document.body.appendChild(f);if(document.createEvent)null===ia&&(ia=document.createEvent("MouseEvents")),ia.initEvent("click",!0,!1),f.dispatchEvent(ia);else if(document.createEventObject)f.fireEvent("onclick");else if("function"===typeof f.onclick)f.onclick();setTimeout(function(){m&&window.URL.revokeObjectURL(m);document.body.removeChild(f);if("function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(c,b)},100)}}}function L(a){var b,c="",q=0;if("string"===
  5282. typeof a){a=a.replace(/\x0d\x0a/g,"\n");var f="";for(b=0;b<a.length;b++){var m=a.charCodeAt(b);128>m?f+=String.fromCharCode(m):(127<m&&2048>m?f+=String.fromCharCode(m>>6|192):(f+=String.fromCharCode(m>>12|224),f+=String.fromCharCode(m>>6&63|128)),f+=String.fromCharCode(m&63|128))}a=f}for(;q<a.length;){var r=a.charCodeAt(q++);f=a.charCodeAt(q++);b=a.charCodeAt(q++);m=r>>2;r=(r&3)<<4|f>>4;var k=(f&15)<<2|b>>6;var g=b&63;isNaN(f)?k=g=64:isNaN(b)&&(g=64);c=c+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(m)+
  5283. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(r)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)}return c}var a={csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,date:{html:"dd/mm/yyyy"},displayTableName:!1,escape:!1,exportHiddenCells:!1,fileName:"tableExport",htmlContent:!1,htmlHyperlink:"content",ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",
  5284. unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"inherit",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"inherit",valign:"middle"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},mso:{fileFormat:"xlshtml",
  5285. onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:!1,styles:[],worksheetName:"",xslx:{formatId:{date:14,numbers:2}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onAfterSaveToFile:null,onBeforeSaveToFile:null,onCellData:null,onCellHtmlData:null,onCellHtmlHyperlink:null,onIgnoreRow:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageOrientation:"portrait",defaultStyle:{font:"Roboto"}},fonts:{}},preserve:{leadingWS:!1,
  5286. trailingWS:!1},preventInjection:!0,sql:{tableEnclosure:"`",columnEnclosure:"`"},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"},O={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],
  5287. b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]},A=this,ia=null,u=[],t=
  5288. [],p=0,n="",U=[],H=[],Ga,K=[],W=!1;c.extend(!0,a,h);"xlsx"===a.type&&(a.mso.fileFormat=a.type,a.type="excel");"undefined"!==typeof a.excelFileFormat&&"undefined"===a.mso.fileFormat&&(a.mso.fileFormat=a.excelFileFormat);"undefined"!==typeof a.excelPageFormat&&"undefined"===a.mso.pageFormat&&(a.mso.pageFormat=a.excelPageFormat);"undefined"!==typeof a.excelPageOrientation&&"undefined"===a.mso.pageOrientation&&(a.mso.pageOrientation=a.excelPageOrientation);"undefined"!==typeof a.excelRTL&&"undefined"===
  5289. a.mso.rtl&&(a.mso.rtl=a.excelRTL);"undefined"!==typeof a.excelstyles&&"undefined"===a.mso.styles&&(a.mso.styles=a.excelstyles);"undefined"!==typeof a.onMsoNumberFormat&&"undefined"===a.mso.onMsoNumberFormat&&(a.mso.onMsoNumberFormat=a.onMsoNumberFormat);"undefined"!==typeof a.worksheetName&&"undefined"===a.mso.worksheetName&&(a.mso.worksheetName=a.worksheetName);a.mso.pageOrientation="l"===a.mso.pageOrientation.substr(0,1)?"landscape":"portrait";a.date.html=a.date.html||"";if(a.date.html.length){h=
  5290. [];h.dd="(3[01]|[12][0-9]|0?[1-9])";h.mm="(1[012]|0?[1-9])";h.yyyy="((?:1[6-9]|2[0-2])\\d{2})";h.yy="(\\d{2})";var v=a.date.html.match(/[^a-zA-Z0-9]/)[0];v=a.date.html.toLowerCase().split(v);a.date.regex="^\\s*";a.date.regex+=h[v[0]];a.date.regex+="(.)";a.date.regex+=h[v[1]];a.date.regex+="\\2";a.date.regex+=h[v[2]];a.date.regex+="\\s*$";a.date.pattern=new RegExp(a.date.regex,"g");h=v.indexOf("dd")+1;a.date.match_d=h+(1<h?1:0);h=v.indexOf("mm")+1;a.date.match_m=h+(1<h?1:0);h=(0<=v.indexOf("yyyy")?
  5291. v.indexOf("yyyy"):v.indexOf("yy"))+1;a.date.match_y=h+(1<h?1:0)}U=T(A);if("csv"===a.type||"tsv"===a.type||"txt"===a.type){var Q="",Z=0;H=[];p=0;var qa=function(b,d,e){b.each(function(){n="";C(this,d,p,e+b.length,function(b,c,d){var e=n,f="";if(null!==b)if(b=F(b,c,d),c=null===b||""===b?"":b.toString(),"tsv"===a.type)b instanceof Date&&b.toLocaleString(),f=ha(c,"\t"," ");else if(b instanceof Date)f=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(f=Da(c),f=ha(f,a.csvEnclosure,a.csvEnclosure+
  5292. a.csvEnclosure),0<=f.indexOf(a.csvSeparator)||/[\r\n ]/g.test(f))f=a.csvEnclosure+f+a.csvEnclosure;n=e+(f+("tsv"===a.type?"\t":a.csvSeparator))});n=c.trim(n).substring(0,n.length-1);0<n.length&&(0<Q.length&&(Q+="\n"),Q+=n);p++});return b.length};Z+=qa(c(A).find("thead").first().find(a.theadSelector),"th,td",Z);D(c(A),"tbody").each(function(){Z+=qa(D(c(this),a.tbodySelector),"td,th",Z)});a.tfootSelector.length&&qa(c(A).find("tfoot").first().find(a.tfootSelector),"td,th",Z);Q+="\n";if("string"===a.outputMode)return Q;
  5293. if("base64"===a.outputMode)return L(Q);if("window"===a.outputMode){ka(!1,"data:text/"+("csv"===a.type?"csv":"plain")+";charset=utf-8,",Q);return}N(Q,a.fileName+"."+a.type,"text/"+("csv"===a.type?"csv":"plain"),"utf-8","","csv"===a.type&&a.csvUseBOM)}else if("sql"===a.type){p=0;H=[];var z="INSERT INTO "+a.sql.tableEnclosure+a.tableName+a.sql.tableEnclosure+" (";u=x(c(A));c(u).each(function(){C(this,"th,td",p,u.length,function(b,c,e){z+=a.sql.columnEnclosure+F(b,c,e)+a.sql.columnEnclosure+","});p++;
  5294. z=c.trim(z).substring(0,z.length-1)});z+=") VALUES ";t=B(c(A));c(t).each(function(){n="";C(this,"td,th",p,u.length+t.length,function(a,c,e){n+="'"+F(a,c,e)+"',"});3<n.length&&(z+="("+n,z=c.trim(z).substring(0,z.length-1),z+="),");p++});z=c.trim(z).substring(0,z.length-1);z+=";";if("string"===a.outputMode)return z;if("base64"===a.outputMode)return L(z);N(z,a.fileName+".sql","application/sql","utf-8","",!1)}else if("json"===a.type){var X=[];H=[];u=x(c(A));c(u).each(function(){var a=[];C(this,"th,td",
  5295. p,u.length,function(b,c,g){a.push(F(b,c,g))});X.push(a)});var ra=[];t=B(c(A));c(t).each(function(){var a={},d=0;C(this,"td,th",p,u.length+t.length,function(b,c,f){X.length?a[X[X.length-1][d]]=F(b,c,f):a[d]=F(b,c,f);d++});!1===c.isEmptyObject(a)&&ra.push(a);p++});h="";h="head"===a.jsonScope?JSON.stringify(X):"data"===a.jsonScope?JSON.stringify(ra):JSON.stringify({header:X,data:ra});if("string"===a.outputMode)return h;if("base64"===a.outputMode)return L(h);N(h,a.fileName+".json","application/json",
  5296. "utf-8","base64",!1)}else if("xml"===a.type){p=0;H=[];var R='<?xml version="1.0" encoding="utf-8"?>';R+="<tabledata><fields>";u=x(c(A));c(u).each(function(){C(this,"th,td",p,u.length,function(a,c,e){R+="<field>"+F(a,c,e)+"</field>"});p++});R+="</fields><data>";var sa=1;t=B(c(A));c(t).each(function(){var a=1;n="";C(this,"td,th",p,u.length+t.length,function(b,c,g){n+="<column-"+a+">"+F(b,c,g)+"</column-"+a+">";a++});0<n.length&&"<column-1></column-1>"!==n&&(R+='<row id="'+sa+'">'+n+"</row>",sa++);p++});
  5297. R+="</data></tabledata>";if("string"===a.outputMode)return R;if("base64"===a.outputMode)return L(R);N(R,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===a.type&&"xmlss"===a.mso.fileFormat){var ta=[],G=[];c(A).filter(function(){return J(c(this))}).each(function(){function b(a,b,d){var f=[];c(a).each(function(){var b=0,e=0;n="";C(this,"td,th",p,d+a.length,function(a,d,m){if(null!==a){var k="";d=F(a,d,m);m="String";if(!1!==jQuery.isNumeric(d))m="Number";else{var g=Na(d);!1!==
  5298. g&&(d=g,m="Number",k+=' ss:StyleID="pct1"')}"Number"!==m&&(d=d.replace(/\n/g,"<br>"));g=P(a);a=V(a);c.each(f,function(){if(p>=this.s.r&&p<=this.e.r&&e>=this.s.c&&e<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)e++,b++});if(a||g)a=a||1,g=g||1,f.push({s:{r:p,c:e},e:{r:p+a-1,c:e+g-1}});1<g&&(k+=' ss:MergeAcross="'+(g-1)+'"',e+=g-1);1<a&&(k+=' ss:MergeDown="'+(a-1)+'" ss:StyleID="rsp1"');0<b&&(k+=' ss:Index="'+(e+1)+'"',b=0);n+="<Cell"+k+'><Data ss:Type="'+m+'">'+c("<div />").text(d).html()+"</Data></Cell>\r";
  5299. e++}});0<n.length&&(I+='<Row ss:AutoFitHeight="0">\r'+n+"</Row>\r");p++});return a.length}var d=c(this),e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(G.length+1):"undefined"!==typeof a.mso.worksheetName[G.length]&&(e=a.mso.worksheetName[G.length]);e.length||(e=d.find("caption").text()||"");e.length||(e="Table "+(G.length+1));e=c.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));G.push(c("<div />").text(e).html());!1===a.exportHiddenCells&&(K=
  5300. d.find("tr, th, td").filter(":hidden"),W=0<K.length);p=0;U=T(this);I="<Table>\r";e=b(x(d),"th,td",0);b(B(d),"td,th",e);I+="</Table>\r";ta.push(I)});h={};v={};for(var l,S,Y=0,da=G.length;Y<da;Y++)l=G[Y],S=h[l],S=h[l]=null==S?1:S+1,2===S&&(G[v[l]]=G[v[l]].substring(0,29)+"-1"),1<h[l]?G[Y]=G[Y].substring(0,29)+"-"+h[l]:v[l]=Y;h='<?xml version="1.0" encoding="UTF-8"?>\r<?mso-application progid="Excel.Sheet"?>\r<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:o="urn:schemas-microsoft-com:office:office"\r xmlns:x="urn:schemas-microsoft-com:office:excel"\r xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:html="http://www.w3.org/TR/REC-html40">\r<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r <Created>'+
  5301. (new Date).toISOString()+'</Created>\r</DocumentProperties>\r<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r <AllowPNG/>\r</OfficeDocumentSettings>\r<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r <WindowHeight>9000</WindowHeight>\r <WindowWidth>13860</WindowWidth>\r <WindowTopX>0</WindowTopX>\r <WindowTopY>0</WindowTopY>\r <ProtectStructure>False</ProtectStructure>\r <ProtectWindows>False</ProtectWindows>\r</ExcelWorkbook>\r<Styles>\r <Style ss:ID="Default" ss:Name="Normal">\r <Alignment ss:Vertical="Bottom"/>\r <Borders/>\r <Font/>\r <Interior/>\r <NumberFormat/>\r <Protection/>\r </Style>\r <Style ss:ID="rsp1">\r <Alignment ss:Vertical="Center"/>\r </Style>\r <Style ss:ID="pct1">\r <NumberFormat ss:Format="Percent"/>\r </Style>\r</Styles>\r';
  5302. for(v=0;v<ta.length;v++)h+='<Worksheet ss:Name="'+G[v]+'" ss:RightToLeft="'+(a.mso.rtl?"1":"0")+'">\r'+ta[v],h=a.mso.rtl?h+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r<DisplayRightToLeft/>\r</WorksheetOptions>\r':h+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r',h+="</Worksheet>\r";h+="</Workbook>\r";if("string"===a.outputMode)return h;if("base64"===a.outputMode)return L(h);N(h,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===
  5303. a.type&&"xlsx"===a.mso.fileFormat){var aa=[],Ha=XLSX.utils.book_new();c(A).filter(function(){return J(c(this))}).each(function(){for(var b=c(this),d={},e=this.getElementsByTagName("tr"),g={s:{r:0,c:0},e:{r:0,c:0}},f=[],m,r=[],k=0,h=0,l,n,u,v,t,x=XLSX.SSF.get_table();k<e.length&&1E7>h;++k)if(l=e[k],n=!1,"function"===typeof a.onIgnoreRow&&(n=a.onIgnoreRow(c(l),k)),!1===n&&-1===c.inArray(p,a.ignoreRow)&&-1===c.inArray(p-sa,a.ignoreRow)&&J(c(l))){var A=l.children,D=0;for(l=0;l<A.length;++l)t=A[l],v=+P(t)||
  5304. 1,D+=v;var B=0;for(l=n=0;l<A.length;++l)if(t=A[l],v=+P(t)||1,m=l+B,!ua(c(t),D,m+(m<n?n-m:0))){B+=v-1;for(m=0;m<f.length;++m){var E=f[m];E.s.c==n&&E.s.r<=h&&h<=E.e.r&&(n=E.e.c+1,m=-1)}(0<(u=+V(t))||1<v)&&f.push({s:{r:h,c:n},e:{r:h+(u||1)-1,c:n+v-1}});m={type:""};E=F(t,k,l+B,m);var z={t:"s",v:E},C="",w=parseInt(c(t).attr("data-tableexport-xlsxformatid")||0);0===w&&"function"===typeof a.mso.xslx.formatId.numbers&&(w=a.mso.xslx.formatId.numbers(c(t),k,l+B));0===w&&"function"===typeof a.mso.xslx.formatId.date&&
  5305. (w=a.mso.xslx.formatId.date(c(t),k,l+B));if(49===w||"@"===w)C="s";else if("number"===m.type||0<w&&14>w||36<w&&41>w||48===w)C="n";else if("date"===m.type||13<w&&37>w||44<w&&48>w||56===w)C="d";null!=E&&(0===E.length?z.t=C||"z":0!==E.trim().length&&"s"!==C&&("function"===m.type?z={f:E}:"TRUE"===E?z={t:"b",v:!0}:"FALSE"===E?z={t:"b",v:!1}:"n"!==C&&isNaN(Fa(E,a.numbers.output))?"d"===C||!1!==Ca(E)?(0===w&&"function"!==typeof a.mso.xslx.formatId.date&&(w=a.mso.xslx.formatId.date),z={t:"d",v:Ca(E),z:"string"===
  5306. typeof w?w:w in x?x[w]:"m/d/yy"}):""===C&&c(t).find("a").length&&(E="href"!==a.htmlHyperlink?E:"",z={f:'=HYPERLINK("'+c(t).find("a").attr("href")+(E.length?'","'+E:"")+'")'}):(0===w&&"function"!==typeof a.mso.xslx.formatId.numbers&&(w=a.mso.xslx.formatId.numbers),z={t:"n",v:Fa(E,a.numbers.output),z:"string"===typeof w?w:w in x?x[w]:"0.00"})));d[oa({c:n,r:h})]=z;g.e.c<n&&(g.e.c=n);n+=v}++h}f.length&&(d["!merges"]=f);r.length&&(d["!rows"]=r);g.e.r=h-1;d["!ref"]=pa(g);1E7<=h&&(d["!fullref"]=pa((g.e.r=
  5307. e.length-k+h-1,g)));e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(aa.length+1):"undefined"!==typeof a.mso.worksheetName[aa.length]&&(e=a.mso.worksheetName[aa.length]);e.length||(e=b.find("caption").text()||"");e.length||(e="Table "+(aa.length+1));e=c.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));aa.push(e);XLSX.utils.book_append_sheet(Ha,d,e)});h=XLSX.write(Ha,{type:"binary",bookType:a.mso.fileFormat,bookSST:!1});N(Pa(h),a.fileName+"."+a.mso.fileFormat,
  5308. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","UTF-8","",!1)}else if("excel"===a.type||"xls"===a.type||"word"===a.type||"doc"===a.type){h="excel"===a.type||"xls"===a.type?"excel":"word";v="excel"===h?"xls":"doc";l='xmlns:x="urn:schemas-microsoft-com:office:'+h+'"';var I="",ba="";c(A).filter(function(){return J(c(this))}).each(function(){var b=c(this);""===ba&&(ba=a.mso.worksheetName||b.find("caption").text()||"Table",ba=c.trim(ba.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31)));
  5309. !1===a.exportHiddenCells&&(K=b.find("tr, th, td").filter(":hidden"),W=0<K.length);p=0;H=[];U=T(this);I+="<table><thead>";u=x(b);c(u).each(function(){var b=c(this);n="";C(this,"th,td",p,u.length,function(c,d,f){if(null!==c){var e="";n+="<th";if(a.mso.styles.length){var g=document.defaultView.getComputedStyle(c,null),k=document.defaultView.getComputedStyle(b[0],null),h;for(h in a.mso.styles){var l=g[a.mso.styles[h]];""===l&&(l=k[a.mso.styles[h]]);""!==l&&"0px none rgb(0, 0, 0)"!==l&&"rgba(0, 0, 0, 0)"!==
  5310. l&&(e+=""===e?'style="':";",e+=a.mso.styles[h]+":"+l)}}""!==e&&(n+=" "+e+'"');e=P(c);0<e&&(n+=' colspan="'+e+'"');e=V(c);0<e&&(n+=' rowspan="'+e+'"');n+=">"+F(c,d,f)+"</th>"}});0<n.length&&(I+="<tr>"+n+"</tr>");p++});I+="</thead><tbody>";t=B(b);c(t).each(function(){var b=c(this);n="";C(this,"td,th",p,u.length+t.length,function(d,g,f){if(null!==d){var e=F(d,g,f),h="",k=c(d).attr("data-tableexport-msonumberformat");"undefined"===typeof k&&"function"===typeof a.mso.onMsoNumberFormat&&(k=a.mso.onMsoNumberFormat(d,
  5311. g,f));"undefined"!==typeof k&&""!==k&&(h="style=\"mso-number-format:'"+k+"'");if(a.mso.styles.length){g=document.defaultView.getComputedStyle(d,null);f=document.defaultView.getComputedStyle(b[0],null);for(var l in a.mso.styles)k=g[a.mso.styles[l]],""===k&&(k=f[a.mso.styles[l]]),""!==k&&"0px none rgb(0, 0, 0)"!==k&&"rgba(0, 0, 0, 0)"!==k&&(h+=""===h?'style="':";",h+=a.mso.styles[l]+":"+k)}n+="<td";""!==h&&(n+=" "+h+'"');h=P(d);0<h&&(n+=' colspan="'+h+'"');d=V(d);0<d&&(n+=' rowspan="'+d+'"');"string"===
  5312. typeof e&&""!==e&&(e=Da(e),e=e.replace(/\n/g,"<br>"));n+=">"+e+"</td>"}});0<n.length&&(I+="<tr>"+n+"</tr>");p++});a.displayTableName&&(I+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+F(c("<p>"+a.tableName+"</p>"))+"</td></tr>");I+="</tbody></table>"});l='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+l+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+h+'; charset=UTF-8">');l+="<head>";"excel"===h&&(l+="\x3c!--[if gte mso 9]>",
  5313. l+="<xml>",l+="<x:ExcelWorkbook>",l+="<x:ExcelWorksheets>",l+="<x:ExcelWorksheet>",l+="<x:Name>",l+=ba,l+="</x:Name>",l+="<x:WorksheetOptions>",l+="<x:DisplayGridlines/>",a.mso.rtl&&(l+="<x:DisplayRightToLeft/>"),l+="</x:WorksheetOptions>",l+="</x:ExcelWorksheet>",l+="</x:ExcelWorksheets>",l+="</x:ExcelWorkbook>",l+="</xml>",l+="<![endif]--\x3e");l+="<style>";l+="@page { size:"+a.mso.pageOrientation+"; mso-page-orientation:"+a.mso.pageOrientation+"; }";l+="@page Section1 {size:"+O[a.mso.pageFormat][0]+
  5314. "pt "+O[a.mso.pageFormat][1]+"pt";l+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";l+="div.Section1 {page:Section1;}";l+="@page Section2 {size:"+O[a.mso.pageFormat][1]+"pt "+O[a.mso.pageFormat][0]+"pt";l+=";mso-page-orientation:"+a.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";l+="div.Section2 {page:Section2;}";l+="br {mso-data-placement:same-cell;}";l+="</style>";
  5315. l+="</head>";l+="<body>";l+='<div class="Section'+("landscape"===a.mso.pageOrientation?"2":"1")+'">';l+=I;l+="</div>";l+="</body>";l+="</html>";if("string"===a.outputMode)return l;if("base64"===a.outputMode)return L(l);N(l,a.fileName+"."+v,"application/vnd.ms-"+h,"","base64",!1)}else if("png"===a.type)html2canvas(c(A)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),e=new ArrayBuffer(c.length),g=new Uint8Array(e),f=0;f<c.length;f++)g[f]=c.charCodeAt(f);if("string"===a.outputMode)return c;
  5316. if("base64"===a.outputMode)return L(b);"window"===a.outputMode?window.open(b):N(e,a.fileName+".png","image/png","","",!1)});else if("pdf"===a.type)if(!0===a.pdfmake.enabled){h=[];var Ia=[];p=0;H=[];v=function(a,d,e){var b=0;c(a).each(function(){var a=[];C(this,d,p,e,function(b,c,d){if("undefined"!==typeof b&&null!==b){var e=P(b),f=V(b);b=F(b,c,d)||" ";1<e||1<f?a.push({colSpan:e||1,rowSpan:f||1,text:b}):a.push(b)}else a.push(" ")});a.length&&Ia.push(a);b<a.length&&(b=a.length);p++});return b};u=x(c(this));
  5317. l=v(u,"th,td",u.length);for(S=h.length;S<l;S++)h.push("*");t=B(c(this));v(t,"th,td",u.length+t.length);h={content:[{table:{headerRows:u.length,widths:h,body:Ia}}]};c.extend(!0,h,a.pdfmake.docDefinition);pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}};c.extend(!0,pdfMake.fonts,a.pdfmake.fonts);pdfMake.createPdf(h).getBuffer(function(b){N(b,a.fileName+".pdf","application/pdf","","",!1)})}else if(!1===a.jspdf.autotable){h=
  5318. {dim:{w:fa(c(A).first().get(0),"width","mm"),h:fa(c(A).first().get(0),"height","mm")},pagesplit:!1};var Ja=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);Ja.addHTML(c(A).first(),a.jspdf.margins.left,a.jspdf.margins.top,h,function(){wa(Ja,!1)})}else{var g=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var ja="",ca="",Ka=0;c(A).each(function(){if(J(c(this))){var a=fa(c(this).get(0),"width","pt");if(a>Ka){a>O.a0[0]&&(ja="a0",ca=
  5319. "l");for(var d in O)O.hasOwnProperty(d)&&O[d][1]>a&&(ja=d,ca="l",O[d][0]>a&&(ca="p"));Ka=a}}});a.jspdf.format=""===ja?"a4":ja;a.jspdf.orientation=""===ca?"w":ca}if(null==g.doc&&(g.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),g.wScaleFactor=1,g.hScaleFactor=1,"function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(g.doc);!0===g.outputImages&&(g.images={});"undefined"!==typeof g.images&&(c(A).filter(function(){return J(c(this))}).each(function(){var b=0;H=[];!1===a.exportHiddenCells&&
  5320. (K=c(this).find("tr, th, td").filter(":hidden"),W=0<K.length);u=x(c(this));t=B(c(this));c(t).each(function(){C(this,"td,th",u.length+b,u.length+t.length,function(a){ya(a,c(a).children(),g)});b++})}),u=[],t=[]);Ma(g,function(){c(A).filter(function(){return J(c(this))}).each(function(){var b;p=0;H=[];!1===a.exportHiddenCells&&(K=c(this).find("tr, th, td").filter(":hidden"),W=0<K.length);U=T(this);g.columns=[];g.rows=[];g.teCells={};if("function"===typeof g.onTable&&!1===g.onTable(c(this),a))return!0;
  5321. a.jspdf.autotable.tableExport=null;var d=c.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=g;d.margin={};c.extend(!0,d.margin,a.jspdf.margins);d.tableExport=g;"function"!==typeof d.beforePageContent&&(d.beforePageContent=function(a){if(1===a.pageCount){var b=a.table.rows.concat(a.table.headerRow);c.each(b,function(){0<this.height&&(this.height+=(2-1.15)/2*this.styles.fontSize,a.table.height+=(2-1.15)/2*this.styles.fontSize)})}});"function"!==typeof d.createdHeaderCell&&(d.createdHeaderCell=
  5322. function(a,b){a.styles=c.extend({},b.row.styles);if("undefined"!==typeof g.columns[b.column.dataKey]){var e=g.columns[b.column.dataKey];if("undefined"!==typeof e.rect){a.contentWidth=e.rect.width;if("undefined"===typeof g.heightRatio||0===g.heightRatio){var f=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height;g.heightRatio=a.styles.rowHeight/f}f=b.row.raw[b.column.dataKey].rect.height*g.heightRatio;
  5323. f>a.styles.rowHeight&&(a.styles.rowHeight=f)}a.styles.halign="inherit"===d.headerStyles.halign?"center":d.headerStyles.halign;a.styles.valign=d.headerStyles.valign;"undefined"!==typeof e.style&&!0!==e.style.hidden&&("inherit"===d.headerStyles.halign&&(a.styles.halign=e.style.align),"inherit"===d.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}});"function"!==
  5324. typeof d.createdCell&&(d.createdCell=function(a,b){b=g.teCells[b.row.index+":"+b.column.dataKey];a.styles.halign="inherit"===d.styles.halign?"center":d.styles.halign;a.styles.valign=d.styles.valign;"undefined"!==typeof b&&"undefined"!==typeof b.style&&!0!==b.style.hidden&&("inherit"===d.styles.halign&&(a.styles.halign=b.style.align),"inherit"===d.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===d.styles.fontStyle&&
  5325. (a.styles.fontStyle=b.style.fstyle))});"function"!==typeof d.drawHeaderCell&&(d.drawHeaderCell=function(a,b){var c=g.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?xa(a,b,c):!1});"function"!==typeof d.drawCell&&(d.drawCell=function(a,b){var d=g.teCells[b.row.index+":"+b.column.dataKey];if(!0!==("undefined"!==typeof d&&d.isCanvas))xa(a,b,d)&&(g.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"!==typeof d&&"undefined"!==typeof d.elements&&
  5326. d.elements.length?(b=a.height/d.rect.height,b>g.hScaleFactor&&(g.hScaleFactor=b),g.wScaleFactor=a.width/d.rect.width,b=a.textPos.y,Aa(a,d.elements,g),a.textPos.y=b,Ba(a,d.elements,g)):Ba(a,{},g));else{d=d.elements[0];var e=c(d).attr("data-tableexport-canvas"),f=d.getBoundingClientRect();a.width=f.width*g.wScaleFactor;a.height=f.height*g.hScaleFactor;b.row.height=a.height;va(a,d,e,g)}return!1});g.headerrows=[];u=x(c(this));c(u).each(function(){b=0;g.headerrows[p]=[];C(this,"th,td",p,u.length,function(a,
  5327. c,d){var e=Ea(a);e.title=F(a,c,d);e.key=b++;e.rowIndex=p;g.headerrows[p].push(e)});p++});if(0<p)for(var e=p-1;0<=e;)c.each(g.headerrows[e],function(){var a=this;0<e&&null===this.rect&&(a=g.headerrows[e-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&g.columns.push(a)}),e=0<g.columns.length?-1:e-1;var h=0;t=[];t=B(c(this));c(t).each(function(){var a=[];b=0;C(this,"td,th",p,u.length+t.length,function(d,e,f){if("undefined"===typeof g.columns[b]){var k=
  5328. {title:"",key:b,style:{hidden:!0}};g.columns.push(k)}"undefined"!==typeof d&&null!==d?(k=Ea(d),k.isCanvas=d.hasAttribute("data-tableexport-canvas"),k.elements=k.isCanvas?c(d):c(d).children()):(k=c.extend(!0,{},g.teCells[h+":"+(b-1)]),k.colspan=-1);g.teCells[h+":"+b++]=k;a.push(F(d,e,f))});a.length&&(g.rows.push(a),h++);p++});if("function"===typeof g.onBeforeAutotable)g.onBeforeAutotable(c(this),g.columns,g.rows,d);g.doc.autoTable(g.columns,g.rows,d);if("function"===typeof g.onAfterAutotable)g.onAfterAutotable(c(this),
  5329. d);a.jspdf.autotable.startY=g.doc.autoTableEndPosY()+d.margin.top});wa(g.doc,"undefined"!==typeof g.images&&!1===jQuery.isEmptyObject(g.images));"undefined"!==typeof g.headerrows&&(g.headerrows.length=0);"undefined"!==typeof g.columns&&(g.columns.length=0);"undefined"!==typeof g.rows&&(g.rows.length=0);delete g.doc;g.doc=null})}return this}})(jQuery);
  5330. define("tableexport", ["jquery"], (function (global) {
  5331. return function () {
  5332. var ret, fn;
  5333. return ret || global.$.fn.extend;
  5334. };
  5335. }(this)));
  5336. /*
  5337. * bootstrap-table - v1.11.1 - 2017-02-22
  5338. * https://github.com/wenzhixin/bootstrap-table
  5339. * Copyright (c) 2017 zhixin wen
  5340. * Licensed MIT License
  5341. */
  5342. !function(a){"use strict";var b=a.fn.bootstrapTable.utils.sprintf,c={json:"JSON",xml:"XML",png:"PNG",csv:"CSV",txt:"TXT",sql:"SQL",doc:"MS-Word",excel:"MS-Excel",xlsx:"MS-Excel (OpenXML)",powerpoint:"MS-Powerpoint",pdf:"PDF"};a.extend(a.fn.bootstrapTable.defaults,{showExport:!1,exportDataType:"basic",exportTypes:["json","xml","csv","txt","sql","excel"],exportOptions:{}}),a.extend(a.fn.bootstrapTable.defaults.icons,{"export":"glyphicon-export icon-share"}),a.extend(a.fn.bootstrapTable.locales,{formatExport:function(){return"Export data"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var d=a.fn.bootstrapTable.Constructor,e=d.prototype.initToolbar;d.prototype.initToolbar=function(){if(this.showToolbar=this.options.showExport,e.apply(this,Array.prototype.slice.apply(arguments)),this.options.showExport){var d=this,f=this.$toolbar.find(">.btn-group"),g=f.find("div.export");if(!g.length){g=a(['<div class="export btn-group">','<button class="btn'+b(" btn-%s",this.options.buttonsClass)+b(" btn-%s",this.options.iconSize)+' dropdown-toggle" aria-label="export type" title="'+this.options.formatExport()+'" data-toggle="dropdown" type="button">',b('<i class="%s %s"></i> ',this.options.iconsPrefix,this.options.icons["export"]),'<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">',"</ul>","</div>"].join("")).appendTo(f);var h=g.find(".dropdown-menu"),i=this.options.exportTypes;if("string"==typeof this.options.exportTypes){var j=this.options.exportTypes.slice(1,-1).replace(/ /g,"").split(",");i=[],a.each(j,function(a,b){i.push(b.slice(1,-1))})}a.each(i,function(a,b){c.hasOwnProperty(b)&&h.append(['<li role="menuitem" data-type="'+b+'">','<a href="javascript:void(0)">',c[b],"</a>","</li>"].join(""))}),h.find("li").click(function(){var b=a(this).data("type"),c=function(){d.$el.tableExport(a.extend({},d.options.exportOptions,{type:b,escape:!1}))};if("all"===d.options.exportDataType&&d.options.pagination)d.$el.one("server"===d.options.sidePagination?"post-body.bs.table":"page-change.bs.table",function(){c(),d.togglePagination()}),d.togglePagination();else if("selected"===d.options.exportDataType){var e=d.getData(),f=d.getAllSelections();"server"===d.options.sidePagination&&(e={total:d.options.totalRows},e[d.options.dataField]=d.getData(),f={total:d.options.totalRows},f[d.options.dataField]=d.getAllSelections()),d.load(f),c(),d.load(e)}else c()})}}}}(jQuery);
  5343. define("bootstrap-table-export", ["bootstrap-table","tableexport"], (function (global) {
  5344. return function () {
  5345. var ret, fn;
  5346. return ret || global.$.fn.bootstrapTable.defaults;
  5347. };
  5348. }(this)));
  5349. /**
  5350. * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
  5351. * v1.5.2
  5352. *
  5353. * Copyright 2013, Moxiecode Systems AB
  5354. * Released under GPL License.
  5355. *
  5356. * License: http://www.plupload.com/license
  5357. * Contributing: http://www.plupload.com/contributing
  5358. *
  5359. * Date: 2016-11-23
  5360. */
  5361. !function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.moxie};"function"==typeof define&&define.amd?define("moxie",[],i):"object"==typeof module&&module.exports?module.exports=i():e.moxie=i()}(this||window,function(){!function(e,t){"use strict";function i(e,t){for(var i,n=[],r=0;r<e.length;++r){if(i=s[e[r]]||o(e[r]),!i)throw"module definition dependecy not found: "+e[r];n.push(i)}t.apply(null,n)}function n(e,n,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(n===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";i(n,function(){s[e]=r.apply(null,arguments)})}function r(e){return!!s[e]}function o(t){for(var i=e,n=t.split(/[.\/]/),r=0;r<n.length;++r){if(!i[n[r]])return;i=i[n[r]]}return i}function a(i){for(var n=0;n<i.length;n++){for(var r=e,o=i[n],a=o.split(/[.\/]/),u=0;u<a.length-1;++u)r[a[u]]===t&&(r[a[u]]={}),r=r[a[u]];r[a[a.length-1]]=s[o]}}var s={};n("moxie/core/utils/Basic",[],function(){function e(e){var t;return e===t?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()}function t(){return a(!1,!1,arguments)}function i(){return a(!0,!1,arguments)}function n(){return a(!1,!0,arguments)}function r(){return a(!0,!0,arguments)}function o(i){switch(e(i)){case"array":return Array.prototype.slice.call(i);case"object":return t({},i)}return i}function a(t,i,n){var r,s=n[0];return u(n,function(n,c){c>0&&u(n,function(n,u){var c=-1!==m(e(n),["array","object"]);return n===r||t&&s[u]===r?!0:(c&&i&&(n=o(n)),e(s[u])===e(n)&&c?a(t,i,[s[u],n]):s[u]=n,void 0)})}),s}function s(e,t){function i(){this.constructor=e}for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.__parent__=t.prototype,e}function u(e,t){var i,n,r,o;if(e){try{i=e.length}catch(a){i=o}if(i===o||"number"!=typeof i){for(n in e)if(e.hasOwnProperty(n)&&t(e[n],n)===!1)return}else for(r=0;i>r;r++)if(t(e[r],r)===!1)return}}function c(t){var i;if(!t||"object"!==e(t))return!0;for(i in t)return!1;return!0}function l(t,i){function n(r){"function"===e(t[r])&&t[r](function(e){++r<o&&!e?n(r):i(e)})}var r=0,o=t.length;"function"!==e(i)&&(i=function(){}),t&&t.length||i(),n(r)}function d(e,t){var i=0,n=e.length,r=new Array(n);u(e,function(e,o){e(function(e){if(e)return t(e);var a=[].slice.call(arguments);a.shift(),r[o]=a,i++,i===n&&(r.unshift(null),t.apply(this,r))})})}function m(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var i=0,n=t.length;n>i;i++)if(t[i]===e)return i}return-1}function h(t,i){var n=[];"array"!==e(t)&&(t=[t]),"array"!==e(i)&&(i=[i]);for(var r in t)-1===m(t[r],i)&&n.push(t[r]);return n.length?n:!1}function f(e,t){var i=[];return u(e,function(e){-1!==m(e,t)&&i.push(e)}),i.length?i:null}function p(e){var t,i=[];for(t=0;t<e.length;t++)i[t]=e[t];return i}function g(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e}function x(e){if("string"!=typeof e)return e;var t,i={t:1099511627776,g:1073741824,m:1048576,k:1024};return e=/^([0-9\.]+)([tmgk]?)$/.exec(e.toLowerCase().replace(/[^0-9\.tmkg]/g,"")),t=e[2],e=+e[1],i.hasOwnProperty(t)&&(e*=i[t]),Math.floor(e)}function v(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e(t)?t:""})}function y(e,t){var i=this;setTimeout(function(){e.call(i)},t||1)}var w=function(){var e=0;return function(t){var i,n=(new Date).getTime().toString(32);for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}();return{guid:w,typeOf:e,extend:t,extendIf:i,extendImmutable:n,extendImmutableIf:r,inherit:s,each:u,isEmptyObj:c,inSeries:l,inParallel:d,inArray:m,arrayDiff:h,arrayIntersect:f,toArray:p,trim:g,sprintf:v,parseSizeStr:x,delay:y}}),n("moxie/core/utils/Encode",[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},i=function(e,i){if("function"==typeof window.atob)return i?t(window.atob(e)):window.atob(e);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!e)return e;e+="";do a=d.indexOf(e.charAt(m++)),s=d.indexOf(e.charAt(m++)),u=d.indexOf(e.charAt(m++)),c=d.indexOf(e.charAt(m++)),l=a<<18|s<<12|u<<6|c,n=255&l>>16,r=255&l>>8,o=255&l,p[h++]=64==u?String.fromCharCode(n):64==c?String.fromCharCode(n,r):String.fromCharCode(n,r,o);while(m<e.length);return f=p.join(""),i?t(f):f},n=function(t,i){if(i&&(t=e(t)),"function"==typeof window.btoa)return window.btoa(t);var n,r,o,a,s,u,c,l,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,h=0,f="",p=[];if(!t)return t;do n=t.charCodeAt(m++),r=t.charCodeAt(m++),o=t.charCodeAt(m++),l=n<<16|r<<8|o,a=63&l>>18,s=63&l>>12,u=63&l>>6,c=63&l,p[h++]=d.charAt(a)+d.charAt(s)+d.charAt(u)+d.charAt(c);while(m<t.length);f=p.join("");var g=t.length%3;return(g?f.slice(0,g-3):f)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:i,btoa:n}}),n("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(e){function t(e,t,i){var n=0,r=0,o=0,a={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?a[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),r=Math.max(e.length,t.length),n=0;r>n;n++)if(e[n]!=t[n]){if(e[n]=u(e[n]),t[n]=u(t[n]),e[n]<t[n]){o=-1;break}if(e[n]>t[n]){o=1;break}}if(!i)return o;switch(i){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var i=function(e){var t="",i="?",n="function",r="undefined",o="object",a="name",s="version",u={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},c={rgx:function(){for(var t,i,a,s,u,c,l,d=0,m=arguments;d<m.length;d+=2){var h=m[d],f=m[d+1];if(typeof t===r){t={};for(s in f)u=f[s],typeof u===o?t[u[0]]=e:t[u]=e}for(i=a=0;i<h.length;i++)if(c=h[i].exec(this.getUA())){for(s=0;s<f.length;s++)l=c[++a],u=f[s],typeof u===o&&u.length>0?2==u.length?t[u[0]]=typeof u[1]==n?u[1].call(this,l):u[1]:3==u.length?t[u[0]]=typeof u[1]!==n||u[1].exec&&u[1].test?l?l.replace(u[1],u[2]):e:l?u[1].call(this,l,u[2]):e:4==u.length&&(t[u[0]]=l?u[3].call(this,l.replace(u[1],u[2])):e):t[u]=l?l:e;break}if(c)break}return t},str:function(t,n){for(var r in n)if(typeof n[r]===o&&n[r].length>0){for(var a=0;a<n[r].length;a++)if(u.has(n[r][a],t))return r===i?e:r}else if(u.has(n[r],t))return r===i?e:r;return t}},l={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},d={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[a,s],[/\s(opr)\/([\w\.]+)/i],[[a,"Opera"],s],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i],[a,s],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[a,"IE"],s],[/(edge)\/((\d+)?[\w\.]+)/i],[a,s],[/(yabrowser)\/([\w\.]+)/i],[[a,"Yandex"],s],[/(comodo_dragon)\/([\w\.]+)/i],[[a,/_/g," "],s],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i],[a,s],[/(dolfin)\/([\w\.]+)/i],[[a,"Dolphin"],s],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[a,"Chrome"],s],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[s,[a,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[s,[a,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[s,[a,"Facebook"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[s,[a,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[s,a],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[a,[s,c.str,l.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[a,s],[/(navigator|netscape)\/([\w\.-]+)/i],[[a,"Netscape"],s],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[a,s]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[s,[a,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[a,s],[/rv\:([\w\.]+).*(gecko)/i],[s,a]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[a,s],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[a,[s,c.str,l.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[a,"Windows"],[s,c.str,l.os.windows.version]],[/\((bb)(10);/i],[[a,"BlackBerry"],s],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[a,s],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[a,"Symbian"],s],[/\((series40);/i],[a],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[a,"Firefox OS"],s],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[a,s],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[a,"Chromium OS"],s],[/(sunos)\s?([\w\.]+\d)*/i],[[a,"Solaris"],s],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[a,s],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[a,"iOS"],[s,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[a,"Mac OS"],[s,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[a,s]]},m=function(e){var i=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return c.rgx.apply(this,d.browser)},this.getEngine=function(){return c.rgx.apply(this,d.engine)},this.getOS=function(){return c.rgx.apply(this,d.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return i},this.setUA=function(e){return i=e,this},this.setUA(i)};return m}(),n=function(){var t={define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var i=new XMLHttpRequest;if(i.open("get","/"),"responseType"in i)return i.responseType=t,i.responseType!==t?!1:!0}}catch(n){}return!1},use_data_uri:function(){var e=new Image;return e.onload=function(){t.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return t.use_data_uri&&("IE"!==o.browser||o.version>=9)},use_data_uri_of:function(e){return t.use_data_uri&&33e3>e||t.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(i){var n=[].slice.call(arguments);return n.shift(),"function"===e.typeOf(t[i])?t[i].apply(this,n):!!t[i]}}(),r=(new i).getResult(),o={can:n,uaParser:i,browser:r.browser.name,version:r.browser.version,os:r.os.name,osVersion:r.os.version,verComp:t,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return o.OS=o.os,o}),n("moxie/core/Exceptions",["moxie/core/utils/Basic"],function(e){function t(e,t){var i;for(i in e)if(e[i]===t)return i;return null}return{RuntimeError:function(){function i(e,i){this.code=e,this.name=t(n,e),this.message=this.name+(i||": RuntimeError "+this.code)}var n={NOT_INIT_ERR:1,EXCEPTION_ERR:3,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(i,n),i.prototype=Error.prototype,i}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": ImageError "+this.code}var n={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return e.extend(i,n),i.prototype=Error.prototype,i}(),FileException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": FileException "+this.code}var n={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(i,n),i.prototype=Error.prototype,i}(),DOMException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": DOMException "+this.code}var n={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(i,n),i.prototype=Error.prototype,i}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),n("moxie/core/utils/Dom",["moxie/core/utils/Env"],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},i=function(e,t){if(!e.className)return!1;var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return i.test(e.className)},n=function(e,t){i(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(i,function(e,t,i){return" "===t&&" "===i?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,i){function n(e){var t,i,n=0,r=0;return e&&(i=e.getBoundingClientRect(),t="CSS1Compat"===c.compatMode?c.documentElement:c.body,n=i.left+t.scrollLeft,r=i.top+t.scrollTop),{x:n,y:r}}var r,o,a,s=0,u=0,c=document;if(t=t,i=i||c.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!c.documentMode||c.documentMode<8))return o=n(t),a=n(i),{x:o.x-a.x,y:o.y-a.y};for(r=t;r&&r!=i&&r.nodeType;)s+=r.offsetLeft||0,u+=r.offsetTop||0,r=r.offsetParent;for(r=t.parentNode;r&&r!=i&&r.nodeType;)s-=r.scrollLeft||0,u-=r.scrollTop||0,r=r.parentNode;return{x:s,y:u}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:i,addClass:n,removeClass:r,getStyle:o,getPos:a,getSize:s}}),n("moxie/core/EventTarget",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic"],function(e,t,i){function n(){this.uid=i.guid()}var r={};return i.extend(n.prototype,{init:function(){this.uid||(this.uid=i.guid("uid_"))},addEventListener:function(e,t,n,o){var a,s=this;return this.hasOwnProperty("uid")||(this.uid=i.guid("uid_")),e=i.trim(e),/\s/.test(e)?(i.each(e.split(/\s+/),function(e){s.addEventListener(e,t,n,o)}),void 0):(e=e.toLowerCase(),n=parseInt(n,10)||0,a=r[this.uid]&&r[this.uid][e]||[],a.push({fn:t,priority:n,scope:o||this}),r[this.uid]||(r[this.uid]={}),r[this.uid][e]=a,void 0)},hasEventListener:function(e){var t;return e?(e=e.toLowerCase(),t=r[this.uid]&&r[this.uid][e]):t=r[this.uid],t?t:!1},removeEventListener:function(e,t){var n,o,a=this;if(e=e.toLowerCase(),/\s/.test(e))return i.each(e.split(/\s+/),function(e){a.removeEventListener(e,t)}),void 0;if(n=r[this.uid]&&r[this.uid][e]){if(t){for(o=n.length-1;o>=0;o--)if(n[o].fn===t){n.splice(o,1);break}}else n=[];n.length||(delete r[this.uid][e],i.isEmptyObj(r[this.uid])&&delete r[this.uid])}},removeAllEventListeners:function(){r[this.uid]&&delete r[this.uid]},dispatchEvent:function(e){var n,o,a,s,u,c={},l=!0;if("string"!==i.typeOf(e)){if(s=e,"string"!==i.typeOf(s.type))throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);e=s.type,s.total!==u&&s.loaded!==u&&(c.total=s.total,c.loaded=s.loaded),c.async=s.async||!1}if(-1!==e.indexOf("::")?function(t){n=t[0],e=t[1]}(e.split("::")):n=this.uid,e=e.toLowerCase(),o=r[n]&&r[n][e]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),c.type=e,a.unshift(c);var d=[];i.each(o,function(e){a[0].target=e.scope,c.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&i.inSeries(d,function(e){l=!e})}return l},bindOnce:function(e,t,i,n){var r=this;r.bind.call(this,e,function o(){return r.unbind(e,o),t.apply(this,arguments)},i,n)},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(e){var t=this;this.bind(e.join(" "),function(e){var t="on"+e.type.toLowerCase();"function"===i.typeOf(this[t])&&this[t].apply(this,arguments)}),i.each(e,function(e){e="on"+e.toLowerCase(e),"undefined"===i.typeOf(t[e])&&(t[e]=null)})}}),n.instance=new n,n}),n("moxie/runtime/Runtime",["moxie/core/utils/Env","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(e,t,i,n){function r(e,n,o,s,u){var c,l=this,d=t.guid(n+"_"),m=u||"browser";e=e||{},a[d]=this,o=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},o),e.preferred_caps&&(m=r.getMode(s,e.preferred_caps,m)),c=function(){var e={};return{exec:function(t,i,n,r){return c[i]&&(e[t]||(e[t]={context:this,instance:new c[i]}),e[t].instance[n])?e[t].instance[n].apply(this,r):void 0},removeInstance:function(t){delete e[t]},removeAllInstances:function(){var i=this;t.each(e,function(e,n){"function"===t.typeOf(e.instance.destroy)&&e.instance.destroy.call(e.context),i.removeInstance(n)})}}}(),t.extend(this,{initialized:!1,uid:d,type:n,mode:r.getMode(s,e.required_caps,m),shimid:d+"_container",clients:0,options:e,can:function(e,i){var n=arguments[2]||o;if("string"===t.typeOf(e)&&"undefined"===t.typeOf(i)&&(e=r.parseCaps(e)),"object"===t.typeOf(e)){for(var a in e)if(!this.can(a,e[a],n))return!1;return!0}return"function"===t.typeOf(n[e])?n[e].call(this,i):i===n[e]},getShimContainer:function(){var e,n=i.get(this.shimid);return n||(e=i.get(this.options.container)||document.body,n=document.createElement("div"),n.id=this.shimid,n.className="moxie-shim moxie-shim-"+this.type,t.extend(n.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.appendChild(n),e=null),n},getShim:function(){return c},shimExec:function(e,t){var i=[].slice.call(arguments,2);return l.getShim().exec.call(this,this.uid,e,t,i)},exec:function(e,t){var i=[].slice.call(arguments,2);return l[e]&&l[e][t]?l[e][t].apply(this,i):l.shimExec.apply(this,arguments)},destroy:function(){if(l){var e=i.get(this.shimid);e&&e.parentNode.removeChild(e),c&&c.removeAllInstances(),this.unbindAll(),delete a[this.uid],this.uid=null,d=l=c=e=null}}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}var o={},a={};return r.order="html5,flash,silverlight,html4",r.getRuntime=function(e){return a[e]?a[e]:!1},r.addConstructor=function(e,t){t.prototype=n.instance,o[e]=t},r.getConstructor=function(e){return o[e]||null},r.getInfo=function(e){var t=r.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},r.parseCaps=function(e){var i={};return"string"!==t.typeOf(e)?e||{}:(t.each(e.split(","),function(e){i[e]=!0}),i)},r.can=function(e,t){var i,n,o=r.getConstructor(e);return o?(i=new o({required_caps:t}),n=i.mode,i.destroy(),!!n):!1},r.thatCan=function(e,t){var i=(t||r.order).split(/\s*,\s*/);for(var n in i)if(r.can(i[n],e))return i[n];return null},r.getMode=function(e,i,n){var r=null;if("undefined"===t.typeOf(n)&&(n="browser"),i&&!t.isEmptyObj(e)){if(t.each(i,function(i,n){if(e.hasOwnProperty(n)){var o=e[n](i);if("string"==typeof o&&(o=[o]),r){if(!(r=t.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==t.inArray(n,r)?n:r[0];if(r===!1)return!1}return n},r.capTrue=function(){return!0},r.capFalse=function(){return!1},r.capTest=function(e){return function(){return!!e}},r}),n("moxie/runtime/RuntimeClient",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/Runtime"],function(e,t,i,n){return function(){var e;i.extend(this,{connectRuntime:function(r){function o(i){var a,u;return i.length?(a=i.shift().toLowerCase(),(u=n.getConstructor(a))?(e=new u(r),e.bind("Init",function(){e.initialized=!0,setTimeout(function(){e.clients++,s.ruid=e.uid,s.trigger("RuntimeInit",e)},1)}),e.bind("Error",function(){e.destroy(),o(i)}),e.bind("Exception",function(e,i){var n=i.name+"(#"+i.code+")"+(i.message?", from: "+i.message:"");s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.EXCEPTION_ERR,n))}),e.mode?(e.init(),void 0):(e.trigger("Error"),void 0)):(o(i),void 0)):(s.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)),e=null,void 0)}var a,s=this;if("string"===i.typeOf(r)?a=r:"string"===i.typeOf(r.ruid)&&(a=r.ruid),a){if(e=n.getRuntime(a))return s.ruid=a,e.clients++,e;throw new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\s*,\s*/))},disconnectRuntime:function(){e&&--e.clients<=0&&e.destroy(),e=null},getRuntime:function(){return e&&e.uid?e:e=null},exec:function(){return e?e.exec.apply(this,arguments):null},can:function(t){return e?e.can(t):!1}})}}),n("moxie/file/Blob",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient"],function(e,t,i){function n(o,a){function s(t,i,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new n(null,{type:o,size:i-t}),a.detach(s.substr(t,a.size)),a):null}i.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,i){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,i)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){if(this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy"),this.disconnectRuntime(),this.ruid=null),e=e||"","data:"==e.substr(0,5)){var i=e.indexOf(";base64,");this.type=e.substring(5,i),e=t.atob(e.substring(i+8))}this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return n}),n("moxie/core/I18n",["moxie/core/utils/Basic"],function(e){var t={};return{addI18n:function(i){return e.extend(t,i)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e.typeOf(t)?t:""})}}}),n("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(e,t){var i="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",n={mimes:{},extensions:{},addMimeType:function(e){var t,i,n,r=e.split(/,/);for(t=0;t<r.length;t+=2){for(n=r[t+1].split(/ /),i=0;i<n.length;i++)this.mimes[n[i]]=r[t];this.extensions[r[t]]=n}},extList2mimes:function(t,i){var n,r,o,a,s=this,u=[];for(r=0;r<t.length;r++)for(n=t[r].extensions.split(/\s*,\s*/),o=0;o<n.length;o++){if("*"===n[o])return[];if(a=s.mimes[n[o]],a&&-1===e.inArray(a,u)&&u.push(a),i&&/^\w+$/.test(n[o]))u.push("."+n[o]);else if(!a)return[]}return u},mimes2exts:function(t){var i=this,n=[];return e.each(t,function(t){if("*"===t)return n=[],!1;var r=t.match(/^(\w+)\/(\*|\w+)$/);r&&("*"===r[2]?e.each(i.extensions,function(e,t){new RegExp("^"+r[1]+"/").test(t)&&[].push.apply(n,i.extensions[t])}):i.extensions[t]&&[].push.apply(n,i.extensions[t]))}),n},mimes2extList:function(i){var n=[],r=[];return"string"===e.typeOf(i)&&(i=e.trim(i).split(/\s*,\s*/)),r=this.mimes2exts(i),n.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),n.mimes=i,n},getFileExtension:function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};return n.addMimeType(i),n}),n("moxie/file/FileInput",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/I18n","moxie/runtime/Runtime","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o,a,s,u){function c(t){var o,c,d;if(-1!==e.inArray(e.typeOf(t),["string","node"])&&(t={browse_button:t}),c=n.get(t.browse_button),!c)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR);d={accept:[{title:a.translate("All Files"),extensions:"*"}],multiple:!1,required_caps:!1,container:c.parentNode||document.body},t=e.extend({},d,t),"string"==typeof t.required_caps&&(t.required_caps=s.parseCaps(t.required_caps)),"string"==typeof t.accept&&(t.accept=i.mimes2extList(t.accept)),o=n.get(t.container),o||(o=document.body),"static"===n.getStyle(o,"position")&&(o.style.position="relative"),o=c=null,u.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){var i=this;i.bind("RuntimeInit",function(r,o){i.ruid=o.uid,i.shimid=o.shimid,i.bind("Ready",function(){i.trigger("Refresh")},999),i.bind("Refresh",function(){var i,r,a,s,u;a=n.get(t.browse_button),s=n.get(o.shimid),a&&(i=n.getPos(a,n.get(t.container)),r=n.getSize(a),u=parseInt(n.getStyle(a,"z-index"),10)||0,s&&e.extend(s.style,{top:i.y+"px",left:i.x+"px",width:r.w+"px",height:r.h+"px",zIndex:u+1})),s=a=null}),o.exec.call(i,"FileInput","init",t)}),i.connectRuntime(e.extend({},t,{required_caps:{select_file:!0}}))},getOption:function(e){return t[e]},setOption:function(e,n){if(t.hasOwnProperty(e)){var o=t[e];switch(e){case"accept":"string"==typeof n&&(n=i.mimes2extList(n));break;case"container":case"required_caps":throw new r.FileException(r.FileException.NO_MODIFICATION_ALLOWED_ERR)}t[e]=n,this.exec("FileInput","setOption",e,n),this.trigger("OptionChanged",e,n,o)}},disable:function(t){var i=this.getRuntime();i&&this.exec("FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){this.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=o.instance,c}),n("moxie/file/File",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/file/Blob"],function(e,t,i){function n(n,r){r||(r={}),i.apply(this,arguments),this.type||(this.type=t.getFileMime(r.name));var o;if(r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else if(this.type){var a=this.type.split("/")[0];o=e.guid((""!==a?a:"file")+"_"),t.extensions[this.type]&&(o+="."+t.extensions[this.type][0])}e.extend(this,{name:o||e.guid("file_"),relativePath:"",lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return n.prototype=i.prototype,n}),n("moxie/file/FileDrop",["moxie/core/I18n","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/core/utils/Env","moxie/file/File","moxie/runtime/RuntimeClient","moxie/core/EventTarget","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u){function c(i){var r,o=this;"string"==typeof i&&(i={drop_zone:i}),r={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},i="object"==typeof i?n.extend({},r,i):r,i.container=t.get(i.drop_zone)||document.body,"static"===t.getStyle(i.container,"position")&&(i.container.style.position="relative"),"string"==typeof i.accept&&(i.accept=u.mimes2extList(i.accept)),a.call(o),n.extend(o,{uid:n.guid("uid_"),ruid:null,files:null,init:function(){o.bind("RuntimeInit",function(e,t){o.ruid=t.uid,t.exec.call(o,"FileDrop","init",i),o.dispatchEvent("ready")}),o.connectRuntime(i)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","dragenter","dragleave","drop","error"];return c.prototype=s.instance,c}),n("moxie/file/FileReader",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/Exceptions","moxie/core/EventTarget","moxie/file/Blob","moxie/runtime/RuntimeClient"],function(e,t,i,n,r,o){function a(){function n(e,n){if(this.trigger("loadstart"),this.readyState===a.LOADING)return this.trigger("error",new i.DOMException(i.DOMException.INVALID_STATE_ERR)),this.trigger("loadend"),void 0;
  5362. if(!(n instanceof r))return this.trigger("error",new i.DOMException(i.DOMException.NOT_FOUND_ERR)),this.trigger("loadend"),void 0;if(this.result=null,this.readyState=a.LOADING,n.isDetached()){var o=n.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=o;break;case"readAsDataURL":this.result="data:"+n.type+";base64,"+t.btoa(o)}this.readyState=a.DONE,this.trigger("load"),this.trigger("loadend")}else this.connectRuntime(n.ruid),this.exec("FileReader","read",e,n)}o.call(this),e.extend(this,{uid:e.guid("uid_"),readyState:a.EMPTY,result:null,error:null,readAsBinaryString:function(e){n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){n.call(this,"readAsDataURL",e)},readAsText:function(e){n.call(this,"readAsText",e)},abort:function(){this.result=null,-1===e.inArray(this.readyState,[a.EMPTY,a.DONE])&&(this.readyState===a.LOADING&&(this.readyState=a.DONE),this.exec("FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),this.exec("FileReader","destroy"),this.disconnectRuntime(),this.unbindAll()}}),this.handleEventProps(s),this.bind("Error",function(e,t){this.readyState=a.DONE,this.error=t},999),this.bind("Load",function(){this.readyState=a.DONE},999)}var s=["loadstart","progress","load","abort","error","loadend"];return a.EMPTY=0,a.LOADING=1,a.DONE=2,a.prototype=n.instance,a}),n("moxie/core/utils/Url",[],function(){var e=function(t,i){for(var n=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],r=n.length,o={http:80,https:443},a={},s=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,u=s.exec(t||"");r--;)u[r]&&(a[n[r]]=u[r]);if(!a.scheme){i&&"string"!=typeof i||(i=e(i||document.location.href)),a.scheme=i.scheme,a.host=i.host,a.port=i.port;var c="";/^[^\/]/.test(a.path)&&(c=i.path,c=/\/[^\/]*\.[^\/]*$/.test(c)?c.replace(/\/[^\/]+$/,"/"):c.replace(/\/?$/,"/")),a.path=c+(a.path||"")}return a.port||(a.port=o[a.scheme]||80),a.port=parseInt(a.port,10),a.path||(a.path="/"),delete a.source,a},t=function(t){var i={http:80,https:443},n="object"==typeof t?t:e(t);return n.scheme+"://"+n.host+(n.port!==i[n.scheme]?":"+n.port:"")+n.path+(n.query?n.query:"")},i=function(t){function i(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof t&&(t=e(t)),i(e())===i(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:i}}),n("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i){function n(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return n.prototype=i.instance,n}),n("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(e,t,i){return function(){function n(e,t){if(!t.isDetached()){var n=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),n}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+i.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return n.call(this,"readAsDataURL",e)},readAsText:function(e){return n.call(this,"readAsText",e)}})}}),n("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(e,t,i){function n(){var e,n=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof i?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isNaN(o)?a.append(r,"false"):n.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(i){t.each(n,function(e){i(e.value,e.name)}),e&&i(e.value,e.name)},destroy:function(){e=null,n=[]}})}return n}),n("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils/Mime"],function(e,t,i,n,r,o,a,s,u,c,l,d){function m(){this.uid=e.guid("uid_")}function h(){function i(e,t){return I.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?I[e]:A[e]:(l.can("define_property")?I[e]=t:A[e]=t,void 0):void 0}function u(t){function n(){R&&(R.destroy(),R=null),s.dispatchEvent("loadend"),s=null}function r(r){R.bind("LoadStart",function(e){i("readyState",h.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),L&&s.upload.dispatchEvent(e)}),R.bind("Progress",function(e){i("readyState")!==h.LOADING&&(i("readyState",h.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),R.bind("UploadProgress",function(e){L&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),R.bind("Load",function(t){i("readyState",h.DONE),i("status",Number(r.exec.call(R,"XMLHttpRequest","getStatus")||0)),i("statusText",f[i("status")]||""),i("response",r.exec.call(R,"XMLHttpRequest","getResponse",i("responseType"))),~e.inArray(i("responseType"),["text",""])?i("responseText",i("response")):"document"===i("responseType")&&i("responseXML",i("response")),U=r.exec.call(R,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),i("status")>0?(L&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(F=!0,s.dispatchEvent("error")),n()}),R.bind("Abort",function(e){s.dispatchEvent(e),n()}),R.bind("Error",function(e){F=!0,i("readyState",h.DONE),s.dispatchEvent("readystatechange"),M=!0,s.dispatchEvent(e),n()}),r.exec.call(R,"XMLHttpRequest","send",{url:x,method:v,async:T,user:y,password:w,headers:S,mimeType:D,encoding:O,responseType:s.responseType,withCredentials:s.withCredentials,options:k},t)}var s=this;E=(new Date).getTime(),R=new a,"string"==typeof k.required_caps&&(k.required_caps=o.parseCaps(k.required_caps)),k.required_caps=e.extend({},k.required_caps,{return_response_type:s.responseType}),t instanceof c&&(k.required_caps.send_multipart=!0),e.isEmptyObj(S)||(k.required_caps.send_custom_headers=!0),B||(k.required_caps.do_cors=!0),k.ruid?r(R.connectRuntime(k)):(R.bind("RuntimeInit",function(e,t){r(t)}),R.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),R.connectRuntime(k))}function g(){i("responseText",""),i("responseXML",null),i("response",null),i("status",0),i("statusText",""),E=b=null}var x,v,y,w,E,b,R,_,A=this,I={timeout:0,readyState:h.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},T=!0,S={},O=null,D=null,N=!1,C=!1,L=!1,M=!1,F=!1,B=!1,P=null,H=null,k={},U="";e.extend(this,I,{uid:e.guid("uid_"),upload:new m,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||n.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(v=o.toUpperCase()),~e.inArray(v,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=n.utf8_encode(a),l=r.parseUrl(a),B=r.hasSameOrigin(l),x=r.resolveUrl(a),(u||c)&&!B)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(y=u||l.user,w=c||l.pass,T=s||!0,T===!1&&(i("timeout")||i("withCredentials")||""!==i("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);N=!T,C=!1,S={},g.call(this),i("readyState",h.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(i("readyState")!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||n.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(S[r]?S[r]+=", "+o:S[r]=o,!0)},hasRequestHeader:function(e){return e&&S[e.toLowerCase()]||!1},getAllResponseHeaders:function(){return U||""},getResponseHeader:function(t){return t=t.toLowerCase(),F||~e.inArray(t,["set-cookie","set-cookie2"])?null:U&&""!==U&&(_||(_={},e.each(U.split(/\r\n/),function(t){var i=t.split(/:\s+/);2===i.length&&(i[0]=e.trim(i[0]),_[i[0].toLowerCase()]={header:i[0],value:e.trim(i[1])})})),_.hasOwnProperty(t))?_[t].header+": "+_[t].value:null},overrideMimeType:function(n){var r,o;if(~e.inArray(i("readyState"),[h.LOADING,h.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n=e.trim(n.toLowerCase()),/;/.test(n)&&(r=n.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(n=r[1],r[2]&&(o=r[2])),!d.mimes[n])throw new t.DOMException(t.DOMException.SYNTAX_ERR);P=n,H=o},send:function(i,r){if(k="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.readyState!==h.OPENED||C)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i instanceof s)k.ruid=i.ruid,D=i.type||"application/octet-stream";else if(i instanceof c){if(i.hasBlob()){var o=i.getBlob();k.ruid=o.ruid,D=o.type||"application/octet-stream"}}else"string"==typeof i&&(O="UTF-8",D="text/plain;charset=UTF-8",i=n.utf8_encode(i));this.withCredentials||(this.withCredentials=k.required_caps&&k.required_caps.send_browser_cookies&&!B),L=!N&&this.upload.hasEventListener(),F=!1,M=!i,N||(C=!0),u.call(this,i)},abort:function(){if(F=!0,N=!1,~e.inArray(i("readyState"),[h.UNSENT,h.OPENED,h.DONE]))i("readyState",h.UNSENT);else{if(i("readyState",h.DONE),C=!1,!R)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);R.getRuntime().exec.call(R,"XMLHttpRequest","abort",M),M=!0}},destroy:function(){R&&("function"===e.typeOf(R.destroy)&&R.destroy(),R=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(p.concat(["readystatechange"])),this.upload.handleEventProps(p)}var f={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};m.prototype=i.instance;var p=["loadstart","progress","abort","error","load","timeout","loadend"];return h.UNSENT=0,h.OPENED=1,h.HEADERS_RECEIVED=2,h.LOADING=3,h.DONE=4,h.prototype=i.instance,h}),n("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i,n){function r(){function n(){l=d=0,c=this.result=null}function o(t,i){var n=this;u=i,n.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(n.state,[r.IDLE,r.DONE])&&a.call(n)},999),n.bind("TransportingComplete",function(){d=l,n.state=r.DONE,c=null,n.result=u.exec.call(n,"Transporter","getAsBlob",t||"")},999),n.state=r.BUSY,n.trigger("TransportingStarted"),a.call(n)}function a(){var e,i=this,n=l-d;m>n&&(m=n),e=t.btoa(c.substr(d,m)),u.exec.call(i,"Transporter","receive",e,l)}var s,u,c,l,d,m;i.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,i,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),m=r.chunk_size,n.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,i,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,i,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),n.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),n.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=n.instance,r}),n("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(e,t,i,n,r,o,a,s,u,c,l,d,m){function h(){function n(e){try{return e||(e=this.exec("Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name),!0}catch(t){return this.trigger("error",t.code),!1}}function c(t){var n=e.typeOf(t);try{if(t instanceof h){if(!t.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);p.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new i.ImageError(i.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(n,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===n)"data:"===t.substr(0,5)?c.call(this,new l(null,{data:t}),arguments[1]):x.apply(this,arguments);else{if("node"!==n||"img"!==t.nodeName.toLowerCase())throw new i.DOMException(i.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r.code)}}function p(t,i){var n=this.connectRuntime(t.ruid);this.ruid=n.uid,n.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(i)?!0:i)}function g(t,i){function n(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){n(t)}),i&&"string"==typeof i.required_caps&&(i.required_caps=o.parseCaps(i.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},i))):n(this.connectRuntime(t.ruid))}function x(e,t){var i,n=this;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){c.apply(this,arguments)},resize:function(t){var n,r,o=this,a={x:0,y:0,width:o.width,height:o.height},s=e.extendIf({width:o.width,height:o.height,type:o.type||"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},t);try{if(!o.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);if(o.width>h.MAX_RESIZE_WIDTH||o.height>h.MAX_RESIZE_HEIGHT)throw new i.ImageError(i.ImageError.MAX_RESOLUTION_ERR);if(n=o.meta&&o.meta.tiff&&o.meta.tiff.Orientation||1,-1!==e.inArray(n,[5,6,7,8])){var u=s.width;s.width=s.height,s.height=u}if(s.crop){switch(r=Math.max(s.width/o.width,s.height/o.height),t.fit?(a.width=Math.min(Math.ceil(s.width/r),o.width),a.height=Math.min(Math.ceil(s.height/r),o.height),r=s.width/a.width):(a.width=Math.min(s.width,o.width),a.height=Math.min(s.height,o.height),r=1),"boolean"==typeof s.crop&&(s.crop="cc"),s.crop.toLowerCase().replace(/_/,"-")){case"rb":case"right-bottom":a.x=o.width-a.width,a.y=o.height-a.height;break;case"cb":case"center-bottom":a.x=Math.floor((o.width-a.width)/2),a.y=o.height-a.height;break;case"lb":case"left-bottom":a.x=0,a.y=o.height-a.height;break;case"lt":case"left-top":a.x=0,a.y=0;break;case"ct":case"center-top":a.x=Math.floor((o.width-a.width)/2),a.y=0;break;case"rt":case"right-top":a.x=o.width-a.width,a.y=0;break;case"rc":case"right-center":case"right-middle":a.x=o.width-a.width,a.y=Math.floor((o.height-a.height)/2);break;case"lc":case"left-center":case"left-middle":a.x=0,a.y=Math.floor((o.height-a.height)/2);break;case"cc":case"center-center":case"center-middle":default:a.x=Math.floor((o.width-a.width)/2),a.y=Math.floor((o.height-a.height)/2)}a.x=Math.max(a.x,0),a.y=Math.max(a.y,0)}else r=Math.min(s.width/o.width,s.height/o.height);this.exec("Image","resize",a,r,s)}catch(c){o.trigger("error",c.code)}},downsize:function(t){var i,n={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,preserveHeaders:!0,resample:"default"};i="object"==typeof t?e.extend(n,t):e.extend(n,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]}),this.resize(i)},crop:function(e,t,i){this.downsize(e,t,!0,i)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);var e=this.connectRuntime(this.ruid);return e.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsBlob",e||"image/jpeg",t||90)},getAsDataURL:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",e||"image/jpeg",t||90)},getAsBinaryString:function(e,t){var i=this.getAsDataURL(e,t);return m.atob(i.substring(i.indexOf("base64,")+7))},embed:function(n,r){function o(t,r){var o=this;if(u.can("create_canvas")){var l=o.getAsCanvas();if(l)return n.appendChild(l),l=null,o.destroy(),c.trigger("embedded"),void 0}var d=o.getAsDataURL(t,r);if(!d)throw new i.ImageError(i.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",d.length))n.innerHTML='<img src="'+d+'" width="'+o.width+'" height="'+o.height+'" />',o.destroy(),c.trigger("embedded");else{var h=new s;h.bind("TransportingComplete",function(){a=c.connectRuntime(this.result.ruid),c.bind("Embedded",function(){e.extend(a.getShimContainer().style,{top:"0px",left:"0px",width:o.width+"px",height:o.height+"px"}),a=null},999),a.exec.call(c,"ImageView","display",this.result.uid,width,height),o.destroy()}),h.transport(m.atob(d.substring(d.indexOf("base64,")+7)),t,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:n})}}var a,c=this,l=e.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90},r);try{if(!(n=t.get(n)))throw new i.DOMException(i.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);this.width>h.MAX_RESIZE_WIDTH||this.height>h.MAX_RESIZE_HEIGHT;var d=new h;return d.bind("Resize",function(){o.call(this,l.type,l.quality)}),d.bind("Load",function(){d.downsize(l)}),this.meta.thumb&&this.meta.thumb.width>=l.width&&this.meta.thumb.height>=l.height?d.load(this.meta.thumb.data):d.clone(this,!1),d}catch(f){this.trigger("error",f.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}}),this.handleEventProps(f),this.bind("Load Resize",function(){return n.call(this)},999)}var f=["progress","load","error","resize","embedded"];return h.MAX_RESIZE_WIDTH=8192,h.MAX_RESIZE_HEIGHT=8192,h.prototype=c.instance,h}),n("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue,l=e.extend({access_binary:u(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return o.can("access_binary")&&!!s.Image},display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:u(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:u(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==n.browser||n.verComp(n.version,9,">"))}()),filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),return_response_headers:c,return_response_type:function(e){return"json"===e&&window.JSON?!0:n.can("return_response_type",e)},return_status_code:c,report_upload_progress:u(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return o.can("access_binary")&&n.can("create_canvas")},select_file:function(){return n.can("use_fileinput")&&window.File},select_folder:function(){return o.can("select_file")&&("Chrome"===n.browser&&n.verComp(n.version,21,">=")||"Firefox"===n.browser&&n.verComp(n.version,42,">="))},select_multiple:function(){return!(!o.can("select_file")||"Safari"===n.browser&&"Windows"===n.os||"iOS"===n.os&&n.verComp(n.osVersion,"7.0.0",">")&&n.verComp(n.osVersion,"8.0.0","<"))},send_binary_string:u(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:u(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||o.can("send_binary_string")},slice_blob:u(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return o.can("slice_blob")&&o.can("send_multipart")},summon_file_dialog:function(){return o.can("select_file")&&("Firefox"===n.browser&&n.verComp(n.version,4,">=")||"Opera"===n.browser&&n.verComp(n.version,12,">=")||"IE"===n.browser&&n.verComp(n.version,10,">=")||!!~e.inArray(n.browser,["Chrome","Safari","Edge"]))},upload_filesize:c,use_http_method:c},arguments[2]);i.call(this,t,arguments[1]||a,l),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html5",s={};return i.addConstructor(a,o),s}),n("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(e,t){function i(){function e(e,t,i){var n;if(!window.File.prototype.slice)return(n=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?n.call(e,t,i):null;try{return e.slice(),e.slice(t,i)}catch(r){return e.slice(t,i-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=i}),n("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(e){function t(){this.returnValue=!1}function i(){this.cancelBubble=!0}var n={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=i,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),n.hasOwnProperty(o[r])||(n[o[r]]={}),l=n[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,i,o){var a,s;if(i=i.toLowerCase(),t[r]&&n[t[r]]&&n[t[r]][i]){a=n[t[r]][i];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(i,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+i,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete n[t[r]][i],e.isEmptyObj(n[t[r]])){delete n[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,i){t&&t[r]&&e.each(n[t[r]],function(e,n){a(t,n,i)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),n("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a){function s(){var e,s;i.extend(this,{init:function(u){var c,l,d,m,h,f,p=this,g=p.getRuntime();e=u,d=e.accept.mimes||o.extList2mimes(e.accept,g.can("filter_by_extension")),l=g.getShimContainer(),l.innerHTML='<input id="'+g.uid+'" type="file" style="font-size:999px;opacity:0;"'+(e.multiple&&g.can("select_multiple")?"multiple":"")+(e.directory&&g.can("select_folder")?"webkitdirectory directory":"")+(d?' accept="'+d.join(",")+'"':"")+" />",c=n.get(g.uid),i.extend(c.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=n.get(e.browse_button),s=n.getStyle(m,"z-index")||"auto",g.can("summon_file_dialog")&&("static"===n.getStyle(m,"position")&&(m.style.position="relative"),r.addEvent(m,"click",function(e){var t=n.get(g.uid);t&&!t.disabled&&t.click(),e.preventDefault()},p.uid),p.bind("Refresh",function(){h=parseInt(s,10)||1,n.get(e.browse_button).style.zIndex=h,this.getRuntime().getShimContainer().style.zIndex=h-1})),f=g.can("summon_file_dialog")?m:l,r.addEvent(f,"mouseover",function(){p.trigger("mouseenter")},p.uid),r.addEvent(f,"mouseout",function(){p.trigger("mouseleave")},p.uid),r.addEvent(f,"mousedown",function(){p.trigger("mousedown")},p.uid),r.addEvent(n.get(e.container),"mouseup",function(){p.trigger("mouseup")},p.uid),c.onchange=function x(){if(p.files=[],i.each(this.files,function(i){var n="";return e.directory&&"."==i.name?!0:(i.webkitRelativePath&&(n="/"+i.webkitRelativePath.replace(/^\//,"")),i=new t(g.uid,i),i.relativePath=n,p.files.push(i),void 0)}),"IE"!==a.browser&&"IEMobile"!==a.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=x}p.files.length&&p.trigger("change")},p.trigger({type:"ready",async:!0}),l=null},setOption:function(e,t){var i=this.getRuntime(),r=n.get(i.uid);switch(e){case"accept":if(t){var a=t.mimes||o.extList2mimes(t,i.can("filter_by_extension"));r.setAttribute("accept",a.join(","))}else r.removeAttribute("accept");break;case"directory":t&&i.can("select_folder")?(r.setAttribute("directory",""),r.setAttribute("webkitdirectory","")):(r.removeAttribute("directory"),r.removeAttribute("webkitdirectory"));break;case"multiple":t&&i.can("select_multiple")?r.setAttribute("multiple",""):r.removeAttribute("multiple")}},disable:function(e){var t,i=this.getRuntime();(t=n.get(i.uid))&&(t.disabled=!!e)},destroy:function(){var t=this.getRuntime(),i=t.getShim(),o=t.getShimContainer(),a=e&&n.get(e.container),u=e&&n.get(e.browse_button);a&&r.removeAllEvents(a,this.uid),u&&(r.removeAllEvents(u,this.uid),u.style.zIndex=s),o&&(r.removeAllEvents(o,this.uid),o.innerHTML=""),i.removeInstance(this.uid),e=o=a=u=i=null}})}return e.FileInput=s}),n("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(e,t,i,n,r,o){function a(){function e(e){if(!e.dataTransfer||!e.dataTransfer.types)return!1;var t=i.toArray(e.dataTransfer.types||[]);return-1!==i.inArray("Files",t)||-1!==i.inArray("public.file-url",t)||-1!==i.inArray("application/x-moz-file",t)}function a(e,i){if(u(e)){var n=new t(f,e);n.relativePath=i||"",p.push(n)}}function s(e){for(var t=[],n=0;n<e.length;n++)[].push.apply(t,e[n].extensions.split(/\s*,\s*/));return-1===i.inArray("*",t)?t:[]}function u(e){if(!g.length)return!0;var t=o.getFileExtension(e.name);return!t||-1!==i.inArray(t,g)}function c(e,t){var n=[];i.each(e,function(e){var t=e.webkitGetAsEntry();t&&(t.isFile?a(e.getAsFile(),t.fullPath):n.push(t))}),n.length?l(n,t):t()}function l(e,t){var n=[];i.each(e,function(e){n.push(function(t){d(e,t)})}),i.inSeries(n,function(){t()})}function d(e,t){e.isFile?e.file(function(i){a(i,e.fullPath),t()},function(){t()}):e.isDirectory?m(e,t):t()}function m(e,t){function i(e){r.readEntries(function(t){t.length?([].push.apply(n,t),i(e)):e()},e)}var n=[],r=e.createReader();i(function(){l(n,t)})}var h,f,p=[],g=[];i.extend(this,{init:function(t){var n,o=this;h=t,f=o.ruid,g=s(h.accept),n=h.container,r.addEvent(n,"dragover",function(t){e(t)&&(t.preventDefault(),t.dataTransfer.dropEffect="copy")},o.uid),r.addEvent(n,"drop",function(t){e(t)&&(t.preventDefault(),p=[],t.dataTransfer.items&&t.dataTransfer.items[0].webkitGetAsEntry?c(t.dataTransfer.items,function(){o.files=p,o.trigger("drop")}):(i.each(t.dataTransfer.files,function(e){a(e)}),o.files=p,o.trigger("drop")))},o.uid),r.addEvent(n,"dragenter",function(){o.trigger("dragenter")},o.uid),r.addEvent(n,"dragleave",function(){o.trigger("dragleave")},o.uid)},destroy:function(){r.removeAllEvents(h&&n.get(h.container),this.uid),f=p=g=h=null}})}return e.FileDrop=a}),n("moxie/runtime/html5/file/FileReader",["moxie/runtime/html5/Runtime","moxie/core/utils/Encode","moxie/core/utils/Basic"],function(e,t,i){function n(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var n,r=!1;i.extend(this,{read:function(t,o){var a=this;a.result="",n=new window.FileReader,n.addEventListener("progress",function(e){a.trigger(e)}),n.addEventListener("load",function(t){a.result=r?e(n.result):n.result,a.trigger(t)}),n.addEventListener("error",function(e){a.trigger(e,n.error)}),n.addEventListener("loadend",function(e){n=null,a.trigger(e)}),"function"===i.typeOf(n[t])?(r=!1,n[t](o.getSource())):"readAsBinaryString"===t&&(r=!0,n.readAsDataURL(o.getSource()))},abort:function(){n&&n.abort()},destroy:function(){n=null}})}return e.FileReader=n}),n("moxie/runtime/html5/xhr/XMLHttpRequest",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/core/utils/Url","moxie/file/File","moxie/file/Blob","moxie/xhr/FormData","moxie/core/Exceptions","moxie/core/utils/Env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(e,t){var i,n,r=this;i=t.getBlob().getSource(),n=new window.FileReader,n.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:n.result})),f.send.call(r,e,t)},n.readAsBinaryString(i)}function c(){return!window.XMLHttpRequest||"IE"===u.browser&&u.verComp(u.version,8,"<")?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(i){}}():new window.XMLHttpRequest}function l(e){var t=e.responseXML,i=e.responseText;return"IE"===u.browser&&i&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(i)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t}function d(e){var t="----moxieboundary"+(new Date).getTime(),i="--",n="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return m.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?i+t+n+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+n+"Content-Type: "+(e.type||"application/octet-stream")+n+n+e.getSource()+n:i+t+n+'Content-Disposition: form-data; name="'+a+'"'+n+n+unescape(encodeURIComponent(e))+n}),r+=i+t+i+n}var m,h,f=this;t.extend(this,{send:function(i,r){var s=this,l="Mozilla"===u.browser&&u.verComp(u.version,4,">=")&&u.verComp(u.version,7,"<"),f="Android Browser"===u.browser,p=!1;if(h=i.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),m=c(),m.open(i.method,i.url,i.async,i.user,i.password),r instanceof o)r.isDetached()&&(p=!0),r=r.getSource();
  5363. else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),p=!0;else if((l||f)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,i,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}m.upload?(i.withCredentials&&(m.withCredentials=!0),m.addEventListener("load",function(e){s.trigger(e)}),m.addEventListener("error",function(e){s.trigger(e)}),m.addEventListener("progress",function(e){s.trigger(e)}),m.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):m.onreadystatechange=function(){switch(m.readyState){case 1:break;case 2:break;case 3:var e,t;try{n.hasSameOrigin(i.url)&&(e=m.getResponseHeader("Content-Length")||0),m.responseText&&(t=m.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:m.onreadystatechange=function(){},0===m.status?s.trigger("error"):s.trigger("load")}},t.isEmptyObj(i.headers)||t.each(i.headers,function(e,t){m.setRequestHeader(t,e)}),""!==i.responseType&&"responseType"in m&&(m.responseType="json"!==i.responseType||u.can("return_response_type","json")?i.responseType:"text"),p?m.sendAsBinary?m.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);m.send(e.buffer)}():m.send(r),s.trigger("loadstart")},getStatus:function(){try{if(m)return m.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var n=new r(t.uid,m.response),o=m.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(h=a[2])}return n.name=h,n.type||(n.type=i.getFileMime(h)),n;case"json":return u.can("return_response_type","json")?m.response:200===m.status&&window.JSON?JSON.parse(m.responseText):null;case"document":return l(m);default:return""!==m.responseText?m.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return m.getAllResponseHeaders()}catch(e){}return""},abort:function(){m&&m.abort()},destroy:function(){f=h=null}})}return e.XMLHttpRequest=c}),n("moxie/runtime/html5/utils/BinaryReader",["moxie/core/utils/Basic"],function(e){function t(e){e instanceof ArrayBuffer?i.apply(this,arguments):n.apply(this,arguments)}function i(t){var i=new DataView(t);e.extend(this,{readByteAt:function(e){return i.getUint8(e)},writeByteAt:function(e,t){i.setUint8(e,t)},SEGMENT:function(e,n,r){switch(arguments.length){case 2:return t.slice(e,e+n);case 1:return t.slice(e);case 3:if(null===r&&(r=new ArrayBuffer),r instanceof ArrayBuffer){var o=new Uint8Array(this.length()-n+r.byteLength);e>0&&o.set(new Uint8Array(t.slice(0,e)),0),o.set(new Uint8Array(r),e),o.set(new Uint8Array(t.slice(e+n)),e+r.byteLength),this.clear(),t=o.buffer,i=new DataView(t);break}default:return t}},length:function(){return t?t.byteLength:0},clear:function(){i=t=null}})}function n(t){function i(e,i,n){n=3===arguments.length?n:t.length-i-1,t=t.substr(0,i)+e+t.substr(n+i)}e.extend(this,{readByteAt:function(e){return t.charCodeAt(e)},writeByteAt:function(e,t){i(String.fromCharCode(t),e,1)},SEGMENT:function(e,n,r){switch(arguments.length){case 1:return t.substr(e);case 2:return t.substr(e,n);case 3:i(null!==r?r:"",e,n);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return e.extend(t.prototype,{littleEndian:!1,read:function(e,t){var i,n,r;if(e+t>this.length())throw new Error("You are trying to read outside the source boundaries.");for(n=this.littleEndian?0:-8*(t-1),r=0,i=0;t>r;r++)i|=this.readByteAt(e+r)<<Math.abs(n+8*r);return i},write:function(e,t,i){var n,r;if(e>this.length())throw new Error("You are trying to write outside the source boundaries.");for(n=this.littleEndian?0:-8*(i-1),r=0;i>r;r++)this.writeByteAt(e+r,255&t>>Math.abs(n+8*r))},BYTE:function(e){return this.read(e,1)},SHORT:function(e){return this.read(e,2)},LONG:function(e){return this.read(e,4)},SLONG:function(e){var t=this.read(e,4);return t>2147483647?t-4294967296:t},CHAR:function(e){return String.fromCharCode(this.read(e,1))},STRING:function(e,t){return this.asArray("CHAR",e,t).join("")},asArray:function(e,t,i){for(var n=[],r=0;i>r;r++)n[r]=this[e](t+r);return n}}),t}),n("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,t){return function i(n){var r,o,a,s=[],u=0;if(r=new e(n),65496!==r.SHORT(0))throw r.clear(),new t.ImageError(t.ImageError.WRONG_FORMAT);for(o=2;o<=r.length();)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;u=r.SHORT(o+2)+2,a>=65505&&65519>=a&&s.push({hex:a,name:"APP"+(15&a),start:o,length:u,segment:r.SEGMENT(o,u)}),o+=u}return r.clear(),{headers:s,restore:function(t){var i,n,r;for(r=new e(t),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,i=s.length;i>n;n++)r.SEGMENT(o,0,s[n].segment),o+=s[n].length;return t=r.SEGMENT(),r.clear(),t},strip:function(t){var n,r,o,a;for(o=new i(t),r=o.headers,o.purge(),n=new e(t),a=r.length;a--;)n.SEGMENT(r[a].start,r[a].length,"");return t=n.SEGMENT(),n.clear(),t},get:function(e){for(var t=[],i=0,n=s.length;n>i;i++)s[i].name===e.toUpperCase()&&t.push(s[i].segment);return t},set:function(e,t){var i,n,r,o=[];for("string"==typeof t?o.push(t):o=t,i=n=0,r=s.length;r>i&&(s[i].name===e.toUpperCase()&&(s[i].segment=o[n],s[i].length=o[n].length,n++),!(n>=o.length));i++);},purge:function(){this.headers=s=[]}}}}),n("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,i,n){function r(o){function a(i,r){var o,a,s,u,c,m,h,f,p=this,g=[],x={},v={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},y={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(o=p.SHORT(i),a=0;o>a;a++)if(g=[],h=i+2+12*a,s=r[p.SHORT(h)],s!==t){if(u=v[p.SHORT(h+=2)],c=p.LONG(h+=2),m=y[u],!m)throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(h+=4,m*c>4&&(h=p.LONG(h)+d.tiffHeader),h+m*c>=this.length())throw new n.ImageError(n.ImageError.INVALID_META_ERR);"ASCII"!==u?(g=p.asArray(u,h,c),f=1==c?g[0]:g,x[s]=l.hasOwnProperty(s)&&"object"!=typeof f?l[s][f]:f):x[s]=e.trim(p.STRING(h,c).replace(/\0$/,""))}return x}function s(e,t,i){var n,r,o,a=0;if("string"==typeof t){var s=c[e.toLowerCase()];for(var u in s)if(s[u]===t){t=u;break}}n=d[e.toLowerCase()+"IFD"],r=this.SHORT(n);for(var l=0;r>l;l++)if(o=n+12*l+2,this.SHORT(o)==t){a=o+8;break}if(!a)return!1;try{this.write(a,i,4)}catch(m){return!1}return!0}var u,c,l,d,m,h;if(i.call(this,o),c={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"},thumb:{513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},d={tiffHeader:10},m=d.tiffHeader,u={clear:this.clear},e.extend(this,{read:function(){try{return r.prototype.read.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},write:function(){try{return r.prototype.write.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},UNDEFINED:function(){return this.BYTE.apply(this,arguments)},RATIONAL:function(e){return this.LONG(e)/this.LONG(e+4)},SRATIONAL:function(e){return this.SLONG(e)/this.SLONG(e+4)},ASCII:function(e){return this.CHAR(e)},TIFF:function(){return h||null},EXIF:function(){var t=null;if(d.exifIFD){try{t=a.call(this,d.exifIFD,c.exif)}catch(i){return null}if(t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var n=0,r="";n<t.ExifVersion.length;n++)r+=String.fromCharCode(t.ExifVersion[n]);t.ExifVersion=r}}return t},GPS:function(){var t=null;if(d.gpsIFD){try{t=a.call(this,d.gpsIFD,c.gps)}catch(i){return null}t.GPSVersionID&&"array"===e.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join("."))}return t},thumb:function(){if(d.IFD1)try{var e=a.call(this,d.IFD1,c.thumb);if("JPEGInterchangeFormat"in e)return this.SEGMENT(d.tiffHeader+e.JPEGInterchangeFormat,e.JPEGInterchangeFormatLength)}catch(t){}return null},setExif:function(e,t){return"PixelXDimension"!==e&&"PixelYDimension"!==e?!1:s.call(this,"exif",e,t)},clear:function(){u.clear(),o=c=l=h=d=u=null}}),65505!==this.SHORT(0)||"EXIF\0"!==this.STRING(4,5).toUpperCase())throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(this.littleEndian=18761==this.SHORT(m),42!==this.SHORT(m+=2))throw new n.ImageError(n.ImageError.INVALID_META_ERR);d.IFD0=d.tiffHeader+this.LONG(m+=2),h=a.call(this,d.IFD0,c.tiff),"ExifIFDPointer"in h&&(d.exifIFD=d.tiffHeader+h.ExifIFDPointer,delete h.ExifIFDPointer),"GPSInfoIFDPointer"in h&&(d.gpsIFD=d.tiffHeader+h.GPSInfoIFDPointer,delete h.GPSInfoIFDPointer),e.isEmptyObj(h)&&(h=null);var f=this.LONG(d.IFD0+12*this.SHORT(d.IFD0)+2);f&&(d.IFD1=d.tiffHeader+f)}return r.prototype=i.prototype,r}),n("moxie/runtime/html5/image/JPEG",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEGHeaders","moxie/runtime/html5/utils/BinaryReader","moxie/runtime/html5/image/ExifParser"],function(e,t,i,n,r){function o(o){function a(e){var t,i,n=0;for(e||(e=c);n<=e.length();){if(t=e.SHORT(n+=2),t>=65472&&65475>=t)return n+=5,{height:e.SHORT(n),width:e.SHORT(n+=2)};i=e.SHORT(n+=2),n+=i-2}return null}function s(){var e,t,i=d.thumb();return i&&(e=new n(i),t=a(e),e.clear(),t)?(t.data=i,t):null}function u(){d&&l&&c&&(d.clear(),l.purge(),c.clear(),m=l=d=c=null)}var c,l,d,m;if(c=new n(o),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new i(o);try{d=new r(l.get("app1")[0])}catch(h){}m=a.call(this),e.extend(this,{type:"image/jpeg",size:c.length(),width:m&&m.width||0,height:m&&m.height||0,setExif:function(t,i){return d?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,i),l.set("app1",d.SEGMENT()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):l.restore(o)},stripHeaders:function(e){return l.strip(e)},purge:function(){u.call(this)}}),d&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS(),thumb:s()})}return o}),n("moxie/runtime/html5/image/PNG",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(e,t,i){function n(n){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:s.LONG(t),height:s.LONG(t+=4)}):null}function o(){s&&(s.clear(),n=l=u=c=s=null)}function a(e){var t,i,n,r;return t=s.LONG(e),i=s.STRING(e+=4,4),n=e+=4,r=s.LONG(e+t),{length:t,type:i,start:n,CRC:r}}var s,u,c,l;s=new i(n),function(){var t=0,i=0,n=[35152,20039,3338,6666];for(i=0;i<n.length;i++,t+=2)if(n[i]!=s.SHORT(t))throw new e.ImageError(e.ImageError.WRONG_FORMAT)}(),l=r.call(this),t.extend(this,{type:"image/png",size:s.length(),width:l.width,height:l.height,purge:function(){o.call(this)}}),o.call(this)}return n}),n("moxie/runtime/html5/image/ImageInfo",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEG","moxie/runtime/html5/image/PNG"],function(e,t,i,n){return function(r){var o,a=[i,n];o=function(){for(var e=0;e<a.length;e++)try{return new a[e](r)}catch(i){}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}(),e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){r=null}}),e.extend(this,o),this.purge=function(){o.purge(),o=null}}}),n("moxie/runtime/html5/image/ResizerCanvas",[],function(){function e(i,n){var r=i.width,o=Math.floor(r*n),a=!1;(.5>n||n>2)&&(n=.5>n?.5:2,a=!0);var s=t(i,n);return a?e(s,o/s.width):s}function t(e,t){var i=e.width,n=e.height,r=Math.floor(i*t),o=Math.floor(n*t),a=document.createElement("canvas");return a.width=r,a.height=o,a.getContext("2d").drawImage(e,0,0,i,n,0,0,r,o),e=null,a}return{scale:e}}),n("moxie/runtime/html5/image/Image",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/runtime/html5/image/ImageInfo","moxie/runtime/html5/image/ResizerCanvas","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a,s,u){function c(){function e(){if(!v&&!g)throw new i.ImageError(i.DOMException.INVALID_STATE_ERR);return v||g}function c(){var t=e();return"canvas"==t.nodeName.toLowerCase()?t:(v=document.createElement("canvas"),v.width=t.width,v.height=t.height,v.getContext("2d").drawImage(t,0,0),v)}function l(e){return n.atob(e.substring(e.indexOf("base64,")+7))}function d(e,t){return"data:"+(t||"")+";base64,"+n.btoa(e)}function m(e){var t=this;g=new Image,g.onerror=function(){p.call(this),t.trigger("error",i.ImageError.WRONG_FORMAT)},g.onload=function(){t.trigger("load")},g.src="data:"==e.substr(0,5)?e:d(e,w.type)}function h(e,t){var n,r=this;return window.FileReader?(n=new FileReader,n.onload=function(){t(this.result)},n.onerror=function(){r.trigger("error",i.ImageError.WRONG_FORMAT)},n.readAsDataURL(e),void 0):t(e.getAsDataURL())}function f(e,i){var n=Math.PI/180,r=document.createElement("canvas"),o=r.getContext("2d"),a=e.width,s=e.height;switch(t.inArray(i,[5,6,7,8])>-1?(r.width=s,r.height=a):(r.width=a,r.height=s),i){case 2:o.translate(a,0),o.scale(-1,1);break;case 3:o.translate(a,s),o.rotate(180*n);break;case 4:o.translate(0,s),o.scale(1,-1);break;case 5:o.rotate(90*n),o.scale(1,-1);break;case 6:o.rotate(90*n),o.translate(0,-s);break;case 7:o.rotate(90*n),o.translate(a,-s),o.scale(-1,1);break;case 8:o.rotate(-90*n),o.translate(-a,0)}return o.drawImage(e,0,0,a,s),r}function p(){x&&(x.purge(),x=null),y=g=v=w=null,b=!1}var g,x,v,y,w,E=this,b=!1,R=!0;t.extend(this,{loadFromBlob:function(e){var t=this,n=t.getRuntime(),r=arguments.length>1?arguments[1]:!0;if(!n.can("access_binary"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return w=e,e.isDetached()?(y=e.getSource(),m.call(this,y),void 0):(h.call(this,e.getSource(),function(e){r&&(y=l(e)),m.call(t,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,w=new o(null,{name:e.name,size:e.size,type:e.type}),m.call(this,t?y=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t,i=this.getRuntime();return!x&&y&&i.can("access_image_binary")&&(x=new a(y)),t={width:e().width||0,height:e().height||0,type:w.type||u.getFileMime(w.name),size:y&&y.length||w.size||0,name:w.name||"",meta:null},R&&(t.meta=x&&x.meta||this.meta||{},!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof r||(t.meta.thumb.data=new r(null,{type:"image/jpeg",data:t.meta.thumb.data}))),t},resize:function(t,i,n){var r=document.createElement("canvas");if(r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(e(),t.x,t.y,t.width,t.height,0,0,r.width,r.height),v=s.scale(r,i),R=n.preserveHeaders,!R){var o=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1;v=f(v,o)}this.width=v.width,this.height=v.height,b=!0,this.trigger("Resize")},getAsCanvas:function(){return v||(v=c()),v.id=this.uid+"_canvas",v},getAsBlob:function(e,t){return e!==this.type?(b=!0,new o(null,{name:w.name||"",type:e,data:E.getAsDataURL(e,t)})):new o(null,{name:w.name||"",type:e,data:E.getAsBinaryString(e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!b)return g.src;if(c(),"image/jpeg"!==e)return v.toDataURL("image/png");try{return v.toDataURL("image/jpeg",t/100)}catch(i){return v.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!b)return y||(y=l(E.getAsDataURL(e,t))),y;if("image/jpeg"!==e)y=l(E.getAsDataURL(e,t));else{var i;t||(t=90),c();try{i=v.toDataURL("image/jpeg",t/100)}catch(n){i=v.toDataURL("image/jpeg")}y=l(i),x&&(y=x.stripHeaders(y),R&&(x.meta&&x.meta.exif&&x.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),y=x.writeHeaders(y)),x.purge(),x=null)}return b=!1,y},destroy:function(){E=null,p.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),n("moxie/runtime/flash/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function a(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(i){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function s(e){var n=i.get(e);n&&"OBJECT"==n.nodeName&&("IE"===t.browser?(n.style.display="none",function r(){4==n.readyState?u(e):setTimeout(r,10)}()):n.parentNode.removeChild(n))}function u(e){var t=i.get(e);if(t){for(var n in t)"function"==typeof t[n]&&(t[n]=null);t.parentNode.removeChild(t)}}function c(u){var c,m=this;u=e.extend({swf_url:t.swf_url},u),o.call(this,u,l,{access_binary:function(e){return e&&"browser"===m.mode},access_image_binary:function(e){return e&&"browser"===m.mode},display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===m.mode},resize_image:o.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!e.arrayDiff(t,["","text","document"])||"browser"===m.mode},return_status_code:function(t){return"browser"===m.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:function(e){return e&&"browser"===m.mode},send_browser_cookies:function(e){return e&&"browser"===m.mode},send_custom_headers:function(e){return e&&"browser"===m.mode},send_multipart:o.capTrue,slice_blob:function(e){return e&&"browser"===m.mode},stream_upload:function(e){return e&&"browser"===m.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===m.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},slice_blob:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),a()<11.3&&(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid)},shimExec:function(e,t){var i=[].slice.call(arguments,2);return m.getShim().exec(this.uid,e,t,i)},init:function(){var i,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),i='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+u.swf_url+'" ',"IE"===t.browser&&(i+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),i+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+u.swf_url+'" />'+'<param name="flashvars" value="uid='+escape(this.uid)+"&target="+t.global_event_dispatcher+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowscriptaccess" value="always" />'+"</object>","IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=i,r=o=null):o.innerHTML=i,c=setTimeout(function(){m&&!m.initialized&&m.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){s(m.uid),e.call(m),clearTimeout(c),u=c=e=m=null}}(this.destroy)},d)}var l="flash",d={};return o.addConstructor(l,c),d}),n("moxie/runtime/flash/file/Blob",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={slice:function(e,i,n,r){var o=this.getRuntime();return 0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),e=o.shimExec.call(this,"Blob","slice",i,n,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=i}),n("moxie/runtime/flash/file/FileInput",["moxie/runtime/flash/Runtime","moxie/file/File","moxie/core/utils/Basic"],function(e,t,i){var n={init:function(e){var n=this,r=this.getRuntime();this.bind("Change",function(){var e=r.shimExec.call(n,"FileInput","getFiles");n.files=[],i.each(e,function(e){n.files.push(new t(r.uid,e))})},999),this.getRuntime().shimExec.call(this,"FileInput","init",{accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=n}),n("moxie/runtime/flash/file/FileReader",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n=this;return n.result="","readAsDataURL"===e&&(n.result="data:"+(t.type||"")+";base64,"),n.bind("Progress",function(t,r){r&&(n.result+=i(r,e))},999),n.getRuntime().shimExec.call(this,"FileReader","readAsBase64",t.uid)}};return e.FileReader=n}),n("moxie/runtime/flash/file/FileReaderSync",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n,r=this.getRuntime();return(n=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(n="data:"+(t.type||"")+";base64,"+n),i(n,e,t.type)):null}};return e.FileReaderSync=n}),n("moxie/runtime/flash/runtime/Transporter",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={getAsBlob:function(e){var i=this.getRuntime(),n=i.shimExec.call(this,"Transporter","getAsBlob",e);return n?new t(i.uid,n):null}};return e.Transporter=i}),n("moxie/runtime/flash/xhr/XMLHttpRequest",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/file/File","moxie/file/FileReaderSync","moxie/runtime/flash/file/FileReaderSync","moxie/xhr/FormData","moxie/runtime/Transporter","moxie/runtime/flash/runtime/Transporter"],function(e,t,i,n,r,o,a,s){var u={send:function(e,n){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,n)}function o(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),n=null,r()}function u(e,t){var i=new s;i.bind("TransportingComplete",function(){t(this.result)}),i.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),n instanceof a){var d;if(n.each(function(e,t){e instanceof i?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),n.hasBlob()){var m=n.getBlob();m.isDetached()?u(m,function(e){m.destroy(),o(d,e)}):o(d,m)}else n=null,r()}else n instanceof i?n.isDetached()?u(n,function(e){n.destroy(),n=e.uid,r()}):(n=n.uid,r()):r()},getResponse:function(e){var i,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new n(a.uid,o),"blob"===e)return o;try{if(i=new r,~t.inArray(e,["","text"]))return i.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(i.readAsText(o))}finally{o.destroy()}}return null},abort:function(){var e=this.getRuntime();e.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=u}),n("moxie/runtime/flash/image/Image",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/runtime/Transporter","moxie/file/Blob","moxie/file/FileReaderSync"],function(e,t,i,n,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(n,"Image","loadFromBlob",e.uid),n=r=null}var n=this,r=n.getRuntime();if(e.isDetached()){var o=new i;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getInfo:function(){var e=this.getRuntime(),t=e.shimExec.call(this,"Image","getInfo");return!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof n||(t.meta.thumb.data=new n(e.uid,t.meta.thumb.data)),t},getAsBlob:function(e,t){var i=this.getRuntime(),r=i.shimExec.call(this,"Image","getAsBlob",e,t);return r?new n(i.uid,r):null},getAsDataURL:function(){var e,t=this.getRuntime(),i=t.Image.getAsBlob.apply(this,arguments);return i?(e=new r,e.readAsDataURL(i)):null}};return e.Image=o}),n("moxie/runtime/silverlight/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function a(e){var t,i,n,r,o,a=!1,s=null,u=0;try{try{s=new ActiveXObject("AgControl.AgControl"),s.IsVersionSupported(e)&&(a=!0),s=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(t=l.description,"1.0.30226.2"===t&&(t="2.0.30226.2"),i=t.split(".");i.length>3;)i.pop();for(;i.length<4;)i.push(0);for(n=e.split(".");n.length>4;)n.pop();do r=parseInt(n[u],10),o=parseInt(i[u],10),u++;while(u<n.length&&r===o);o>=r&&!isNaN(r)&&(a=!0)}}}catch(d){a=!1}return a}function s(s){var l,d=this;s=e.extend({xap_url:t.xap_url},s),o.call(this,s,u,{access_binary:o.capTrue,access_image_binary:o.capTrue,display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:o.capTrue,resize_image:o.capTrue,return_response_headers:function(e){return e&&"client"===d.mode},return_response_type:function(e){return"json"!==e?!0:!!window.JSON},return_status_code:function(t){return"client"===d.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:o.capTrue,send_browser_cookies:function(e){return e&&"browser"===d.mode},send_custom_headers:function(e){return e&&"client"===d.mode},send_multipart:o.capTrue,slice_blob:o.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:o.capTrue,use_http_method:function(t){return"client"===d.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),a("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid).content.Moxie},shimExec:function(e,t){var i=[].slice.call(arguments,2);return d.getShim().exec(this.uid,e,t,i)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">'+'<param name="source" value="'+s.xap_url+'"/>'+'<param name="background" value="Transparent"/>'+'<param name="windowless" value="true"/>'+'<param name="enablehtmlaccess" value="true"/>'+'<param name="initParams" value="uid='+this.uid+",target="+t.global_event_dispatcher+'"/>'+"</object>",l=setTimeout(function(){d&&!d.initialized&&d.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(d),clearTimeout(l),s=l=e=d=null}}(this.destroy)},c)}var u="silverlight",c={};return o.addConstructor(u,s),c}),n("moxie/runtime/silverlight/file/Blob",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/Blob"],function(e,t,i){return e.Blob=t.extend({},i)}),n("moxie/runtime/silverlight/file/FileInput",["moxie/runtime/silverlight/Runtime","moxie/file/File","moxie/core/utils/Basic"],function(e,t,i){function n(e){for(var t="",i=0;i<e.length;i++)t+=(""!==t?"|":"")+e[i].title+" | *."+e[i].extensions.replace(/,/g,";*.");return t}var r={init:function(e){var r=this,o=this.getRuntime();this.bind("Change",function(){var e=o.shimExec.call(r,"FileInput","getFiles");r.files=[],i.each(e,function(e){r.files.push(new t(o.uid,e))})},999),o.shimExec.call(this,"FileInput","init",n(e.accept),e.multiple),this.trigger("ready")},setOption:function(e,t){"accept"==e&&(t=n(t)),this.getRuntime().shimExec.call(this,"FileInput","setOption",e,t)}};return e.FileInput=r}),n("moxie/runtime/silverlight/file/FileDrop",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Dom","moxie/core/utils/Events"],function(e,t,i){var n={init:function(){var e,n=this,r=n.getRuntime();return e=r.getShimContainer(),i.addEvent(e,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},n.uid),i.addEvent(e,"dragenter",function(e){e.preventDefault();var i=t.get(r.uid).dragEnter(e);i&&e.stopPropagation()},n.uid),i.addEvent(e,"drop",function(e){e.preventDefault();var i=t.get(r.uid).dragDrop(e);i&&e.stopPropagation()},n.uid),r.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=n}),n("moxie/runtime/silverlight/file/FileReader",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReader"],function(e,t,i){return e.FileReader=t.extend({},i)}),n("moxie/runtime/silverlight/file/FileReaderSync",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReaderSync"],function(e,t,i){return e.FileReaderSync=t.extend({},i)
  5364. }),n("moxie/runtime/silverlight/runtime/Transporter",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/runtime/Transporter"],function(e,t,i){return e.Transporter=t.extend({},i)}),n("moxie/runtime/silverlight/xhr/XMLHttpRequest",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/xhr/XMLHttpRequest","moxie/runtime/silverlight/file/FileReaderSync","moxie/runtime/silverlight/runtime/Transporter"],function(e,t,i){return e.XMLHttpRequest=t.extend({},i)}),n("moxie/runtime/silverlight/image/Image",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/runtime/flash/image/Image"],function(e,t,i,n){return e.Image=t.extend({},n,{getInfo:function(){var e=this.getRuntime(),n=["tiff","exif","gps","thumb"],r={meta:{}},o=e.shimExec.call(this,"Image","getInfo");return o.meta&&(t.each(n,function(e){var t,i,n,a,s=o.meta[e];if(s&&s.keys)for(r.meta[e]={},i=0,n=s.keys.length;n>i;i++)t=s.keys[i],a=s[t],a&&(/^(\d|[1-9]\d+)$/.test(a)?a=parseInt(a,10):/^\d*\.\d+$/.test(a)&&(a=parseFloat(a)),r.meta[e][t]=a)}),!r.meta||!r.meta.thumb||r.meta.thumb.data instanceof i||(r.meta.thumb.data=new i(e.uid,r.meta.thumb.data))),r.width=parseInt(o.width,10),r.height=parseInt(o.height,10),r.size=parseInt(o.size,10),r.type=o.type,r.name=o.name,r},resize:function(e,t,i){this.getRuntime().shimExec.call(this,"Image","resize",e.x,e.y,e.width,e.height,t,i.preserveHeaders,i.resample)}})}),n("moxie/runtime/html4/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue;i.call(this,t,a,{access_binary:u(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:!1,drag_and_drop:!1,filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),resize_image:function(){return s.Image&&o.can("access_binary")&&n.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return n.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return o.can("select_file")},summon_file_dialog:function(){return o.can("select_file")&&("Firefox"===n.browser&&n.verComp(n.version,4,">=")||"Opera"===n.browser&&n.verComp(n.version,12,">=")||"IE"===n.browser&&n.verComp(n.version,10,">=")||!!~e.inArray(n.browser,["Chrome","Safari"]))},upload_filesize:c,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html4",s={};return i.addConstructor(a,o),s}),n("moxie/runtime/html4/file/FileInput",["moxie/runtime/html4/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,a){function s(){function e(){var o,c,d,m,h,f,p=this,g=p.getRuntime();f=i.guid("uid_"),o=g.getShimContainer(),s&&(d=n.get(s+"_form"),d&&i.extend(d.style,{top:"100%"})),m=document.createElement("form"),m.setAttribute("id",f+"_form"),m.setAttribute("method","post"),m.setAttribute("enctype","multipart/form-data"),m.setAttribute("encoding","multipart/form-data"),i.extend(m.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),h=document.createElement("input"),h.setAttribute("id",f),h.setAttribute("type","file"),h.setAttribute("accept",l.join(",")),i.extend(h.style,{fontSize:"999px",opacity:0}),m.appendChild(h),o.appendChild(m),i.extend(h.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===a.browser&&a.verComp(a.version,10,"<")&&i.extend(h.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),h.onchange=function(){var i;if(this.value){if(this.files){if(i=this.files[0],0===i.size)return m.parentNode.removeChild(m),void 0}else i={name:this.value};i=new t(g.uid,i),this.onchange=function(){},e.call(p),p.files=[i],h.setAttribute("id",i.uid),m.setAttribute("id",i.uid+"_form"),p.trigger("change"),h=m=null}},g.can("summon_file_dialog")&&(c=n.get(u.browse_button),r.removeEvent(c,"click",p.uid),r.addEvent(c,"click",function(e){h&&!h.disabled&&h.click(),e.preventDefault()},p.uid)),s=f,o=d=c=null}var s,u,c,l=[];i.extend(this,{init:function(t){var i,a=this,s=a.getRuntime();u=t,l=t.accept.mimes||o.extList2mimes(t.accept,s.can("filter_by_extension")),i=s.getShimContainer(),function(){var e,o,l;e=n.get(t.browse_button),c=n.getStyle(e,"z-index")||"auto",s.can("summon_file_dialog")&&("static"===n.getStyle(e,"position")&&(e.style.position="relative"),a.bind("Refresh",function(){o=parseInt(c,10)||1,n.get(u.browse_button).style.zIndex=o,this.getRuntime().getShimContainer().style.zIndex=o-1})),l=s.can("summon_file_dialog")?e:i,r.addEvent(l,"mouseover",function(){a.trigger("mouseenter")},a.uid),r.addEvent(l,"mouseout",function(){a.trigger("mouseleave")},a.uid),r.addEvent(l,"mousedown",function(){a.trigger("mousedown")},a.uid),r.addEvent(n.get(t.container),"mouseup",function(){a.trigger("mouseup")},a.uid),e=null}(),e.call(this),i=null,a.trigger({type:"ready",async:!0})},setOption:function(e,t){var i,r=this.getRuntime();"accept"==e&&(l=t.mimes||o.extList2mimes(t,r.can("filter_by_extension"))),i=n.get(s),i&&i.setAttribute("accept",l.join(","))},disable:function(e){var t;(t=n.get(s))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),i=e.getShimContainer(),o=u&&n.get(u.container),a=u&&n.get(u.browse_button);o&&r.removeAllEvents(o,this.uid),a&&(r.removeAllEvents(a,this.uid),a.style.zIndex=c),i&&(r.removeAllEvents(i,this.uid),i.innerHTML=""),t.removeInstance(this.uid),s=l=u=i=o=a=t=null}})}return e.FileInput=s}),n("moxie/runtime/html4/file/FileReader",["moxie/runtime/html4/Runtime","moxie/runtime/html5/file/FileReader"],function(e,t){return e.FileReader=t}),n("moxie/runtime/html4/xhr/XMLHttpRequest",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/utils/Events","moxie/file/Blob","moxie/xhr/FormData"],function(e,t,i,n,r,o,a,s){function u(){function e(e){var t,n,r,a,s=this,u=!1;if(l){if(t=l.id.replace(/_iframe$/,""),n=i.get(t+"_form")){for(r=n.getElementsByTagName("input"),a=r.length;a--;)switch(r[a].getAttribute("type")){case"hidden":r[a].parentNode.removeChild(r[a]);break;case"file":u=!0}r=[],u||n.parentNode.removeChild(n),n=null}setTimeout(function(){o.removeEvent(l,"load",s.uid),l.parentNode&&l.parentNode.removeChild(l);var t=s.getRuntime().getShimContainer();t.children.length||t.parentNode.removeChild(t),t=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,m){function h(){var i=y.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='<iframe id="'+f+'_iframe" name="'+f+'_iframe" src="javascript:&quot;&quot;" style="display:none"></iframe>',l=r.firstChild,i.appendChild(l),o.addEvent(l,"load",function(){var i;try{i=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(i.title)?u=i.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(i.body.innerHTML),v.trigger({type:"progress",loaded:c.length,total:c.length}),x&&v.trigger({type:"uploadprogress",loaded:x.size||1025,total:x.size||1025}))}catch(r){if(!n.hasSameOrigin(d.url))return e.call(v,function(){v.trigger("error")}),void 0;u=404}e.call(v,function(){v.trigger("load")})},v.uid)}var f,p,g,x,v=this,y=v.getRuntime();if(u=c=null,m instanceof s&&m.hasBlob()){if(x=m.getBlob(),f=x.uid,g=i.get(f),p=i.get(f+"_form"),!p)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else f=t.guid("uid_"),p=document.createElement("form"),p.setAttribute("id",f+"_form"),p.setAttribute("method",d.method),p.setAttribute("enctype","multipart/form-data"),p.setAttribute("encoding","multipart/form-data"),y.getShimContainer().appendChild(p);p.setAttribute("target",f+"_iframe"),m instanceof s&&m.each(function(e,i){if(e instanceof a)g&&g.setAttribute("name",i);else{var n=document.createElement("input");t.extend(n,{type:"hidden",name:i,value:e}),g?p.insertBefore(n,g):p.appendChild(n)}}),p.setAttribute("action",d.url),h(),p.submit(),v.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(i){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),n("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(e,t){return e.Image=t}),a(["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Dom","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/core/I18n","moxie/core/utils/Mime","moxie/file/FileInput","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/image/Image","moxie/core/utils/Events","moxie/runtime/html5/image/ResizerCanvas"])}(this)});
  5365. define("../libs/plupload/js/moxie.min", function(){});
  5366. /**
  5367. * Plupload - multi-runtime File Uploader
  5368. * v2.2.1
  5369. *
  5370. * Copyright 2013, Moxiecode Systems AB
  5371. * Released under GPL License.
  5372. *
  5373. * License: http://www.plupload.com/license
  5374. * Contributing: http://www.plupload.com/contributing
  5375. *
  5376. * Date: 2016-11-23
  5377. */
  5378. !function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.plupload};"function"==typeof define&&define.amd?define("plupload",["./moxie"],i):"object"==typeof module&&module.exports?module.exports=i(require("./moxie")):e.plupload=i(e.moxie)}(this||window,function(e){!function(e,t,i){function n(e){function t(e,t,i){var r={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};r[e]?n[r[e]]=t:i||(n[e]=t)}var i=e.required_features,n={};return"string"==typeof i?l.each(i.split(/\s*,\s*/),function(e){t(e,!0)}):"object"==typeof i?l.each(i,function(e,i){t(i,e)}):i===!0&&(e.chunk_size>0&&(n.slice_blob=!0),l.isEmptyObj(e.resize)&&e.multipart||(n.send_binary_string=!0),l.each(e,function(e,i){t(i,!!e,!0)})),n}var r=window.setTimeout,s={},a=t.core.utils,o=t.runtime.Runtime,l={VERSION:"2.2.1",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:a.Mime.mimes,ua:a.Env,typeOf:a.Basic.typeOf,extend:a.Basic.extend,guid:a.Basic.guid,getAll:function(e){var t,i=[];"array"!==l.typeOf(e)&&(e=[e]);for(var n=e.length;n--;)t=l.get(e[n]),t&&i.push(t);return i.length?i:null},get:a.Dom.get,each:a.Basic.each,getPos:a.Dom.getPos,getSize:a.Dom.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},i=/[<>&\"\']/g;return e?(""+e).replace(i,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:a.Basic.toArray,inArray:a.Basic.inArray,inSeries:a.Basic.inSeries,addI18n:t.core.I18n.addI18n,translate:t.core.I18n.translate,sprintf:a.Basic.sprintf,isEmptyObj:a.Basic.isEmptyObj,hasClass:a.Dom.hasClass,addClass:a.Dom.addClass,removeClass:a.Dom.removeClass,getStyle:a.Dom.getStyle,addEvent:a.Events.addEvent,removeEvent:a.Events.removeEvent,removeAllEvents:a.Events.removeAllEvents,cleanName:function(e){var t,i;for(i=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],t=0;t<i.length;t+=2)e=e.replace(i[t],i[t+1]);return e=e.replace(/\s+/g,"_"),e=e.replace(/[^a-z0-9_\-\.]+/gi,"")},buildUrl:function(e,t){var i="";return l.each(t,function(e,t){i+=(i?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),i&&(e+=(e.indexOf("?")>0?"&":"?")+i),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===i||/\D/.test(e))return l.translate("N/A");var n=Math.pow(1024,4);return e>n?t(e/n,1)+" "+l.translate("tb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("gb"):e>(n/=1024)?t(e/n,1)+" "+l.translate("mb"):e>1024?Math.round(e/1024)+" "+l.translate("kb"):e+" "+l.translate("b")},parseSize:a.Basic.parseSizeStr,predictRuntime:function(e,t){var i,n;return i=new l.Uploader(e),n=o.thatCan(i.getOption().required_features,t||e.runtimes),i.destroy(),n},addFileFilter:function(e,t){s[e]=t}};l.addFileFilter("mime_types",function(e,t,i){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:l.FILE_EXTENSION_ERROR,message:l.translate("File extension error."),file:t}),i(!1)):i(!0)}),l.addFileFilter("max_file_size",function(e,t,i){var n;e=l.parseSize(e),t.size!==n&&e&&t.size>e?(this.trigger("Error",{code:l.FILE_SIZE_ERROR,message:l.translate("File size error."),file:t}),i(!1)):i(!0)}),l.addFileFilter("prevent_duplicates",function(e,t,i){if(e)for(var n=this.files.length;n--;)if(t.name===this.files[n].name&&t.size===this.files[n].size)return this.trigger("Error",{code:l.FILE_DUPLICATE_ERROR,message:l.translate("Duplicate file error."),file:t}),i(!1),void 0;i(!0)}),l.Uploader=function(e){function a(){var e,t,i=0;if(this.state==l.STARTED){for(t=0;t<T.length;t++)e||T[t].status!=l.QUEUED?i++:(e=T[t],this.trigger("BeforeUpload",e)&&(e.status=l.UPLOADING,this.trigger("UploadFile",e)));i==T.length&&(this.state!==l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",T))}}function u(e){e.percent=e.size>0?Math.ceil(100*(e.loaded/e.size)):100,d()}function d(){var e,t;for(w.reset(),e=0;e<T.length;e++)t=T[e],t.size!==i?(w.size+=t.origSize,w.loaded+=t.loaded*t.origSize/t.size):w.size=i,t.status==l.DONE?w.uploaded++:t.status==l.FAILED?w.failed++:w.queued++;w.size===i?w.percent=T.length>0?Math.ceil(100*(w.uploaded/T.length)):0:(w.bytesPerSec=Math.ceil(w.loaded/((+new Date-S||1)/1e3)),w.percent=w.size>0?Math.ceil(100*(w.loaded/w.size)):0)}function c(){var e=A[0]||P[0];return e?e.getRuntime().uid:!1}function f(e,t){if(e.ruid){var i=o.getInfo(e.ruid);if(i)return i.can(t)}return!1}function p(){this.bind("FilesAdded FilesRemoved",function(e){e.trigger("QueueChanged"),e.refresh()}),this.bind("CancelUpload",y),this.bind("BeforeUpload",m),this.bind("UploadFile",E),this.bind("UploadProgress",v),this.bind("StateChanged",b),this.bind("QueueChanged",d),this.bind("Error",z),this.bind("FileUploaded",R),this.bind("Destroy",O)}function g(e,i){var n=this,r=0,s=[],a={runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:F,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};l.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(a[t]=e[t])}),e.browse_button&&l.each(e.browse_button,function(i){s.push(function(s){var u=new t.file.FileInput(l.extend({},a,{accept:e.filters.mime_types,name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:i}));u.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),r++,A.push(this),s()},u.onchange=function(){n.addFile(this.files)},u.bind("mouseenter mouseleave mousedown mouseup",function(t){U||(e.browse_button_hover&&("mouseenter"===t.type?l.addClass(i,e.browse_button_hover):"mouseleave"===t.type&&l.removeClass(i,e.browse_button_hover)),e.browse_button_active&&("mousedown"===t.type?l.addClass(i,e.browse_button_active):"mouseup"===t.type&&l.removeClass(i,e.browse_button_active)))}),u.bind("mousedown",function(){n.trigger("Browse")}),u.bind("error runtimeerror",function(){u=null,s()}),u.init()})}),e.drop_element&&l.each(e.drop_element,function(e){s.push(function(i){var s=new t.file.FileDrop(l.extend({},a,{drop_zone:e}));s.onready=function(){var e=o.getInfo(this.ruid);l.extend(n.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),dragdrop:e.can("drag_and_drop")}),r++,P.push(this),i()},s.ondrop=function(){n.addFile(this.files)},s.bind("error runtimeerror",function(){s=null,i()}),s.init()})}),l.inSeries(s,function(){"function"==typeof i&&i(r)})}function h(e,n,r){var s=new t.image.Image;try{s.onload=function(){return n.width>this.width&&n.height>this.height&&n.quality===i&&n.preserve_headers&&!n.crop?(this.destroy(),r(e)):(s.downsize(n.width,n.height,n.crop,n.preserve_headers),void 0)},s.onresize=function(){r(this.getAsBlob(e.type,n.quality)),this.destroy()},s.onerror=function(){r(e)},s.load(e)}catch(a){r(e)}}function _(e,i,r){function s(e,i,n){var r=I[e];switch(e){case"max_file_size":"max_file_size"===e&&(I.max_file_size=I.filters.max_file_size=i);break;case"chunk_size":(i=l.parseSize(i))&&(I[e]=i,I.send_file_name=!0);break;case"multipart":I[e]=i,i||(I.send_file_name=!0);break;case"unique_names":I[e]=i,i&&(I.send_file_name=!0);break;case"filters":"array"===l.typeOf(i)&&(i={mime_types:i}),n?l.extend(I.filters,i):I.filters=i,i.mime_types&&("string"===l.typeOf(i.mime_types)&&(i.mime_types=t.core.utils.Mime.mimes2extList(i.mime_types)),i.mime_types.regexp=function(e){var t=[];return l.each(e,function(e){l.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(i.mime_types),I.filters.mime_types=i.mime_types);break;case"resize":I.resize=i?l.extend({preserve_headers:!0,crop:!1},i):!1;break;case"prevent_duplicates":I.prevent_duplicates=I.filters.prevent_duplicates=!!i;break;case"container":case"browse_button":case"drop_element":i="container"===e?l.get(i):l.getAll(i);case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":I[e]=i,n||(u=!0);break;default:I[e]=i}n||a.trigger("OptionChanged",e,i,r)}var a=this,u=!1;"object"==typeof e?l.each(e,function(e,t){s(t,e,r)}):s(e,i,r),r?(I.required_features=n(l.extend({},I)),F=n(l.extend({},I,{required_features:!0}))):u&&(a.trigger("Destroy"),g.call(a,I,function(e){e?(a.runtime=o.getInfo(c()).type,a.trigger("Init",{runtime:a.runtime}),a.trigger("PostInit")):a.trigger("Error",{code:l.INIT_ERROR,message:l.translate("Init error.")})}))}function m(e,t){if(e.settings.unique_names){var i=t.name.match(/\.([^.]+)$/),n="part";i&&(n=i[1]),t.target_name=t.id+"."+n}}function E(e,i){function n(){d-->0?r(s,1e3):(i.loaded=p,e.trigger("Error",{code:l.HTTP_ERROR,message:l.translate("HTTP Error."),file:i,response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()}))}function s(){var f,g,h,_={};i.status===l.UPLOADING&&e.state!==l.STOPPED&&(e.settings.send_file_name&&(_.name=i.target_name||i.name),u&&c.chunks&&a.size>u?(h=Math.min(u,a.size-p),f=a.slice(p,p+h)):(h=a.size,f=a),u&&c.chunks&&(e.settings.send_chunk_number?(_.chunk=Math.ceil(p/u),_.chunks=Math.ceil(a.size/u)):(_.offset=p,_.total=a.size)),D=new t.xhr.XMLHttpRequest,D.upload&&(D.upload.onprogress=function(t){i.loaded=Math.min(i.size,p+t.loaded),e.trigger("UploadProgress",i)}),D.onload=function(){return D.status>=400?(n(),void 0):(d=e.settings.max_retries,h<a.size?(f.destroy(),p+=h,i.loaded=Math.min(p,a.size),e.trigger("ChunkUploaded",i,{offset:i.loaded,total:a.size,response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()}),"Android Browser"===l.ua.browser&&e.trigger("UploadProgress",i)):i.loaded=i.size,f=g=null,!p||p>=a.size?(i.size!=i.origSize&&(a.destroy(),a=null),e.trigger("UploadProgress",i),i.status=l.DONE,e.trigger("FileUploaded",i,{response:D.responseText,status:D.status,responseHeaders:D.getAllResponseHeaders()})):r(s,1),void 0)},D.onerror=function(){n()},D.onloadend=function(){this.destroy(),D=null},e.settings.multipart&&c.multipart?(D.open("post",o,!0),l.each(e.settings.headers,function(e,t){D.setRequestHeader(t,e)}),g=new t.xhr.FormData,l.each(l.extend(_,e.settings.multipart_params),function(e,t){g.append(t,e)}),g.append(e.settings.file_data_name,f),D.send(g,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:F,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(o=l.buildUrl(e.settings.url,l.extend(_,e.settings.multipart_params)),D.open("post",o,!0),l.each(e.settings.headers,function(e,t){D.setRequestHeader(t,e)}),D.hasRequestHeader("Content-Type")||D.setRequestHeader("Content-Type","application/octet-stream"),D.send(f,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:F,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})))}var a,o=e.settings.url,u=e.settings.chunk_size,d=e.settings.max_retries,c=e.features,p=0;i.loaded&&(p=i.loaded=u?u*Math.floor(i.loaded/u):0),a=i.getSource(),!l.isEmptyObj(e.settings.resize)&&f(a,"send_binary_string")&&-1!==l.inArray(a.type,["image/jpeg","image/png"])?h.call(this,a,e.settings.resize,function(e){a=e,i.size=e.size,s()}):s()}function v(e,t){u(t)}function b(e){if(e.state==l.STARTED)S=+new Date;else if(e.state==l.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==l.UPLOADING&&(e.files[t].status=l.QUEUED,d())}function y(){D&&D.abort()}function R(e){d(),r(function(){a.call(e)},1)}function z(e,t){t.code===l.INIT_ERROR?e.destroy():t.code===l.HTTP_ERROR&&(t.file.status=l.FAILED,u(t.file),e.state==l.STARTED&&(e.trigger("CancelUpload"),r(function(){a.call(e)},1)))}function O(e){e.stop(),l.each(T,function(e){e.destroy()}),T=[],A.length&&(l.each(A,function(e){e.destroy()}),A=[]),P.length&&(l.each(P,function(e){e.destroy()}),P=[]),F={},U=!1,S=D=null,w.reset()}var I,S,w,D,x=l.guid(),T=[],F={},A=[],P=[],U=!1;I={runtimes:o.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:!1,send_file_name:!0,send_chunk_number:!0},_.call(this,e,null,!0),w=new l.QueueProgress,l.extend(this,{id:x,uid:x,state:l.STOPPED,features:{},runtime:null,files:T,settings:I,total:w,init:function(){var e,t,i=this;return e=i.getOption("preinit"),"function"==typeof e?e(i):l.each(e,function(e,t){i.bind(t,e)}),p.call(i),l.each(["container","browse_button","drop_element"],function(e){return null===i.getOption(e)?(t={code:l.INIT_ERROR,message:l.sprintf(l.translate("%s specified, but cannot be found."),e)},!1):void 0}),t?i.trigger("Error",t):I.browse_button||I.drop_element?(g.call(i,I,function(e){var t=i.getOption("init");"function"==typeof t?t(i):l.each(t,function(e,t){i.bind(t,e)}),e?(i.runtime=o.getInfo(c()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:l.INIT_ERROR,message:l.translate("Init error.")})}),void 0):i.trigger("Error",{code:l.INIT_ERROR,message:l.translate("You must specify either browse_button or drop_element.")})},setOption:function(e,t){_.call(this,e,t,!this.runtime)},getOption:function(e){return e?I[e]:I},refresh:function(){A.length&&l.each(A,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=l.STARTED&&(this.state=l.STARTED,this.trigger("StateChanged"),a.call(this))},stop:function(){this.state!=l.STOPPED&&(this.state=l.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){U=arguments[0]!==i?arguments[0]:!0,A.length&&l.each(A,function(e){e.disable(U)}),this.trigger("DisableBrowse",U)},getFile:function(e){var t;for(t=T.length-1;t>=0;t--)if(T[t].id===e)return T[t]},addFile:function(e,i){function n(e,t){var i=[];l.each(u.settings.filters,function(t,n){s[n]&&i.push(function(i){s[n].call(u,t,e,function(e){i(!e)})})}),l.inSeries(i,t)}function a(e){var s=l.typeOf(e);if(e instanceof t.file.File){if(!e.ruid&&!e.isDetached()){if(!o)return!1;e.ruid=o,e.connectRuntime(o)}a(new l.File(e))}else e instanceof t.file.Blob?(a(e.getSource()),e.destroy()):e instanceof l.File?(i&&(e.name=i),d.push(function(t){n(e,function(i){i||(T.push(e),f.push(e),u.trigger("FileFiltered",e)),r(t,1)})})):-1!==l.inArray(s,["file","blob"])?a(new t.file.File(null,e)):"node"===s&&"filelist"===l.typeOf(e.files)?l.each(e.files,a):"array"===s&&(i=null,l.each(e,a))}var o,u=this,d=[],f=[];o=c(),a(e),d.length&&l.inSeries(d,function(){f.length&&u.trigger("FilesAdded",f)})},removeFile:function(e){for(var t="string"==typeof e?e:e.id,i=T.length-1;i>=0;i--)if(T[i].id===t)return this.splice(i,1)[0]},splice:function(e,t){var n=T.splice(e===i?0:e,t===i?T.length:t),r=!1;return this.state==l.STARTED&&(l.each(n,function(e){return e.status===l.UPLOADING?(r=!0,!1):void 0}),r&&this.stop()),this.trigger("FilesRemoved",n),l.each(n,function(e){e.destroy()}),r&&this.start(),n},dispatchEvent:function(e){var t,i;if(e=e.toLowerCase(),t=this.hasEventListener(e)){t.sort(function(e,t){return t.priority-e.priority}),i=[].slice.call(arguments),i.shift(),i.unshift(this);for(var n=0;n<t.length;n++)if(t[n].fn.apply(t[n].scope,i)===!1)return!1}return!0},bind:function(e,t,i,n){l.Uploader.prototype.bind.call(this,e,t,n,i)},destroy:function(){this.trigger("Destroy"),I=w=null,this.unbindAll()}})},l.Uploader.prototype=t.core.EventTarget.instance,l.File=function(){function e(e){l.extend(this,{id:l.guid(),name:e.name||e.fileName,type:e.type||"",size:e.size||e.fileSize,origSize:e.size||e.fileSize,loaded:0,percent:0,status:l.QUEUED,lastModifiedDate:e.lastModifiedDate||(new Date).toLocaleString(),getNative:function(){var e=this.getSource().getSource();return-1!==l.inArray(l.typeOf(e),["blob","file"])?e:null},getSource:function(){return t[this.id]?t[this.id]:null},destroy:function(){var e=this.getSource();e&&(e.destroy(),delete t[this.id])}}),t[this.id]=e}var t={};return e}(),l.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=l}(this,e)});
  5379. define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, undefined, Plupload, Template) {
  5380. var Upload = {
  5381. list: {},
  5382. config: {
  5383. container: document.body,
  5384. classname: '.plupload:not([initialized])',
  5385. previewtpl: '<li class="col-xs-3"><a href="<%=fullurl%>" data-url="<%=url%>" target="_blank" class="thumbnail"><img src="<%=fullurl%>" onerror="this.src=\'' + Fast.api.fixurl("ajax/icon") + '?suffix=<%=suffix%>\';this.onerror=null;" class="img-responsive"></a><a href="javascript:;" class="btn btn-danger btn-xs btn-trash"><i class="fa fa-trash"></i></a></li>',
  5386. },
  5387. events: {
  5388. onInit: function (up) {
  5389. //修复少数安卓浏览器无法上传图片的Bug
  5390. var input = $("input[type=file]", up.settings.container);
  5391. if (input && input.prop("accept") && input.prop("accept").match(/image\//)) {
  5392. input.prop("accept", "image/jpg," + input.prop("accept"));
  5393. }
  5394. },
  5395. //初始化完成
  5396. onPostInit: function (up) {
  5397. },
  5398. //文件添加成功后
  5399. onFileAdded: function (up, files) {
  5400. var button = up.settings.button;
  5401. $(button).data("bakup-html", $(button).html());
  5402. var maxcount = $(button).data("maxcount");
  5403. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  5404. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  5405. if (maxcount > 0 && input_id) {
  5406. var inputObj = $("#" + input_id);
  5407. if (inputObj.size() > 0) {
  5408. var value = $.trim(inputObj.val());
  5409. var nums = value === '' ? 0 : value.split(/\,/).length;
  5410. var remains = maxcount - nums;
  5411. if (files.length > remains) {
  5412. for (var i = 0; i < files.length; i++) {
  5413. up.removeFile(files[i]);
  5414. }
  5415. Toastr.error(__('You can upload up to %d file%s', remains));
  5416. return false;
  5417. }
  5418. }
  5419. }
  5420. //添加后立即上传
  5421. setTimeout(function () {
  5422. up.start();
  5423. }, 1);
  5424. },
  5425. //上传进行中的回调
  5426. onUploadProgress: function (up, file) {
  5427. },
  5428. //上传之前的回调
  5429. onBeforeUpload: function (up, file) {
  5430. },
  5431. //上传成功的回调
  5432. onUploadSuccess: function (up, ret) {
  5433. var button = up.settings.button;
  5434. var onUploadSuccess = up.settings.onUploadSuccess;
  5435. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  5436. //上传成功后回调
  5437. if (button) {
  5438. //如果有文本框则填充
  5439. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  5440. if (input_id) {
  5441. var urlArr = [];
  5442. var inputObj = $("#" + input_id);
  5443. if ($(button).data("multiple") && inputObj.val() !== "") {
  5444. urlArr.push(inputObj.val());
  5445. }
  5446. urlArr.push(data.url);
  5447. inputObj.val(urlArr.join(",")).trigger("change").trigger("validate");
  5448. }
  5449. //如果有回调函数
  5450. var onDomUploadSuccess = $(button).data("upload-success");
  5451. if (onDomUploadSuccess) {
  5452. if (typeof onDomUploadSuccess !== 'function' && typeof Upload.api.custom[onDomUploadSuccess] === 'function') {
  5453. onDomUploadSuccess = Upload.api.custom[onDomUploadSuccess];
  5454. }
  5455. if (typeof onDomUploadSuccess === 'function') {
  5456. var result = onDomUploadSuccess.call(button, data, ret);
  5457. if (result === false)
  5458. return;
  5459. }
  5460. }
  5461. }
  5462. if (typeof onUploadSuccess === 'function') {
  5463. var result = onUploadSuccess.call(button, data, ret);
  5464. if (result === false)
  5465. return;
  5466. }
  5467. },
  5468. //上传错误的回调
  5469. onUploadError: function (up, ret) {
  5470. var button = up.settings.button;
  5471. var onUploadError = up.settings.onUploadError;
  5472. var data = typeof ret.data !== 'undefined' ? ret.data : null;
  5473. if (button) {
  5474. var onDomUploadError = $(button).data("upload-error");
  5475. if (onDomUploadError) {
  5476. if (typeof onDomUploadError !== 'function' && typeof Upload.api.custom[onDomUploadError] === 'function') {
  5477. onDomUploadError = Upload.api.custom[onDomUploadError];
  5478. }
  5479. if (typeof onDomUploadError === 'function') {
  5480. var result = onDomUploadError.call(button, data, ret);
  5481. if (result === false)
  5482. return;
  5483. }
  5484. }
  5485. }
  5486. if (typeof onUploadError === 'function') {
  5487. var result = onUploadError.call(button, data, ret);
  5488. if (result === false) {
  5489. return;
  5490. }
  5491. }
  5492. Toastr.error(ret.msg + "(code:" + ret.code + ")");
  5493. },
  5494. //服务器响应数据后
  5495. onUploadResponse: function (response) {
  5496. try {
  5497. var ret = typeof response === 'object' ? response : JSON.parse(response);
  5498. if (!ret.hasOwnProperty('code')) {
  5499. $.extend(ret, {code: -2, msg: response, data: null});
  5500. }
  5501. } catch (e) {
  5502. var ret = {code: -1, msg: e.message, data: null};
  5503. }
  5504. return ret;
  5505. },
  5506. //上传全部结束后
  5507. onUploadComplete: function (up, files) {
  5508. var button = up.settings.button;
  5509. var onUploadComplete = up.settings.onUploadComplete;
  5510. if (button) {
  5511. var onDomUploadComplete = $(button).data("upload-complete");
  5512. if (onDomUploadComplete) {
  5513. if (typeof onDomUploadComplete !== 'function' && typeof Upload.api.custom[onDomUploadComplete] === 'function') {
  5514. onDomUploadComplete = Upload.api.custom[onDomUploadComplete];
  5515. }
  5516. if (typeof onDomUploadComplete === 'function') {
  5517. var result = onDomUploadComplete.call(button, files);
  5518. if (result === false)
  5519. return;
  5520. }
  5521. }
  5522. }
  5523. if (typeof onUploadComplete === 'function') {
  5524. var result = onUploadComplete.call(button, files);
  5525. if (result === false) {
  5526. return;
  5527. }
  5528. }
  5529. }
  5530. },
  5531. api: {
  5532. //Plupload上传
  5533. plupload: function (element, onUploadSuccess, onUploadError, onUploadComplete) {
  5534. element = typeof element === 'undefined' ? Upload.config.classname : element;
  5535. $(element, Upload.config.container).each(function () {
  5536. if ($(this).attr("initialized")) {
  5537. return true;
  5538. }
  5539. $(this).attr("initialized", true);
  5540. var that = this;
  5541. var id = $(this).prop("id");
  5542. var url = $(this).data("url");
  5543. var maxsize = $(this).data("maxsize");
  5544. var mimetype = $(this).data("mimetype");
  5545. var multipart = $(this).data("multipart");
  5546. var multiple = $(this).data("multiple");
  5547. //填充ID
  5548. var input_id = $(that).data("input-id") ? $(that).data("input-id") : "";
  5549. //预览ID
  5550. var preview_id = $(that).data("preview-id") ? $(that).data("preview-id") : "";
  5551. //上传URL
  5552. url = url ? url : Config.upload.uploadurl;
  5553. url = Fast.api.fixurl(url);
  5554. //最大可上传文件大小
  5555. maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
  5556. //文件类型
  5557. mimetype = typeof mimetype !== "undefined" ? mimetype : Config.upload.mimetype;
  5558. //请求的表单参数
  5559. multipart = typeof multipart !== "undefined" ? multipart : Config.upload.multipart;
  5560. //是否支持批量上传
  5561. multiple = typeof multiple !== "undefined" ? multiple : Config.upload.multiple;
  5562. var mimetypeArr = new Array();
  5563. //支持后缀和Mimetype格式,以,分隔
  5564. if (mimetype && mimetype !== "*" && mimetype.indexOf("/") === -1) {
  5565. var tempArr = mimetype.split(',');
  5566. for (var i = 0; i < tempArr.length; i++) {
  5567. mimetypeArr.push({title: __('Files'), extensions: tempArr[i]});
  5568. }
  5569. mimetype = mimetypeArr;
  5570. }
  5571. //生成Plupload实例
  5572. Upload.list[id] = new Plupload.Uploader({
  5573. runtimes: 'html5,flash,silverlight,html4',
  5574. multi_selection: multiple, //是否允许多选批量上传
  5575. browse_button: id, // 浏览按钮的ID
  5576. container: $(this).parent().get(0), //取按钮的上级元素
  5577. flash_swf_url: '/assets/libs/plupload/js/Moxie.swf',
  5578. silverlight_xap_url: '/assets/libs/plupload/js/Moxie.xap',
  5579. drop_element: [id, $(this).data("input-id")],
  5580. filters: {
  5581. max_file_size: maxsize,
  5582. mime_types: mimetype,
  5583. },
  5584. url: url,
  5585. multipart_params: $.isArray(multipart) ? {} : multipart,
  5586. init: {
  5587. Init: Upload.events.onInit,
  5588. PostInit: Upload.events.onPostInit,
  5589. FilesAdded: Upload.events.onFileAdded,
  5590. BeforeUpload: Upload.events.onBeforeUpload,
  5591. UploadProgress: function (up, file) {
  5592. var button = up.settings.button;
  5593. $(button).prop("disabled", true).html("<i class='fa fa-upload'></i> " + __('Upload') + file.percent + "%");
  5594. Upload.events.onUploadProgress(up, file);
  5595. },
  5596. FileUploaded: function (up, file, info) {
  5597. var button = up.settings.button;
  5598. //还原按钮文字及状态
  5599. $(button).prop("disabled", false).html($(button).data("bakup-html"));
  5600. var ret = Upload.events.onUploadResponse(info.response, info, up, file);
  5601. file.ret = ret;
  5602. if (ret.code === 1) {
  5603. Upload.events.onUploadSuccess(up, ret, file);
  5604. } else {
  5605. Upload.events.onUploadError(up, ret, file);
  5606. }
  5607. },
  5608. UploadComplete: Upload.events.onUploadComplete,
  5609. Error: function (up, err) {
  5610. var button = up.settings.button;
  5611. $(button).prop("disabled", false).html($(button).data("bakup-html"));
  5612. var ret = {code: err.code, msg: err.message, data: null};
  5613. Upload.events.onUploadError(up, ret);
  5614. }
  5615. },
  5616. onUploadSuccess: onUploadSuccess,
  5617. onUploadError: onUploadError,
  5618. onUploadComplete: onUploadComplete,
  5619. button: that
  5620. });
  5621. //拖动排序
  5622. if (preview_id && multiple) {
  5623. require(['dragsort'], function () {
  5624. $("#" + preview_id).dragsort({
  5625. dragSelector: "li a:not(.btn-trash)",
  5626. dragEnd: function () {
  5627. $("#" + preview_id).trigger("fa.preview.change");
  5628. },
  5629. placeHolderTemplate: '<li class="col-xs-3"></li>'
  5630. });
  5631. });
  5632. }
  5633. //刷新隐藏textarea的值
  5634. var refresh = function (name) {
  5635. var data = {};
  5636. var textarea = $("textarea[name='" + name + "']");
  5637. var container = textarea.prev("ul");
  5638. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  5639. var reg = /\[?(\w+)\]?\[(\w+)\]$/g;
  5640. var match = reg.exec(j.name);
  5641. if (!match)
  5642. return true;
  5643. if (!isNaN(match[2])) {
  5644. data[i] = j.value;
  5645. } else {
  5646. match[1] = "x" + parseInt(match[1]);
  5647. if (typeof data[match[1]] === 'undefined') {
  5648. data[match[1]] = {};
  5649. }
  5650. data[match[1]][match[2]] = j.value;
  5651. }
  5652. });
  5653. var result = [];
  5654. $.each(data, function (i, j) {
  5655. result.push(j);
  5656. });
  5657. textarea.val(JSON.stringify(result));
  5658. };
  5659. if (preview_id && input_id) {
  5660. $(document.body).on("keyup change", "#" + input_id, function (e) {
  5661. var inputStr = $("#" + input_id).val();
  5662. var inputArr = inputStr.split(/\,/);
  5663. $("#" + preview_id).empty();
  5664. var tpl = $("#" + preview_id).data("template") ? $("#" + preview_id).data("template") : "";
  5665. var extend = $("#" + preview_id).next().is("textarea") ? $("#" + preview_id).next("textarea").val() : "{}";
  5666. var json = {};
  5667. try {
  5668. json = JSON.parse(extend);
  5669. } catch (e) {
  5670. }
  5671. $.each(inputArr, function (i, j) {
  5672. if (!j) {
  5673. return true;
  5674. }
  5675. var suffix = /[\.]([a-zA-Z0-9]+)$/.exec(j);
  5676. suffix = suffix ? suffix[1] : 'file';
  5677. var data = {url: j, fullurl: Fast.api.cdnurl(j), data: $(that).data(), key: i, index: i, value: (json && typeof json[i] !== 'undefined' ? json[i] : null), suffix: suffix};
  5678. var html = tpl ? Template(tpl, data) : Template.render(Upload.config.previewtpl, data);
  5679. $("#" + preview_id).append(html);
  5680. });
  5681. });
  5682. $("#" + input_id).trigger("change");
  5683. }
  5684. if (preview_id) {
  5685. //监听文本框改变事件
  5686. $("#" + preview_id).on('change keyup', "input,textarea,select", function () {
  5687. refresh($(this).closest("ul").data("name"));
  5688. });
  5689. // 监听事件
  5690. $(document.body).on("fa.preview.change", "#" + preview_id, function () {
  5691. var urlArr = [];
  5692. $("#" + preview_id + " [data-url]").each(function (i, j) {
  5693. urlArr.push($(this).data("url"));
  5694. });
  5695. if (input_id) {
  5696. $("#" + input_id).val(urlArr.join(","));
  5697. }
  5698. refresh($("#" + preview_id).data("name"));
  5699. });
  5700. // 移除按钮事件
  5701. $(document.body).on("click", "#" + preview_id + " .btn-trash", function () {
  5702. $(this).closest("li").remove();
  5703. $("#" + preview_id).trigger("fa.preview.change");
  5704. });
  5705. }
  5706. if (input_id) {
  5707. //粘贴上传
  5708. $("body").on('paste', "#" + input_id, function (event) {
  5709. var that = this;
  5710. var image, pasteEvent;
  5711. pasteEvent = event.originalEvent;
  5712. if (pasteEvent.clipboardData && pasteEvent.clipboardData.items) {
  5713. image = Upload.api.getImageFromClipboard(pasteEvent);
  5714. if (image) {
  5715. event.preventDefault();
  5716. var button = $(".plupload[data-input-id='" + $(that).attr("id") + "']");
  5717. Upload.api.send(image, function (data) {
  5718. var urlArr = [];
  5719. if (button && button.data("multiple") && $(that).val() !== '') {
  5720. urlArr.push($(that).val());
  5721. }
  5722. urlArr.push(data.url);
  5723. $(that).val(urlArr.join(",")).trigger("change").trigger("validate");
  5724. });
  5725. }
  5726. }
  5727. });
  5728. //拖拽上传
  5729. $("body").on('drop', "#" + input_id, function (event) {
  5730. var that = this;
  5731. var images, pasteEvent;
  5732. pasteEvent = event.originalEvent;
  5733. if (pasteEvent.dataTransfer && pasteEvent.dataTransfer.files) {
  5734. images = Upload.api.getImageFromDrop(pasteEvent);
  5735. if (images.length > 0) {
  5736. event.preventDefault();
  5737. var button = $(".plupload[data-input-id='" + $(that).attr("id") + "']");
  5738. $.each(images, function (i, image) {
  5739. Upload.api.send(image, function (data) {
  5740. var urlArr = [];
  5741. if (button && button.data("multiple") && $(that).val() !== '') {
  5742. urlArr.push($(that).val());
  5743. }
  5744. urlArr.push(data.url);
  5745. $(that).val(urlArr.join(",")).trigger("change").trigger("validate");
  5746. });
  5747. });
  5748. }
  5749. }
  5750. });
  5751. }
  5752. Upload.list[id].init();
  5753. });
  5754. },
  5755. // AJAX异步上传
  5756. send: function (file, onUploadSuccess, onUploadError, onUploadComplete) {
  5757. var index = Layer.msg(__('Uploading'), {offset: 't', time: 0});
  5758. var id = Plupload.guid();
  5759. var _onPostInit = Upload.events.onPostInit;
  5760. Upload.events.onPostInit = function () {
  5761. // 当加载完成后添加文件并上传
  5762. Upload.list[id].addFile(file);
  5763. //Upload.list[id].start();
  5764. };
  5765. $('<button type="button" id="' + id + '" class="btn btn-danger hidden plupload" />').appendTo("body");
  5766. $("#" + id).data("upload-complete", function (files) {
  5767. Upload.events.onPostInit = _onPostInit;
  5768. Layer.close(index);
  5769. });
  5770. Upload.api.plupload("#" + id, onUploadSuccess, onUploadError, onUploadComplete);
  5771. },
  5772. custom: {
  5773. //自定义上传完成回调
  5774. afteruploadcallback: function (response) {
  5775. console.log(this, response);
  5776. alert("Custom Callback,Response URL:" + response.url);
  5777. },
  5778. },
  5779. getImageFromClipboard: function (data) {
  5780. var i, item;
  5781. i = 0;
  5782. while (i < data.clipboardData.items.length) {
  5783. item = data.clipboardData.items[i];
  5784. if (item.type.indexOf("image") !== -1) {
  5785. return item.getAsFile() || false;
  5786. }
  5787. i++;
  5788. }
  5789. return false;
  5790. },
  5791. getImageFromDrop: function (data) {
  5792. var i, item, images;
  5793. i = 0;
  5794. images = [];
  5795. while (i < data.dataTransfer.files.length) {
  5796. item = data.dataTransfer.files[i];
  5797. if (item.type.indexOf("image") !== -1) {
  5798. images.push(item);
  5799. }
  5800. i++;
  5801. }
  5802. return images;
  5803. }
  5804. }
  5805. }
  5806. ;
  5807. return Upload;
  5808. });
  5809. /*! nice-validator 1.1.4
  5810. * (c) 2012-2018 Jony Zhang <niceue@live.com>, MIT Licensed
  5811. * https://github.com/niceue/nice-validator
  5812. */
  5813. ;(function(factory) {
  5814. typeof module === 'object' && module.exports ? module.exports = factory( require( 'jquery' ) ) :
  5815. typeof define === 'function' && define.amd ? define('validator-core',['jquery'], factory) :
  5816. factory(jQuery);
  5817. }(function($, undefined) {
  5818. 'use strict';
  5819. var NS = 'validator',
  5820. CLS_NS = '.' + NS,
  5821. CLS_NS_RULE = '.rule',
  5822. CLS_NS_FIELD = '.field',
  5823. CLS_NS_FORM = '.form',
  5824. CLS_WRAPPER = 'nice-' + NS,
  5825. CLS_MSG_BOX = 'msg-box',
  5826. ARIA_INVALID = 'aria-invalid',
  5827. DATA_RULE = 'data-rule',
  5828. DATA_MSG = 'data-msg',
  5829. DATA_TIP = 'data-tip',
  5830. DATA_OK = 'data-ok',
  5831. DATA_TIMELY = 'data-timely',
  5832. DATA_TARGET = 'data-target',
  5833. DATA_DISPLAY = 'data-display',
  5834. DATA_MUST = 'data-must',
  5835. NOVALIDATE = 'novalidate',
  5836. INPUT_SELECTOR = ':verifiable',
  5837. rRules = /(&)?(!)?\b(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?\s*(;|\|)?/g,
  5838. rRule = /(\w+)(?:\[\s*(.*?\]?)\s*\]|\(\s*(.*?\)?)\s*\))?/,
  5839. rDisplay = /(?:([^:;\(\[]*):)?(.*)/,
  5840. rDoubleBytes = /[^\x00-\xff]/g,
  5841. rPos = /top|right|bottom|left/,
  5842. rAjaxType = /(?:(cors|jsonp):)?(?:(post|get):)?(.+)/i,
  5843. rUnsafe = /[<>'"`\\]|&#x?\d+[A-F]?;?|%3[A-F]/gmi,
  5844. noop = $.noop,
  5845. proxy = $.proxy,
  5846. trim = $.trim,
  5847. isFunction = $.isFunction,
  5848. isString = function(s) {
  5849. return typeof s === 'string';
  5850. },
  5851. isObject = function(o) {
  5852. return o && Object.prototype.toString.call(o) === '[object Object]';
  5853. },
  5854. isIE = document.documentMode || +(navigator.userAgent.match(/MSIE (\d+)/) && RegExp.$1),
  5855. attr = function(el, key, value) {
  5856. if (!el || !el.tagName) return null;
  5857. if (value !== undefined) {
  5858. if (value === null) el.removeAttribute(key);
  5859. else el.setAttribute(key, '' + value);
  5860. } else {
  5861. return el.getAttribute(key);
  5862. }
  5863. },
  5864. novalidateonce,
  5865. preinitialized = {},
  5866. defaults = {
  5867. debug: 0,
  5868. theme: 'default',
  5869. ignore: '',
  5870. focusInvalid: true,
  5871. focusCleanup: false,
  5872. stopOnError: false,
  5873. beforeSubmit: null,
  5874. valid: null,
  5875. invalid: null,
  5876. validation: null,
  5877. formClass: 'n-default',
  5878. validClass: 'n-valid',
  5879. invalidClass: 'n-invalid',
  5880. bindClassTo: null
  5881. },
  5882. fieldDefaults = {
  5883. timely: 1,
  5884. display: null,
  5885. target: null,
  5886. ignoreBlank: false,
  5887. showOk: true,
  5888. // Translate ajax response to validation result
  5889. dataFilter: function (data) {
  5890. if ( isString(data) || ( isObject(data) && ('error' in data || 'ok' in data) ) ) {
  5891. return data;
  5892. }
  5893. },
  5894. msgMaker: function(opt) {
  5895. var html;
  5896. html = '<span role="alert" class="msg-wrap n-'+ opt.type + '">' + opt.arrow;
  5897. if (opt.result) {
  5898. $.each(opt.result, function(i, obj){
  5899. html += '<span class="n-'+ obj.type +'">' + opt.icon + '<span class="n-msg">' + obj.msg + '</span></span>';
  5900. });
  5901. } else {
  5902. html += opt.icon + '<span class="n-msg">' + opt.msg + '</span>';
  5903. }
  5904. html += '</span>';
  5905. return html;
  5906. },
  5907. msgWrapper: 'span',
  5908. msgArrow: '',
  5909. msgIcon: '<span class="n-icon"></span>',
  5910. msgClass: 'n-right',
  5911. msgStyle: '',
  5912. msgShow: null,
  5913. msgHide: null
  5914. },
  5915. themes = {};
  5916. /** jQuery Plugin
  5917. * @param {Object} options
  5918. debug {Boolean} 0 Whether to enable debug mode
  5919. timely {Number} 1 Whether to enable timely validation
  5920. theme {String} 'default' Theme name
  5921. stopOnError {Boolean} false Whether to stop validate when found an error input
  5922. focusCleanup {Boolean} false Whether to clean up the field message when focus the field
  5923. focusInvalid {Boolean} true Whether to focus the field that is invalid
  5924. ignoreBlank {Boolean} false When the field has no value, whether to ignore validation
  5925. ignore {jqSelector} '' Ignored fields (Using jQuery selector)
  5926. beforeSubmit {Function} Do something before submit form
  5927. dataFilter {Function} Convert ajax results
  5928. valid {Function} Triggered when the form is valid
  5929. invalid {Function} Triggered when the form is invalid
  5930. validClass {String} 'n-valid' Add this class name to a valid field
  5931. invalidClass {String} 'n-invalid' Add this class name to a invalid field
  5932. bindClassTo {jqSelector} ':verifiable' Which element should the className binding to
  5933. display {Function} Callback function to get dynamic display
  5934. target {Function} Callback function to get dynamic target
  5935. msgShow {Function} Trigger this callback when show message
  5936. msgHide {Function} Trigger this callback when hide message
  5937. msgWrapper {String} 'span' Message wrapper tag name
  5938. msgMaker {Function} Callback function to make message HTML
  5939. msgArrow {String} Message arrow template
  5940. msgIcon {String} Message icon template
  5941. msgStyle {String} Custom message css style
  5942. msgClass {String} Additional added to the message class names
  5943. formClass {String} Additional added to the form class names
  5944. messages {Object} Custom messages for the current instance
  5945. rules {Object} Custom rules for the current instance
  5946. fields {Object} Field validation configuration
  5947. {String} key name|#id
  5948. {String|Object} value Rule string or an object which can pass more arguments
  5949. fields[key][rule] {String} Rule string
  5950. fields[key][display] {String|Function}
  5951. fields[key][tip] {String} Custom tip message
  5952. fields[key][ok] {String} Custom success message
  5953. fields[key][msg] {Object} Custom error message
  5954. fields[key][msgStyle] {String} Custom message style
  5955. fields[key][msgClass] {String} A className which added to message placeholder element
  5956. fields[key][msgWrapper] {String} Tag name of the message placeholder element
  5957. fields[key][msgMaker] {Function} A function to custom message HTML
  5958. fields[key][dataFilter] {Function} A function to convert ajax results
  5959. fields[key][valid] {Function} A function triggered when field is valid
  5960. fields[key][invalid] {Function} A function triggered when field is invalid
  5961. fields[key][must] {Boolean} If set true, we always check the field even has remote checking
  5962. fields[key][timely] {Boolean} Whether to enable timely validation
  5963. fields[key][target] {jqSelector} Define placement of a message
  5964. */
  5965. $.fn.validator = function(options) {
  5966. var that = this,
  5967. args = arguments;
  5968. if (that.is(INPUT_SELECTOR)) return that;
  5969. if (!that.is('form')) that = this.find('form');
  5970. if (!that.length) that = this;
  5971. that.each(function() {
  5972. var instance = $(this).data(NS);
  5973. if (instance) {
  5974. if ( isString(options) ) {
  5975. if ( options.charAt(0) === '_' ) return;
  5976. instance[options].apply(instance, [].slice.call(args, 1));
  5977. }
  5978. else if (options) {
  5979. instance._reset(true);
  5980. instance._init(this, options);
  5981. }
  5982. } else {
  5983. new Validator(this, options);
  5984. }
  5985. });
  5986. return this;
  5987. };
  5988. // Validate a field, or an area
  5989. $.fn.isValid = function(callback, hideMsg) {
  5990. var me = _getInstance(this[0]),
  5991. hasCallback = isFunction(callback),
  5992. ret, opt;
  5993. if (!me) return true;
  5994. if (!hasCallback && hideMsg === undefined) hideMsg = callback;
  5995. me.checkOnly = !!hideMsg;
  5996. opt = me.options;
  5997. ret = me._multiValidate(
  5998. this.is(INPUT_SELECTOR) ? this : this.find(INPUT_SELECTOR),
  5999. function(isValid){
  6000. if (!isValid && opt.focusInvalid && !me.checkOnly) {
  6001. // navigate to the error element
  6002. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  6003. }
  6004. if (hasCallback) {
  6005. if (callback.length) {
  6006. callback(isValid);
  6007. } else if (isValid) {
  6008. callback();
  6009. }
  6010. }
  6011. me.checkOnly = false;
  6012. }
  6013. );
  6014. // If you pass a callback, we maintain the jQuery object chain
  6015. return hasCallback ? this : ret;
  6016. };
  6017. $.extend($.expr.pseudos || $.expr[':'], {
  6018. // A faster selector than ":input:not(:submit,:button,:reset,:image,:disabled,[contenteditable])"
  6019. verifiable: function(elem) {
  6020. var name = elem.nodeName.toLowerCase();
  6021. return ( name === 'input' && !({submit: 1, button: 1, reset: 1, image: 1})[elem.type] ||
  6022. name === 'select' ||
  6023. name === 'textarea' ||
  6024. elem.contentEditable === 'true'
  6025. ) && !elem.disabled;
  6026. },
  6027. // any value, but not only whitespace
  6028. filled: function(elem) {
  6029. return !!trim($(elem).val());
  6030. }
  6031. });
  6032. /**
  6033. * Creates a new Validator
  6034. *
  6035. * @class
  6036. * @param {Element} element - form element
  6037. * @param {Object} options - options for validator
  6038. */
  6039. function Validator(element, options) {
  6040. var me = this;
  6041. if ( !(me instanceof Validator) ) {
  6042. return new Validator(element, options);
  6043. }
  6044. if (Validator.pending) {
  6045. $(window).on('validatorready', init);
  6046. } else {
  6047. init();
  6048. }
  6049. function init() {
  6050. me.$el = $(element);
  6051. if (me.$el.length) {
  6052. me._init(me.$el[0], options);
  6053. }
  6054. else if (isString(element)) {
  6055. preinitialized[element] = options;
  6056. }
  6057. }
  6058. }
  6059. Validator.prototype = {
  6060. _init: function(element, options) {
  6061. var me = this,
  6062. opt, themeOpt, dataOpt;
  6063. // Initialization options
  6064. if ( isFunction(options) ) {
  6065. options = {
  6066. valid: options
  6067. };
  6068. }
  6069. options = me._opt = options || {};
  6070. dataOpt = attr(element, 'data-'+ NS +'-option');
  6071. dataOpt = me._dataOpt = dataOpt && dataOpt.charAt(0) === '{' ? (new Function('return ' + dataOpt))() : {};
  6072. themeOpt = me._themeOpt = themes[ options.theme || dataOpt.theme || defaults.theme ];
  6073. opt = me.options = $.extend({}, defaults, fieldDefaults, themeOpt, me.options, options, dataOpt);
  6074. me.rules = new Rules(opt.rules, true);
  6075. me.messages = new Messages(opt.messages, true);
  6076. me.Field = _createFieldFactory(me);
  6077. me.elements = me.elements || {};
  6078. me.deferred = {};
  6079. me.errors = {};
  6080. me.fields = {};
  6081. // Initialization fields
  6082. me._initFields(opt.fields);
  6083. // Initialization events and make a cache
  6084. if ( !me.$el.data(NS) ) {
  6085. me.$el.data(NS, me).addClass(CLS_WRAPPER +' '+ opt.formClass)
  6086. .on('form-submit-validate', function(e, a, $form, opts, veto) {
  6087. me.vetoed = veto.veto = !me.isValid;
  6088. me.ajaxFormOptions = opts;
  6089. })
  6090. .on('submit'+ CLS_NS +' validate'+ CLS_NS, proxy(me, '_submit'))
  6091. .on('reset'+ CLS_NS, proxy(me, '_reset'))
  6092. .on('showmsg'+ CLS_NS, proxy(me, '_showmsg'))
  6093. .on('hidemsg'+ CLS_NS, proxy(me, '_hidemsg'))
  6094. .on('focusin'+ CLS_NS + ' click'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusin'))
  6095. .on('focusout'+ CLS_NS +' validate'+ CLS_NS, INPUT_SELECTOR, proxy(me, '_focusout'))
  6096. .on('keyup'+ CLS_NS +' input'+ CLS_NS + ' compositionstart compositionend', INPUT_SELECTOR, proxy(me, '_focusout'))
  6097. .on('click'+ CLS_NS, ':radio,:checkbox', 'click', proxy(me, '_focusout'))
  6098. .on('change'+ CLS_NS, 'select,input[type="file"]', 'change', proxy(me, '_focusout'));
  6099. // cache the novalidate attribute value
  6100. me._NOVALIDATE = attr(element, NOVALIDATE);
  6101. // Initialization is complete, stop off default HTML5 form validation
  6102. // If use "jQuery.attr('novalidate')" in IE7 will complain: "SCRIPT3: Member not found."
  6103. attr(element, NOVALIDATE, NOVALIDATE);
  6104. }
  6105. // Display all messages in target container
  6106. if ( isString(opt.target) ) {
  6107. me.$el.find(opt.target).addClass('msg-container');
  6108. }
  6109. },
  6110. // Guess whether the form use ajax submit
  6111. _guessAjax: function(form) {
  6112. var me = this;
  6113. if ( !(me.isAjaxSubmit = !!me.options.valid) ) {
  6114. // if there is a "valid.form" event
  6115. var events = ($._data || $.data)(form, 'events');
  6116. me.isAjaxSubmit = issetEvent(events, 'valid', 'form') || issetEvent(events, 'submit', 'form-plugin');
  6117. }
  6118. function issetEvent(events, name, namespace) {
  6119. return !!(
  6120. events && events[name]
  6121. && $.map(events[name], function(e){
  6122. return ~e.namespace.indexOf(namespace) ? 1 : null;
  6123. }).length )
  6124. }
  6125. },
  6126. _initFields: function(fields) {
  6127. var me = this, k, arr, i,
  6128. clear = fields === null;
  6129. // Processing field information
  6130. if (clear) fields = me.fields;
  6131. if ( isObject(fields) ) {
  6132. for (k in fields) {
  6133. if (~k.indexOf(',')) {
  6134. arr = k.split(',');
  6135. i = arr.length;
  6136. while (i--) {
  6137. initField(trim(arr[i]), fields[k]);
  6138. }
  6139. } else {
  6140. initField(k, fields[k]);
  6141. }
  6142. }
  6143. }
  6144. // Parsing DOM rules
  6145. me.$el.find(INPUT_SELECTOR).each(function() {
  6146. me._parse(this);
  6147. });
  6148. function initField(k, v) {
  6149. // delete a field from settings
  6150. if ( v === null || clear ) {
  6151. var el = me.elements[k];
  6152. if (el) me._resetElement(el, true);
  6153. delete me.fields[k];
  6154. } else {
  6155. me.fields[k] = new me.Field(k, isString(v) ? {rule: v} : v, me.fields[k]);
  6156. }
  6157. }
  6158. },
  6159. // Parsing a field
  6160. _parse: function(el) {
  6161. var me = this,
  6162. field,
  6163. key = el.name,
  6164. display,
  6165. timely,
  6166. dataRule = attr(el, DATA_RULE);
  6167. dataRule && attr(el, DATA_RULE, null);
  6168. // If the field has passed the key as id mode, or it doesn't has a name
  6169. if ( el.id && (
  6170. ('#' + el.id in me.fields) ||
  6171. !key ||
  6172. // If dataRule and element are diffrent from old's, we use ID mode.
  6173. (dataRule !== null && (field = me.fields[key]) && dataRule !== field.rule && el.id !== field.key)
  6174. )
  6175. ) {
  6176. key = '#' + el.id;
  6177. }
  6178. // Generate id
  6179. if (!key) {
  6180. key = '#' + (el.id = 'N' + String(Math.random()).slice(-12));
  6181. }
  6182. field = me.getField(key, true);
  6183. // The priority of passing parameter by DOM is higher than by JS.
  6184. field.rule = dataRule || field.rule;
  6185. if (display = attr(el, DATA_DISPLAY)) {
  6186. field.display = display;
  6187. }
  6188. if (field.rule) {
  6189. if ( attr(el, DATA_MUST) !== null || /\b(?:match|checked)\b/.test(field.rule) ) {
  6190. field.must = true;
  6191. }
  6192. if ( /\brequired\b/.test(field.rule) ) {
  6193. field.required = true;
  6194. }
  6195. if (timely = attr(el, DATA_TIMELY)) {
  6196. field.timely = +timely;
  6197. } else if (field.timely > 3) {
  6198. attr(el, DATA_TIMELY, field.timely);
  6199. }
  6200. me._parseRule(field);
  6201. field.old = {};
  6202. }
  6203. if ( isString(field.target) ) {
  6204. attr(el, DATA_TARGET, field.target);
  6205. }
  6206. if ( isString(field.tip) ) {
  6207. attr(el, DATA_TIP, field.tip);
  6208. }
  6209. return me.fields[key] = field;
  6210. },
  6211. // Parsing field rules
  6212. _parseRule: function(field) {
  6213. var arr = rDisplay.exec(field.rule);
  6214. if (!arr) return;
  6215. // current rule index
  6216. field._i = 0;
  6217. if (arr[1]) {
  6218. field.display = arr[1];
  6219. }
  6220. if (arr[2]) {
  6221. field._rules = [];
  6222. arr[2].replace(rRules, function(){
  6223. var args = arguments;
  6224. args[4] = args[4] || args[5];
  6225. field._rules.push({
  6226. and: args[1] === '&',
  6227. not: args[2] === '!',
  6228. or: args[6] === '|',
  6229. method: args[3],
  6230. params: args[4] ? $.map( args[4].split(', '), trim ) : undefined
  6231. });
  6232. });
  6233. }
  6234. },
  6235. // Verify a zone
  6236. _multiValidate: function($inputs, doneCallback){
  6237. var me = this,
  6238. opt = me.options;
  6239. me.hasError = false;
  6240. if (opt.ignore) {
  6241. $inputs = $inputs.not(opt.ignore);
  6242. }
  6243. $inputs.each(function() {
  6244. me._validate(this);
  6245. if (me.hasError && opt.stopOnError) {
  6246. // stop the validation
  6247. return false;
  6248. }
  6249. });
  6250. // Need to wait for all fields validation complete, especially asynchronous validation
  6251. if (doneCallback) {
  6252. me.validating = true;
  6253. $.when.apply(
  6254. null,
  6255. $.map(me.deferred, function(v){return v;})
  6256. ).done(function(){
  6257. doneCallback.call(me, !me.hasError);
  6258. me.validating = false;
  6259. });
  6260. }
  6261. // If the form does not contain asynchronous validation, the return value is correct.
  6262. // Otherwise, you should detect form validation result through "doneCallback".
  6263. return !$.isEmptyObject(me.deferred) ? undefined : !me.hasError;
  6264. },
  6265. // Validate the whole form
  6266. _submit: function(e) {
  6267. var me = this,
  6268. opt = me.options,
  6269. form = e.target,
  6270. canSubmit = e.type === 'submit' && form.tagName === 'FORM' && !e.isDefaultPrevented();
  6271. e.preventDefault();
  6272. if (
  6273. novalidateonce && ~(novalidateonce = false) ||
  6274. // Prevent duplicate submission
  6275. me.submiting ||
  6276. // Receive the "validate" event only from the form.
  6277. e.type === 'validate' && me.$el[0] !== form ||
  6278. // trigger the beforeSubmit callback.
  6279. isFunction(opt.beforeSubmit) && opt.beforeSubmit.call(me, form) === false
  6280. ) {
  6281. return;
  6282. }
  6283. if (me.isAjaxSubmit === undefined) {
  6284. me._guessAjax(form);
  6285. }
  6286. me._debug('log', '\n<<< event: ' + e.type);
  6287. me._reset();
  6288. me.submiting = true;
  6289. me._multiValidate(
  6290. me.$el.find(INPUT_SELECTOR),
  6291. function(isValid){
  6292. var ret = (isValid || opt.debug === 2) ? 'valid' : 'invalid',
  6293. errors;
  6294. if (!isValid) {
  6295. if (opt.focusInvalid) {
  6296. // navigate to the error element
  6297. me.$el.find('[' + ARIA_INVALID + ']:first').focus();
  6298. }
  6299. errors = $.map(me.errors, function(err){return err;});
  6300. }
  6301. // releasing submit
  6302. me.submiting = false;
  6303. me.isValid = isValid;
  6304. // trigger callback and event
  6305. isFunction(opt[ret]) && opt[ret].call(me, form, errors);
  6306. me.$el.trigger(ret + CLS_NS_FORM, [form, errors]);
  6307. me._debug('log', '>>> ' + ret);
  6308. if (!isValid) return;
  6309. // For jquery.form plugin
  6310. if (me.vetoed) {
  6311. $(form).ajaxSubmit(me.ajaxFormOptions);
  6312. }
  6313. else if (canSubmit && !me.isAjaxSubmit) {
  6314. document.createElement('form').submit.call(form);
  6315. }
  6316. }
  6317. );
  6318. },
  6319. _reset: function(e) {
  6320. var me = this;
  6321. me.errors = {};
  6322. if (e) {
  6323. me.reseting = true;
  6324. me.$el.find(INPUT_SELECTOR).each( function(){
  6325. me._resetElement(this);
  6326. });
  6327. delete me.reseting;
  6328. }
  6329. },
  6330. _resetElement: function(el, all) {
  6331. this._setClass(el, null);
  6332. this.hideMsg(el);
  6333. },
  6334. // Handle events: "focusin/click"
  6335. _focusin: function(e) {
  6336. var me = this,
  6337. opt = me.options,
  6338. el = e.target,
  6339. timely,
  6340. msg;
  6341. if ( me.validating || ( e.type==='click' && document.activeElement === el ) ) {
  6342. return;
  6343. }
  6344. if (opt.focusCleanup) {
  6345. if ( attr(el, ARIA_INVALID) === 'true' ) {
  6346. me._setClass(el, null);
  6347. me.hideMsg(el);
  6348. }
  6349. }
  6350. msg = attr(el, DATA_TIP);
  6351. if (msg) {
  6352. me.showMsg(el, {
  6353. type: 'tip',
  6354. msg: msg
  6355. });
  6356. } else {
  6357. if (attr(el, DATA_RULE)) {
  6358. me._parse(el);
  6359. }
  6360. if (timely = attr(el, DATA_TIMELY)) {
  6361. if ( timely === 8 || timely === 9 ) {
  6362. me._focusout(e);
  6363. }
  6364. }
  6365. }
  6366. },
  6367. // Handle events: "focusout/validate/keyup/click/change/input/compositionstart/compositionend"
  6368. _focusout: function(e) {
  6369. var me = this,
  6370. opt = me.options,
  6371. el = e.target,
  6372. etype = e.type,
  6373. etype0,
  6374. focusin = etype === 'focusin',
  6375. special = etype === 'validate',
  6376. elem,
  6377. field,
  6378. old,
  6379. value,
  6380. timestamp,
  6381. key, specialKey,
  6382. timely,
  6383. timer = 0;
  6384. if (etype === 'compositionstart') {
  6385. me.pauseValidate = true;
  6386. }
  6387. if (etype === 'compositionend') {
  6388. me.pauseValidate = false;
  6389. }
  6390. if (me.pauseValidate) {
  6391. return;
  6392. }
  6393. // For checkbox and radio
  6394. elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
  6395. // Get field
  6396. if (!(field = me.getField(elem)) || !field.rule) {
  6397. return;
  6398. }
  6399. // Cache event type
  6400. etype0 = field._e;
  6401. field._e = etype;
  6402. timely = field.timely;
  6403. if (!special) {
  6404. if (!timely || (_checkable(el) && etype !== 'click')) {
  6405. return;
  6406. }
  6407. value = field.getValue();
  6408. // not validate field unless fill a value
  6409. if ( field.ignoreBlank && !value && !focusin ) {
  6410. me.hideMsg(el);
  6411. return;
  6412. }
  6413. if ( etype === 'focusout' ) {
  6414. if (etype0 === 'change') {
  6415. return;
  6416. }
  6417. if ( timely === 2 || timely === 8 ) {
  6418. old = field.old;
  6419. if (value && old) {
  6420. if (field.isValid && !old.showOk) {
  6421. me.hideMsg(el);
  6422. } else {
  6423. me._makeMsg(el, field, old);
  6424. }
  6425. } else {
  6426. return;
  6427. }
  6428. }
  6429. }
  6430. else {
  6431. if ( timely < 2 && !e.data ) {
  6432. return;
  6433. }
  6434. // mark timestamp to reduce the frequency of the received event
  6435. timestamp = +new Date();
  6436. if ( timestamp - (el._ts || 0) < 100 ) {
  6437. return;
  6438. }
  6439. el._ts = timestamp;
  6440. // handle keyup
  6441. if ( etype === 'keyup' ) {
  6442. if (etype0 === 'input') {
  6443. return;
  6444. }
  6445. key = e.keyCode;
  6446. specialKey = {
  6447. 8: 1, // Backspace
  6448. 9: 1, // Tab
  6449. 16: 1, // Shift
  6450. 32: 1, // Space
  6451. 46: 1 // Delete
  6452. };
  6453. // only gets focus, no validation
  6454. if ( key === 9 && !value ) {
  6455. return;
  6456. }
  6457. // do not validate, if triggered by these keys
  6458. if ( key < 48 && !specialKey[key] ) {
  6459. return;
  6460. }
  6461. }
  6462. if ( !focusin ) {
  6463. // keyboard events, reducing the frequency of validation
  6464. timer = timely <100 ? (etype === 'click' || el.tagName === 'SELECT') ? 0 : 400 : timely;
  6465. }
  6466. }
  6467. }
  6468. // if the current field is ignored
  6469. if ( opt.ignore && $(el).is(opt.ignore) ) {
  6470. return;
  6471. }
  6472. clearTimeout(field._t);
  6473. if (timer) {
  6474. field._t = setTimeout(function() {
  6475. me._validate(el, field);
  6476. }, timer);
  6477. } else {
  6478. if (special) field.old = {};
  6479. me._validate(el, field);
  6480. }
  6481. },
  6482. _setClass: function(el, isValid) {
  6483. var $el = $(el), opt = this.options;
  6484. if (opt.bindClassTo) {
  6485. $el = $el.closest(opt.bindClassTo);
  6486. }
  6487. $el.removeClass( opt.invalidClass + ' ' + opt.validClass );
  6488. if (isValid !== null) {
  6489. $el.addClass( isValid ? opt.validClass : opt.invalidClass );
  6490. }
  6491. },
  6492. _showmsg: function(e, type, msg) {
  6493. var me = this,
  6494. el = e.target;
  6495. if ( me.$el.is(el) ) {
  6496. if (isObject(type)) {
  6497. me.showMsg(type)
  6498. }
  6499. else if ( type === 'tip' ) {
  6500. me.$el.find(INPUT_SELECTOR +'['+ DATA_TIP +']', el).each(function(){
  6501. me.showMsg(this, {type: type, msg: msg});
  6502. });
  6503. }
  6504. }
  6505. else {
  6506. me.showMsg(el, {type: type, msg: msg});
  6507. }
  6508. },
  6509. _hidemsg: function(e) {
  6510. var $el = $(e.target);
  6511. if ( $el.is(INPUT_SELECTOR) ) {
  6512. this.hideMsg($el);
  6513. }
  6514. },
  6515. // Validated a field
  6516. _validatedField: function(el, field, ret) {
  6517. var me = this,
  6518. opt = me.options,
  6519. isValid = field.isValid = ret.isValid = !!ret.isValid,
  6520. callback = isValid ? 'valid' : 'invalid';
  6521. ret.key = field.key;
  6522. ret.ruleName = field._r;
  6523. ret.id = el.id;
  6524. ret.value = field.value;
  6525. me.elements[field.key] = ret.element = el;
  6526. me.isValid = me.$el[0].isValid = isValid ? me.isFormValid() : isValid;
  6527. if (isValid) {
  6528. ret.type = 'ok';
  6529. } else {
  6530. if (me.submiting) {
  6531. me.errors[field.key] = ret.msg;
  6532. }
  6533. me.hasError = true;
  6534. }
  6535. // cache result
  6536. field.old = ret;
  6537. // trigger callback
  6538. isFunction(field[callback]) && field[callback].call(me, el, ret);
  6539. isFunction(opt.validation) && opt.validation.call(me, el, ret);
  6540. // trigger event
  6541. $(el).attr( ARIA_INVALID, isValid ? null : true )
  6542. .trigger( callback + CLS_NS_FIELD, [ret, me] );
  6543. me.$el.triggerHandler('validation', [ret, me]);
  6544. if (me.checkOnly) return;
  6545. // set className
  6546. me._setClass(el, ret.skip || ret.type === 'tip' ? null : isValid);
  6547. me._makeMsg.apply(me, arguments);
  6548. },
  6549. _makeMsg: function(el, field, ret) {
  6550. // show or hide the message
  6551. if (field.msgMaker) {
  6552. ret = $.extend({}, ret);
  6553. if (field._e === 'focusin') {
  6554. ret.type = 'tip';
  6555. }
  6556. this[ ret.showOk || ret.msg || ret.type === 'tip' ? 'showMsg' : 'hideMsg' ](el, ret, field);
  6557. }
  6558. },
  6559. // Validated a rule
  6560. _validatedRule: function(el, field, ret, msgOpt) {
  6561. field = field || me.getField(el);
  6562. msgOpt = msgOpt || {};
  6563. var me = this,
  6564. msg,
  6565. rule,
  6566. method = field._r,
  6567. timely = field.timely,
  6568. special = timely === 9 || timely === 8,
  6569. transfer,
  6570. temp,
  6571. isValid = false;
  6572. // use null to break validation from a field
  6573. if (ret === null) {
  6574. me._validatedField(el, field, {isValid: true, skip: true});
  6575. field._i = 0;
  6576. return;
  6577. }
  6578. else if (ret === undefined) {
  6579. transfer = true;
  6580. }
  6581. else if (ret === true || ret === '') {
  6582. isValid = true;
  6583. }
  6584. else if (isString(ret)) {
  6585. msg = ret;
  6586. }
  6587. else if (isObject(ret)) {
  6588. if (ret.error) {
  6589. msg = ret.error;
  6590. } else {
  6591. msg = ret.ok;
  6592. isValid = true;
  6593. }
  6594. }
  6595. else {
  6596. isValid = !!ret
  6597. }
  6598. rule = field._rules[field._i];
  6599. if (rule.not) {
  6600. msg = undefined;
  6601. isValid = method === 'required' || !isValid;
  6602. }
  6603. if (rule.or) {
  6604. if (isValid) {
  6605. while ( field._i < field._rules.length && field._rules[field._i].or ) {
  6606. field._i++;
  6607. }
  6608. } else {
  6609. transfer = true;
  6610. }
  6611. }
  6612. else if (rule.and) {
  6613. if (!field.isValid) transfer = true;
  6614. }
  6615. if (transfer) {
  6616. isValid = true;
  6617. }
  6618. // message analysis, and throw rule level event
  6619. else {
  6620. if (isValid) {
  6621. if (field.showOk !== false) {
  6622. temp = attr(el, DATA_OK);
  6623. msg = temp === null ? isString(field.ok) ? field.ok : msg : temp;
  6624. if (!isString(msg) && isString(field.showOk)) {
  6625. msg = field.showOk;
  6626. }
  6627. if (isString(msg)) {
  6628. msgOpt.showOk = isValid;
  6629. }
  6630. }
  6631. }
  6632. if (!isValid || special) {
  6633. /* rule message priority:
  6634. 1. custom DOM message
  6635. 2. custom field message;
  6636. 3. global defined message;
  6637. 4. rule returned message;
  6638. 5. default message;
  6639. */
  6640. msg = (_getDataMsg(el, field, msg || rule.msg || me.messages[method]) || me.messages.fallback).replace(/\{0\|?([^\}]*)\}/, function(m, defaultDisplay){
  6641. return me._getDisplay(el, field.display) || defaultDisplay || me.messages[0];
  6642. });
  6643. }
  6644. if (!isValid) field.isValid = isValid;
  6645. msgOpt.msg = msg;
  6646. $(el).trigger( (isValid ? 'valid' : 'invalid') + CLS_NS_RULE, [method, msg]);
  6647. }
  6648. if (special && (!transfer || rule.and)) {
  6649. if (!isValid && !field._m) field._m = msg;
  6650. field._v = field._v || [];
  6651. field._v.push({
  6652. type: isValid ? !transfer ? 'ok' : 'tip' : 'error',
  6653. msg: msg || rule.msg
  6654. });
  6655. }
  6656. me._debug('log', ' ' + field._i + ': ' + method + ' => ' + (isValid || msg));
  6657. // the current rule has passed, continue to validate
  6658. if ( (isValid || special) && field._i < field._rules.length - 1) {
  6659. field._i++;
  6660. me._checkRule(el, field);
  6661. }
  6662. // field was invalid, or all fields was valid
  6663. else {
  6664. field._i = 0;
  6665. if (special) {
  6666. msgOpt.isValid = field.isValid;
  6667. msgOpt.result = field._v;
  6668. msgOpt.msg = field._m || '';
  6669. if (!field.value && (field._e === 'focusin')) {
  6670. msgOpt.type = 'tip';
  6671. }
  6672. } else {
  6673. msgOpt.isValid = isValid;
  6674. }
  6675. me._validatedField(el, field, msgOpt);
  6676. delete field._m;
  6677. delete field._v;
  6678. }
  6679. },
  6680. // Verify a rule form a field
  6681. _checkRule: function(el, field) {
  6682. var me = this,
  6683. ret,
  6684. fn,
  6685. old,
  6686. key = field.key,
  6687. rule = field._rules[field._i],
  6688. method = rule.method,
  6689. params = rule.params;
  6690. // request has been sent, wait it
  6691. if (me.submiting && me.deferred[key]) {
  6692. return;
  6693. }
  6694. old = field.old;
  6695. field._r = method;
  6696. if (old && !field.must && !rule.must && rule.result !== undefined &&
  6697. old.ruleName === method && old.id === el.id &&
  6698. field.value && old.value === field.value )
  6699. {
  6700. // get result from cache
  6701. ret = rule.result;
  6702. }
  6703. else {
  6704. // get result from current rule
  6705. fn = _getDataRule(el, method) || me.rules[method] || noop;
  6706. ret = fn.call(field, el, params, field);
  6707. if (fn.msg) rule.msg = fn.msg;
  6708. }
  6709. // asynchronous validation
  6710. if (isObject(ret) && isFunction(ret.then)) {
  6711. me.deferred[key] = ret;
  6712. // whether the field valid is unknown
  6713. field.isValid = undefined;
  6714. // show loading message
  6715. !me.checkOnly && me.showMsg(el, {
  6716. type: 'loading',
  6717. msg: me.messages.loading
  6718. }, field);
  6719. // waiting to parse the response data
  6720. ret.then(
  6721. function(d, textStatus, jqXHR) {
  6722. var data = trim(jqXHR.responseText),
  6723. result,
  6724. dataFilter = field.dataFilter;
  6725. // detect if data is json or jsonp format
  6726. if (/jsonp?/.test(this.dataType)) {
  6727. data = d;
  6728. } else if (data.charAt(0) === '{') {
  6729. data = $.parseJSON(data);
  6730. }
  6731. // filter data
  6732. result = dataFilter.call(this, data, field);
  6733. if (result === undefined) result = dataFilter.call(this, data.data, field);
  6734. rule.data = this.data;
  6735. rule.result = field.old ? result : undefined;
  6736. me._validatedRule(el, field, result);
  6737. },
  6738. function(jqXHR, textStatus){
  6739. me._validatedRule(el, field, me.messages[textStatus] || textStatus);
  6740. }
  6741. ).always(function(){
  6742. delete me.deferred[key];
  6743. });
  6744. }
  6745. // other result
  6746. else {
  6747. me._validatedRule(el, field, ret);
  6748. }
  6749. },
  6750. // Processing the validation
  6751. _validate: function(el, field) {
  6752. var me = this;
  6753. // doesn't validate the element that has "disabled" or "novalidate" attribute
  6754. if ( el.disabled || attr(el, NOVALIDATE) !== null ) {
  6755. return;
  6756. }
  6757. field = field || me.getField(el);
  6758. if (!field) return;
  6759. if (!field._rules) me._parse(el);
  6760. if (!field._rules) return;
  6761. me._debug('info', field.key);
  6762. field.isValid = true;
  6763. field.element = el;
  6764. // Cache the value
  6765. field.value = field.getValue();
  6766. // if the field is not required, and that has a blank value
  6767. if (!field.required && !field.must && !field.value) {
  6768. if (!_checkable(el)) {
  6769. me._validatedField(el, field, {isValid: true});
  6770. return true;
  6771. }
  6772. }
  6773. me._checkRule(el, field);
  6774. return field.isValid;
  6775. },
  6776. _debug: function(type, messages) {
  6777. if (window.console && this.options.debug) {
  6778. console[type](messages);
  6779. }
  6780. },
  6781. /**
  6782. * Detecting whether the value of an element that matches a rule
  6783. *
  6784. * @method test
  6785. * @param {Element} el - input element
  6786. * @param {String} rule - rule name
  6787. */
  6788. test: function(el, rule) {
  6789. var me = this,
  6790. ret,
  6791. parts = rRule.exec(rule),
  6792. field,
  6793. method,
  6794. params;
  6795. if (parts) {
  6796. method = parts[1];
  6797. if (method in me.rules) {
  6798. params = parts[2] || parts[3];
  6799. params = params ? params.split(', ') : undefined;
  6800. field = me.getField(el, true);
  6801. field._r = method;
  6802. field.value = field.getValue();
  6803. ret = me.rules[method].call(field, el, params);
  6804. }
  6805. }
  6806. return ret === true || ret === undefined || ret === null;
  6807. },
  6808. _getDisplay: function(el, str) {
  6809. return !isString(str) ? isFunction(str) ? str.call(this, el) : '' : str;
  6810. },
  6811. _getMsgOpt: function(obj, field) {
  6812. var opt = field ? field : this.options;
  6813. return $.extend({
  6814. type: 'error',
  6815. pos: _getPos(opt.msgClass),
  6816. target: opt.target,
  6817. wrapper: opt.msgWrapper,
  6818. style: opt.msgStyle,
  6819. cls: opt.msgClass,
  6820. arrow: opt.msgArrow,
  6821. icon: opt.msgIcon
  6822. }, isString(obj) ? {msg: obj} : obj);
  6823. },
  6824. _getMsgDOM: function(el, msgOpt) {
  6825. var $el = $(el), $msgbox, datafor, tgt, container;
  6826. if ( $el.is(INPUT_SELECTOR) ) {
  6827. tgt = msgOpt.target || attr(el, DATA_TARGET);
  6828. if (tgt) {
  6829. tgt = !isFunction(tgt) ? tgt.charAt(0) === '#' ? $(tgt) : this.$el.find(tgt) : tgt.call(this, el);
  6830. if (tgt.length) {
  6831. if ( tgt.is(INPUT_SELECTOR) ) {
  6832. $el = tgt
  6833. el = tgt.get(0);
  6834. } else if ( tgt.hasClass(CLS_MSG_BOX) ) {
  6835. $msgbox = tgt;
  6836. } else {
  6837. container = tgt;
  6838. }
  6839. }
  6840. }
  6841. if (!$msgbox) {
  6842. datafor = (!_checkable(el) || !el.name) && el.id ? el.id : el.name;
  6843. $msgbox = (container || this.$el).find(msgOpt.wrapper + '.' + CLS_MSG_BOX + '[for="' + datafor + '"]');
  6844. }
  6845. } else {
  6846. $msgbox = $el;
  6847. }
  6848. // Create new message box
  6849. if (!msgOpt.hide && !$msgbox.length) {
  6850. $msgbox = $('<'+ msgOpt.wrapper + '>').attr({
  6851. 'class': CLS_MSG_BOX + (msgOpt.cls ? ' ' + msgOpt.cls : ''),
  6852. 'style': msgOpt.style || undefined,
  6853. 'for': datafor
  6854. });
  6855. if (container) {
  6856. $msgbox.appendTo(container);
  6857. } else {
  6858. if ( _checkable(el) ) {
  6859. var $parent = $el.parent();
  6860. $msgbox.appendTo( $parent.is('label') ? $parent.parent() : $parent );
  6861. } else {
  6862. $msgbox[!msgOpt.pos || msgOpt.pos === 'right' ? 'insertAfter' : 'insertBefore']($el);
  6863. }
  6864. }
  6865. }
  6866. return $msgbox;
  6867. },
  6868. /**
  6869. * Show validation message
  6870. *
  6871. * @method showMsg
  6872. * @param {Element} el - input element
  6873. * @param {Object} msgOpt
  6874. */
  6875. showMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  6876. if (!el) return;
  6877. var me = this,
  6878. opt = me.options,
  6879. msgShow,
  6880. msgMaker,
  6881. temp,
  6882. $msgbox;
  6883. if (isObject(el) && !el.jquery && !msgOpt) {
  6884. $.each(el, function(key, msg) {
  6885. var el = me.elements[key] || me.$el.find(_key2selector(key))[0];
  6886. me.showMsg(el, msg);
  6887. });
  6888. return;
  6889. }
  6890. if ($(el).is(INPUT_SELECTOR)) {
  6891. field = field || me.getField(el);
  6892. }
  6893. if (!(msgMaker = (field || opt).msgMaker)) {
  6894. return;
  6895. }
  6896. msgOpt = me._getMsgOpt(msgOpt, field);
  6897. el = (el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]') : $(el)).get(0);
  6898. // ok or tip
  6899. if (!msgOpt.msg && msgOpt.type !== 'error') {
  6900. temp = attr(el, 'data-' + msgOpt.type);
  6901. if (temp !== null) msgOpt.msg = temp;
  6902. }
  6903. if ( !isString(msgOpt.msg) ) {
  6904. return;
  6905. }
  6906. $msgbox = me._getMsgDOM(el, msgOpt);
  6907. !rPos.test($msgbox[0].className) && $msgbox.addClass(msgOpt.cls);
  6908. if ( isIE === 6 && msgOpt.pos === 'bottom' ) {
  6909. $msgbox[0].style.marginTop = $(el).outerHeight() + 'px';
  6910. }
  6911. $msgbox.html( msgMaker.call(me, msgOpt) )[0].style.display = '';
  6912. if (isFunction(msgShow = field && field.msgShow || opt.msgShow)) {
  6913. msgShow.call(me, $msgbox, msgOpt.type);
  6914. }
  6915. },
  6916. /**
  6917. * Hide validation message
  6918. *
  6919. * @method hideMsg
  6920. * @param {Element} el - input element
  6921. * @param {Object} msgOpt optional
  6922. */
  6923. hideMsg: function(el, msgOpt, /*INTERNAL*/ field) {
  6924. var me = this,
  6925. opt = me.options,
  6926. msgHide,
  6927. $msgbox;
  6928. el = $(el).get(0);
  6929. if ($(el).is(INPUT_SELECTOR)) {
  6930. field = field || me.getField(el);
  6931. if (field) {
  6932. if (field.isValid || me.reseting) attr(el, ARIA_INVALID, null);
  6933. }
  6934. }
  6935. msgOpt = me._getMsgOpt(msgOpt, field);
  6936. msgOpt.hide = true;
  6937. $msgbox = me._getMsgDOM(el, msgOpt);
  6938. if (!$msgbox.length) return;
  6939. if ( isFunction(msgHide = field && field.msgHide || opt.msgHide) ) {
  6940. msgHide.call(me, $msgbox, msgOpt.type);
  6941. } else {
  6942. $msgbox[0].style.display = 'none';
  6943. $msgbox[0].innerHTML = '';
  6944. }
  6945. },
  6946. /**
  6947. * Get field information
  6948. *
  6949. * @method getField
  6950. * @param {Element} - input element
  6951. * @return {Object} field
  6952. */
  6953. getField: function(el, must) {
  6954. var me = this,
  6955. key,
  6956. field;
  6957. if (isString(el)) {
  6958. key = el;
  6959. el = undefined;
  6960. } else {
  6961. if (attr(el, DATA_RULE)) {
  6962. return me._parse(el);
  6963. }
  6964. if (el.id && '#' + el.id in me.fields || !el.name) {
  6965. key = '#' + el.id;
  6966. } else {
  6967. key = el.name;
  6968. }
  6969. }
  6970. if ( (field = me.fields[key]) || must && (field = new me.Field(key)) ) {
  6971. field.element = el;
  6972. }
  6973. return field;
  6974. },
  6975. /**
  6976. * Config a field
  6977. *
  6978. * @method: setField
  6979. * @param {String} key
  6980. * @param {Object} obj
  6981. */
  6982. setField: function(key, obj) {
  6983. var fields = {};
  6984. if (!key) return;
  6985. // update this field
  6986. if (isString(key)) {
  6987. fields[key] = obj;
  6988. }
  6989. // update fields
  6990. else {
  6991. fields = key;
  6992. }
  6993. this._initFields(fields);
  6994. },
  6995. /**
  6996. * Detecting whether the form is valid
  6997. *
  6998. * @method isFormValid
  6999. * @return {Boolean}
  7000. */
  7001. isFormValid: function() {
  7002. var fields = this.fields, k, field;
  7003. for (k in fields) {
  7004. field = fields[k];
  7005. if (!field._rules || !field.required && !field.must && !field.value) continue;
  7006. if (!field.isValid) return false;
  7007. }
  7008. return true;
  7009. },
  7010. /**
  7011. * Prevent submission form
  7012. *
  7013. * @method holdSubmit
  7014. * @param {Boolean} hold - If set to false, will release the hold
  7015. */
  7016. holdSubmit: function(hold) {
  7017. this.submiting = hold === undefined || hold;
  7018. },
  7019. /**
  7020. * Clean validation messages
  7021. *
  7022. * @method cleanUp
  7023. */
  7024. cleanUp: function() {
  7025. this._reset(1);
  7026. },
  7027. /**
  7028. * Destroy the validation
  7029. *
  7030. * @method destroy
  7031. */
  7032. destroy: function() {
  7033. this._reset(1);
  7034. this.$el.off(CLS_NS).removeData(NS);
  7035. attr(this.$el[0], NOVALIDATE, this._NOVALIDATE);
  7036. }
  7037. };
  7038. /**
  7039. * Create Field Factory
  7040. *
  7041. * @class
  7042. * @param {Object} context
  7043. * @return {Function} Factory
  7044. */
  7045. function _createFieldFactory(context) {
  7046. function FieldFactory() {
  7047. var options = this.options;
  7048. for (var i in options) {
  7049. if (i in fieldDefaults) this[i] = options[i];
  7050. }
  7051. $.extend(this, {
  7052. _valHook: function() {
  7053. return this.element.contentEditable === 'true' ? 'text' : 'val';
  7054. },
  7055. getValue: function() {
  7056. var elem = this.element;
  7057. if (elem.type === 'number' && elem.validity && elem.validity.badInput) {
  7058. return 'NaN';
  7059. }
  7060. return $(elem)[this._valHook()]();
  7061. },
  7062. setValue: function(value) {
  7063. $(this.element)[this._valHook()](this.value = value);
  7064. },
  7065. // Get a range of validation messages
  7066. getRangeMsg: function(value, params, suffix) {
  7067. if (!params) return;
  7068. var me = this,
  7069. msg = me.messages[me._r] || '',
  7070. result,
  7071. p = params[0].split('~'),
  7072. e = params[1] === 'false',
  7073. a = p[0],
  7074. b = p[1],
  7075. c = 'rg',
  7076. args = [''],
  7077. isNumber = trim(value) && +value === +value;
  7078. function compare(large, small) {
  7079. return !e ? large >= small : large > small;
  7080. }
  7081. if (p.length === 2) {
  7082. if (a && b) {
  7083. if (isNumber && compare(value, +a) && compare(+b, value)) {
  7084. result = true;
  7085. }
  7086. args = args.concat(p);
  7087. c = e ? 'gtlt' : 'rg';
  7088. }
  7089. else if (a && !b) {
  7090. if (isNumber && compare(value, +a)) {
  7091. result = true;
  7092. }
  7093. args.push(a);
  7094. c = e ? 'gt' : 'gte';
  7095. }
  7096. else if (!a && b) {
  7097. if (isNumber && compare(+b, value)) {
  7098. result = true;
  7099. }
  7100. args.push(b);
  7101. c = e ? 'lt' : 'lte';
  7102. }
  7103. }
  7104. else {
  7105. if (value === +a) {
  7106. result = true;
  7107. }
  7108. args.push(a);
  7109. c = 'eq';
  7110. }
  7111. if (msg) {
  7112. if (suffix && msg[c + suffix]) {
  7113. c += suffix;
  7114. }
  7115. args[0] = msg[c];
  7116. }
  7117. return result || me._rules && ( me._rules[me._i].msg = me.renderMsg.apply(null, args) );
  7118. },
  7119. // Render message template
  7120. renderMsg: function() {
  7121. var args = arguments,
  7122. tpl = args[0],
  7123. i = args.length;
  7124. if (!tpl) return;
  7125. while (--i) {
  7126. tpl = tpl.replace('{' + i + '}', args[i]);
  7127. }
  7128. return tpl;
  7129. }
  7130. });
  7131. }
  7132. function Field(key, obj, oldField) {
  7133. this.key = key;
  7134. this.validator = context;
  7135. $.extend(this, oldField, obj);
  7136. }
  7137. FieldFactory.prototype = context;
  7138. Field.prototype = new FieldFactory();
  7139. return Field;
  7140. }
  7141. /**
  7142. * Create Rules
  7143. *
  7144. * @class
  7145. * @param {Object} obj rules
  7146. * @param {Object} context context
  7147. */
  7148. function Rules(obj, context) {
  7149. if (!isObject(obj)) return;
  7150. var k, that = context ? context === true ? this : context : Rules.prototype;
  7151. for (k in obj) {
  7152. if (_checkRuleName(k)) {
  7153. that[k] = _getRule(obj[k]);
  7154. }
  7155. }
  7156. }
  7157. /**
  7158. * Create Messages
  7159. *
  7160. * @class
  7161. * @param {Object} obj rules
  7162. * @param {Object} context context
  7163. */
  7164. function Messages(obj, context) {
  7165. if (!isObject(obj)) return;
  7166. var k, that = context ? context === true ? this : context : Messages.prototype;
  7167. for (k in obj) {
  7168. that[k] = obj[k];
  7169. }
  7170. }
  7171. // Rule converted factory
  7172. function _getRule(fn) {
  7173. switch ($.type(fn)) {
  7174. case 'function':
  7175. return fn;
  7176. case 'array':
  7177. var f = function() {
  7178. return fn[0].test(this.value) || fn[1] || false;
  7179. };
  7180. f.msg = fn[1];
  7181. return f;
  7182. case 'regexp':
  7183. return function() {
  7184. return fn.test(this.value);
  7185. };
  7186. }
  7187. }
  7188. // Get instance by an element
  7189. function _getInstance(el) {
  7190. var wrap, k, options;
  7191. if (!el || !el.tagName) return;
  7192. switch (el.tagName) {
  7193. case 'INPUT':
  7194. case 'SELECT':
  7195. case 'TEXTAREA':
  7196. case 'BUTTON':
  7197. case 'FIELDSET':
  7198. wrap = el.form || $(el).closest('.' + CLS_WRAPPER);
  7199. break;
  7200. case 'FORM':
  7201. wrap = el;
  7202. break;
  7203. default:
  7204. wrap = $(el).closest('.' + CLS_WRAPPER);
  7205. }
  7206. for (k in preinitialized) {
  7207. if ($(wrap).is(k)) {
  7208. options = preinitialized[k];
  7209. break;
  7210. }
  7211. }
  7212. return $(wrap).data(NS) || $(wrap)[NS](options).data(NS);
  7213. }
  7214. // Get custom rules on the node
  7215. function _getDataRule(el, method) {
  7216. var fn = trim(attr(el, DATA_RULE + '-' + method));
  7217. if ( fn && (fn = new Function('return ' + fn)()) ) {
  7218. return _getRule(fn);
  7219. }
  7220. }
  7221. // Get custom messages on the node
  7222. function _getDataMsg(el, field, m) {
  7223. var msg = field.msg,
  7224. item = field._r;
  7225. if ( isObject(msg) ) msg = msg[item];
  7226. if ( !isString(msg) ) {
  7227. msg = attr(el, DATA_MSG + '-' + item) || attr(el, DATA_MSG) || ( m ? isString(m) ? m : m[item] : '');
  7228. }
  7229. return msg;
  7230. }
  7231. // Get message position
  7232. function _getPos(str) {
  7233. var pos;
  7234. if (str) pos = rPos.exec(str);
  7235. return pos && pos[0];
  7236. }
  7237. // Check whether the element is checkbox or radio
  7238. function _checkable(el) {
  7239. return el.tagName === 'INPUT' && el.type === 'checkbox' || el.type === 'radio';
  7240. }
  7241. // Parse date string to timestamp
  7242. function _parseDate(str) {
  7243. return Date.parse(str.replace(/\.|\-/g, '/'));
  7244. }
  7245. // Rule name only allows alphanumeric characters and underscores
  7246. function _checkRuleName(name) {
  7247. return /^\w+$/.test(name);
  7248. }
  7249. // Translate field key to jQuery selector.
  7250. function _key2selector(key) {
  7251. var isID = key.charAt(0) === '#';
  7252. key = key.replace(/([:.{(|)}/\[\]])/g, '\\$1');
  7253. return isID ? key : '[name="'+ key +'"]:first';
  7254. }
  7255. // Fixed a issue cause by refresh page in IE.
  7256. $(window).on('beforeunload', function(){
  7257. this.focus();
  7258. });
  7259. $(document)
  7260. .on('click', ':submit', function(){
  7261. var input = this, attrNode;
  7262. if (!input.form) return;
  7263. // Shim for "formnovalidate"
  7264. attrNode = input.getAttributeNode('formnovalidate');
  7265. if (attrNode && attrNode.nodeValue !== null || attr(input, NOVALIDATE)!== null) {
  7266. novalidateonce = true;
  7267. }
  7268. })
  7269. // Automatic initializing form validation
  7270. .on('focusin submit validate', 'form,.'+CLS_WRAPPER, function(e) {
  7271. if ( attr(this, NOVALIDATE) !== null ) return;
  7272. var $form = $(this), me;
  7273. if ( !$form.data(NS) && (me = _getInstance(this)) ) {
  7274. if ( !$.isEmptyObject(me.fields) ) {
  7275. // Execute event handler
  7276. if (e.type === 'focusin') {
  7277. me._focusin(e);
  7278. } else {
  7279. me._submit(e);
  7280. }
  7281. } else {
  7282. attr(this, NOVALIDATE, NOVALIDATE);
  7283. $form.off(CLS_NS).removeData(NS);
  7284. }
  7285. }
  7286. });
  7287. new Messages({
  7288. fallback: 'This field is not valid.',
  7289. loading: 'Validating...'
  7290. });
  7291. // Built-in rules (global)
  7292. new Rules({
  7293. /**
  7294. * required
  7295. *
  7296. * @example:
  7297. required
  7298. required(jqSelector)
  7299. required(anotherRule)
  7300. required(not, -1)
  7301. required(from, .contact)
  7302. */
  7303. required: function(element, params) {
  7304. var me = this,
  7305. val = trim(me.value),
  7306. isValid = true;
  7307. if (params) {
  7308. if ( params.length === 1 ) {
  7309. if ( !_checkRuleName(params[0]) ) {
  7310. if (!val && !$(params[0], me.$el).length ) {
  7311. return null;
  7312. }
  7313. }
  7314. else if ( me.rules[params[0]] ) {
  7315. if ( !val && !me.test(element, params[0]) ) {
  7316. return null;
  7317. }
  7318. }
  7319. }
  7320. else if ( params[0] === 'not' ) {
  7321. $.each(params.slice(1), function() {
  7322. return (isValid = val !== trim(this));
  7323. });
  7324. }
  7325. else if ( params[0] === 'from' ) {
  7326. var $elements = me.$el.find(params[1]),
  7327. VALIDATED = '_validated_',
  7328. ret;
  7329. isValid = $elements.filter(function(){
  7330. var field = me.getField(this);
  7331. return field && !!trim(field.getValue());
  7332. }).length >= (params[2] || 1);
  7333. if (isValid) {
  7334. if (!val) ret = null;
  7335. } else {
  7336. ret = _getDataMsg($elements[0], me) || false;
  7337. }
  7338. if ( !$(element).data(VALIDATED) ) {
  7339. $elements.data(VALIDATED, 1).each(function(){
  7340. if (element !== this) {
  7341. me._validate(this);
  7342. }
  7343. }).removeData(VALIDATED);
  7344. }
  7345. return ret;
  7346. }
  7347. }
  7348. return isValid && !!val;
  7349. },
  7350. /**
  7351. * integer
  7352. *
  7353. * @example:
  7354. integer
  7355. integer[+]
  7356. integer[+0]
  7357. integer[-]
  7358. integer[-0]
  7359. */
  7360. integer: function(element, params) {
  7361. var re, z = '0|',
  7362. p = '[1-9]\\d*',
  7363. key = params ? params[0] : '*';
  7364. switch (key) {
  7365. case '+':
  7366. re = p;
  7367. break;
  7368. case '-':
  7369. re = '-' + p;
  7370. break;
  7371. case '+0':
  7372. re = z + p;
  7373. break;
  7374. case '-0':
  7375. re = z + '-' + p;
  7376. break;
  7377. default:
  7378. re = z + '-?' + p;
  7379. }
  7380. re = '^(?:' + re + ')$';
  7381. return new RegExp(re).test(this.value) || (this.messages.integer && this.messages.integer[key]);
  7382. },
  7383. /**
  7384. * match another field
  7385. *
  7386. * @example:
  7387. match[password] Match the password field (two values ​​must be the same)
  7388. match[eq, password] Ditto
  7389. match[neq, count] The value must be not equal to the value of the count field
  7390. match[lt, count] The value must be less than the value of the count field
  7391. match[lte, count] The value must be less than or equal to the value of the count field
  7392. match[gt, count] The value must be greater than the value of the count field
  7393. match[gte, count] The value must be greater than or equal to the value of the count field
  7394. match[gte, startDate, date]
  7395. match[gte, startTime, time]
  7396. **/
  7397. match: function(element, params) {
  7398. if (!params) return;
  7399. var me = this,
  7400. isValid = true,
  7401. a, b,
  7402. key, msg, type = 'eq', parser,
  7403. selector2, elem2, field2;
  7404. if (params.length === 1) {
  7405. key = params[0];
  7406. } else {
  7407. type = params[0];
  7408. key = params[1];
  7409. }
  7410. selector2 = _key2selector(key);
  7411. elem2 = me.$el.find(selector2)[0];
  7412. // If the compared field is not exist
  7413. if (!elem2) return;
  7414. field2 = me.getField(elem2);
  7415. a = me.value;
  7416. b = field2.getValue();
  7417. if (!me._match) {
  7418. me.$el.on('valid'+CLS_NS_FIELD+CLS_NS, selector2, function(){
  7419. $(element).trigger('validate');
  7420. });
  7421. me._match = field2._match = 1;
  7422. }
  7423. // If both fields are blank
  7424. if (!me.required && a === '' && b === '') {
  7425. return null;
  7426. }
  7427. parser = params[2];
  7428. if (parser) {
  7429. if (/^date(time)?$/i.test(parser)) {
  7430. a = _parseDate(a);
  7431. b = _parseDate(b);
  7432. } else if (parser === 'time') {
  7433. a = +a.replace(/:/g, '');
  7434. b = +b.replace(/:/g, '');
  7435. }
  7436. }
  7437. // If the compared field is incorrect, we only ensure that this field is correct.
  7438. if (type !== 'eq' && !isNaN(+a) && isNaN(+b)) {
  7439. return true;
  7440. }
  7441. switch (type) {
  7442. case 'lt':
  7443. isValid = +a < +b; break;
  7444. case 'lte':
  7445. isValid = +a <= +b; break;
  7446. case 'gte':
  7447. isValid = +a >= +b; break;
  7448. case 'gt':
  7449. isValid = +a > +b; break;
  7450. case 'neq':
  7451. isValid = a !== b; break;
  7452. default:
  7453. isValid = a === b;
  7454. }
  7455. return isValid || (
  7456. isObject(me.messages.match)
  7457. && me.messages.match[type].replace( '{1}', me._getDisplay( elem2, field2.display || key ) )
  7458. );
  7459. },
  7460. /**
  7461. * range numbers
  7462. *
  7463. * @example:
  7464. range[0~99] Number 0-99
  7465. range[0~] Number greater than or equal to 0
  7466. range[~100] Number less than or equal to 100
  7467. **/
  7468. range: function(element, params) {
  7469. return this.getRangeMsg(this.value, params);
  7470. },
  7471. /**
  7472. * how many checkbox or radio inputs that checked
  7473. *
  7474. * @example:
  7475. checked; no empty, same to required
  7476. checked[1~3] 1-3 items
  7477. checked[1~] greater than 1 item
  7478. checked[~3] less than 3 items
  7479. checked[3] 3 items
  7480. **/
  7481. checked: function(element, params) {
  7482. if ( !_checkable(element) ) return;
  7483. var me = this,
  7484. elem, count;
  7485. if (element.name) {
  7486. count = me.$el.find('input[name="' + element.name + '"]').filter(function() {
  7487. var el = this;
  7488. if (!elem && _checkable(el)) elem = el;
  7489. return !el.disabled && el.checked;
  7490. }).length;
  7491. } else {
  7492. elem = element;
  7493. count = elem.checked;
  7494. }
  7495. if (params) {
  7496. return me.getRangeMsg(count, params);
  7497. } else {
  7498. return !!count || _getDataMsg(elem, me, '') || me.messages.required || false;
  7499. }
  7500. },
  7501. /**
  7502. * length of a characters (You can pass the second parameter "true", will calculate the length in bytes)
  7503. *
  7504. * @example:
  7505. length[6~16] 6-16 characters
  7506. length[6~] Greater than 6 characters
  7507. length[~16] Less than 16 characters
  7508. length[~16, true] Less than 16 characters, non-ASCII characters calculating two-character
  7509. **/
  7510. length: function(element, params) {
  7511. var value = this.value,
  7512. len = (params[1] === 'true' ? value.replace(rDoubleBytes, 'xx') : value).length;
  7513. return this.getRangeMsg(len, params, (params[1] ? '_2' : ''));
  7514. },
  7515. /**
  7516. * remote validation
  7517. *
  7518. * @description
  7519. * remote([get:]url [, name1, [name2 ...]]);
  7520. * Adaptation three kinds of results (Front for the successful, followed by a failure):
  7521. 1. text:
  7522. '' 'Error Message'
  7523. 2. json:
  7524. {"ok": ""} {"error": "Error Message"}
  7525. 3. json wrapper:
  7526. {"status": 1, "data": {"ok": ""}} {"status": 1, "data": {"error": "Error Message"}}
  7527. * @example
  7528. The simplest: remote(path/to/server);
  7529. With parameters: remote(path/to/server, name1, name2, ...);
  7530. By GET: remote(get:path/to/server, name1, name2, ...);
  7531. Name proxy: remote(path/to/server, name1, proxyname2:name2, proxyname3:#id3, ...)
  7532. Query String remote(path/to/server, foo=1&bar=2, name1, name2, ...)
  7533. CORS remote(cors:path/to/server)
  7534. JSONP remote(jsonp:path/to/server)
  7535. */
  7536. remote: function(element, params) {
  7537. if (!params) return;
  7538. var me = this,
  7539. arr = rAjaxType.exec(params[0]),
  7540. rule = me._rules[me._i],
  7541. data = {},
  7542. queryString = '',
  7543. url = arr[3],
  7544. type = arr[2] || 'POST', // GET / POST
  7545. rType = (arr[1]||'').toLowerCase(), // CORS / JSONP
  7546. dataType;
  7547. rule.must = true;
  7548. data[element.name] = me.value;
  7549. // There are extra fields
  7550. if (params[1]) {
  7551. $.map(params.slice(1), function(name) {
  7552. var arr, key;
  7553. if (~name.indexOf('=')) {
  7554. queryString += '&' + name;
  7555. } else {
  7556. arr = name.split(':');
  7557. name = trim(arr[0]);
  7558. key = trim(arr[1]) || name;
  7559. data[ name ] = me.$el.find( _key2selector(key) ).val();
  7560. }
  7561. });
  7562. }
  7563. data = $.param(data) + queryString;
  7564. if (!me.must && rule.data && rule.data === data) {
  7565. return rule.result;
  7566. }
  7567. // Cross-domain request, force jsonp dataType
  7568. if (rType !== 'cors' && /^https?:/.test(url) && !~url.indexOf(location.host)) {
  7569. dataType = 'jsonp';
  7570. }
  7571. // Asynchronous validation need return jqXHR objects
  7572. return $.ajax({
  7573. url: url,
  7574. type: type,
  7575. data: data,
  7576. dataType: dataType
  7577. });
  7578. },
  7579. /**
  7580. * filter characters, direct filtration without prompting error (support custom regular expressions)
  7581. *
  7582. * @example
  7583. * filter filtering unsafe characters
  7584. * filter(regexp) filtering the "regexp" matched characters
  7585. */
  7586. filter: function(element, params) {
  7587. var value = this.value,
  7588. temp = value.replace( params ? (new RegExp('[' + params[0] + ']', 'gm')) : rUnsafe, '' );
  7589. if (temp !== value) this.setValue(temp);
  7590. }
  7591. });
  7592. /**
  7593. * Config global options
  7594. *
  7595. * @static config
  7596. * @param {Object} options
  7597. */
  7598. Validator.config = function(key, value) {
  7599. if (isObject(key)) {
  7600. $.each(key, _config);
  7601. }
  7602. else if (isString(key)) {
  7603. _config(key, value);
  7604. }
  7605. function _config(k, o) {
  7606. if (k === 'rules') {
  7607. new Rules(o);
  7608. }
  7609. else if (k === 'messages') {
  7610. new Messages(o);
  7611. }
  7612. else if (k in fieldDefaults) {
  7613. fieldDefaults[k] = o;
  7614. }
  7615. else {
  7616. defaults[k] = o;
  7617. }
  7618. }
  7619. };
  7620. /**
  7621. * Config themes
  7622. *
  7623. * @static setTheme
  7624. * @param {String|Object} name
  7625. * @param {Object} obj
  7626. * @example
  7627. .setTheme( themeName, themeOptions )
  7628. .setTheme( multiThemes )
  7629. */
  7630. Validator.setTheme = function(name, obj) {
  7631. if ( isObject(name) ) {
  7632. $.extend(true, themes, name);
  7633. }
  7634. else if ( isString(name) && isObject(obj) ) {
  7635. themes[name] = $.extend(themes[name], obj);
  7636. }
  7637. };
  7638. /**
  7639. * Resource loader
  7640. *
  7641. * @static load
  7642. * @param {String} str
  7643. * @example
  7644. .load('local=zh-CN') // load: local/zh-CN.js and jquery.validator.css
  7645. .load('local=zh-CN&css=') // load: local/zh-CN.js
  7646. .load('local&css') // load: local/en.js (set <html lang="en">) and jquery.validator.css
  7647. .load('local') // dito
  7648. */
  7649. Validator.load = function(str) {
  7650. if (!str) return;
  7651. var doc = document,
  7652. params = {},
  7653. node = doc.scripts[0],
  7654. dir, el, ONLOAD;
  7655. str.replace(/([^?=&]+)=([^&#]*)/g, function(m, key, value){
  7656. params[key] = value;
  7657. });
  7658. dir = params.dir || Validator.dir;
  7659. if (!Validator.css && params.css !== '') {
  7660. el = doc.createElement('link');
  7661. el.rel = 'stylesheet';
  7662. el.href = Validator.css = dir + 'jquery.validator.css';
  7663. node.parentNode.insertBefore(el, node);
  7664. }
  7665. if (!Validator.local && ~str.indexOf('local') && params.local !== '') {
  7666. Validator.local = (params.local || doc.documentElement.lang || 'en').replace('_','-');
  7667. Validator.pending = 1;
  7668. el = doc.createElement('script');
  7669. el.src = dir + 'local/' + Validator.local + '.js';
  7670. ONLOAD = 'onload' in el ? 'onload' : 'onreadystatechange';
  7671. el[ONLOAD] = function() {
  7672. if (!el.readyState || /loaded|complete/.test(el.readyState)) {
  7673. el = el[ONLOAD] = null;
  7674. delete Validator.pending;
  7675. $(window).triggerHandler('validatorready');
  7676. }
  7677. };
  7678. node.parentNode.insertBefore(el, node);
  7679. }
  7680. };
  7681. // Auto loading resources
  7682. (function(){
  7683. var scripts = document.scripts,
  7684. i = scripts.length, node, arr,
  7685. re = /(.*validator(?:\.min)?.js)(\?.*(?:local|css|dir)(?:=[\w\-]*)?)?/;
  7686. while (i-- && !arr) {
  7687. node = scripts[i];
  7688. arr = (node.hasAttribute ? node.src : node.getAttribute('src',4)||'').match(re);
  7689. }
  7690. if (!arr) return;
  7691. Validator.dir = arr[1].split('/').slice(0, -1).join('/')+'/';
  7692. Validator.load(arr[2]);
  7693. })();
  7694. return $[NS] = Validator;
  7695. }));
  7696. /*********************************
  7697. * Themes, rules, and i18n support
  7698. * Locale: Chinese; 中文
  7699. *********************************/
  7700. (function(factory) {
  7701. typeof module === "object" && module.exports ? module.exports = factory( require( "jquery" ) ) :
  7702. typeof define === 'function' && define.amd ? define('validator-lang',['jquery'], factory) :
  7703. factory(jQuery);
  7704. }(function($) {
  7705. /* Global configuration
  7706. */
  7707. $.validator.config({
  7708. //stopOnError: true,
  7709. //focusCleanup: true,
  7710. //theme: 'yellow_right',
  7711. //timely: 2,
  7712. // Custom rules
  7713. rules: {
  7714. digits: [/^\d+$/, "请填写数字"]
  7715. ,letters: [/^[a-z]+$/i, "请填写字母"]
  7716. ,date: [/^\d{4}-\d{2}-\d{2}$/, "请填写有效的日期,格式:yyyy-mm-dd"]
  7717. ,time: [/^([01]\d|2[0-3])(:[0-5]\d){1,2}$/, "请填写有效的时间,00:00到23:59之间"]
  7718. ,email: [/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,4})$/i, "请填写有效的邮箱"]
  7719. ,url: [/^(https?|s?ftp):\/\/\S+$/i, "请填写有效的网址"]
  7720. ,qq: [/^[1-9]\d{4,}$/, "请填写有效的QQ号"]
  7721. ,IDcard: [/^\d{6}(19|2\d)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)?$/, "请填写正确的身份证号码"]
  7722. ,tel: [/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/, "请填写有效的电话号码"]
  7723. ,mobile: [/^1[3-9]\d{9}$/, "请填写有效的手机号"]
  7724. ,zipcode: [/^\d{6}$/, "请检查邮政编码格式"]
  7725. ,chinese: [/^[\u0391-\uFFE5]+$/, "请填写中文字符"]
  7726. ,username: [/^\w{3,12}$/, "请填写3-12位数字、字母、下划线"]
  7727. ,password: [/^[\S]{6,16}$/, "请填写6-16位字符,不能包含空格"]
  7728. ,accept: function (element, params){
  7729. if (!params) return true;
  7730. var ext = params[0],
  7731. value = $(element).val();
  7732. return (ext === '*') ||
  7733. (new RegExp(".(?:" + ext + ")$", "i")).test(value) ||
  7734. this.renderMsg("只接受{1}后缀的文件", ext.replace(/\|/g, ','));
  7735. }
  7736. },
  7737. // Default error messages
  7738. messages: {
  7739. 0: "此处",
  7740. fallback: "{0}格式不正确",
  7741. loading: "正在验证...",
  7742. error: "网络异常",
  7743. timeout: "请求超时",
  7744. required: "{0}不能为空",
  7745. remote: "{0}已被使用",
  7746. integer: {
  7747. '*': "请填写整数",
  7748. '+': "请填写正整数",
  7749. '+0': "请填写正整数或0",
  7750. '-': "请填写负整数",
  7751. '-0': "请填写负整数或0"
  7752. },
  7753. match: {
  7754. eq: "{0}与{1}不一致",
  7755. neq: "{0}与{1}不能相同",
  7756. lt: "{0}必须小于{1}",
  7757. gt: "{0}必须大于{1}",
  7758. lte: "{0}不能大于{1}",
  7759. gte: "{0}不能小于{1}"
  7760. },
  7761. range: {
  7762. rg: "请填写{1}到{2}的数",
  7763. gte: "请填写不小于{1}的数",
  7764. lte: "请填写最大{1}的数",
  7765. gtlt: "请填写{1}到{2}之间的数",
  7766. gt: "请填写大于{1}的数",
  7767. lt: "请填写小于{1}的数"
  7768. },
  7769. checked: {
  7770. eq: "请选择{1}项",
  7771. rg: "请选择{1}到{2}项",
  7772. gte: "请至少选择{1}项",
  7773. lte: "请最多选择{1}项"
  7774. },
  7775. length: {
  7776. eq: "请填写{1}个字符",
  7777. rg: "请填写{1}到{2}个字符",
  7778. gte: "请至少填写{1}个字符",
  7779. lte: "请最多填写{1}个字符",
  7780. eq_2: "",
  7781. rg_2: "",
  7782. gte_2: "",
  7783. lte_2: ""
  7784. }
  7785. }
  7786. });
  7787. /* Themes
  7788. */
  7789. var TPL_ARROW = '<span class="n-arrow"><b>◆</b><i>◆</i></span>';
  7790. $.validator.setTheme({
  7791. 'simple_right': {
  7792. formClass: 'n-simple',
  7793. msgClass: 'n-right'
  7794. },
  7795. 'simple_bottom': {
  7796. formClass: 'n-simple',
  7797. msgClass: 'n-bottom'
  7798. },
  7799. 'yellow_top': {
  7800. formClass: 'n-yellow',
  7801. msgClass: 'n-top',
  7802. msgArrow: TPL_ARROW
  7803. },
  7804. 'yellow_right': {
  7805. formClass: 'n-yellow',
  7806. msgClass: 'n-right',
  7807. msgArrow: TPL_ARROW
  7808. },
  7809. 'yellow_right_effect': {
  7810. formClass: 'n-yellow',
  7811. msgClass: 'n-right',
  7812. msgArrow: TPL_ARROW,
  7813. msgShow: function($msgbox, type){
  7814. var $el = $msgbox.children();
  7815. if ($el.is(':animated')) return;
  7816. if (type === 'error') {
  7817. $el.css({left: '20px', opacity: 0})
  7818. .delay(100).show().stop()
  7819. .animate({left: '-4px', opacity: 1}, 150)
  7820. .animate({left: '3px'}, 80)
  7821. .animate({left: 0}, 80);
  7822. } else {
  7823. $el.css({left: 0, opacity: 1}).fadeIn(200);
  7824. }
  7825. },
  7826. msgHide: function($msgbox, type){
  7827. var $el = $msgbox.children();
  7828. $el.stop().delay(100).show()
  7829. .animate({left: '20px', opacity: 0}, 300, function(){
  7830. $msgbox.hide();
  7831. });
  7832. }
  7833. }
  7834. });
  7835. }));
  7836. define('validator',['validator-core', 'validator-lang'], function (Validator, undefined) {
  7837. return Validator;
  7838. });
  7839. define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, Upload, Validator) {
  7840. var Form = {
  7841. config: {
  7842. fieldlisttpl: '<dd class="form-inline"><input type="text" name="<%=name%>[<%=index%>][key]" class="form-control" value="<%=row.key%>" size="10" /> <input type="text" name="<%=name%>[<%=index%>][value]" class="form-control" value="<%=row.value%>" /> <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></dd>'
  7843. },
  7844. events: {
  7845. validator: function (form, success, error, submit) {
  7846. if (!form.is("form"))
  7847. return;
  7848. //绑定表单事件
  7849. form.validator($.extend({
  7850. validClass: 'has-success',
  7851. invalidClass: 'has-error',
  7852. bindClassTo: '.form-group',
  7853. formClass: 'n-default n-bootstrap',
  7854. msgClass: 'n-right',
  7855. stopOnError: true,
  7856. display: function (elem) {
  7857. return $(elem).closest('.form-group').find(".control-label").text().replace(/\:/, '');
  7858. },
  7859. dataFilter: function (data) {
  7860. if (data.code === 1) {
  7861. return data.msg ? {"ok": data.msg} : '';
  7862. } else {
  7863. return data.msg;
  7864. }
  7865. },
  7866. target: function (input) {
  7867. var target = $(input).data("target");
  7868. if (target && $(target).size() > 0) {
  7869. return $(target);
  7870. }
  7871. var $formitem = $(input).closest('.form-group'),
  7872. $msgbox = $formitem.find('span.msg-box');
  7873. if (!$msgbox.length) {
  7874. return [];
  7875. }
  7876. return $msgbox;
  7877. },
  7878. valid: function (ret) {
  7879. var that = this, submitBtn = $(".layer-footer [type=submit]", form);
  7880. that.holdSubmit(true);
  7881. submitBtn.addClass("disabled");
  7882. //验证通过提交表单
  7883. var submitResult = Form.api.submit($(ret), function (data, ret) {
  7884. that.holdSubmit(false);
  7885. submitBtn.removeClass("disabled");
  7886. if (false === $(this).triggerHandler("success.form", [data, ret])) {
  7887. return false;
  7888. }
  7889. if (typeof success === 'function') {
  7890. if (false === success.call($(this), data, ret)) {
  7891. return false;
  7892. }
  7893. }
  7894. //提示及关闭当前窗口
  7895. var msg = ret.hasOwnProperty("msg") && ret.msg !== "" ? ret.msg : __('Operation completed');
  7896. parent.Toastr.success(msg);
  7897. parent.$(".btn-refresh").trigger("click");
  7898. var index = parent.Layer.getFrameIndex(window.name);
  7899. parent.Layer.close(index);
  7900. return false;
  7901. }, function (data, ret) {
  7902. that.holdSubmit(false);
  7903. if (false === $(this).triggerHandler("error.form", [data, ret])) {
  7904. return false;
  7905. }
  7906. submitBtn.removeClass("disabled");
  7907. if (typeof error === 'function') {
  7908. if (false === error.call($(this), data, ret)) {
  7909. return false;
  7910. }
  7911. }
  7912. }, submit);
  7913. //如果提交失败则释放锁定
  7914. if (!submitResult) {
  7915. that.holdSubmit(false);
  7916. submitBtn.removeClass("disabled");
  7917. }
  7918. return false;
  7919. }
  7920. }, form.data("validator-options") || {}));
  7921. //移除提交按钮的disabled类
  7922. $(".layer-footer [type=submit],.fixed-footer [type=submit],.normal-footer [type=submit]", form).removeClass("disabled");
  7923. },
  7924. selectpicker: function (form) {
  7925. //绑定select元素事件
  7926. if ($(".selectpicker", form).size() > 0) {
  7927. require(['bootstrap-select', 'bootstrap-select-lang'], function () {
  7928. $('.selectpicker', form).selectpicker();
  7929. $(form).on("reset", function () {
  7930. setTimeout(function () {
  7931. $('.selectpicker').selectpicker('refresh').trigger("change");
  7932. }, 1);
  7933. });
  7934. });
  7935. }
  7936. },
  7937. selectpage: function (form) {
  7938. //绑定selectpage元素事件
  7939. if ($(".selectpage", form).size() > 0) {
  7940. require(['selectpage'], function () {
  7941. $('.selectpage', form).selectPage({
  7942. eAjaxSuccess: function (data) {
  7943. data.list = typeof data.rows !== 'undefined' ? data.rows : (typeof data.list !== 'undefined' ? data.list : []);
  7944. data.totalRow = typeof data.total !== 'undefined' ? data.total : (typeof data.totalRow !== 'undefined' ? data.totalRow : data.list.length);
  7945. return data;
  7946. }
  7947. });
  7948. });
  7949. //给隐藏的元素添加上validate验证触发事件
  7950. $(document).on("change", ".sp_hidden", function () {
  7951. $(this).trigger("validate");
  7952. });
  7953. $(document).on("change", ".sp_input", function () {
  7954. $(this).closest(".sp_container").find(".sp_hidden").trigger("change");
  7955. });
  7956. $(form).on("reset", function () {
  7957. setTimeout(function () {
  7958. $('.selectpage', form).selectPageClear();
  7959. }, 1);
  7960. });
  7961. }
  7962. },
  7963. cxselect: function (form) {
  7964. //绑定cxselect元素事件
  7965. if ($("[data-toggle='cxselect']", form).size() > 0) {
  7966. require(['cxselect'], function () {
  7967. $.cxSelect.defaults.jsonName = 'name';
  7968. $.cxSelect.defaults.jsonValue = 'value';
  7969. $.cxSelect.defaults.jsonSpace = 'data';
  7970. $("[data-toggle='cxselect']", form).cxSelect();
  7971. });
  7972. }
  7973. },
  7974. citypicker: function (form) {
  7975. //绑定城市远程插件
  7976. if ($("[data-toggle='city-picker']", form).size() > 0) {
  7977. require(['citypicker'], function () {
  7978. $(form).on("reset", function () {
  7979. setTimeout(function () {
  7980. $("[data-toggle='city-picker']").citypicker('refresh');
  7981. }, 1);
  7982. });
  7983. });
  7984. }
  7985. },
  7986. datetimepicker: function (form) {
  7987. //绑定日期时间元素事件
  7988. if ($(".datetimepicker", form).size() > 0) {
  7989. require(['bootstrap-datetimepicker'], function () {
  7990. var options = {
  7991. format: 'YYYY-MM-DD HH:mm:ss',
  7992. icons: {
  7993. time: 'fa fa-clock-o',
  7994. date: 'fa fa-calendar',
  7995. up: 'fa fa-chevron-up',
  7996. down: 'fa fa-chevron-down',
  7997. previous: 'fa fa-chevron-left',
  7998. next: 'fa fa-chevron-right',
  7999. today: 'fa fa-history',
  8000. clear: 'fa fa-trash',
  8001. close: 'fa fa-remove'
  8002. },
  8003. showTodayButton: true,
  8004. showClose: true
  8005. };
  8006. $('.datetimepicker', form).parent().css('position', 'relative');
  8007. $('.datetimepicker', form).datetimepicker(options).on('dp.change', function (e) {
  8008. $(this, document).trigger("changed");
  8009. });
  8010. });
  8011. }
  8012. },
  8013. daterangepicker: function (form) {
  8014. //绑定日期时间元素事件
  8015. if ($(".datetimerange", form).size() > 0) {
  8016. require(['bootstrap-daterangepicker'], function () {
  8017. var ranges = {};
  8018. ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
  8019. ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
  8020. ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
  8021. ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
  8022. ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
  8023. ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
  8024. var options = {
  8025. timePicker: false,
  8026. autoUpdateInput: false,
  8027. timePickerSeconds: true,
  8028. timePicker24Hour: true,
  8029. autoApply: true,
  8030. locale: {
  8031. format: 'YYYY-MM-DD HH:mm:ss',
  8032. customRangeLabel: __("Custom Range"),
  8033. applyLabel: __("Apply"),
  8034. cancelLabel: __("Clear"),
  8035. },
  8036. ranges: ranges,
  8037. };
  8038. var origincallback = function (start, end) {
  8039. $(this.element).val(start.format(this.locale.format) + " - " + end.format(this.locale.format));
  8040. $(this.element).trigger('blur');
  8041. };
  8042. $(".datetimerange", form).each(function () {
  8043. var callback = typeof $(this).data('callback') == 'function' ? $(this).data('callback') : origincallback;
  8044. $(this).on('apply.daterangepicker', function (ev, picker) {
  8045. callback.call(picker, picker.startDate, picker.endDate);
  8046. });
  8047. $(this).on('cancel.daterangepicker', function (ev, picker) {
  8048. $(this).val('').trigger('blur');
  8049. });
  8050. $(this).daterangepicker($.extend(true, options, $(this).data()), callback);
  8051. });
  8052. });
  8053. }
  8054. },
  8055. plupload: function (form) {
  8056. //绑定plupload上传元素事件
  8057. if ($(".plupload", form).size() > 0) {
  8058. Upload.api.plupload($(".plupload", form));
  8059. }
  8060. },
  8061. faselect: function (form) {
  8062. //绑定fachoose选择附件事件
  8063. if ($(".fachoose", form).size() > 0) {
  8064. $(".fachoose", form).on('click', function () {
  8065. var that = this;
  8066. var multiple = $(this).data("multiple") ? $(this).data("multiple") : false;
  8067. var mimetype = $(this).data("mimetype") ? $(this).data("mimetype") : '';
  8068. var admin_id = $(this).data("admin-id") ? $(this).data("admin-id") : '';
  8069. var user_id = $(this).data("user-id") ? $(this).data("user-id") : '';
  8070. parent.Fast.api.open("general/attachment/select?element_id=" + $(this).attr("id") + "&multiple=" + multiple + "&mimetype=" + mimetype + "&admin_id=" + admin_id + "&user_id=" + user_id, __('Choose'), {
  8071. callback: function (data) {
  8072. var button = $("#" + $(that).attr("id"));
  8073. var maxcount = $(button).data("maxcount");
  8074. var input_id = $(button).data("input-id") ? $(button).data("input-id") : "";
  8075. maxcount = typeof maxcount !== "undefined" ? maxcount : 0;
  8076. if (input_id && data.multiple) {
  8077. var urlArr = [];
  8078. var inputObj = $("#" + input_id);
  8079. var value = $.trim(inputObj.val());
  8080. if (value !== "") {
  8081. urlArr.push(inputObj.val());
  8082. }
  8083. urlArr.push(data.url)
  8084. var result = urlArr.join(",");
  8085. if (maxcount > 0) {
  8086. var nums = value === '' ? 0 : value.split(/\,/).length;
  8087. var files = data.url !== "" ? data.url.split(/\,/) : [];
  8088. var remains = maxcount - nums;
  8089. if (files.length > remains) {
  8090. Toastr.error(__('You can choose up to %d file%s', remains));
  8091. return false;
  8092. }
  8093. }
  8094. inputObj.val(result).trigger("change").trigger("validate");
  8095. } else {
  8096. $("#" + input_id).val(data.url).trigger("change").trigger("validate");
  8097. }
  8098. }
  8099. });
  8100. return false;
  8101. });
  8102. }
  8103. },
  8104. fieldlist: function (form) {
  8105. //绑定fieldlist
  8106. if ($(".fieldlist", form).size() > 0) {
  8107. require(['dragsort', 'template'], function (undefined, Template) {
  8108. //刷新隐藏textarea的值
  8109. var refresh = function (name) {
  8110. var data = {};
  8111. var textarea = $("textarea[name='" + name + "']", form);
  8112. var container = $(".fieldlist[data-name='" + name + "']");
  8113. var template = container.data("template");
  8114. $.each($("input,select,textarea", container).serializeArray(), function (i, j) {
  8115. var reg = /\[(\w+)\]\[(\w+)\]$/g;
  8116. var match = reg.exec(j.name);
  8117. if (!match)
  8118. return true;
  8119. match[1] = "x" + parseInt(match[1]);
  8120. if (typeof data[match[1]] == 'undefined') {
  8121. data[match[1]] = {};
  8122. }
  8123. data[match[1]][match[2]] = j.value;
  8124. });
  8125. var result = template ? [] : {};
  8126. $.each(data, function (i, j) {
  8127. if (j) {
  8128. if (!template) {
  8129. if (j.key != '') {
  8130. result[j.key] = j.value;
  8131. }
  8132. } else {
  8133. result.push(j);
  8134. }
  8135. }
  8136. });
  8137. textarea.val(JSON.stringify(result));
  8138. };
  8139. //监听文本框改变事件
  8140. $(document).on('change keyup changed', ".fieldlist input,.fieldlist textarea,.fieldlist select", function () {
  8141. refresh($(this).closest(".fieldlist").data("name"));
  8142. });
  8143. //追加控制
  8144. $(".fieldlist", form).on("click", ".btn-append,.append", function (e, row) {
  8145. var container = $(this).closest(".fieldlist");
  8146. var tagName = container.data("tag") || "dd";
  8147. var index = container.data("index");
  8148. var name = container.data("name");
  8149. var template = container.data("template");
  8150. var data = container.data();
  8151. index = index ? parseInt(index) : 0;
  8152. container.data("index", index + 1);
  8153. row = row ? row : {};
  8154. var vars = {index: index, name: name, data: data, row: row};
  8155. var html = template ? Template(template, vars) : Template.render(Form.config.fieldlisttpl, vars);
  8156. $(html).insertBefore($(tagName + ":last", container));
  8157. $(this).trigger("fa.event.appendfieldlist", $(this).closest(tagName).prev());
  8158. });
  8159. //移除控制
  8160. $(".fieldlist", form).on("click", ".btn-remove", function () {
  8161. var container = $(this).closest(".fieldlist");
  8162. var tagName = container.data("tag") || "dd";
  8163. $(this).closest(tagName).remove();
  8164. refresh(container.data("name"));
  8165. });
  8166. //渲染数据&拖拽排序
  8167. $(".fieldlist", form).each(function () {
  8168. var container = this;
  8169. var tagName = $(this).data("tag") || "dd";
  8170. $(this).dragsort({
  8171. itemSelector: tagName,
  8172. dragSelector: ".btn-dragsort",
  8173. dragEnd: function () {
  8174. refresh($(this).closest(".fieldlist").data("name"));
  8175. },
  8176. placeHolderTemplate: $("<" + tagName + "/>")
  8177. });
  8178. var textarea = $("textarea[name='" + $(this).data("name") + "']", form);
  8179. if (textarea.val() == '') {
  8180. return true;
  8181. }
  8182. var template = $(this).data("template");
  8183. var json = {};
  8184. try {
  8185. json = JSON.parse(textarea.val());
  8186. } catch (e) {
  8187. }
  8188. $.each(json, function (i, j) {
  8189. $(".btn-append,.append", container).trigger('click', template ? j : {
  8190. key: i,
  8191. value: j
  8192. });
  8193. });
  8194. });
  8195. });
  8196. }
  8197. },
  8198. switcher: function (form) {
  8199. form.on("click", "[data-toggle='switcher']", function () {
  8200. if ($(this).hasClass("disabled")) {
  8201. return false;
  8202. }
  8203. var input = $(this).prev("input");
  8204. input = $(this).data("input-id") ? $("#" + $(this).data("input-id")) : input;
  8205. if (input.size() > 0) {
  8206. var yes = $(this).data("yes");
  8207. var no = $(this).data("no");
  8208. if (input.val() == yes) {
  8209. input.val(no);
  8210. $("i", this).addClass("fa-flip-horizontal text-gray");
  8211. } else {
  8212. input.val(yes);
  8213. $("i", this).removeClass("fa-flip-horizontal text-gray");
  8214. }
  8215. input.trigger('change');
  8216. }
  8217. return false;
  8218. });
  8219. },
  8220. bindevent: function (form) {
  8221. },
  8222. slider: function (form) {
  8223. if ($(".slider", form).size() > 0) {
  8224. require(['bootstrap-slider'], function () {
  8225. $('.slider').removeClass('hidden').css('width', function (index, value) {
  8226. return $(this).parents('.form-control').width();
  8227. }).slider().on('slide', function (ev) {
  8228. var data = $(this).data();
  8229. if (typeof data.unit !== 'undefined') {
  8230. $(this).parents('.form-control').siblings('.value').text(ev.value + data.unit);
  8231. }
  8232. });
  8233. });
  8234. }
  8235. }
  8236. },
  8237. api: {
  8238. submit: function (form, success, error, submit) {
  8239. if (form.size() === 0) {
  8240. Toastr.error("表单未初始化完成,无法提交");
  8241. return false;
  8242. }
  8243. if (typeof submit === 'function') {
  8244. if (false === submit.call(form, success, error)) {
  8245. return false;
  8246. }
  8247. }
  8248. var type = form.attr("method") ? form.attr("method").toUpperCase() : 'GET';
  8249. type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
  8250. url = form.attr("action");
  8251. url = url ? url : location.href;
  8252. //修复当存在多选项元素时提交的BUG
  8253. var params = {};
  8254. var multipleList = $("[name$='[]']", form);
  8255. if (multipleList.size() > 0) {
  8256. var postFields = form.serializeArray().map(function (obj) {
  8257. return $(obj).prop("name");
  8258. });
  8259. $.each(multipleList, function (i, j) {
  8260. if (postFields.indexOf($(this).prop("name")) < 0) {
  8261. params[$(this).prop("name")] = '';
  8262. }
  8263. });
  8264. }
  8265. //调用Ajax请求方法
  8266. Fast.api.ajax({
  8267. type: type,
  8268. url: url,
  8269. data: form.serialize() + (Object.keys(params).length > 0 ? '&' + $.param(params) : ''),
  8270. dataType: 'json',
  8271. complete: function (xhr) {
  8272. var token = xhr.getResponseHeader('__token__');
  8273. if (token) {
  8274. $("input[name='__token__']").val(token);
  8275. }
  8276. }
  8277. }, function (data, ret) {
  8278. $('.form-group', form).removeClass('has-feedback has-success has-error');
  8279. if (data && typeof data === 'object') {
  8280. //刷新客户端token
  8281. if (typeof data.token !== 'undefined') {
  8282. $("input[name='__token__']").val(data.token);
  8283. }
  8284. //调用客户端事件
  8285. if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
  8286. data.callback.call(form, data);
  8287. }
  8288. }
  8289. if (typeof success === 'function') {
  8290. if (false === success.call(form, data, ret)) {
  8291. return false;
  8292. }
  8293. }
  8294. }, function (data, ret) {
  8295. if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
  8296. $("input[name='__token__']").val(data.token);
  8297. }
  8298. if (typeof error === 'function') {
  8299. if (false === error.call(form, data, ret)) {
  8300. return false;
  8301. }
  8302. }
  8303. });
  8304. return true;
  8305. },
  8306. bindevent: function (form, success, error, submit) {
  8307. form = typeof form === 'object' ? form : $(form);
  8308. var events = Form.events;
  8309. events.bindevent(form);
  8310. events.validator(form, success, error, submit);
  8311. events.selectpicker(form);
  8312. events.daterangepicker(form);
  8313. events.selectpage(form);
  8314. events.cxselect(form);
  8315. events.citypicker(form);
  8316. events.datetimepicker(form);
  8317. events.plupload(form);
  8318. events.faselect(form);
  8319. events.fieldlist(form);
  8320. events.slider(form);
  8321. events.switcher(form);
  8322. },
  8323. custom: {}
  8324. },
  8325. };
  8326. return Form;
  8327. });
  8328. /**
  8329. * FastAdmin通用搜索
  8330. *
  8331. * @author: pppscn <35696959@qq.com>
  8332. * @update 2017-05-07 <https://gitee.com/pp/fastadmin>
  8333. *
  8334. * @author: Karson <karsonzhang@163.com>
  8335. * @update 2018-04-05 <https://gitee.com/karson/fastadmin>
  8336. */
  8337. !function ($) {
  8338. 'use strict';
  8339. var ColumnsForSearch = [];
  8340. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  8341. var initCommonSearch = function (pColumns, that) {
  8342. var vFormCommon = createFormCommon(pColumns, that);
  8343. var vModal = sprintf("<div class=\"commonsearch-table %s\">", that.options.searchFormVisible ? "" : "hidden");
  8344. vModal += vFormCommon;
  8345. vModal += "</div>";
  8346. that.$container.prepend($(vModal));
  8347. that.$commonsearch = $(".commonsearch-table", that.$container);
  8348. var form = $("form.form-commonsearch", that.$commonsearch);
  8349. require(['form'], function (Form) {
  8350. Form.api.bindevent(form);
  8351. form.validator("destroy");
  8352. });
  8353. // 表单提交
  8354. form.on("submit", function (event) {
  8355. event.preventDefault();
  8356. that.onCommonSearch();
  8357. return false;
  8358. });
  8359. // 重置搜索
  8360. form.on("click", "button[type=reset]", function (event) {
  8361. form[0].reset();
  8362. setTimeout(function () {
  8363. that.onCommonSearch();
  8364. }, 0);
  8365. });
  8366. };
  8367. var createFormCommon = function (pColumns, that) {
  8368. // 如果有使用模板则直接返回模板的内容
  8369. if (that.options.searchFormTemplate) {
  8370. return Template(that.options.searchFormTemplate, {columns: pColumns, table: that});
  8371. }
  8372. var htmlForm = [];
  8373. htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" novalidate method="post" action="%s" >', that.options.actionForm));
  8374. htmlForm.push('<fieldset>');
  8375. if (that.options.titleForm.length > 0)
  8376. htmlForm.push(sprintf("<legend>%s</legend>", that.options.titleForm));
  8377. htmlForm.push('<div class="row">');
  8378. for (var i in pColumns) {
  8379. var vObjCol = pColumns[i];
  8380. if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
  8381. var query = Fast.api.query(vObjCol.field);
  8382. var operate = Fast.api.query(vObjCol.field + "-operate");
  8383. vObjCol.defaultValue = that.options.renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
  8384. vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
  8385. ColumnsForSearch.push(vObjCol);
  8386. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  8387. htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, vObjCol.title));
  8388. htmlForm.push('<div class="col-xs-8">');
  8389. vObjCol.operate = vObjCol.operate ? vObjCol.operate.toUpperCase() : '=';
  8390. htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="%s-operate" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate));
  8391. var addClass = typeof vObjCol.addClass === 'undefined' ? (typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass) : 'form-control ' + vObjCol.addClass;
  8392. var extend = typeof vObjCol.extend === 'undefined' ? '' : vObjCol.extend;
  8393. var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style);
  8394. extend = typeof vObjCol.data !== 'undefined' && extend == '' ? vObjCol.data : extend;
  8395. if (vObjCol.searchList) {
  8396. if (typeof vObjCol.searchList === 'function') {
  8397. htmlForm.push(vObjCol.searchList.call(this, vObjCol));
  8398. } else {
  8399. var optionList = [sprintf('<option value="">%s</option>', that.options.formatCommonChoose())];
  8400. if (typeof vObjCol.searchList === 'object' && typeof vObjCol.searchList.then === 'function') {
  8401. (function (vObjCol, that) {
  8402. $.when(vObjCol.searchList).done(function (ret) {
  8403. var searchList = [];
  8404. if (ret.data && ret.data.searchlist && $.isArray(ret.data.searchlist)) {
  8405. searchList = ret.data.searchlist;
  8406. } else if (ret.constructor === Array || ret.constructor === Object) {
  8407. searchList = ret;
  8408. }
  8409. var optionList = createOptionList(searchList, vObjCol, that);
  8410. $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).html(optionList.join(''));
  8411. });
  8412. })(vObjCol, that);
  8413. } else {
  8414. optionList = createOptionList(vObjCol.searchList, vObjCol, that);
  8415. }
  8416. htmlForm.push(sprintf('<select class="%s" name="%s" %s %s>%s</select>', addClass, vObjCol.field, style, extend, optionList.join('')));
  8417. }
  8418. } else {
  8419. var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder;
  8420. var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type;
  8421. var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
  8422. if (/BETWEEN$/.test(vObjCol.operate)) {
  8423. var defaultValueArr = defaultValue.toString().match(/\|/) ? defaultValue.split('|') : ['', ''];
  8424. var placeholderArr = placeholder.toString().match(/\|/) ? placeholder.split('|') : [placeholder, placeholder];
  8425. htmlForm.push('<div class="row row-between">');
  8426. htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[0], placeholderArr[0], vObjCol.field, i, style, extend));
  8427. htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addClass, vObjCol.field, defaultValueArr[1], placeholderArr[1], vObjCol.field, i, style, extend));
  8428. htmlForm.push('</div>');
  8429. } else {
  8430. htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s>', type, addClass, vObjCol.field, defaultValue, placeholder, vObjCol.field, i, style, extend));
  8431. }
  8432. }
  8433. htmlForm.push('</div>');
  8434. htmlForm.push('</div>');
  8435. }
  8436. }
  8437. htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
  8438. htmlForm.push(createFormBtn(that).join(''));
  8439. htmlForm.push('</div>');
  8440. htmlForm.push('</div>');
  8441. htmlForm.push('</fieldset>');
  8442. htmlForm.push('</form>');
  8443. return htmlForm.join('');
  8444. };
  8445. var createFormBtn = function (that) {
  8446. var htmlBtn = [];
  8447. var searchSubmit = that.options.formatCommonSubmitButton();
  8448. var searchReset = that.options.formatCommonResetButton();
  8449. htmlBtn.push('<div class="col-sm-8 col-xs-offset-4">');
  8450. htmlBtn.push(sprintf('<button type="submit" class="btn btn-success" formnovalidate>%s</button> ', searchSubmit));
  8451. htmlBtn.push(sprintf('<button type="reset" class="btn btn-default" >%s</button> ', searchReset));
  8452. htmlBtn.push('</div>');
  8453. return htmlBtn;
  8454. };
  8455. var createOptionList = function (searchList, vObjCol, that) {
  8456. var isArray = searchList.constructor === Array;
  8457. var optionList = [];
  8458. optionList.push(sprintf('<option value="">%s</option>', that.options.formatCommonChoose()));
  8459. $.each(searchList, function (key, value) {
  8460. if (value.constructor === Object) {
  8461. key = value.id;
  8462. value = value.name;
  8463. } else {
  8464. key = isArray ? value : key;
  8465. }
  8466. optionList.push(sprintf("<option value='" + key + "' %s>" + value + "</option>", key == vObjCol.defaultValue ? 'selected' : ''));
  8467. });
  8468. return optionList;
  8469. };
  8470. var isSearchAvailble = function (that) {
  8471. //只支持服务端搜索
  8472. if (!that.options.commonSearch || that.options.sidePagination != 'server' || !that.options.url) {
  8473. return false;
  8474. }
  8475. return true;
  8476. };
  8477. var getSearchQuery = function (that, removeempty) {
  8478. var op = {};
  8479. var filter = {};
  8480. var value = '';
  8481. $("form.form-commonsearch .operate", that.$commonsearch).each(function (i) {
  8482. var name = $(this).data("name");
  8483. var sym = $(this).is("select") ? $("option:selected", this).val() : $(this).val().toUpperCase();
  8484. var obj = $("[name='" + name + "']", that.$commonsearch);
  8485. if (obj.size() == 0)
  8486. return true;
  8487. var vObjCol = ColumnsForSearch[i];
  8488. var process = !that.options.searchFormTemplate && vObjCol && typeof vObjCol.process == 'function' ? vObjCol.process : null;
  8489. if (obj.size() > 1) {
  8490. if (/BETWEEN$/.test(sym)) {
  8491. var value_begin = $.trim($("[name='" + name + "']:first", that.$commonsearch).val()),
  8492. value_end = $.trim($("[name='" + name + "']:last", that.$commonsearch).val());
  8493. if (value_begin.length || value_end.length) {
  8494. if (process) {
  8495. value_begin = process(value_begin, 'begin');
  8496. value_end = process(value_end, 'end');
  8497. }
  8498. value = value_begin + ',' + value_end;
  8499. } else {
  8500. value = '';
  8501. }
  8502. //如果是时间筛选,将operate置为RANGE
  8503. if ($("[name='" + name + "']:first", that.$commonsearch).hasClass("datetimepicker")) {
  8504. sym = 'RANGE';
  8505. }
  8506. } else {
  8507. value = $("[name='" + name + "']:checked", that.$commonsearch).val();
  8508. value = process ? process(value) : value;
  8509. }
  8510. } else {
  8511. value = process ? process(obj.val()) : obj.val();
  8512. }
  8513. if (removeempty && (value == '' || value == null || ($.isArray(value) && value.length == 0)) && !sym.match(/null/i)) {
  8514. return true;
  8515. }
  8516. op[name] = sym;
  8517. filter[name] = value;
  8518. });
  8519. return {op: op, filter: filter};
  8520. };
  8521. var getQueryParams = function (params, searchQuery, removeempty) {
  8522. params.filter = typeof params.filter === 'Object' ? params.filter : (params.filter ? JSON.parse(params.filter) : {});
  8523. params.op = typeof params.op === 'Object' ? params.op : (params.op ? JSON.parse(params.op) : {});
  8524. params.filter = $.extend({}, params.filter, searchQuery.filter);
  8525. params.op = $.extend({}, params.op, searchQuery.op);
  8526. //移除empty的值
  8527. if (removeempty) {
  8528. $.each(params.filter, function (i, j) {
  8529. if ((j == '' || j == null || ($.isArray(j) && j.length == 0)) && !params.op[i].match(/null/i)) {
  8530. delete params.filter[i];
  8531. delete params.op[i];
  8532. }
  8533. });
  8534. }
  8535. params.filter = JSON.stringify(params.filter);
  8536. params.op = JSON.stringify(params.op);
  8537. return params;
  8538. };
  8539. $.extend($.fn.bootstrapTable.defaults, {
  8540. commonSearch: false,
  8541. titleForm: "Common search",
  8542. actionForm: "",
  8543. searchFormTemplate: "",
  8544. searchFormVisible: true,
  8545. searchClass: 'searchit',
  8546. showSearch: true,
  8547. renderDefault: true,
  8548. onCommonSearch: function (field, text) {
  8549. return false;
  8550. },
  8551. onPostCommonSearch: function (table) {
  8552. return false;
  8553. }
  8554. });
  8555. $.extend($.fn.bootstrapTable.defaults.icons, {
  8556. commonSearchIcon: 'glyphicon-search'
  8557. });
  8558. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  8559. 'common-search.bs.table': 'onCommonSearch',
  8560. 'post-common-search.bs.table': 'onPostCommonSearch'
  8561. });
  8562. $.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
  8563. formatCommonSearch: function () {
  8564. return "Common search";
  8565. },
  8566. formatCommonSubmitButton: function () {
  8567. return "Submit";
  8568. },
  8569. formatCommonResetButton: function () {
  8570. return "Reset";
  8571. },
  8572. formatCommonCloseButton: function () {
  8573. return "Close";
  8574. },
  8575. formatCommonChoose: function () {
  8576. return "Choose";
  8577. }
  8578. });
  8579. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  8580. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  8581. _initHeader = BootstrapTable.prototype.initHeader,
  8582. _initToolbar = BootstrapTable.prototype.initToolbar,
  8583. _load = BootstrapTable.prototype.load,
  8584. _initSearch = BootstrapTable.prototype.initSearch;
  8585. BootstrapTable.prototype.initHeader = function () {
  8586. _initHeader.apply(this, Array.prototype.slice.apply(arguments));
  8587. this.$header.find('th[data-field]').each(function (i) {
  8588. var column = $(this).data();
  8589. if (typeof column['width'] !== 'undefined') {
  8590. $(this).css("min-width", column['width']);
  8591. }
  8592. });
  8593. };
  8594. BootstrapTable.prototype.initToolbar = function () {
  8595. _initToolbar.apply(this, Array.prototype.slice.apply(arguments));
  8596. if (!isSearchAvailble(this)) {
  8597. return;
  8598. }
  8599. var that = this,
  8600. html = [];
  8601. if (that.options.showSearch) {
  8602. html.push(sprintf('<div class="columns-%s pull-%s" style="margin-top:10px;margin-bottom:10px;">', this.options.buttonsAlign, this.options.buttonsAlign));
  8603. html.push(sprintf('<button class="btn btn-default%s' + '" type="button" name="commonSearch" title="%s">', that.options.iconSize === undefined ? '' : ' btn-' + that.options.iconSize, that.options.formatCommonSearch()));
  8604. html.push(sprintf('<i class="%s %s"></i>', that.options.iconsPrefix, that.options.icons.commonSearchIcon))
  8605. html.push('</button></div>');
  8606. }
  8607. if (that.$toolbar.find(".pull-right").size() > 0) {
  8608. $(html.join('')).insertBefore(that.$toolbar.find(".pull-right:first"));
  8609. } else {
  8610. that.$toolbar.append(html.join(''));
  8611. }
  8612. initCommonSearch(that.columns, that);
  8613. that.$toolbar.find('button[name="commonSearch"]')
  8614. .off('click').on('click', function () {
  8615. that.$commonsearch.toggleClass("hidden");
  8616. return;
  8617. });
  8618. that.$container.on("click", "." + that.options.searchClass, function () {
  8619. var obj = $("form [name='" + $(this).data("field") + "']", that.$commonsearch);
  8620. if (obj.size() > 0) {
  8621. var value = $(this).data("value");
  8622. if (obj.is("select")) {
  8623. $("option[value='" + value + "']", obj).prop("selected", true);
  8624. } else if (obj.size() > 1) {
  8625. $("form [name='" + $(this).data("field") + "'][value='" + value + "']", that.$commonsearch).prop("checked", true);
  8626. } else {
  8627. obj.val(value);
  8628. }
  8629. obj.trigger("change");
  8630. $("form", that.$commonsearch).trigger("submit");
  8631. }
  8632. });
  8633. var queryParams = that.options.queryParams;
  8634. //匹配默认搜索值
  8635. this.options.queryParams = function (params) {
  8636. return queryParams(getQueryParams(params, getSearchQuery(that, true)));
  8637. };
  8638. this.trigger('post-common-search', that);
  8639. };
  8640. BootstrapTable.prototype.onCommonSearch = function () {
  8641. var searchQuery = getSearchQuery(this);
  8642. this.trigger('common-search', this, searchQuery);
  8643. this.options.pageNumber = 1;
  8644. //this.options.pageSize = $.fn.bootstrapTable.defaults.pageSize;
  8645. this.refresh({});
  8646. };
  8647. BootstrapTable.prototype.load = function (data) {
  8648. _load.apply(this, Array.prototype.slice.apply(arguments));
  8649. if (!isSearchAvailble(this)) {
  8650. return;
  8651. }
  8652. };
  8653. BootstrapTable.prototype.initSearch = function () {
  8654. _initSearch.apply(this, Array.prototype.slice.apply(arguments));
  8655. if (!isSearchAvailble(this)) {
  8656. return;
  8657. }
  8658. var that = this;
  8659. var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
  8660. this.data = fp ? $.grep(this.data, function (item, i) {
  8661. for (var key in fp) {
  8662. var fval = fp[key].toLowerCase();
  8663. var value = item[key];
  8664. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header,
  8665. that.header.formatters[$.inArray(key, that.header.fields)],
  8666. [value, item, i], value);
  8667. if (!($.inArray(key, that.header.fields) !== -1 &&
  8668. (typeof value === 'string' || typeof value === 'number') &&
  8669. (value + '').toLowerCase().indexOf(fval) !== -1)) {
  8670. return false;
  8671. }
  8672. }
  8673. return true;
  8674. }) : this.data;
  8675. };
  8676. }(jQuery);
  8677. define("bootstrap-table-commonsearch", ["bootstrap-table"], (function (global) {
  8678. return function () {
  8679. var ret, fn;
  8680. return ret || global.$.fn.bootstrapTable.defaults;
  8681. };
  8682. }(this)));
  8683. /**
  8684. * 将BootstrapTable的行使用自定义的模板来渲染
  8685. *
  8686. * @author: karson
  8687. * @version: v0.0.1
  8688. *
  8689. * @update 2017-06-24 <http://github.com/karsonzhang/fastadmin>
  8690. */
  8691. !function ($) {
  8692. 'use strict';
  8693. $.extend($.fn.bootstrapTable.defaults, {
  8694. //是否启用模板渲染
  8695. templateView: false,
  8696. //数据格式化的模板ID或格式函数
  8697. templateFormatter: "itemtpl",
  8698. //添加的父类的class
  8699. templateParentClass: "row row-flex",
  8700. //向table添加的class
  8701. templateTableClass: "table-template",
  8702. });
  8703. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  8704. _initContainer = BootstrapTable.prototype.initContainer,
  8705. _initBody = BootstrapTable.prototype.initBody,
  8706. _initRow = BootstrapTable.prototype.initRow;
  8707. BootstrapTable.prototype.initContainer = function () {
  8708. _initContainer.apply(this, Array.prototype.slice.apply(arguments));
  8709. var that = this;
  8710. if (!that.options.templateView) {
  8711. return;
  8712. }
  8713. that.options.cardView = true;
  8714. };
  8715. BootstrapTable.prototype.initBody = function () {
  8716. var that = this;
  8717. $.extend(that.options, {
  8718. showHeader: !that.options.templateView ? $.fn.bootstrapTable.defaults.showHeader : false,
  8719. showFooter: !that.options.templateView ? $.fn.bootstrapTable.defaults.showFooter : false,
  8720. });
  8721. $(that.$el).toggleClass(that.options.templateTableClass, that.options.templateView);
  8722. _initBody.apply(this, Array.prototype.slice.apply(arguments));
  8723. if (!that.options.templateView) {
  8724. return;
  8725. } else {
  8726. //由于Bootstrap是基于Table的,添加一个父类容器
  8727. $("> *:not(.no-records-found)", that.$body).wrapAll($("<div />").addClass(that.options.templateParentClass));
  8728. }
  8729. };
  8730. BootstrapTable.prototype.initRow = function (item, i, data, parentDom) {
  8731. var that = this;
  8732. //如果未启用则使用原生的initRow方法
  8733. if (!that.options.templateView) {
  8734. return _initRow.apply(that, Array.prototype.slice.apply(arguments));
  8735. }
  8736. var $content = '';
  8737. if (typeof that.options.templateFormatter === 'function') {
  8738. $content = that.options.templateFormatter.call(that, item, i, data);
  8739. } else {
  8740. var Template = require('template');
  8741. $content = Template(that.options.templateFormatter, {item: item, i: i, data: data});
  8742. }
  8743. return $content;
  8744. };
  8745. }(jQuery);
  8746. define("bootstrap-table-template", ["bootstrap-table","template"], (function (global) {
  8747. return function () {
  8748. var ret, fn;
  8749. return ret || global.$.fn.bootstrapTable.defaults;
  8750. };
  8751. }(this)));
  8752. /**
  8753. * @author Jay <jwang@dizsoft.com>
  8754. */
  8755. (function ($) {
  8756. 'use strict';
  8757. var sprintf = $.fn.bootstrapTable.utils.sprintf;
  8758. $.extend($.fn.bootstrapTable.defaults, {
  8759. showJumpto: false,
  8760. exportOptions: {}
  8761. });
  8762. $.extend($.fn.bootstrapTable.locales, {
  8763. formatJumpto: function () {
  8764. return 'GO';
  8765. }
  8766. });
  8767. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  8768. var BootstrapTable = $.fn.bootstrapTable.Constructor,
  8769. _initPagination = BootstrapTable.prototype.initPagination;
  8770. BootstrapTable.prototype.initPagination = function () {
  8771. this.showToolbar = this.options.showExport;
  8772. _initPagination.apply(this, Array.prototype.slice.apply(arguments));
  8773. if (this.options.showJumpto) {
  8774. var that = this,
  8775. $pageGroup = this.$pagination.find('ul.pagination'),
  8776. $jumpto = $pageGroup.find('li.jumpto');
  8777. if (!$jumpto.length) {
  8778. $jumpto = $([
  8779. '<li class="jumpto">',
  8780. '<input type="text" class="form-control">',
  8781. '<button class="btn' +
  8782. sprintf(' btn-%s', this.options.buttonsClass) +
  8783. sprintf(' btn-%s', this.options.iconSize) +
  8784. '" title="' + this.options.formatJumpto() + '" ' +
  8785. ' type="button">'+this.options.formatJumpto(),
  8786. '</button>',
  8787. '</li>'].join('')).appendTo($pageGroup);
  8788. $jumpto.find('button').click(function () {
  8789. that.selectPage(parseInt($jumpto.find('input').val()));
  8790. });
  8791. }
  8792. }
  8793. };
  8794. })(jQuery);
  8795. define("bootstrap-table-jumpto", ["bootstrap-table"], (function (global) {
  8796. return function () {
  8797. var ret, fn;
  8798. return ret || global.$.fn.bootstrapTable.defaults;
  8799. };
  8800. }(this)));
  8801. define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-export', 'bootstrap-table-commonsearch', 'bootstrap-table-template', 'bootstrap-table-jumpto'], function ($, undefined, Moment) {
  8802. var Table = {
  8803. list: {},
  8804. // Bootstrap-table 基础配置
  8805. defaults: {
  8806. url: '',
  8807. sidePagination: 'server',
  8808. method: 'get', //请求方法
  8809. toolbar: ".toolbar", //工具栏
  8810. search: true, //是否启用快速搜索
  8811. cache: false,
  8812. commonSearch: true, //是否启用通用搜索
  8813. searchFormVisible: false, //是否始终显示搜索表单
  8814. titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索
  8815. idTable: 'commonTable',
  8816. showExport: true,
  8817. exportDataType: "all",
  8818. exportTypes: ['json', 'xml', 'csv', 'txt', 'doc', 'excel'],
  8819. exportOptions: {
  8820. fileName: 'export_' + Moment().format("YYYY-MM-DD"),
  8821. ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
  8822. },
  8823. pageSize: 10,
  8824. pageList: [10, 25, 50, 'All'],
  8825. pagination: true,
  8826. clickToSelect: true, //是否启用点击选中
  8827. dblClickToEdit: true, //是否启用双击编辑
  8828. singleSelect: false, //是否启用单选
  8829. showRefresh: false,
  8830. showJumpto: true,
  8831. locale: 'zh-CN',
  8832. showToggle: true,
  8833. showColumns: true,
  8834. pk: 'id',
  8835. sortName: 'id',
  8836. sortOrder: 'desc',
  8837. paginationFirstText: __("First"),
  8838. paginationPreText: __("Previous"),
  8839. paginationNextText: __("Next"),
  8840. paginationLastText: __("Last"),
  8841. cardView: false, //卡片视图
  8842. checkOnInit: true, //是否在初始化时判断
  8843. escape: true, //是否对内容进行转义
  8844. extend: {
  8845. index_url: '',
  8846. add_url: '',
  8847. edit_url: '',
  8848. del_url: '',
  8849. import_url: '',
  8850. multi_url: '',
  8851. dragsort_url: 'ajax/weigh',
  8852. }
  8853. },
  8854. // Bootstrap-table 列配置
  8855. columnDefaults: {
  8856. align: 'center',
  8857. valign: 'middle',
  8858. },
  8859. config: {
  8860. firsttd: 'tbody tr td:first-child:not(:has(div.card-views))',
  8861. toolbar: '.toolbar',
  8862. refreshbtn: '.btn-refresh',
  8863. addbtn: '.btn-add',
  8864. editbtn: '.btn-edit',
  8865. delbtn: '.btn-del',
  8866. importbtn: '.btn-import',
  8867. multibtn: '.btn-multi',
  8868. disabledbtn: '.btn-disabled',
  8869. editonebtn: '.btn-editone',
  8870. restoreonebtn: '.btn-restoreone',
  8871. destroyonebtn: '.btn-destroyone',
  8872. restoreallbtn: '.btn-restoreall',
  8873. destroyallbtn: '.btn-destroyall',
  8874. dragsortfield: 'weigh',
  8875. },
  8876. button: {
  8877. edit: {
  8878. name: 'edit',
  8879. icon: 'fa fa-pencil',
  8880. title: __('Edit'),
  8881. extend: 'data-toggle="tooltip"',
  8882. classname: 'btn btn-xs btn-success btn-editone'
  8883. },
  8884. del: {
  8885. name: 'del',
  8886. icon: 'fa fa-trash',
  8887. title: __('Del'),
  8888. extend: 'data-toggle="tooltip"',
  8889. classname: 'btn btn-xs btn-danger btn-delone'
  8890. },
  8891. dragsort: {
  8892. name: 'dragsort',
  8893. icon: 'fa fa-arrows',
  8894. title: __('Drag to sort'),
  8895. extend: 'data-toggle="tooltip"',
  8896. classname: 'btn btn-xs btn-primary btn-dragsort'
  8897. }
  8898. },
  8899. api: {
  8900. init: function (defaults, columnDefaults, locales) {
  8901. defaults = defaults ? defaults : {};
  8902. columnDefaults = columnDefaults ? columnDefaults : {};
  8903. locales = locales ? locales : {};
  8904. // 如果是iOS设备则启用卡片视图
  8905. if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
  8906. Table.defaults.cardView = true;
  8907. }
  8908. // 写入bootstrap-table默认配置
  8909. $.extend(true, $.fn.bootstrapTable.defaults, Table.defaults, defaults);
  8910. // 写入bootstrap-table column配置
  8911. $.extend($.fn.bootstrapTable.columnDefaults, Table.columnDefaults, columnDefaults);
  8912. // 写入bootstrap-table locale配置
  8913. $.extend($.fn.bootstrapTable.locales[Table.defaults.locale], {
  8914. formatCommonSearch: function () {
  8915. return __('Common search');
  8916. },
  8917. formatCommonSubmitButton: function () {
  8918. return __('Submit');
  8919. },
  8920. formatCommonResetButton: function () {
  8921. return __('Reset');
  8922. },
  8923. formatCommonCloseButton: function () {
  8924. return __('Close');
  8925. },
  8926. formatCommonChoose: function () {
  8927. return __('Choose');
  8928. },
  8929. formatJumpto: function () {
  8930. return __('Go');
  8931. }
  8932. }, locales);
  8933. if (typeof defaults.exportTypes != 'undefined') {
  8934. $.fn.bootstrapTable.defaults.exportTypes = defaults.exportTypes;
  8935. }
  8936. },
  8937. // 绑定事件
  8938. bindevent: function (table) {
  8939. //Bootstrap-table的父元素,包含table,toolbar,pagnation
  8940. var parenttable = table.closest('.bootstrap-table');
  8941. //Bootstrap-table配置
  8942. var options = table.bootstrapTable('getOptions');
  8943. //Bootstrap操作区
  8944. var toolbar = $(options.toolbar, parenttable);
  8945. //当刷新表格时
  8946. table.on('load-error.bs.table', function (status, res, e) {
  8947. if (e.status === 0) {
  8948. return;
  8949. }
  8950. Toastr.error(__('Unknown data format'));
  8951. });
  8952. //当加载数据成功时
  8953. table.on('load-success.bs.table', function (e, data) {
  8954. if (typeof data.rows === 'undefined' && typeof data.code != 'undefined') {
  8955. Toastr.error(data.msg);
  8956. }
  8957. });
  8958. //当刷新表格时
  8959. table.on('refresh.bs.table', function (e, settings, data) {
  8960. $(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
  8961. });
  8962. if (options.dblClickToEdit) {
  8963. //当双击单元格时
  8964. table.on('dbl-click-row.bs.table', function (e, row, element, field) {
  8965. $(Table.config.editonebtn, element).trigger("click");
  8966. });
  8967. }
  8968. //当内容渲染完成后
  8969. table.on('post-body.bs.table', function (e, settings, json, xhr) {
  8970. $(Table.config.refreshbtn, toolbar).find(".fa").removeClass("fa-spin");
  8971. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', true);
  8972. if ($(Table.config.firsttd, table).find("input[type='checkbox'][data-index]").size() > 0) {
  8973. // 挺拽选择,需要重新绑定事件
  8974. require(['drag', 'drop'], function () {
  8975. $(Table.config.firsttd, table).drag("start", function (ev, dd) {
  8976. return $('<div class="selection" />').css('opacity', .65).appendTo(document.body);
  8977. }).drag(function (ev, dd) {
  8978. $(dd.proxy).css({
  8979. top: Math.min(ev.pageY, dd.startY),
  8980. left: Math.min(ev.pageX, dd.startX),
  8981. height: Math.abs(ev.pageY - dd.startY),
  8982. width: Math.abs(ev.pageX - dd.startX)
  8983. });
  8984. }).drag("end", function (ev, dd) {
  8985. $(dd.proxy).remove();
  8986. });
  8987. $(Table.config.firsttd, table).drop("start", function () {
  8988. Table.api.toggleattr(this);
  8989. }).drop(function () {
  8990. Table.api.toggleattr(this);
  8991. }).drop("end", function () {
  8992. Table.api.toggleattr(this);
  8993. });
  8994. $.drop({
  8995. multi: true
  8996. });
  8997. });
  8998. }
  8999. });
  9000. // 处理选中筛选框后按钮的状态统一变更
  9001. table.on('check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table', function () {
  9002. var ids = Table.api.selectedids(table);
  9003. $(Table.config.disabledbtn, toolbar).toggleClass('disabled', !ids.length);
  9004. });
  9005. // 绑定TAB事件
  9006. $('.panel-heading [data-field] a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
  9007. var field = $(this).closest("[data-field]").data("field");
  9008. var value = $(this).data("value");
  9009. var object = $("[name='" + field + "']", table.closest(".bootstrap-table").find(".commonsearch-table"));
  9010. if (object.prop('tagName') == "SELECT") {
  9011. $("option[value='" + value + "']", object).prop("selected", true);
  9012. } else {
  9013. object.val(value);
  9014. }
  9015. table.bootstrapTable('refresh', {pageNumber: 1});
  9016. return false;
  9017. });
  9018. // 刷新按钮事件
  9019. $(toolbar).on('click', Table.config.refreshbtn, function () {
  9020. table.bootstrapTable('refresh');
  9021. });
  9022. // 添加按钮事件
  9023. $(toolbar).on('click', Table.config.addbtn, function () {
  9024. var ids = Table.api.selectedids(table);
  9025. var url = options.extend.add_url;
  9026. if (url.indexOf("{ids}") !== -1) {
  9027. url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
  9028. }
  9029. Fast.api.open(url, __('Add'), $(this).data() || {});
  9030. });
  9031. // 导入按钮事件
  9032. if ($(Table.config.importbtn, toolbar).size() > 0) {
  9033. require(['upload'], function (Upload) {
  9034. Upload.api.plupload($(Table.config.importbtn, toolbar), function (data, ret) {
  9035. Fast.api.ajax({
  9036. url: options.extend.import_url,
  9037. data: {file: data.url},
  9038. }, function (data, ret) {
  9039. table.bootstrapTable('refresh');
  9040. });
  9041. });
  9042. });
  9043. }
  9044. // 批量编辑按钮事件
  9045. $(toolbar).on('click', Table.config.editbtn, function () {
  9046. var that = this;
  9047. //循环弹出多个编辑框
  9048. $.each(table.bootstrapTable('getSelections'), function (index, row) {
  9049. var url = options.extend.edit_url;
  9050. row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
  9051. var url = Table.api.replaceurl(url, row, table);
  9052. Fast.api.open(url, __('Edit'), $(that).data() || {});
  9053. });
  9054. });
  9055. //清空回收站
  9056. $(document).on('click', Table.config.destroyallbtn, function () {
  9057. var that = this;
  9058. Layer.confirm(__('Are you sure you want to truncate?'), function () {
  9059. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  9060. Fast.api.ajax(url, function () {
  9061. Layer.closeAll();
  9062. table.bootstrapTable('refresh');
  9063. }, function () {
  9064. Layer.closeAll();
  9065. });
  9066. });
  9067. return false;
  9068. });
  9069. //还原或删除
  9070. $(document).on('click', Table.config.restoreallbtn + ',' + Table.config.restoreonebtn + ',' + Table.config.destroyonebtn, function () {
  9071. var that = this;
  9072. var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
  9073. Fast.api.ajax(url, function () {
  9074. table.bootstrapTable('refresh');
  9075. });
  9076. return false;
  9077. });
  9078. // 批量操作按钮事件
  9079. $(toolbar).on('click', Table.config.multibtn, function () {
  9080. var ids = Table.api.selectedids(table);
  9081. Table.api.multi($(this).data("action"), ids, table, this);
  9082. });
  9083. // 批量删除按钮事件
  9084. $(toolbar).on('click', Table.config.delbtn, function () {
  9085. var that = this;
  9086. var ids = Table.api.selectedids(table);
  9087. Layer.confirm(
  9088. __('Are you sure you want to delete the %s selected item?', ids.length),
  9089. {icon: 3, title: __('Warning'), offset: 0, shadeClose: true},
  9090. function (index) {
  9091. Table.api.multi("del", ids, table, that);
  9092. Layer.close(index);
  9093. }
  9094. );
  9095. });
  9096. // 拖拽排序
  9097. require(['dragsort'], function () {
  9098. //绑定拖动排序
  9099. $("tbody", table).dragsort({
  9100. itemSelector: 'tr:visible',
  9101. dragSelector: "a.btn-dragsort",
  9102. dragEnd: function (a, b) {
  9103. var element = $("a.btn-dragsort", this);
  9104. var data = table.bootstrapTable('getData');
  9105. var current = data[parseInt($(this).data("index"))];
  9106. var options = table.bootstrapTable('getOptions');
  9107. //改变的值和改变的ID集合
  9108. var ids = $.map($("tbody tr:visible", table), function (tr) {
  9109. return data[parseInt($(tr).data("index"))][options.pk];
  9110. });
  9111. var changeid = current[options.pk];
  9112. var pid = typeof current.pid != 'undefined' ? current.pid : '';
  9113. var params = {
  9114. url: table.bootstrapTable('getOptions').extend.dragsort_url,
  9115. data: {
  9116. ids: ids.join(','),
  9117. changeid: changeid,
  9118. pid: pid,
  9119. field: Table.config.dragsortfield,
  9120. orderway: options.sortOrder,
  9121. table: options.extend.table,
  9122. pk: options.pk
  9123. }
  9124. };
  9125. Fast.api.ajax(params, function (data, ret) {
  9126. var success = $(element).data("success") || $.noop;
  9127. if (typeof success === 'function') {
  9128. if (false === success.call(element, data, ret)) {
  9129. return false;
  9130. }
  9131. }
  9132. table.bootstrapTable('refresh');
  9133. }, function (data, ret) {
  9134. var error = $(element).data("error") || $.noop;
  9135. if (typeof error === 'function') {
  9136. if (false === error.call(element, data, ret)) {
  9137. return false;
  9138. }
  9139. }
  9140. table.bootstrapTable('refresh');
  9141. });
  9142. },
  9143. placeHolderTemplate: ""
  9144. });
  9145. });
  9146. $(table).on("click", "input[data-id][name='checkbox']", function (e) {
  9147. var ids = $(this).data("id");
  9148. var row = Table.api.getrowbyid(table, ids);
  9149. table.trigger('check.bs.table', [row, this]);
  9150. });
  9151. $(table).on("click", "[data-id].btn-change", function (e) {
  9152. e.preventDefault();
  9153. Table.api.multi($(this).data("action") ? $(this).data("action") : '', [$(this).data("id")], table, this);
  9154. });
  9155. $(table).on("click", "[data-id].btn-edit", function (e) {
  9156. e.preventDefault();
  9157. var ids = $(this).data("id");
  9158. var row = Table.api.getrowbyid(table, ids);
  9159. row.ids = ids;
  9160. var url = Table.api.replaceurl(options.extend.edit_url, row, table);
  9161. Fast.api.open(url, __('Edit'), $(this).data() || {});
  9162. });
  9163. $(table).on("click", "[data-id].btn-del", function (e) {
  9164. e.preventDefault();
  9165. var id = $(this).data("id");
  9166. var that = this;
  9167. Layer.confirm(
  9168. __('Are you sure you want to delete this item?'),
  9169. {icon: 3, title: __('Warning'), shadeClose: true},
  9170. function (index) {
  9171. Table.api.multi("del", id, table, that);
  9172. Layer.close(index);
  9173. }
  9174. );
  9175. });
  9176. var id = table.attr("id");
  9177. Table.list[id] = table;
  9178. return table;
  9179. },
  9180. // 批量操作请求
  9181. multi: function (action, ids, table, element) {
  9182. var options = table.bootstrapTable('getOptions');
  9183. var data = element ? $(element).data() : {};
  9184. var ids = ($.isArray(ids) ? ids.join(",") : ids);
  9185. var url = typeof data.url !== "undefined" ? data.url : (action == "del" ? options.extend.del_url : options.extend.multi_url);
  9186. url = this.replaceurl(url, {ids: ids}, table);
  9187. var params = typeof data.params !== "undefined" ? (typeof data.params == 'object' ? $.param(data.params) : data.params) : '';
  9188. var options = {url: url, data: {action: action, ids: ids, params: params}};
  9189. Fast.api.ajax(options, function (data, ret) {
  9190. var success = $(element).data("success") || $.noop;
  9191. if (typeof success === 'function') {
  9192. if (false === success.call(element, data, ret)) {
  9193. return false;
  9194. }
  9195. }
  9196. table.bootstrapTable('refresh');
  9197. }, function (data, ret) {
  9198. var error = $(element).data("error") || $.noop;
  9199. if (typeof error === 'function') {
  9200. if (false === error.call(element, data, ret)) {
  9201. return false;
  9202. }
  9203. }
  9204. });
  9205. },
  9206. // 单元格元素事件
  9207. events: {
  9208. operate: {
  9209. 'click .btn-editone': function (e, value, row, index) {
  9210. e.stopPropagation();
  9211. e.preventDefault();
  9212. var table = $(this).closest('table');
  9213. var options = table.bootstrapTable('getOptions');
  9214. var ids = row[options.pk];
  9215. row = $.extend({}, row ? row : {}, {ids: ids});
  9216. var url = options.extend.edit_url;
  9217. Fast.api.open(Table.api.replaceurl(url, row, table), __('Edit'), $(this).data() || {});
  9218. },
  9219. 'click .btn-delone': function (e, value, row, index) {
  9220. e.stopPropagation();
  9221. e.preventDefault();
  9222. var that = this;
  9223. var top = $(that).offset().top - $(window).scrollTop();
  9224. var left = $(that).offset().left - $(window).scrollLeft() - 260;
  9225. if (top + 154 > $(window).height()) {
  9226. top = top - 154;
  9227. }
  9228. if ($(window).width() < 480) {
  9229. top = left = undefined;
  9230. }
  9231. Layer.confirm(
  9232. __('Are you sure you want to delete this item?'),
  9233. {icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true},
  9234. function (index) {
  9235. var table = $(that).closest('table');
  9236. var options = table.bootstrapTable('getOptions');
  9237. Table.api.multi("del", row[options.pk], table, that);
  9238. Layer.close(index);
  9239. }
  9240. );
  9241. }
  9242. },//单元格图片预览
  9243. image: {
  9244. 'click .img-center': function (e, value, row, index) {
  9245. var data = [];
  9246. value = value.toString().split(",");
  9247. $.each(value, function (index, value) {
  9248. data.push({
  9249. src: Fast.api.cdnurl(value),
  9250. });
  9251. });
  9252. Layer.photos({
  9253. photos: {
  9254. "start": $(this).parent().index(),
  9255. "data": data
  9256. },
  9257. anim: 5 //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  9258. });
  9259. },
  9260. }
  9261. },
  9262. // 单元格数据格式化
  9263. formatter: {
  9264. icon: function (value, row, index) {
  9265. if (!value)
  9266. return '';
  9267. value = value === null ? '' : value.toString();
  9268. value = value.indexOf(" ") > -1 ? value : "fa fa-" + value;
  9269. //渲染fontawesome图标
  9270. return '<i class="' + value + '"></i> ' + value;
  9271. },
  9272. image: function (value, row, index) {
  9273. value = value ? value : '/assets/img/blank.gif';
  9274. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  9275. return '<a href="javascript:"><img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" /></a>';
  9276. },
  9277. images: function (value, row, index) {
  9278. value = value === null ? '' : value.toString();
  9279. var classname = typeof this.classname !== 'undefined' ? this.classname : 'img-sm img-center';
  9280. var arr = value.split(',');
  9281. var html = [];
  9282. $.each(arr, function (i, value) {
  9283. value = value ? value : '/assets/img/blank.gif';
  9284. html.push('<a href="javascript:"><img class="' + classname + '" src="' + Fast.api.cdnurl(value) + '" /></a>');
  9285. });
  9286. return html.join(' ');
  9287. },
  9288. content: function (value, row, index) {
  9289. var width = this.width != undefined ? this.width : 250;
  9290. return "<div style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + "px;'>" + value + "</div>";
  9291. },
  9292. status: function (value, row, index) {
  9293. var custom = {normal: 'success', hidden: 'gray', deleted: 'danger', locked: 'info'};
  9294. if (typeof this.custom !== 'undefined') {
  9295. custom = $.extend(custom, this.custom);
  9296. }
  9297. this.custom = custom;
  9298. this.icon = 'fa fa-circle';
  9299. return Table.api.formatter.normal.call(this, value, row, index);
  9300. },
  9301. normal: function (value, row, index) {
  9302. var colorArr = ["primary", "success", "danger", "warning", "info", "gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];
  9303. var custom = {};
  9304. if (typeof this.custom !== 'undefined') {
  9305. custom = $.extend(custom, this.custom);
  9306. }
  9307. value = value === null ? '' : value.toString();
  9308. var keys = typeof this.searchList === 'object' ? Object.keys(this.searchList) : [];
  9309. var index = keys.indexOf(value);
  9310. var color = value && typeof custom[value] !== 'undefined' ? custom[value] : null;
  9311. var display = index > -1 ? this.searchList[value] : null;
  9312. var icon = typeof this.icon !== 'undefined' ? this.icon : null;
  9313. if (!color) {
  9314. color = index > -1 && typeof colorArr[index] !== 'undefined' ? colorArr[index] : 'primary';
  9315. }
  9316. if (!display) {
  9317. display = __(value.charAt(0).toUpperCase() + value.slice(1));
  9318. }
  9319. var html = '<span class="text-' + color + '">' + (icon ? '<i class="' + icon + '"></i> ' : '') + display + '</span>';
  9320. if (this.operate != false) {
  9321. html = '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + this.field + '" data-value="' + value + '">' + html + '</a>';
  9322. }
  9323. return html;
  9324. },
  9325. toggle: function (value, row, index) {
  9326. var table = this.table;
  9327. var options = table ? table.bootstrapTable('getOptions') : {};
  9328. var pk = options.pk || "id";
  9329. var color = typeof this.color !== 'undefined' ? this.color : 'success';
  9330. var yes = typeof this.yes !== 'undefined' ? this.yes : 1;
  9331. var no = typeof this.no !== 'undefined' ? this.no : 0;
  9332. var url = typeof this.url !== 'undefined' ? this.url : '';
  9333. var disable = false;
  9334. if (typeof this.disable !== "undefined") {
  9335. disable = typeof this.disable === "function" ? this.disable.call(this, value, row, index) : this.disable;
  9336. }
  9337. return "<a href='javascript:;' data-toggle='tooltip' title='" + __('Click to toggle') + "' class='btn-change " + (disable ? 'btn disabled' : '') + "' data-id='"
  9338. + row[pk] + "' " + (url ? "data-url='" + url + "'" : "") + " data-params='" + this.field + "=" + (value == yes ? no : yes) + "'><i class='fa fa-toggle-on " + (value == yes ? 'text-' + color : 'fa-flip-horizontal text-gray') + " fa-2x'></i></a>";
  9339. },
  9340. url: function (value, row, index) {
  9341. return '<div class="input-group input-group-sm" style="width:250px;margin:0 auto;"><input type="text" class="form-control input-sm" value="' + value + '"><span class="input-group-btn input-group-sm"><a href="' + value + '" target="_blank" class="btn btn-default btn-sm"><i class="fa fa-link"></i></a></span></div>';
  9342. },
  9343. search: function (value, row, index) {
  9344. var field = this.field;
  9345. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  9346. value = row[this.customField];
  9347. field = this.customField;
  9348. }
  9349. return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + field + '" data-value="' + value + '">' + value + '</a>';
  9350. },
  9351. addtabs: function (value, row, index) {
  9352. var url = Table.api.replaceurl(this.url, row, this.table);
  9353. var title = this.atitle ? this.atitle : __("Search %s", value);
  9354. return '<a href="' + Fast.api.fixurl(url) + '" class="addtabsit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  9355. },
  9356. dialog: function (value, row, index) {
  9357. var url = Table.api.replaceurl(this.url, row, this.table);
  9358. var title = this.atitle ? this.atitle : __("View %s", value);
  9359. return '<a href="' + Fast.api.fixurl(url) + '" class="dialogit" data-value="' + value + '" title="' + title + '">' + value + '</a>';
  9360. },
  9361. flag: function (value, row, index) {
  9362. var that = this;
  9363. value = value === null ? '' : value.toString();
  9364. var colorArr = {index: 'success', hot: 'warning', recommend: 'danger', 'new': 'info'};
  9365. //如果字段列有定义custom
  9366. if (typeof this.custom !== 'undefined') {
  9367. colorArr = $.extend(colorArr, this.custom);
  9368. }
  9369. var field = this.field;
  9370. if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
  9371. value = row[this.customField];
  9372. field = this.customField;
  9373. }
  9374. //渲染Flag
  9375. var html = [];
  9376. var arr = value.split(',');
  9377. var color, display, label;
  9378. $.each(arr, function (i, value) {
  9379. value = value === null ? '' : value.toString();
  9380. if (value == '')
  9381. return true;
  9382. color = value && typeof colorArr[value] !== 'undefined' ? colorArr[value] : 'primary';
  9383. display = typeof that.searchList !== 'undefined' && typeof that.searchList[value] !== 'undefined' ? that.searchList[value] : __(value.charAt(0).toUpperCase() + value.slice(1));
  9384. label = '<span class="label label-' + color + '">' + display + '</span>';
  9385. if (that.operate) {
  9386. html.push('<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', display) + '" data-field="' + field + '" data-value="' + value + '">' + label + '</a>');
  9387. } else {
  9388. html.push(label);
  9389. }
  9390. });
  9391. return html.join(' ');
  9392. },
  9393. label: function (value, row, index) {
  9394. return Table.api.formatter.flag.call(this, value, row, index);
  9395. },
  9396. datetime: function (value, row, index) {
  9397. var datetimeFormat = typeof this.datetimeFormat === 'undefined' ? 'YYYY-MM-DD HH:mm:ss' : this.datetimeFormat;
  9398. if (isNaN(value)) {
  9399. return value ? Moment(value).format(datetimeFormat) : __('None');
  9400. } else {
  9401. return value ? Moment(parseInt(value) * 1000).format(datetimeFormat) : __('None');
  9402. }
  9403. },
  9404. operate: function (value, row, index) {
  9405. var table = this.table;
  9406. // 操作配置
  9407. var options = table ? table.bootstrapTable('getOptions') : {};
  9408. // 默认按钮组
  9409. var buttons = $.extend([], this.buttons || []);
  9410. // 所有按钮名称
  9411. var names = [];
  9412. buttons.forEach(function (item) {
  9413. names.push(item.name);
  9414. });
  9415. if (options.extend.dragsort_url !== '' && names.indexOf('dragsort') === -1) {
  9416. buttons.push(Table.button.dragsort);
  9417. }
  9418. if (options.extend.edit_url !== '' && names.indexOf('edit') === -1) {
  9419. Table.button.edit.url = options.extend.edit_url;
  9420. buttons.push(Table.button.edit);
  9421. }
  9422. if (options.extend.del_url !== '' && names.indexOf('del') === -1) {
  9423. buttons.push(Table.button.del);
  9424. }
  9425. return Table.api.buttonlink(this, buttons, value, row, index, 'operate');
  9426. }
  9427. ,
  9428. buttons: function (value, row, index) {
  9429. // 默认按钮组
  9430. var buttons = $.extend([], this.buttons || []);
  9431. return Table.api.buttonlink(this, buttons, value, row, index, 'buttons');
  9432. }
  9433. },
  9434. buttonlink: function (column, buttons, value, row, index, type) {
  9435. var table = column.table;
  9436. type = typeof type === 'undefined' ? 'buttons' : type;
  9437. var options = table ? table.bootstrapTable('getOptions') : {};
  9438. var html = [];
  9439. var hidden, visible, disable, url, classname, icon, text, title, refresh, confirm, extend,
  9440. dropdown, link;
  9441. var fieldIndex = column.fieldIndex;
  9442. var dropdowns = {};
  9443. $.each(buttons, function (i, j) {
  9444. if (type === 'operate') {
  9445. if (j.name === 'dragsort' && typeof row[Table.config.dragsortfield] === 'undefined') {
  9446. return true;
  9447. }
  9448. if (['add', 'edit', 'del', 'multi', 'dragsort'].indexOf(j.name) > -1 && !options.extend[j.name + "_url"]) {
  9449. return true;
  9450. }
  9451. }
  9452. var attr = table.data(type + "-" + j.name);
  9453. if (typeof attr === 'undefined' || attr) {
  9454. hidden = typeof j.hidden === 'function' ? j.hidden.call(table, row, j) : (typeof j.hidden !== 'undefined' ? j.hidden : false);
  9455. if (hidden) {
  9456. return true;
  9457. }
  9458. visible = typeof j.visible === 'function' ? j.visible.call(table, row, j) : (typeof j.visible !== 'undefined' ? j.visible : true);
  9459. if (!visible) {
  9460. return true;
  9461. }
  9462. dropdown = j.dropdown ? j.dropdown : '';
  9463. url = j.url ? j.url : '';
  9464. url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
  9465. classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
  9466. icon = j.icon ? j.icon : '';
  9467. text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
  9468. title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
  9469. refresh = j.refresh ? 'data-refresh="' + j.refresh + '"' : '';
  9470. confirm = typeof j.confirm === 'function' ? j.confirm.call(table, row, j) : (typeof j.confirm !== 'undefined' ? j.confirm : false);
  9471. confirm = confirm ? 'data-confirm="' + confirm + '"' : '';
  9472. extend = j.extend ? j.extend : '';
  9473. disable = typeof j.disable === 'function' ? j.disable.call(table, row, j) : (typeof j.disable !== 'undefined' ? j.disable : false);
  9474. if (disable) {
  9475. classname = classname + ' disabled';
  9476. }
  9477. link = '<a href="' + url + '" class="' + classname + '" ' + (confirm ? confirm + ' ' : '') + (refresh ? refresh + ' ' : '') + extend + ' title="' + title + '" data-table-id="' + (table ? table.attr("id") : '') + '" data-field-index="' + fieldIndex + '" data-row-index="' + index + '" data-button-index="' + i + '"><i class="' + icon + '"></i>' + (text ? ' ' + text : '') + '</a>';
  9478. if (dropdown) {
  9479. if (typeof dropdowns[dropdown] == 'undefined') {
  9480. dropdowns[dropdown] = [];
  9481. }
  9482. dropdowns[dropdown].push(link);
  9483. } else {
  9484. html.push(link);
  9485. }
  9486. }
  9487. });
  9488. if (!$.isEmptyObject(dropdowns)) {
  9489. var dropdownHtml = [];
  9490. $.each(dropdowns, function (i, j) {
  9491. dropdownHtml.push('<div class="btn-group"><button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown">' + i + '</button><button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown"><span class="caret"></span></button><ul class="dropdown-menu pull-right"><li>' + j.join('</li><li>') + '</li></ul></div>');
  9492. });
  9493. html.unshift(dropdownHtml);
  9494. }
  9495. return html.join(' ');
  9496. },
  9497. //替换URL中的数据
  9498. replaceurl: function (url, row, table) {
  9499. var options = table ? table.bootstrapTable('getOptions') : null;
  9500. var ids = options ? row[options.pk] : 0;
  9501. row.ids = ids ? ids : (typeof row.ids !== 'undefined' ? row.ids : 0);
  9502. //自动添加ids参数
  9503. url = !url.match(/\{ids\}/i) ? url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
  9504. url = url.replace(/\{(.*?)\}/gi, function (matched) {
  9505. matched = matched.substring(1, matched.length - 1);
  9506. if (matched.indexOf(".") !== -1) {
  9507. var temp = row;
  9508. var arr = matched.split(/\./);
  9509. for (var i = 0; i < arr.length; i++) {
  9510. if (typeof temp[arr[i]] !== 'undefined') {
  9511. temp = temp[arr[i]];
  9512. }
  9513. }
  9514. return typeof temp === 'object' ? '' : temp;
  9515. }
  9516. return row[matched];
  9517. });
  9518. return url;
  9519. },
  9520. // 获取选中的条目ID集合
  9521. selectedids: function (table) {
  9522. var options = table.bootstrapTable('getOptions');
  9523. if (options.templateView) {
  9524. return $.map($("input[data-id][name='checkbox']:checked"), function (dom) {
  9525. return $(dom).data("id");
  9526. });
  9527. } else {
  9528. return $.map(table.bootstrapTable('getSelections'), function (row) {
  9529. return row[options.pk];
  9530. });
  9531. }
  9532. },
  9533. // 切换复选框状态
  9534. toggleattr: function (table) {
  9535. $("input[type='checkbox']", table).trigger('click');
  9536. },
  9537. // 根据行索引获取行数据
  9538. getrowdata: function (table, index) {
  9539. index = parseInt(index);
  9540. var data = table.bootstrapTable('getData');
  9541. return typeof data[index] !== 'undefined' ? data[index] : null;
  9542. },
  9543. // 根据行索引获取行数据
  9544. getrowbyindex: function (table, index) {
  9545. return Table.api.getrowdata(table, index);
  9546. },
  9547. // 根据主键ID获取行数据
  9548. getrowbyid: function (table, id) {
  9549. var row = {};
  9550. var options = table.bootstrapTable("getOptions");
  9551. $.each(table.bootstrapTable('getData'), function (i, j) {
  9552. if (j[options.pk] == id) {
  9553. row = j;
  9554. return false;
  9555. }
  9556. });
  9557. return row;
  9558. }
  9559. },
  9560. };
  9561. return Table;
  9562. });
  9563. // jQuery List DragSort v0.5.2
  9564. // Website: http://dragsort.codeplex.com/
  9565. // License: http://dragsort.codeplex.com/license
  9566. (function($) {
  9567. $.fn.dragsort = function(options) {
  9568. if (options == "destroy") {
  9569. $(this.selector).trigger("dragsort-uninit");
  9570. return;
  9571. }
  9572. var opts = $.extend({}, $.fn.dragsort.defaults, options);
  9573. var lists = [];
  9574. var list = null, lastPos = null;
  9575. this.each(function(i, cont) {
  9576. //if list container is table, the browser automatically wraps rows in tbody if not specified so change list container to tbody so that children returns rows as user expected
  9577. if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody"))
  9578. cont = $(cont).children().get(0);
  9579. var newList = {
  9580. draggedItem: null,
  9581. placeHolderItem: null,
  9582. pos: null,
  9583. offset: null,
  9584. offsetLimit: null,
  9585. scroll: null,
  9586. container: cont,
  9587. init: function() {
  9588. //set options to default values if not set
  9589. opts.tagName = opts.tagName == "" ? ($(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase()) : opts.tagName;
  9590. if (opts.itemSelector == "")
  9591. opts.itemSelector = opts.tagName;
  9592. if (opts.dragSelector == "")
  9593. opts.dragSelector = opts.tagName;
  9594. if (opts.placeHolderTemplate == "")
  9595. opts.placeHolderTemplate = "<" + opts.tagName + ">&nbsp;</" + opts.tagName + ">";
  9596. //listidx allows reference back to correct list variable instance
  9597. $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit);
  9598. this.styleDragHandlers(true);
  9599. },
  9600. uninit: function() {
  9601. var list = lists[$(this).attr("data-listidx")];
  9602. $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit");
  9603. list.styleDragHandlers(false);
  9604. },
  9605. getItems: function() {
  9606. return $(this.container).children(opts.itemSelector);
  9607. },
  9608. styleDragHandlers: function(cursor) {
  9609. this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : "");
  9610. },
  9611. grabItem: function(e) {
  9612. var list = lists[$(this).attr("data-listidx")];
  9613. var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0);
  9614. var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0;
  9615. //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return
  9616. if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem)
  9617. return;
  9618. //prevents selection, stops issue on Fx where dragging hyperlink doesn't work and on IE where it triggers mousemove even though mouse hasn't moved,
  9619. //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude
  9620. //e.preventDefault();
  9621. //change cursor to move while dragging
  9622. var dragHandle = e.target;
  9623. while (!$(dragHandle).is(opts.dragSelector)) {
  9624. if (dragHandle == this) return;
  9625. dragHandle = dragHandle.parentNode;
  9626. }
  9627. $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor"));
  9628. $(dragHandle).css("cursor", "move");
  9629. //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work
  9630. var listElem = this;
  9631. var trigger = function() {
  9632. list.dragStart.call(listElem, e);
  9633. $(list.container).unbind("mousemove", trigger);
  9634. };
  9635. $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); });
  9636. },
  9637. dragStart: function(e) {
  9638. if (list != null && list.draggedItem != null)
  9639. list.dropItem();
  9640. list = lists[$(this).attr("data-listidx")];
  9641. list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName)
  9642. //record current position so on dragend we know if the dragged item changed position or not, not using getItems to allow dragsort to restore dragged item to original location in relation to fixed items
  9643. list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem));
  9644. //calculate mouse offset relative to draggedItem
  9645. var mt = parseInt(list.draggedItem.css("marginTop"));
  9646. var ml = parseInt(list.draggedItem.css("marginLeft"));
  9647. list.offset = list.draggedItem.offset();
  9648. list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1;
  9649. list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1;
  9650. //calculate box the dragged item can't be dragged outside of
  9651. if (!opts.dragBetween) {
  9652. var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().size() * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight();
  9653. list.offsetLimit = $(list.container).offset();
  9654. list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
  9655. list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
  9656. }
  9657. //create placeholder item
  9658. var h = list.draggedItem.height();
  9659. var w = list.draggedItem.width();
  9660. if (opts.tagName == "tr") {
  9661. list.draggedItem.children().each(function() { $(this).width($(this).width()); });
  9662. list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true);
  9663. list.draggedItem.after(list.placeHolderItem);
  9664. //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html("&nbsp;"); });
  9665. list.placeHolderItem.children().each(function() { $(this).html("&nbsp;"); });
  9666. } else {
  9667. list.draggedItem.after(opts.placeHolderTemplate);
  9668. list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true);
  9669. }
  9670. if (opts.tagName == "td") {
  9671. var listTable = list.draggedItem.closest("table").get(0);
  9672. $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").appendTo("body").children().append(list.draggedItem);
  9673. }
  9674. //style draggedItem while dragging
  9675. var orig = list.draggedItem.attr("style");
  9676. list.draggedItem.attr("data-origstyle", orig ? orig : "");
  9677. list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w });
  9678. //auto-scroll setup
  9679. list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() };
  9680. list.scroll.scrollY = window.setInterval(function() {
  9681. if (opts.scrollContainer != window) {
  9682. $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY);
  9683. return;
  9684. }
  9685. var t = $(opts.scrollContainer).scrollTop();
  9686. if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) {
  9687. $(opts.scrollContainer).scrollTop(t + list.scroll.moveY);
  9688. list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1);
  9689. }
  9690. }, 10);
  9691. list.scroll.scrollX = window.setInterval(function() {
  9692. if (opts.scrollContainer != window) {
  9693. $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX);
  9694. return;
  9695. }
  9696. var l = $(opts.scrollContainer).scrollLeft();
  9697. if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) {
  9698. $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX);
  9699. list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1);
  9700. }
  9701. }, 10);
  9702. //misc
  9703. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  9704. list.setPos(e.pageX, e.pageY);
  9705. $(document).bind("mousemove", list.swapItems);
  9706. $(document).bind("mouseup", list.dropItem);
  9707. if (opts.scrollContainer != window)
  9708. $(window).bind("wheel", list.wheel);
  9709. },
  9710. //set position of draggedItem
  9711. setPos: function(x, y) {
  9712. //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner
  9713. var top = y - this.offset.top;
  9714. var left = x - this.offset.left;
  9715. //limit top, left to within box draggedItem can't be dragged outside of
  9716. if (!opts.dragBetween) {
  9717. top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
  9718. left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
  9719. }
  9720. //adjust top & left calculations to parent offset
  9721. var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin
  9722. if (parent != null) {
  9723. top -= parent.top;
  9724. left -= parent.left;
  9725. }
  9726. //set x or y auto-scroll amount
  9727. if (opts.scrollContainer == window) {
  9728. y -= $(window).scrollTop();
  9729. x -= $(window).scrollLeft();
  9730. y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5);
  9731. x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5);
  9732. } else {
  9733. var cont = $(opts.scrollContainer);
  9734. var offset = cont.offset();
  9735. y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top);
  9736. x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left);
  9737. }
  9738. list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x);
  9739. list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y);
  9740. //move draggedItem to new mouse cursor location
  9741. this.draggedItem.css({ top: top, left: left });
  9742. },
  9743. //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over
  9744. wheel: function(e) {
  9745. if (list && opts.scrollContainer != window) {
  9746. var cont = $(opts.scrollContainer);
  9747. var offset = cont.offset();
  9748. e = e.originalEvent;
  9749. if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) {
  9750. var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY;
  9751. cont.scrollTop(cont.scrollTop() + deltaY);
  9752. e.preventDefault();
  9753. }
  9754. }
  9755. },
  9756. //build a table recording all the positions of the moveable list items
  9757. buildPositionTable: function() {
  9758. var pos = [];
  9759. this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) {
  9760. var loc = $(this).offset();
  9761. loc.right = loc.left + $(this).outerWidth();
  9762. loc.bottom = loc.top + $(this).outerHeight();
  9763. loc.elm = this;
  9764. pos[i] = loc;
  9765. });
  9766. this.pos = pos;
  9767. },
  9768. dropItem: function() {
  9769. if (list.draggedItem == null)
  9770. return;
  9771. //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower
  9772. //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower)
  9773. var orig = list.draggedItem.attr("data-origstyle");
  9774. list.draggedItem.attr("style", orig);
  9775. if (orig == "")
  9776. list.draggedItem.removeAttr("style");
  9777. list.draggedItem.removeAttr("data-origstyle");
  9778. list.styleDragHandlers(true);
  9779. list.placeHolderItem.before(list.draggedItem);
  9780. list.placeHolderItem.remove();
  9781. $("[data-droptarget], .dragSortItem").remove();
  9782. window.clearInterval(list.scroll.scrollY);
  9783. window.clearInterval(list.scroll.scrollX);
  9784. //if position changed call dragEnd
  9785. if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem))
  9786. if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order
  9787. var pos = list.draggedItem.attr("data-origpos").split('-');
  9788. var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]);
  9789. if (nextItem.size() > 0)
  9790. nextItem.before(list.draggedItem);
  9791. else if (pos[1] == 0) //was the only item in list
  9792. $(lists[pos[0]].container).prepend(list.draggedItem);
  9793. else //was the last item in list
  9794. $(lists[pos[0]].container).append(list.draggedItem);
  9795. }
  9796. list.draggedItem.removeAttr("data-origpos");
  9797. list.draggedItem = null;
  9798. $(document).unbind("mousemove", list.swapItems);
  9799. $(document).unbind("mouseup", list.dropItem);
  9800. if (opts.scrollContainer != window)
  9801. $(window).unbind("wheel", list.wheel);
  9802. return false;
  9803. },
  9804. //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of
  9805. swapItems: function(e) {
  9806. if (list.draggedItem == null)
  9807. return false;
  9808. //move draggedItem to mouse location
  9809. list.setPos(e.pageX, e.pageY);
  9810. //retrieve list and item position mouse cursor is over
  9811. var ei = list.findPos(e.pageX, e.pageY);
  9812. var nlist = list;
  9813. for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) {
  9814. ei = lists[i].findPos(e.pageX, e.pageY);
  9815. nlist = lists[i];
  9816. }
  9817. //if not over another moveable list item return
  9818. if (ei == -1)
  9819. return false;
  9820. //save fixed items locations
  9821. var children = function() { return $(nlist.container).children().not(nlist.draggedItem); };
  9822. var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); });
  9823. //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after
  9824. if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left)
  9825. $(nlist.pos[ei].elm).before(list.placeHolderItem);
  9826. else
  9827. $(nlist.pos[ei].elm).after(list.placeHolderItem);
  9828. //restore fixed items location
  9829. fixed.each(function() {
  9830. var elm = children().eq(this.idx).get(0);
  9831. if (this != elm && children().index(this) < this.idx)
  9832. $(this).insertAfter(elm);
  9833. else if (this != elm)
  9834. $(this).insertBefore(elm);
  9835. });
  9836. //misc
  9837. $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); });
  9838. lastPos = list.draggedItem.offset();
  9839. return false;
  9840. },
  9841. //returns the index of the list item the mouse is over
  9842. findPos: function(x, y) {
  9843. for (var i = 0; i < this.pos.length; i++) {
  9844. if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y)
  9845. return i;
  9846. }
  9847. return -1;
  9848. },
  9849. //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position
  9850. createDropTargets: function() {
  9851. if (!opts.dragBetween)
  9852. return;
  9853. $(lists).each(function() {
  9854. var ph = $(this.container).find("[data-placeholder]");
  9855. var dt = $(this.container).find("[data-droptarget]");
  9856. if (ph.size() > 0 && dt.size() > 0)
  9857. dt.remove();
  9858. else if (ph.size() == 0 && dt.size() == 0) {
  9859. if (opts.tagName == "td")
  9860. $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container);
  9861. else
  9862. //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8)
  9863. $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true));
  9864. list.placeHolderItem.attr("data-placeholder", true);
  9865. }
  9866. });
  9867. }
  9868. };
  9869. newList.init();
  9870. lists.push(newList);
  9871. });
  9872. return this;
  9873. };
  9874. $.fn.dragsort.defaults = {
  9875. tagName:"",
  9876. itemSelector: "",
  9877. dragSelector: "",
  9878. dragSelectorExclude: "input, textarea",
  9879. dragEnd: function() { },
  9880. dragBetween: false,
  9881. placeHolderTemplate: "",
  9882. scrollContainer: window,
  9883. scrollSpeed: 5
  9884. };
  9885. })(jQuery);
  9886. define("dragsort", function(){});
  9887. /*!
  9888. * jquery.event.drag - v 2.2
  9889. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  9890. * Open Source MIT License - http://threedubmedia.com/code/license
  9891. */
  9892. ;(function(e){e.fn.drag=function(k,g,j){var i=typeof k=="string"?k:"",h=e.isFunction(k)?k:e.isFunction(g)?g:null;if(i.indexOf("drag")!==0){i="drag"+i}j=(k==h?g:j)||{};return h?this.bind(i,j,h):this.trigger(i)};var b=e.event,a=b.special,d=a.drag={defaults:{which:1,distance:0,not:":input",handle:null,relative:false,drop:true,click:false},datakey:"dragdata",noBubble:true,add:function(i){var h=e.data(this,d.datakey),g=i.data||{};h.related+=1;e.each(d.defaults,function(j,k){if(g[j]!==undefined){h[j]=g[j]}})},remove:function(){e.data(this,d.datakey).related-=1},setup:function(){if(e.data(this,d.datakey)){return}var g=e.extend({related:0},d.defaults);e.data(this,d.datakey,g);b.add(this,"touchstart mousedown",d.init,g);if(this.attachEvent){this.attachEvent("ondragstart",d.dontstart)}},teardown:function(){var g=e.data(this,d.datakey)||{};if(g.related){return}e.removeData(this,d.datakey);b.remove(this,"touchstart mousedown",d.init);d.textselect(true);if(this.detachEvent){this.detachEvent("ondragstart",d.dontstart)}},init:function(i){if(d.touched){return}var g=i.data,h;if(i.which!=0&&g.which>0&&i.which!=g.which){return}if(e(i.target).is(g.not)){return}if(g.handle&&!e(i.target).closest(g.handle,i.currentTarget).length){return}d.touched=i.type=="touchstart"?this:null;g.propagates=1;g.mousedown=this;g.interactions=[d.interaction(this,g)];g.target=i.target;g.pageX=i.pageX;g.pageY=i.pageY;g.dragging=null;h=d.hijack(i,"draginit",g);if(!g.propagates){return}h=d.flatten(h);if(h&&h.length){g.interactions=[];e.each(h,function(){g.interactions.push(d.interaction(this,g))})}g.propagates=g.interactions.length;if(g.drop!==false&&a.drop){a.drop.handler(i,g)}d.textselect(false);if(d.touched){b.add(d.touched,"touchmove touchend",d.handler,g)}else{b.add(document,"mousemove mouseup",d.handler,g)}if(!d.touched||g.live){return false}},interaction:function(h,g){var i=e(h)[g.relative?"position":"offset"]()||{top:0,left:0};return{drag:h,callback:new d.callback(),droppable:[],offset:i}},handler:function(h){var g=h.data;switch(h.type){case !g.dragging&&"touchmove":h.preventDefault();case !g.dragging&&"mousemove":if(Math.pow(h.pageX-g.pageX,2)+Math.pow(h.pageY-g.pageY,2)<Math.pow(g.distance,2)){break}h.target=g.target;d.hijack(h,"dragstart",g);if(g.propagates){g.dragging=true}case"touchmove":h.preventDefault();case"mousemove":if(g.dragging){d.hijack(h,"drag",g);if(g.propagates){if(g.drop!==false&&a.drop){a.drop.handler(h,g)}break}h.type="mouseup"}case"touchend":case"mouseup":default:if(d.touched){b.remove(d.touched,"touchmove touchend",d.handler)}else{b.remove(document,"mousemove mouseup",d.handler)}if(g.dragging){if(g.drop!==false&&a.drop){a.drop.handler(h,g)}d.hijack(h,"dragend",g)}d.textselect(true);if(g.click===false&&g.dragging){e.data(g.mousedown,"suppress.click",new Date().getTime()+5)}g.dragging=d.touched=false;break}},hijack:function(h,o,r,p,k){if(!r){return}var q={event:h.originalEvent,type:h.type},m=o.indexOf("drop")?"drag":"drop",t,l=p||0,j,g,s,n=!isNaN(p)?p:r.interactions.length;h.type=o;h.originalEvent=null;r.results=[];do{if(j=r.interactions[l]){if(o!=="dragend"&&j.cancelled){continue}s=d.properties(h,r,j);j.results=[];e(k||j[m]||r.droppable).each(function(u,i){s.target=i;h.isPropagationStopped=function(){return false};t=i?b.dispatch.call(i,h,s):null;if(t===false){if(m=="drag"){j.cancelled=true;r.propagates-=1}if(o=="drop"){j[m][u]=null}}else{if(o=="dropinit"){j.droppable.push(d.element(t)||i)}}if(o=="dragstart"){j.proxy=e(d.element(t)||j.drag)[0]}j.results.push(t);delete h.result;if(o!=="dropinit"){return t}});r.results[l]=d.flatten(j.results);if(o=="dropinit"){j.droppable=d.flatten(j.droppable)}if(o=="dragstart"&&!j.cancelled){s.update()}}}while(++l<n);h.type=q.type;h.originalEvent=q.event;return d.flatten(r.results)},properties:function(i,g,h){var j=h.callback;j.drag=h.drag;j.proxy=h.proxy||h.drag;j.startX=g.pageX;j.startY=g.pageY;j.deltaX=i.pageX-g.pageX;j.deltaY=i.pageY-g.pageY;j.originalX=h.offset.left;j.originalY=h.offset.top;j.offsetX=j.originalX+j.deltaX;j.offsetY=j.originalY+j.deltaY;j.drop=d.flatten((h.drop||[]).slice());j.available=d.flatten((h.droppable||[]).slice());return j},element:function(g){if(g&&(g.jquery||g.nodeType==1)){return g}},flatten:function(g){return e.map(g,function(h){return h&&h.jquery?e.makeArray(h):h&&h.length?d.flatten(h):h})},textselect:function(g){e(document)[g?"unbind":"bind"]("selectstart",d.dontstart).css("MozUserSelect",g?"":"none");document.unselectable=g?"off":"on"},dontstart:function(){return false},callback:function(){}};d.callback.prototype={update:function(){if(a.drop&&this.available.length){e.each(this.available,function(g){a.drop.locate(this,g)})}}};var f=b.dispatch;b.dispatch=function(g){if(e.data(this,"suppress."+g.type)-new Date().getTime()>0){e.removeData(this,"suppress."+g.type);return}return f.apply(this,arguments)};var c=b.fixHooks.touchstart=b.fixHooks.touchmove=b.fixHooks.touchend=b.fixHooks.touchcancel={props:"clientX clientY pageX pageY screenX screenY".split(" "),filter:function(h,i){if(i){var g=(i.touches&&i.touches[0])||(i.changedTouches&&i.changedTouches[0])||null;if(g){e.each(c.props,function(j,k){h[k]=g[k]})}}return h}};a.draginit=a.dragstart=a.dragend=d})(jQuery);
  9893. define("drag", function(){});
  9894. /*!
  9895. * jquery.event.drop - v 2.2
  9896. * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
  9897. * Open Source MIT License - http://threedubmedia.com/code/license
  9898. */
  9899. ;(function(d){d.fn.drop=function(i,e,h){var g=typeof i=="string"?i:"",f=d.isFunction(i)?i:d.isFunction(e)?e:null;if(g.indexOf("drop")!==0){g="drop"+g}h=(i==f?e:h)||{};return f?this.bind(g,h,f):this.trigger(g)};d.drop=function(e){e=e||{};b.multi=e.multi===true?Infinity:e.multi===false?1:!isNaN(e.multi)?e.multi:b.multi;b.delay=e.delay||b.delay;b.tolerance=d.isFunction(e.tolerance)?e.tolerance:e.tolerance===null?null:b.tolerance;b.mode=e.mode||b.mode||"intersect"};var c=d.event,a=c.special,b=d.event.special.drop={multi:1,delay:20,mode:"overlap",targets:[],datakey:"dropdata",noBubble:true,add:function(f){var e=d.data(this,b.datakey);e.related+=1},remove:function(){d.data(this,b.datakey).related-=1},setup:function(){if(d.data(this,b.datakey)){return}var e={related:0,active:[],anyactive:0,winner:0,location:{}};d.data(this,b.datakey,e);b.targets.push(this);return false},teardown:function(){var f=d.data(this,b.datakey)||{};if(f.related){return}d.removeData(this,b.datakey);var e=this;b.targets=d.grep(b.targets,function(g){return(g!==e)})},handler:function(g,e){var f,h;if(!e){return}switch(g.type){case"mousedown":case"touchstart":h=d(b.targets);if(typeof e.drop=="string"){h=h.filter(e.drop)}h.each(function(){var i=d.data(this,b.datakey);i.active=[];i.anyactive=0;i.winner=0});e.droppable=h;a.drag.hijack(g,"dropinit",e);break;case"mousemove":case"touchmove":b.event=g;if(!b.timer){b.tolerate(e)}break;case"mouseup":case"touchend":b.timer=clearTimeout(b.timer);if(e.propagates){a.drag.hijack(g,"drop",e);a.drag.hijack(g,"dropend",e)}break}},locate:function(k,h){var l=d.data(k,b.datakey),g=d(k),i=g.offset()||{},e=g.outerHeight(),j=g.outerWidth(),f={elem:k,width:j,height:e,top:i.top,left:i.left,right:i.left+j,bottom:i.top+e};if(l){l.location=f;l.index=h;l.elem=k}return f},contains:function(e,f){return((f[0]||f.left)>=e.left&&(f[0]||f.right)<=e.right&&(f[1]||f.top)>=e.top&&(f[1]||f.bottom)<=e.bottom)},modes:{intersect:function(f,e,g){return this.contains(g,[f.pageX,f.pageY])?1000000000:this.modes.overlap.apply(this,arguments)},overlap:function(f,e,g){return Math.max(0,Math.min(g.bottom,e.bottom)-Math.max(g.top,e.top))*Math.max(0,Math.min(g.right,e.right)-Math.max(g.left,e.left))},fit:function(f,e,g){return this.contains(g,e)?1:0},middle:function(f,e,g){return this.contains(g,[e.left+e.width*0.5,e.top+e.height*0.5])?1:0}},sort:function(f,e){return(e.winner-f.winner)||(f.index-e.index)},tolerate:function(q){var k,e,n,j,l,m,g,p=0,f,h=q.interactions.length,r=[b.event.pageX,b.event.pageY],o=b.tolerance||b.modes[b.mode];do{if(f=q.interactions[p]){if(!f){return}f.drop=[];l=[];m=f.droppable.length;if(o){n=b.locate(f.proxy)}k=0;do{if(g=f.droppable[k]){j=d.data(g,b.datakey);e=j.location;if(!e){continue}j.winner=o?o.call(b,b.event,n,e):b.contains(e,r)?1:0;l.push(j)}}while(++k<m);l.sort(b.sort);k=0;do{if(j=l[k]){if(j.winner&&f.drop.length<b.multi){if(!j.active[p]&&!j.anyactive){if(a.drag.hijack(b.event,"dropstart",q,p,j.elem)[0]!==false){j.active[p]=1;j.anyactive+=1}else{j.winner=0}}if(j.winner){f.drop.push(j.elem)}}else{if(j.active[p]&&j.anyactive==1){a.drag.hijack(b.event,"dropend",q,p,j.elem);j.active[p]=0;j.anyactive-=1}}}}while(++k<m)}}while(++p<h);if(b.last&&r[0]==b.last.pageX&&r[1]==b.last.pageY){delete b.timer}else{b.timer=setTimeout(function(){b.tolerate(q)},b.delay)}b.last=b.event}};a.dropinit=a.dropstart=a.dropend=b})(jQuery);
  9900. define("drop", function(){});
  9901. /**
  9902. * http://git.oschina.net/hbbcs/bootStrap-addTabs
  9903. * Created by joe on 2015-12-19.
  9904. * Modified by Karson
  9905. */
  9906. (function ($) {
  9907. $.fn.addtabs = function (options) {
  9908. var obj = $(this);
  9909. options = $.extend({
  9910. content: '', //直接指定所有页面TABS内容
  9911. close: true, //是否可以关闭
  9912. monitor: 'body', //监视的区域
  9913. nav: '.nav-addtabs',
  9914. tab: '.tab-addtabs',
  9915. iframeUse: true, //使用iframe还是ajax
  9916. iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改
  9917. iframeForceRefresh: false, //点击后强制加载对应的iframe
  9918. iframeForceRefreshTable: false, //点击后强制刷新对应的iframe中的table
  9919. callback: function () {
  9920. //关闭后回调函数
  9921. }
  9922. }, options || {});
  9923. var navobj = $(options.nav);
  9924. var tabobj = $(options.tab);
  9925. if (history.pushState) {
  9926. //浏览器前进后退事件
  9927. $(window).on("popstate", function (e) {
  9928. var state = e.originalEvent.state;
  9929. if (state) {
  9930. $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click");
  9931. }
  9932. });
  9933. }
  9934. $(options.monitor).on('click', '[addtabs]', function (e) {
  9935. if ($(this).attr('url').indexOf("javascript:") !== 0) {
  9936. if ($(this).is("a")) {
  9937. e.preventDefault();
  9938. }
  9939. var id = $(this).attr('addtabs');
  9940. var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text());
  9941. var url = $(this).attr('url');
  9942. var content = options.content ? options.content : $(this).attr('content');
  9943. var ajax = $(this).attr('ajax') === '1' || $(this).attr('ajax') === 'true';
  9944. var state = ({
  9945. url: url, title: title, id: id, content: content, ajax: ajax
  9946. });
  9947. document.title = title;
  9948. if (history.pushState && !$(this).data("pushstate")) {
  9949. var pushurl = url.indexOf("ref=addtabs") === -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url;
  9950. try {
  9951. window.history.pushState(state, title, pushurl);
  9952. } catch (e) {
  9953. }
  9954. }
  9955. $(this).data("pushstate", null);
  9956. _add.call(this, {
  9957. id: id,
  9958. title: $(this).attr('title') ? $(this).attr('title') : $(this).html(),
  9959. content: content,
  9960. url: url,
  9961. ajax: ajax
  9962. });
  9963. }
  9964. });
  9965. navobj.on('click', '.close-tab', function () {
  9966. var id = $(this).prev("a").attr("aria-controls");
  9967. _close(id);
  9968. return false;
  9969. });
  9970. navobj.on('dblclick', 'li[role=presentation]', function () {
  9971. $(this).find(".close-tab").trigger("click");
  9972. });
  9973. navobj.on('click', 'li[role=presentation]', function () {
  9974. $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click");
  9975. });
  9976. $(window).resize(function () {
  9977. if (typeof options.nav === 'object') {
  9978. var siblingsWidth = 0;
  9979. navobj.siblings().each(function () {
  9980. siblingsWidth += $(this).outerWidth();
  9981. });
  9982. navobj.width(navobj.parent().width() - siblingsWidth);
  9983. } else {
  9984. $("#nav").width($("#header").find("> .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20);
  9985. }
  9986. _drop();
  9987. });
  9988. var _add = function (opts) {
  9989. var id, tabid, conid, url;
  9990. id = opts.id;
  9991. tabid = 'tab_' + opts.id;
  9992. conid = 'con_' + opts.id;
  9993. url = opts.url;
  9994. url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1");
  9995. var tabitem = $('#' + tabid, navobj);
  9996. var conitem = $('#' + conid, tabobj);
  9997. navobj.find("[role='presentation']").removeClass('active');
  9998. tabobj.find("[role='tabpanel']").removeClass('active');
  9999. //如果TAB不存在,创建一个新的TAB
  10000. if (tabitem.size() === 0) {
  10001. //创建新TAB的title
  10002. tabitem = $('<li role="presentation" id="' + tabid + '"><a href="#' + conid + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>');
  10003. //是否允许关闭
  10004. if (options.close && $("li", navobj).size() > 0) {
  10005. tabitem.append(' <i class="close-tab fa fa-remove"></i>');
  10006. }
  10007. if (conitem.size() === 0) {
  10008. //创建新TAB的内容
  10009. conitem = $('<div role="tabpanel" class="tab-pane" id="' + conid + '"></div>');
  10010. //是否指定TAB内容
  10011. if (opts.content) {
  10012. conitem.append(opts.content);
  10013. } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接
  10014. var height = options.iframeHeight;
  10015. conitem.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>');
  10016. } else {
  10017. $.get(url, function (data) {
  10018. conitem.append(data);
  10019. });
  10020. }
  10021. tabobj.append(conitem);
  10022. }
  10023. //加入TABS
  10024. if ($('.tabdrop li', navobj).size() > 0) {
  10025. $('.tabdrop ul', navobj).append(tabitem);
  10026. } else {
  10027. navobj.append(tabitem);
  10028. }
  10029. } else {
  10030. //强制刷新iframe
  10031. if (options.iframeForceRefresh) {
  10032. $("#" + conid + " iframe").attr('src', function (i, val) {
  10033. return val;
  10034. });
  10035. } else if (options.iframeForceRefreshTable) {
  10036. try {
  10037. //检测iframe中是否存在刷新按钮
  10038. if ($("#" + conid + " iframe").contents().find(".btn-refresh").size() > 0) {
  10039. $("#" + conid + " iframe")[0].contentWindow.$(".btn-refresh").trigger("click");
  10040. }
  10041. } catch (e) {
  10042. }
  10043. }
  10044. }
  10045. localStorage.setItem("addtabs", $(this).prop('outerHTML'));
  10046. //激活TAB
  10047. tabitem.addClass('active');
  10048. conitem.addClass("active");
  10049. _drop();
  10050. };
  10051. var _close = function (id) {
  10052. var tabid = 'tab_' + id;
  10053. var conid = 'con_' + id;
  10054. var tabitem = $('#' + tabid, navobj);
  10055. var conitem = $('#' + conid, tabobj);
  10056. //如果关闭的是当前激活的TAB,激活他的前一个TAB
  10057. if (obj.find("li.active").not('.tabdrop').attr('id') === tabid) {
  10058. var prev = tabitem.prev().not(".tabdrop");
  10059. var next = tabitem.next().not(".tabdrop");
  10060. if (prev.size() > 0) {
  10061. prev.find('a').trigger("click");
  10062. } else if (next.size() > 0) {
  10063. next.find('a').trigger("click");
  10064. } else {
  10065. $(">li:not(.tabdrop):last > a", navobj).trigger('click');
  10066. }
  10067. }
  10068. //关闭TAB
  10069. tabitem.remove();
  10070. conitem.remove();
  10071. _drop();
  10072. options.callback();
  10073. };
  10074. var _drop = function () {
  10075. navobj.refreshAddtabs();
  10076. };
  10077. };
  10078. //刷新Addtabs
  10079. $.fn.refreshAddtabs = function () {
  10080. var navobj = $(this);
  10081. var dropdown = $(".tabdrop", navobj);
  10082. if (dropdown.size() === 0) {
  10083. dropdown = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' +
  10084. '<i class="glyphicon glyphicon-align-justify"></i>' +
  10085. ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>');
  10086. dropdown.prependTo(navobj);
  10087. }
  10088. //检测是否有下拉样式
  10089. if (navobj.parent().is('.tabs-below')) {
  10090. dropdown.addClass('dropup');
  10091. }
  10092. var collection = 0;
  10093. var maxwidth = navobj.width() - 65;
  10094. var liwidth = 0;
  10095. //检查超过一行的标签页
  10096. var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop');
  10097. var totalwidth = 0;
  10098. litabs.each(function () {
  10099. totalwidth += $(this).outerWidth(true);
  10100. });
  10101. if (navobj.width() < totalwidth) {
  10102. litabs.each(function () {
  10103. liwidth += $(this).outerWidth(true);
  10104. if (liwidth > maxwidth) {
  10105. dropdown.find('ul').append($(this));
  10106. collection++;
  10107. }
  10108. });
  10109. if (collection > 0) {
  10110. dropdown.removeClass('hide');
  10111. if (dropdown.find('.active').length === 1) {
  10112. dropdown.addClass('active');
  10113. } else {
  10114. dropdown.removeClass('active');
  10115. }
  10116. }
  10117. } else {
  10118. dropdown.addClass('hide');
  10119. }
  10120. };
  10121. })(jQuery);
  10122. define("addtabs", function(){});
  10123. /**
  10124. * @summary SelectPage
  10125. * @desc Simple and powerful selection plugin
  10126. * @file selectpage.js
  10127. * @version 2.18
  10128. * @author TerryZeng
  10129. * @contact https://terryz.github.io/
  10130. * @license MIT License
  10131. *
  10132. */
  10133. ;
  10134. (function ($) {
  10135. "use strict";
  10136. /**
  10137. * Default options
  10138. */
  10139. var defaults = {
  10140. /**
  10141. * Data source
  10142. * @type {string|Object}
  10143. *
  10144. * string:server side request url address
  10145. * Object:JSON array,format:[{a:1,b:2,c:3},{...}]
  10146. */
  10147. data: undefined,
  10148. /**
  10149. * Language ('cn', 'en', 'ja', 'es', 'pt-br')
  10150. * @type string
  10151. * @default 'cn'
  10152. */
  10153. lang: 'cn',
  10154. /**
  10155. * Multiple select mode(tags)
  10156. * @type boolean
  10157. * @default false
  10158. */
  10159. multiple: false,
  10160. /**
  10161. * pagination or not
  10162. * @type boolean
  10163. * @default true
  10164. */
  10165. pagination: true,
  10166. /**
  10167. * Show up menu button
  10168. * @type boolean
  10169. * @default true
  10170. */
  10171. dropButton: true,
  10172. /**
  10173. * Result list visible size in pagination bar close
  10174. * @type number
  10175. * @default 10
  10176. */
  10177. listSize: 10,
  10178. /**
  10179. * Show control bar in multiple select mode
  10180. * @type boolean
  10181. * @default true
  10182. */
  10183. multipleControlbar: true,
  10184. /**
  10185. * Max selected item limited in multiple select mode
  10186. * @type number
  10187. * @default 0(unlimited)
  10188. */
  10189. maxSelectLimit: 0,
  10190. /**
  10191. * Select result item to close list, work on multiple select mode
  10192. * @type boolean
  10193. * @default false
  10194. */
  10195. selectToCloseList: false,
  10196. /**
  10197. * Init selected item key, the result will match to option.keyField option
  10198. * @type string
  10199. */
  10200. initRecord: undefined,
  10201. /**
  10202. * The table parameter in server side mode
  10203. * @type string
  10204. */
  10205. dbTable: 'tbl',
  10206. /**
  10207. * The value field, the value will fill to hidden element
  10208. * @type string
  10209. * @default 'id'
  10210. */
  10211. keyField: 'id',
  10212. /**
  10213. * The show text field, the text will show to input element or tags(multiple mode)
  10214. * @type string
  10215. * @default 'name'
  10216. */
  10217. showField: 'name',
  10218. /**
  10219. * Actually used to search field
  10220. * @type string
  10221. */
  10222. searchField: undefined,
  10223. /**
  10224. * Search type ('AND' or 'OR')
  10225. * @type string
  10226. * @default 'AND'
  10227. */
  10228. andOr: 'AND',
  10229. /**
  10230. * Result sort type
  10231. * @type array - if not set, will default used showField field
  10232. * @example
  10233. * orderBy : ['id desc']
  10234. */
  10235. orderBy: undefined,
  10236. /**
  10237. * Page size
  10238. * @type number
  10239. * @default 10
  10240. */
  10241. pageSize: 10,
  10242. /**
  10243. * Server side request parameters
  10244. * @type function
  10245. * @return object
  10246. * @example params : function(){return {'name':'aa','sex':1};}
  10247. */
  10248. params: undefined,
  10249. /**
  10250. * Custom result list item show text
  10251. * @type function
  10252. * @param data {object} row data
  10253. * @return string
  10254. */
  10255. formatItem: undefined,
  10256. /**
  10257. * Have some highlight item and lost focus, auto select the highlight item
  10258. * @type boolean
  10259. * @default false
  10260. */
  10261. autoFillResult: false,
  10262. /**
  10263. * Auto select first item in show up result list or search result
  10264. * depend on `autoFillResult` option set to true
  10265. * @type boolean
  10266. * @default false
  10267. */
  10268. autoSelectFirst: false,
  10269. /**
  10270. * Whether clear input element text when enter some keywords to search and no result return
  10271. * @type boolean
  10272. * @default true
  10273. */
  10274. noResultClean: true,
  10275. /**
  10276. * Select only mode
  10277. * @type boolean
  10278. */
  10279. selectOnly: false,
  10280. /**
  10281. * Input to search delay time, work on ajax data source
  10282. * @type number
  10283. * @default 0.5
  10284. */
  10285. inputDelay: 0.5,
  10286. /**
  10287. * -----------------------------------------Callback--------------------------------------------
  10288. */
  10289. /**
  10290. * Result list item selected callback
  10291. * @type function
  10292. * @param object - selected item json data
  10293. * @param self - plugin object
  10294. */
  10295. eSelect: undefined,
  10296. /**
  10297. * Before result list show up callback, you can do anything prepared
  10298. * @param self - plugin object
  10299. */
  10300. eOpen: undefined,
  10301. /**
  10302. * Server side return data convert callback
  10303. * @type function
  10304. * @param data {object} server side return data
  10305. * @param self {object} plugin object
  10306. * @return {object} return data format:
  10307. * @example
  10308. * {
  10309. * list : [{name:'aa',sex:1},{name:'bb',sex:1}...],
  10310. * totalRow : 100
  10311. * }
  10312. */
  10313. eAjaxSuccess: undefined,
  10314. /**
  10315. * Close selected item tag callback (multiple mode)
  10316. * @type function
  10317. * @param removeCount {number} remove item count
  10318. * @param self {object} plugin object
  10319. */
  10320. eTagRemove: undefined,
  10321. /**
  10322. * Clear selected item callback(single select mode)
  10323. * @type function
  10324. * @param self {object} plugin object
  10325. */
  10326. eClear: undefined
  10327. };
  10328. /**
  10329. * SelectPage class definition
  10330. * @constructor
  10331. * @param {Object} input - input element
  10332. * @param {Object} option
  10333. */
  10334. var SelectPage = function (input, option) {
  10335. //特殊字段处理
  10336. $.each({data: 'source', keyField: 'primaryKey', showField: 'field', pageSize: 'perPage'}, function (i, j) {
  10337. if (typeof option[j] !== 'undefined') {
  10338. option[i] = option[j];
  10339. delete option[j];
  10340. }
  10341. });
  10342. this.setOption(option);
  10343. this.setLanguage();
  10344. this.setCssClass();
  10345. this.setProp();
  10346. this.setElem(input);
  10347. this.setButtonAttrDefault();
  10348. this.setInitRecord();
  10349. this.eDropdownButton();
  10350. this.eInput();
  10351. this.eWhole();
  10352. };
  10353. /**
  10354. * Plugin version number
  10355. */
  10356. SelectPage.version = '2.18';
  10357. /**
  10358. * Plugin object cache key
  10359. */
  10360. SelectPage.dataKey = 'selectPageObject';
  10361. /**
  10362. * Options set
  10363. * @param {Object} option
  10364. */
  10365. SelectPage.prototype.setOption = function (option) {
  10366. //use showField to default
  10367. option.searchField = option.searchField || option.showField;
  10368. option.andOr = option.andOr.toUpperCase();
  10369. if (option.andOr !== 'AND' && option.andOr !== 'OR')
  10370. option.andOr = 'AND';
  10371. //support multiple field set
  10372. var arr = ['searchField'];
  10373. for (var i = 0; i < arr.length; i++) {
  10374. option[arr[i]] = this.strToArray(option[arr[i]]);
  10375. }
  10376. //set default order field
  10377. option.orderBy = option.orderBy || option.showField;
  10378. //set multiple order field
  10379. //example: [ ['id', 'ASC'], ['name', 'DESC'] ]
  10380. option.orderBy = this.setOrderbyOption(option.orderBy, option.showField);
  10381. //close auto fill result and auto select first in multiple mode and select item not close list
  10382. if (option.multiple && !option.selectToCloseList) {
  10383. option.autoFillResult = false;
  10384. option.autoSelectFirst = false;
  10385. }
  10386. //show all item when pagination bar close, limited 200
  10387. if (!option.pagination)
  10388. option.pageSize = 200;
  10389. if ($.type(option.listSize) !== 'number' || option.listSize < 0)
  10390. option.listSize = 10;
  10391. this.option = option;
  10392. };
  10393. /**
  10394. * String convert to array
  10395. * @param str {string}
  10396. * @return {Array}
  10397. */
  10398. SelectPage.prototype.strToArray = function (str) {
  10399. if (!str)
  10400. return '';
  10401. return str.replace(/[\s ]+/g, '').split(',');
  10402. };
  10403. /**
  10404. * Set order field
  10405. * @param {Array} arg_order
  10406. * @param {string} arg_field
  10407. * @return {Array}
  10408. */
  10409. SelectPage.prototype.setOrderbyOption = function (arg_order, arg_field) {
  10410. var arr = [], orders = [];
  10411. if (typeof arg_order == 'object') {
  10412. for (var i = 0; i < arg_order.length; i++) {
  10413. orders = $.trim(arg_order[i]).split(' ');
  10414. arr[i] = (orders.length == 2) ? orders : [orders[0], 'ASC'];
  10415. }
  10416. } else {
  10417. orders = $.trim(arg_order).split(' ');
  10418. arr[0] = (orders.length == 2) ? orders : (orders[0].match(/^(ASC|DESC)$/i)) ? [arg_field, orders[0]] : [orders[0], 'ASC'];
  10419. }
  10420. return arr;
  10421. };
  10422. /**
  10423. * i18n
  10424. */
  10425. SelectPage.prototype.setLanguage = function () {
  10426. var message, p = this.option;
  10427. switch (p.lang) {
  10428. // English
  10429. case 'en':
  10430. message = {
  10431. add_btn: 'Add button',
  10432. add_title: 'add a box',
  10433. del_btn: 'Del button',
  10434. del_title: 'delete a box',
  10435. next: 'Next',
  10436. next_title: 'Next' + p.pageSize + ' (Right key)',
  10437. prev: 'Prev',
  10438. prev_title: 'Prev' + p.pageSize + ' (Left key)',
  10439. first_title: 'First (Shift + Left key)',
  10440. last_title: 'Last (Shift + Right key)',
  10441. get_all_btn: 'Get All (Down key)',
  10442. get_all_alt: '(button)',
  10443. close_btn: 'Close (Tab key)',
  10444. close_alt: '(button)',
  10445. loading: 'loading...',
  10446. loading_alt: '(loading)',
  10447. page_info: 'page_num of page_count',
  10448. select_ng: 'Attention : Please choose from among the list.',
  10449. select_ok: 'OK : Correctly selected.',
  10450. not_found: 'not found',
  10451. ajax_error: 'An error occurred while connecting to server.',
  10452. clear: 'Clear content',
  10453. select_all: 'Select current page',
  10454. unselect_all: 'Clear current page',
  10455. clear_all: 'Clear all selected',
  10456. max_selected: 'You can only select up to max_selected_limit items'
  10457. };
  10458. break;
  10459. // 中文
  10460. case 'cn':
  10461. default:
  10462. message = {
  10463. add_btn: '添加按钮',
  10464. add_title: '添加区域',
  10465. del_btn: '删除按钮',
  10466. del_title: '删除区域',
  10467. next: '下一页',
  10468. next_title: '下' + p.pageSize + ' (→)',
  10469. prev: '上一页',
  10470. prev_title: '上' + p.pageSize + ' (←)',
  10471. first_title: '首页 (Shift + ←)',
  10472. last_title: '尾页 (Shift + →)',
  10473. get_all_btn: '获得全部 (↓)',
  10474. get_all_alt: '(按钮)',
  10475. close_btn: '关闭 (Tab键)',
  10476. close_alt: '(按钮)',
  10477. loading: '读取中...',
  10478. loading_alt: '(读取中)',
  10479. page_info: '第 page_num 页(共page_count页)',
  10480. select_ng: '请注意:请从列表中选择.',
  10481. select_ok: 'OK : 已经选择.',
  10482. not_found: '无查询结果',
  10483. ajax_error: '连接到服务器时发生错误!',
  10484. clear: '清除内容',
  10485. select_all: '选择当前页项目',
  10486. unselect_all: '取消选择当前页项目',
  10487. clear_all: '清除全部已选择项目',
  10488. max_selected: '最多只能选择 max_selected_limit 个项目'
  10489. };
  10490. break;
  10491. }
  10492. this.message = message;
  10493. };
  10494. /**
  10495. * Css classname defined
  10496. */
  10497. SelectPage.prototype.setCssClass = function () {
  10498. var css_class = {
  10499. container: 'sp_container',
  10500. container_open: 'sp_container_open',
  10501. re_area: 'sp_result_area',
  10502. result_open: 'sp_result_area_open',
  10503. control_box: 'sp_control_box',
  10504. //multiple select mode
  10505. element_box: 'sp_element_box',
  10506. navi: 'sp_navi',
  10507. //result list
  10508. results: 'sp_results',
  10509. re_off: 'sp_results_off',
  10510. select: 'sp_over',
  10511. select_ok: 'sp_select_ok',
  10512. select_ng: 'sp_select_ng',
  10513. selected: 'sp_selected',
  10514. input_off: 'sp_input_off',
  10515. message_box: 'sp_message_box',
  10516. disabled: 'sp_disabled',
  10517. button: 'sp_button',
  10518. btn_on: 'sp_btn_on',
  10519. btn_out: 'sp_btn_out',
  10520. input: 'sp_input',
  10521. clear_btn: 'sp_clear_btn',
  10522. align_right: 'sp_align_right'
  10523. };
  10524. this.css_class = css_class;
  10525. };
  10526. /**
  10527. * Plugin inner properties
  10528. */
  10529. SelectPage.prototype.setProp = function () {
  10530. this.prop = {
  10531. //input disabled status
  10532. disabled: false,
  10533. current_page: 1,
  10534. //total page
  10535. max_page: 1,
  10536. //ajax data loading status
  10537. is_loading: false,
  10538. xhr: false,
  10539. key_paging: false,
  10540. key_select: false,
  10541. //last selected item value
  10542. prev_value: '',
  10543. //last selected item text
  10544. selected_text: '',
  10545. last_input_time: undefined,
  10546. init_set: false
  10547. };
  10548. this.template = {
  10549. tag: {
  10550. content: '<li class="selected_tag" itemvalue="#item_value#">#item_text#<span class="tag_close"><i class="spfont sp-close"></i></span></li>',
  10551. textKey: '#item_text#',
  10552. valueKey: '#item_value#'
  10553. },
  10554. page: {
  10555. current: 'page_num',
  10556. total: 'page_count'
  10557. },
  10558. msg: {
  10559. maxSelectLimit: 'max_selected_limit'
  10560. }
  10561. };
  10562. };
  10563. /**
  10564. * Get the actual width/height of invisible DOM elements with jQuery.
  10565. * Source code come from dreamerslab/jquery.actual
  10566. * @param element
  10567. * @param method
  10568. * @returns {*}
  10569. */
  10570. SelectPage.prototype.elementRealSize = function (element, method) {
  10571. var defaults = {
  10572. absolute: false,
  10573. clone: false,
  10574. includeMargin: false,
  10575. display: 'block'
  10576. };
  10577. var configs = defaults, $target = element.eq(0), fix, restore, tmp = [], style = '', $hidden;
  10578. fix = function () {
  10579. // get all hidden parents
  10580. $hidden = $target.parents().addBack().filter(':hidden');
  10581. style += 'visibility: hidden !important; display: ' + configs.display + ' !important; ';
  10582. if (configs.absolute === true)
  10583. style += 'position: absolute !important;';
  10584. // save the origin style props
  10585. // set the hidden el css to be got the actual value later
  10586. $hidden.each(function () {
  10587. // Save original style. If no style was set, attr() returns undefined
  10588. var $this = $(this), thisStyle = $this.attr('style');
  10589. tmp.push(thisStyle);
  10590. // Retain as much of the original style as possible, if there is one
  10591. $this.attr('style', thisStyle ? thisStyle + ';' + style : style);
  10592. });
  10593. };
  10594. restore = function () {
  10595. // restore origin style values
  10596. $hidden.each(function (i) {
  10597. var $this = $(this), _tmp = tmp[i];
  10598. if (_tmp === undefined)
  10599. $this.removeAttr('style');
  10600. else
  10601. $this.attr('style', _tmp);
  10602. });
  10603. };
  10604. fix();
  10605. // get the actual value with user specific methed
  10606. // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
  10607. // configs.includeMargin only works for 'outerWidth' and 'outerHeight'
  10608. var actual = /(outer)/.test(method) ?
  10609. $target[method](configs.includeMargin) :
  10610. $target[method]();
  10611. restore();
  10612. // IMPORTANT, this plugin only return the value of the first element
  10613. return actual;
  10614. };
  10615. /**
  10616. * Dom building
  10617. * @param {Object} combo_input - original input element
  10618. */
  10619. SelectPage.prototype.setElem = function (combo_input) {
  10620. // 1. build Dom object
  10621. var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
  10622. var cssWidth = input.css("width");
  10623. var orgWidth = input.outerWidth();
  10624. if (cssWidth.indexOf("%") > -1 || input.parent().size() > 0 && input.parent().width() == orgWidth) {
  10625. orgWidth = "100%";
  10626. } else {
  10627. // fix input width in hidden situation
  10628. if (orgWidth <= 0)
  10629. orgWidth = this.elementRealSize(input, 'outerWidth');
  10630. if (orgWidth < 150)
  10631. orgWidth = 150;
  10632. }
  10633. elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
  10634. if (p.selectOnly)
  10635. elem.combo_input.prop('readonly', true);
  10636. elem.container = elem.combo_input.parent().addClass(css.container);
  10637. if (elem.combo_input.prop('disabled')) {
  10638. if (p.multiple)
  10639. elem.container.addClass(css.disabled);
  10640. else
  10641. elem.combo_input.addClass(css.input_off);
  10642. }
  10643. // set outer box width
  10644. elem.container.width(orgWidth);
  10645. elem.button = $('<div>').addClass(css.button);
  10646. //drop down button
  10647. elem.dropdown = $('<span class="sp_caret"></span>');
  10648. //clear button 'X' in single mode
  10649. elem.clear_btn = $('<div>').html($('<i>').addClass('spfont sp-close')).addClass(css.clear_btn).attr('title', msg.clear);
  10650. if (!p.dropButton)
  10651. elem.clear_btn.addClass(css.align_right);
  10652. //main box in multiple mode
  10653. elem.element_box = $('<ul>').addClass(css.element_box);
  10654. if (p.multiple && p.multipleControlbar)
  10655. elem.control = $('<div>').addClass(css.control_box);
  10656. //result list box
  10657. elem.result_area = $('<div>').addClass(css.re_area);
  10658. //pagination bar
  10659. if (p.pagination)
  10660. elem.navi = $('<div>').addClass('sp_pagination').append('<ul>');
  10661. elem.results = $('<ul>').addClass(css.results);
  10662. var namePrefix = '_text',
  10663. input_id = elem.combo_input.attr('id') || elem.combo_input.attr('name'),
  10664. input_name = elem.combo_input.attr('name') || 'selectPage',
  10665. hidden_name = input_name,
  10666. hidden_id = input_id;
  10667. //switch the id and name attributes of input/hidden element
  10668. elem.hidden = $('<input type="hidden" class="sp_hidden" />').attr({
  10669. name: hidden_name,
  10670. id: hidden_id
  10671. }).val('');
  10672. elem.combo_input.attr({
  10673. name: typeof input.data('name') !== 'undefined' ? input.data('name') : input_name + namePrefix,
  10674. id: input_id + namePrefix
  10675. });
  10676. // 2. DOM element put
  10677. elem.container.append(elem.hidden);
  10678. if (p.dropButton) {
  10679. elem.container.append(elem.button)
  10680. elem.button.append(elem.dropdown);
  10681. }
  10682. $(document.body).append(elem.result_area);
  10683. elem.result_area.append(elem.results);
  10684. if (p.pagination)
  10685. elem.result_area.append(elem.navi);
  10686. //Multiple select mode
  10687. if (p.multiple) {
  10688. if (p.multipleControlbar) {
  10689. elem.control.append('<button type="button" class="btn btn-default sp_clear_all" ><i class="spfont sp-clear"></i></button>');
  10690. elem.control.append('<button type="button" class="btn btn-default sp_unselect_all" ><i class="spfont sp-unselect-all"></i></button>');
  10691. elem.control.append('<button type="button" class="btn btn-default sp_select_all" ><i class="spfont sp-select-all"></i></button>');
  10692. elem.control_text = $('<p>');
  10693. elem.control.append(elem.control_text);
  10694. elem.result_area.prepend(elem.control);
  10695. }
  10696. elem.container.addClass('sp_container_combo');
  10697. elem.combo_input.addClass('sp_combo_input').before(elem.element_box);
  10698. var li = $('<li>').addClass('input_box');
  10699. li.append(elem.combo_input);
  10700. elem.element_box.append(li);
  10701. if (elem.combo_input.attr('placeholder'))
  10702. elem.combo_input.attr('placeholder_bak', elem.combo_input.attr('placeholder'));
  10703. }
  10704. this.elem = elem;
  10705. };
  10706. /**
  10707. * Drop down button set to default
  10708. */
  10709. SelectPage.prototype.setButtonAttrDefault = function () {
  10710. /*
  10711. if (this.option.selectOnly) {
  10712. if ($(this.elem.combo_input).val() !== '') {
  10713. if ($(this.elem.hidden).val() !== '') {
  10714. //选择条件
  10715. $(this.elem.combo_input).attr('title', this.message.select_ok).removeClass(this.css_class.select_ng).addClass(this.css_class.select_ok);
  10716. } else {
  10717. //输入方式
  10718. $(this.elem.combo_input).attr('title', this.message.select_ng).removeClass(this.css_class.select_ok).addClass(this.css_class.select_ng);
  10719. }
  10720. } else {
  10721. $(this.elem.hidden).val('');
  10722. $(this.elem.combo_input).removeAttr('title').removeClass(this.css_class.select_ng);
  10723. }
  10724. }
  10725. */
  10726. //this.elem.button.attr('title', this.message.get_all_btn);
  10727. if (this.option.dropButton)
  10728. this.elem.button.attr('title', this.message.close_btn);
  10729. };
  10730. /**
  10731. * Set item need selected after init
  10732. * set selected item ways:
  10733. * <input value="key">
  10734. * <input data-init="key">
  10735. */
  10736. SelectPage.prototype.setInitRecord = function (refresh) {
  10737. var self = this, p = self.option, el = self.elem, key = '';
  10738. if ($.type(el.combo_input.data('init')) != 'undefined')
  10739. p.initRecord = String(el.combo_input.data('init'));
  10740. //data-init and value attribute can be init plugin selected item
  10741. //but, if set data-init and value attribute in the same time, plugin will choose data-init attribute first
  10742. if (!refresh && !p.initRecord && el.combo_input.val())
  10743. p.initRecord = el.combo_input.val();
  10744. el.combo_input.val('');
  10745. if (!refresh)
  10746. el.hidden.val(p.initRecord);
  10747. key = refresh && el.hidden.val() ? el.hidden.val() : p.initRecord;
  10748. if (key) {
  10749. if (typeof p.data === 'object') {
  10750. var data = new Array();
  10751. var keyarr = key.split(',');
  10752. $.each(keyarr, function (index, row) {
  10753. for (var i = 0; i < p.data.length; i++) {
  10754. if (p.data[i][p.keyField] == row) {
  10755. data.push(p.data[i]);
  10756. break;
  10757. }
  10758. }
  10759. });
  10760. if (!p.multiple && data.length > 1)
  10761. data = [data[0]];
  10762. self.afterInit(self, data);
  10763. } else {//ajax data source mode to init selected item
  10764. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  10765. var _orgParams = {
  10766. searchTable: p.dbTable,
  10767. searchKey: p.keyField,
  10768. searchValue: key,
  10769. orderBy: p.orderBy,
  10770. showField: p.showField,
  10771. keyField: p.keyField,
  10772. keyValue: key,
  10773. searchField: p.searchField
  10774. };
  10775. if (_paramsFunc) {
  10776. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  10777. if (result && $.isPlainObject(result)) {
  10778. _params = $.extend({}, _orgParams, result);
  10779. } else {
  10780. _params = _orgParams;
  10781. }
  10782. } else {
  10783. _params = _orgParams;
  10784. }
  10785. $.ajax({
  10786. dataType: 'json',
  10787. type: 'POST',
  10788. url: p.data,
  10789. data: _params,
  10790. success: function (json) {
  10791. var d = null;
  10792. if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
  10793. d = p.eAjaxSuccess(json);
  10794. self.afterInit(self, d.list);
  10795. },
  10796. error: function (jqXHR, textStatus, errorThrown) {
  10797. self.ajaxErrorNotify(self, errorThrown);
  10798. }
  10799. });
  10800. }
  10801. }
  10802. };
  10803. /**
  10804. * Selected item set to plugin
  10805. * @param {Object} self
  10806. * @param {Object} data - selected item data
  10807. */
  10808. SelectPage.prototype.afterInit = function (self, data) {
  10809. if (!data || ($.isArray(data) && data.length === 0))
  10810. return;
  10811. if (!$.isArray(data))
  10812. data = [data];
  10813. var p = self.option, css = self.css_class;
  10814. var getText = function (row) {
  10815. var text = row[p.showField];
  10816. if (p.formatItem && $.isFunction(p.formatItem)) {
  10817. try {
  10818. text = p.formatItem(row);
  10819. } catch (e) {
  10820. }
  10821. }
  10822. return text;
  10823. };
  10824. if (p.multiple) {
  10825. self.prop.init_set = true;
  10826. self.clearAll(self);
  10827. $.each(data, function (i, row) {
  10828. var item = {text: getText(row), value: row[p.keyField]};
  10829. if (!self.isAlreadySelected(self, item))
  10830. self.addNewTag(self, item);
  10831. });
  10832. self.tagValuesSet(self);
  10833. self.inputResize(self);
  10834. console.log(self.elem.hidden.blur());
  10835. self.prop.init_set = false;
  10836. } else {
  10837. var row = data[0];
  10838. self.elem.combo_input.val(getText(row));
  10839. self.elem.hidden.val(row[p.keyField]);
  10840. self.prop.prev_value = getText(row);
  10841. self.prop.selected_text = getText(row);
  10842. if (p.selectOnly) {
  10843. self.elem.combo_input.attr('title', self.message.select_ok).removeClass(css.select_ng).addClass(css.select_ok);
  10844. }
  10845. self.putClearButton();
  10846. }
  10847. };
  10848. /**
  10849. * Drop down button event bind
  10850. */
  10851. SelectPage.prototype.eDropdownButton = function () {
  10852. var self = this;
  10853. if (self.option.dropButton) {
  10854. self.elem.button.mouseup(function (ev) {
  10855. ev.stopPropagation();
  10856. if (self.elem.result_area.is(':hidden') && !self.elem.combo_input.prop('disabled')) {
  10857. self.elem.combo_input.focus();
  10858. } else
  10859. self.hideResults(self);
  10860. });
  10861. }
  10862. };
  10863. /**
  10864. * Events bind
  10865. */
  10866. SelectPage.prototype.eInput = function () {
  10867. var self = this, p = self.option, el = self.elem, msg = self.message;
  10868. var showList = function () {
  10869. self.prop.page_move = false;
  10870. self.suggest(self);
  10871. self.setCssFocusedInput(self);
  10872. };
  10873. el.combo_input.keyup(function (e) {
  10874. self.processKey(self, e);
  10875. }).keydown(function (e) {
  10876. self.processControl(self, e);
  10877. }).focus(function (e) {
  10878. //When focus on input, show the result list
  10879. if (el.result_area.is(':hidden')) {
  10880. e.stopPropagation();
  10881. self.prop.first_show = true;
  10882. showList();
  10883. }
  10884. });
  10885. el.container.on('click.SelectPage', 'div.' + self.css_class.clear_btn, function (e) {
  10886. e.stopPropagation();
  10887. if (!self.disabled(self)) {
  10888. self.clearAll(self);
  10889. self.elem.hidden.change();
  10890. if (p.eClear && $.isFunction(p.eClear))
  10891. p.eClear(self);
  10892. }
  10893. });
  10894. el.result_area.on('mousedown.SelectPage', function (e) {
  10895. e.stopPropagation();
  10896. });
  10897. if (p.multiple) {
  10898. if (p.multipleControlbar) {
  10899. //Select all item of current page
  10900. el.control.find('.sp_select_all').on('click.SelectPage', function (e) {
  10901. self.selectAllLine(self);
  10902. }).hover(function () {
  10903. el.control_text.html(msg.select_all);
  10904. }, function () {
  10905. el.control_text.html('');
  10906. });
  10907. //Cancel select all item of current page
  10908. el.control.find('.sp_unselect_all').on('click.SelectPage', function (e) {
  10909. self.unSelectAllLine(self);
  10910. }).hover(function () {
  10911. el.control_text.html(msg.unselect_all);
  10912. }, function () {
  10913. el.control_text.html('');
  10914. });
  10915. //Clear all selected item
  10916. el.control.find('.sp_clear_all').on('click.SelectPage', function (e) {
  10917. self.clearAll(self);
  10918. }).hover(function () {
  10919. el.control_text.html(msg.clear_all);
  10920. }, function () {
  10921. el.control_text.html('');
  10922. });
  10923. }
  10924. el.element_box.on('click.SelectPage', function (e) {
  10925. var srcEl = e.target || e.srcElement;
  10926. if ($(srcEl).is('ul'))
  10927. el.combo_input.focus();
  10928. });
  10929. //Tag close
  10930. el.element_box.on('click.SelectPage', 'span.tag_close', function () {
  10931. var li = $(this).closest('li');
  10932. self.removeTag(self, li);
  10933. showList();
  10934. if (p.eTagRemove && $.isFunction(p.eTagRemove))
  10935. p.eTagRemove(1, self);
  10936. });
  10937. self.inputResize(self);
  10938. }
  10939. };
  10940. /**
  10941. * Out of plugin area click event handler
  10942. */
  10943. SelectPage.prototype.eWhole = function () {
  10944. var self = this, css = self.css_class;
  10945. var cleanContent = function (obj) {
  10946. obj.elem.combo_input.val('');
  10947. if (!obj.option.multiple)
  10948. obj.elem.hidden.val('');
  10949. obj.prop.selected_text = '';
  10950. };
  10951. //Out of plugin area
  10952. $(document.body).off('mousedown.selectPage').on('mousedown.selectPage', function (e) {
  10953. var ele = e.target || e.srcElement;
  10954. var sp = $(ele).closest('div.' + css.container);
  10955. //Open status result list
  10956. $('div.' + css.container + '.' + css.container_open).each(function () {
  10957. if (this == sp[0])
  10958. return;
  10959. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey);
  10960. if (!d.elem.combo_input.val() && d.elem.hidden.val() && !d.option.multiple) {
  10961. d.prop.current_page = 1;//reset page to 1
  10962. cleanContent(d);
  10963. d.hideResults(d);
  10964. return true;
  10965. }
  10966. if (d.elem.results.find('li').not('.' + css.message_box).size()) {
  10967. if (d.option.autoFillResult) {
  10968. //have selected item, then hide result list
  10969. if (d.elem.hidden.val())
  10970. d.hideResults(d);
  10971. else if (d.elem.results.find('li.sp_over').size()) {
  10972. //no one selected and have highlight item, select the highlight item
  10973. d.selectCurrentLine(d, true);
  10974. } else if (d.option.autoSelectFirst) {
  10975. //no one selected, no one highlight, select the first item
  10976. d.nextLine(d);
  10977. d.selectCurrentLine(d, true);
  10978. } else
  10979. d.hideResults(d);
  10980. } else
  10981. d.hideResults(d);
  10982. } else {
  10983. //when no one item match, clear search keywords
  10984. if (d.option.noResultClean)
  10985. cleanContent(d);
  10986. else {
  10987. if (!d.option.multiple)
  10988. d.elem.hidden.val('');
  10989. }
  10990. d.hideResults(d);
  10991. }
  10992. });
  10993. });
  10994. };
  10995. /**
  10996. * Result list event bind
  10997. */
  10998. SelectPage.prototype.eResultList = function () {
  10999. var self = this, css = this.css_class;
  11000. self.elem.results.children('li').hover(function () {
  11001. if (self.prop.key_select) {
  11002. self.prop.key_select = false;
  11003. return;
  11004. }
  11005. if (!$(this).hasClass(css.selected) && !$(this).hasClass(css.message_box)) {
  11006. $(this).addClass(css.select);
  11007. self.setCssFocusedResults(self);
  11008. }
  11009. }, function () {
  11010. $(this).removeClass(css.select);
  11011. }).click(function (e) {
  11012. if (self.prop.key_select) {
  11013. self.prop.key_select = false;
  11014. return;
  11015. }
  11016. e.preventDefault();
  11017. e.stopPropagation();
  11018. if (!$(this).hasClass(css.selected))
  11019. self.selectCurrentLine(self, false);
  11020. });
  11021. };
  11022. /**
  11023. * Reposition result list when list beyond the visible area
  11024. */
  11025. SelectPage.prototype.eScroll = function () {
  11026. var self = this, css = this.css_class;
  11027. $(window).on('scroll.SelectPage', function (e) {
  11028. $('div.' + css.container + '.' + css.container_open).each(function () {
  11029. var $this = $(this), d = $this.find('input.' + css.input).data(SelectPage.dataKey),
  11030. offset = d.elem.result_area.offset(),
  11031. screenScrollTop = $(window).scrollTop(),
  11032. docHeight = $(document).height(),
  11033. viewHeight = $(window).height(),
  11034. listHeight = d.elem.result_area.outerHeight(),
  11035. listBottom = offset.top + listHeight,
  11036. hasOverflow = docHeight > viewHeight,
  11037. down = d.elem.result_area.hasClass('shadowDown');
  11038. if (hasOverflow) {
  11039. if (down) {//open down
  11040. if (listBottom > (viewHeight + screenScrollTop))
  11041. d.calcResultsSize(d);
  11042. } else {//open up
  11043. if (offset.top < screenScrollTop)
  11044. d.calcResultsSize(d);
  11045. }
  11046. }
  11047. });
  11048. });
  11049. };
  11050. /**
  11051. * Page bar button event bind
  11052. */
  11053. SelectPage.prototype.ePaging = function () {
  11054. var self = this;
  11055. if (!self.option.pagination)
  11056. return;
  11057. self.elem.navi.find('li.csFirstPage').off('click').on('click', function (ev) {
  11058. //$(self.elem.combo_input).focus();
  11059. ev.preventDefault();
  11060. self.firstPage(self);
  11061. });
  11062. self.elem.navi.find('li.csPreviousPage').off('click').on('click', function (ev) {
  11063. //$(self.elem.combo_input).focus();
  11064. ev.preventDefault();
  11065. self.prevPage(self);
  11066. });
  11067. self.elem.navi.find('li.csNextPage').off('click').on('click', function (ev) {
  11068. //$(self.elem.combo_input).focus();
  11069. ev.preventDefault();
  11070. self.nextPage(self);
  11071. });
  11072. self.elem.navi.find('li.csLastPage').off('click').on('click', function (ev) {
  11073. //$(self.elem.combo_input).focus();
  11074. ev.preventDefault();
  11075. self.lastPage(self);
  11076. });
  11077. };
  11078. /**
  11079. * Ajax request fail
  11080. * @param {Object} self
  11081. * @param {string} errorThrown
  11082. */
  11083. SelectPage.prototype.ajaxErrorNotify = function (self, errorThrown) {
  11084. self.showMessage(self.message.ajax_error);
  11085. };
  11086. /**
  11087. * Message box
  11088. * @param {Object} self
  11089. * @param msg {string} the text need to show
  11090. */
  11091. SelectPage.prototype.showMessage = function (self, msg) {
  11092. if (!msg)
  11093. return;
  11094. var msgLi = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' + msg + '</li>';
  11095. self.elem.results.empty().append(msgLi).show();
  11096. self.calcResultsSize(self);
  11097. self.setOpenStatus(self, true);
  11098. self.elem.control.hide();
  11099. if (self.option.pagination)
  11100. self.elem.navi.hide();
  11101. };
  11102. /**
  11103. * @desc Scroll
  11104. * @param {Object} self
  11105. * @param {boolean} enforce
  11106. */
  11107. SelectPage.prototype.scrollWindow = function (self, enforce) {
  11108. var current_result = self.getCurrentLine(self),
  11109. target_top = (current_result && !enforce) ? current_result.offset().top : self.elem.container.offset().top,
  11110. target_size;
  11111. self.prop.size_li = self.elem.results.children('li:first').outerHeight();
  11112. target_size = self.prop.size_li;
  11113. var gap, client_height = $(window).height(),
  11114. scroll_top = $(window).scrollTop(),
  11115. scroll_bottom = scroll_top + client_height - target_size;
  11116. if (current_result.length) {
  11117. if (target_top < scroll_top || target_size > client_height) {
  11118. //scroll to top
  11119. gap = target_top - scroll_top;
  11120. } else if (target_top > scroll_bottom) {
  11121. //scroll down
  11122. gap = target_top - scroll_bottom;
  11123. } else
  11124. return; //do not scroll
  11125. } else if (target_top < scroll_top)
  11126. gap = target_top - scroll_top;
  11127. window.scrollBy(0, gap);
  11128. };
  11129. /**
  11130. * change css class by status
  11131. * @param self
  11132. * @param status {boolean} true: open, false: close
  11133. */
  11134. SelectPage.prototype.setOpenStatus = function (self, status) {
  11135. var el = self.elem, css = self.css_class;
  11136. if (status) {
  11137. el.container.addClass(css.container_open);
  11138. el.result_area.addClass(css.result_open);
  11139. } else {
  11140. el.container.removeClass(css.container_open);
  11141. el.result_area.removeClass(css.result_open);
  11142. }
  11143. };
  11144. /**
  11145. * input element in focus css class set
  11146. * @param {Object} self
  11147. */
  11148. SelectPage.prototype.setCssFocusedInput = function (self) {
  11149. //$(self.elem.results).addClass(self.css_class.re_off);
  11150. //$(self.elem.combo_input).removeClass(self.css_class.input_off);
  11151. };
  11152. /**
  11153. * set result list get focus and input element lost focus
  11154. * @param {Object} self
  11155. */
  11156. SelectPage.prototype.setCssFocusedResults = function (self) {
  11157. //$(self.elem.results).removeClass(self.css_class.re_off);
  11158. //$(self.elem.combo_input).addClass(self.css_class.input_off);
  11159. };
  11160. /**
  11161. * Quick search input keywords listener
  11162. * @param {Object} self
  11163. */
  11164. SelectPage.prototype.checkValue = function (self) {
  11165. var now_value = self.elem.combo_input.val();
  11166. if (now_value != self.prop.prev_value) {
  11167. self.prop.prev_value = now_value;
  11168. self.prop.first_show = false;
  11169. if (self.option.selectOnly)
  11170. self.setButtonAttrDefault();
  11171. if (!self.option.multiple && !now_value) {
  11172. self.elem.combo_input.val('');
  11173. self.elem.hidden.val('');
  11174. self.elem.clear_btn.remove();
  11175. }
  11176. self.suggest(self);
  11177. }
  11178. };
  11179. /**
  11180. * Input handle(regular input)
  11181. * @param {Object} self
  11182. * @param {Object} e - event object
  11183. */
  11184. SelectPage.prototype.processKey = function (self, e) {
  11185. if ($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9, 13]) === -1) {
  11186. if (e.keyCode != 16)
  11187. self.setCssFocusedInput(self); // except Shift(16)
  11188. self.inputResize(self);
  11189. if ($.type(self.option.data) === 'string') {
  11190. self.prop.last_input_time = e.timeStamp;
  11191. setTimeout(function () {
  11192. if ((e.timeStamp - self.prop.last_input_time) === 0)
  11193. self.checkValue(self);
  11194. }, self.option.inputDelay * 1000);
  11195. } else {
  11196. self.checkValue(self);
  11197. }
  11198. }
  11199. }
  11200. /**
  11201. * Input handle(control key)
  11202. * @param {Object} self
  11203. * @param {Object} e - event object
  11204. */
  11205. SelectPage.prototype.processControl = function (self, e) {
  11206. if (($.inArray(e.keyCode, [37, 38, 39, 40, 27, 9]) > -1 && self.elem.result_area.is(':visible')) ||
  11207. ($.inArray(e.keyCode, [13, 9]) > -1 && self.getCurrentLine(self))) {
  11208. e.preventDefault();
  11209. e.stopPropagation();
  11210. e.cancelBubble = true;
  11211. e.returnValue = false;
  11212. switch (e.keyCode) {
  11213. case 37:// left
  11214. if (e.shiftKey)
  11215. self.firstPage(self);
  11216. else
  11217. self.prevPage(self);
  11218. break;
  11219. case 38:// up
  11220. self.prop.key_select = true;
  11221. self.prevLine(self);
  11222. break;
  11223. case 39:// right
  11224. if (e.shiftKey)
  11225. self.lastPage(self);
  11226. else
  11227. self.nextPage(self);
  11228. break;
  11229. case 40:// down
  11230. if (self.elem.results.children('li').length) {
  11231. self.prop.key_select = true;
  11232. self.nextLine(self);
  11233. } else
  11234. self.suggest(self);
  11235. break;
  11236. case 9:// tab
  11237. self.prop.key_paging = true;
  11238. self.selectCurrentLine(self, true);
  11239. //self.hideResults(self);
  11240. break;
  11241. case 13:// return
  11242. self.selectCurrentLine(self, true);
  11243. break;
  11244. case 27:// escape
  11245. self.prop.key_paging = true;
  11246. self.hideResults(self);
  11247. break;
  11248. }
  11249. }
  11250. };
  11251. /**
  11252. * Abort Ajax request
  11253. * @param {Object} self
  11254. */
  11255. SelectPage.prototype.abortAjax = function (self) {
  11256. if (self.prop.xhr) {
  11257. self.prop.xhr.abort();
  11258. self.prop.xhr = false;
  11259. }
  11260. };
  11261. /**
  11262. * Suggest result of search keywords
  11263. * @param {Object} self
  11264. */
  11265. SelectPage.prototype.suggest = function (self) {
  11266. var q_word, val = $.trim(self.elem.combo_input.val());
  11267. if (self.option.multiple)
  11268. q_word = val;
  11269. else {
  11270. if (val && val === self.prop.selected_text)
  11271. q_word = '';
  11272. else
  11273. q_word = val;
  11274. }
  11275. q_word = q_word.split(/[\s ]+/);
  11276. //Before show up result list callback
  11277. if (self.option.eOpen && $.isFunction(self.option.eOpen))
  11278. self.option.eOpen.call(self);
  11279. self.abortAjax(self);
  11280. //self.setLoading(self);
  11281. var which_page_num = self.prop.current_page || 1;
  11282. if (typeof self.option.data == 'object')
  11283. self.searchForJson(self, q_word, which_page_num);
  11284. else
  11285. self.searchForDb(self, q_word, which_page_num);
  11286. };
  11287. /**
  11288. * Loading
  11289. * @param {Object} self
  11290. */
  11291. SelectPage.prototype.setLoading = function (self) {
  11292. if (self.elem.results.html() === '') {
  11293. //self.calcResultsSize(self);
  11294. self.setOpenStatus(self, true);
  11295. }
  11296. };
  11297. /**
  11298. * Search for ajax
  11299. * @param {Object} self
  11300. * @param {Array} q_word - query keyword
  11301. * @param {number} which_page_num - target page number
  11302. */
  11303. SelectPage.prototype.searchForDb = function (self, q_word, which_page_num) {
  11304. var p = self.option;
  11305. if (!p.eAjaxSuccess || !$.isFunction(p.eAjaxSuccess))
  11306. self.hideResults(self);
  11307. var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
  11308. //when have new query keyword, then reset page number to 1.
  11309. if (q_word.length && q_word[0] && q_word[0] !== self.prop.prev_value)
  11310. which_page_num = 1;
  11311. var _orgParams = {
  11312. q_word: q_word,
  11313. pageNumber: which_page_num,
  11314. pageSize: p.pageSize,
  11315. andOr: p.andOr,
  11316. orderBy: p.orderBy,
  11317. searchTable: p.dbTable,
  11318. showField: self.option.showField,
  11319. keyField: self.option.keyField,
  11320. searchField: self.option.searchField
  11321. };
  11322. _orgParams[searchKey] = q_word[0];
  11323. if (_paramsFunc) {
  11324. var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
  11325. if (result && $.isPlainObject(result)) {
  11326. _params = $.extend({}, _orgParams, result);
  11327. } else {
  11328. _params = _orgParams;
  11329. }
  11330. } else {
  11331. _params = _orgParams;
  11332. }
  11333. self.prop.xhr = $.ajax({
  11334. dataType: 'json',
  11335. url: p.data,
  11336. type: 'POST',
  11337. data: _params,
  11338. success: function (returnData) {
  11339. if (!returnData || !$.isPlainObject(returnData)) {
  11340. self.hideResults(self);
  11341. self.ajaxErrorNotify(self, errorThrown);
  11342. return;
  11343. }
  11344. var data = {}, json = {};
  11345. try {
  11346. data = p.eAjaxSuccess(returnData);
  11347. json.originalResult = data.list;
  11348. json.cnt_whole = data.totalRow;
  11349. } catch (e) {
  11350. self.showMessage(self, self.message.ajax_error);
  11351. return;
  11352. }
  11353. if (self.elem.navi) {
  11354. $(self.elem.navi).toggleClass("hide", json.cnt_whole <= json.originalResult.length);
  11355. }
  11356. json.candidate = [];
  11357. json.keyField = [];
  11358. if (typeof json.originalResult != 'object') {
  11359. self.prop.xhr = null;
  11360. self.notFoundSearch(self);
  11361. return;
  11362. }
  11363. json.cnt_page = json.originalResult.length;
  11364. for (var i = 0; i < json.cnt_page; i++) {
  11365. for (var key in json.originalResult[i]) {
  11366. if (key == p.keyField) {
  11367. json.keyField.push(json.originalResult[i][key]);
  11368. }
  11369. if (key == p.showField) {
  11370. json.candidate.push(json.originalResult[i][key]);
  11371. }
  11372. }
  11373. }
  11374. self.prepareResults(self, json, q_word, which_page_num);
  11375. },
  11376. error: function (jqXHR, textStatus, errorThrown) {
  11377. if (textStatus != 'abort') {
  11378. self.hideResults(self);
  11379. self.ajaxErrorNotify(self, errorThrown);
  11380. }
  11381. },
  11382. complete: function () {
  11383. self.prop.xhr = null;
  11384. }
  11385. });
  11386. };
  11387. /**
  11388. * Search for json data source
  11389. * @param {Object} self
  11390. * @param {Array} q_word
  11391. * @param {number} which_page_num
  11392. */
  11393. SelectPage.prototype.searchForJson = function (self, q_word, which_page_num) {
  11394. var p = self.option, matched = [], esc_q = [], sorted = [], json = {}, i = 0, arr_reg = [];
  11395. //query keyword filter
  11396. do {
  11397. //'/\W/g'正则代表全部不是字母,数字,下划线,汉字的字符
  11398. //将非法字符进行转义
  11399. esc_q[i] = q_word[i].replace(/\W/g, '\\$&').toString();
  11400. arr_reg[i] = new RegExp(esc_q[i], 'gi');
  11401. i++;
  11402. } while (i < q_word.length);
  11403. // SELECT * FROM data WHERE field LIKE q_word;
  11404. for (i = 0; i < p.data.length; i++) {
  11405. var flag = false, row = p.data[i], itemText;
  11406. for (var j = 0; j < arr_reg.length; j++) {
  11407. itemText = row[p.searchField];
  11408. if (p.formatItem && $.isFunction(p.formatItem))
  11409. itemText = p.formatItem(row);
  11410. if (itemText.match(arr_reg[j])) {
  11411. flag = true;
  11412. if (p.andOr == 'OR')
  11413. break;
  11414. } else {
  11415. flag = false;
  11416. if (p.andOr == 'AND')
  11417. break;
  11418. }
  11419. }
  11420. if (flag)
  11421. matched.push(row);
  11422. }
  11423. // (CASE WHEN ...) then く order some column
  11424. var reg1 = new RegExp('^' + esc_q[0] + '$', 'gi'),
  11425. reg2 = new RegExp('^' + esc_q[0], 'gi'),
  11426. matched1 = [], matched2 = [], matched3 = [];
  11427. for (i = 0; i < matched.length; i++) {
  11428. var orderField = p.orderBy[0][0];
  11429. var orderValue = String(matched[i][orderField]);
  11430. if (orderValue.match(reg1)) {
  11431. matched1.push(matched[i]);
  11432. } else if (orderValue.match(reg2)) {
  11433. matched2.push(matched[i]);
  11434. } else {
  11435. matched3.push(matched[i]);
  11436. }
  11437. }
  11438. if (p.orderBy[0][1].match(/^asc$/i)) {
  11439. matched1 = self.sortAsc(self, matched1);
  11440. matched2 = self.sortAsc(self, matched2);
  11441. matched3 = self.sortAsc(self, matched3);
  11442. } else {
  11443. matched1 = self.sortDesc(self, matched1);
  11444. matched2 = self.sortDesc(self, matched2);
  11445. matched3 = self.sortDesc(self, matched3);
  11446. }
  11447. sorted = sorted.concat(matched1).concat(matched2).concat(matched3);
  11448. /*
  11449. if (sorted.length === undefined || sorted.length === 0 ) {
  11450. self.notFoundSearch(self);
  11451. return;
  11452. }
  11453. */
  11454. json.cnt_whole = sorted.length;
  11455. //page_move used to distinguish between init plugin or page moving
  11456. if (!self.prop.page_move) {
  11457. //only single mode can be used page number relocation
  11458. if (!p.multiple) {
  11459. //get selected item belong page number
  11460. var currentValue = self.elem.hidden.val();
  11461. if ($.type(currentValue) !== 'undefined' && $.trim(currentValue) !== '') {
  11462. var index = 0;
  11463. $.each(sorted, function (i, row) {
  11464. if (row[p.keyField] == currentValue) {
  11465. index = i + 1;
  11466. return false;
  11467. }
  11468. });
  11469. which_page_num = Math.ceil(index / p.pageSize);
  11470. if (which_page_num < 1)
  11471. which_page_num = 1;
  11472. self.prop.current_page = which_page_num;
  11473. }
  11474. }
  11475. } else {
  11476. //set page number to 1 when result number less then page size
  11477. if (sorted.length <= ((which_page_num - 1) * p.pageSize)) {
  11478. which_page_num = 1;
  11479. self.prop.current_page = 1;
  11480. }
  11481. }
  11482. //LIMIT xx OFFSET xx
  11483. var start = (which_page_num - 1) * p.pageSize, end = start + p.pageSize;
  11484. //save original data
  11485. json.originalResult = [];
  11486. //after data filter handle
  11487. for (i = start; i < end; i++) {
  11488. if (sorted[i] === undefined)
  11489. break;
  11490. json.originalResult.push(sorted[i]);
  11491. for (var key in sorted[i]) {
  11492. if (key == p.keyField) {
  11493. if (json.keyField === undefined)
  11494. json.keyField = [];
  11495. json.keyField.push(sorted[i][key]);
  11496. }
  11497. if (key == p.showField) {
  11498. if (json.candidate === undefined)
  11499. json.candidate = [];
  11500. json.candidate.push(sorted[i][key]);
  11501. }
  11502. }
  11503. }
  11504. if (json.candidate === undefined)
  11505. json.candidate = [];
  11506. json.cnt_page = json.candidate.length;
  11507. self.prepareResults(self, json, q_word, which_page_num);
  11508. };
  11509. /**
  11510. * Set order asc
  11511. * @param {Object} self
  11512. * @param {Array} arr - result array
  11513. */
  11514. SelectPage.prototype.sortAsc = function (self, arr) {
  11515. arr.sort(function (a, b) {
  11516. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  11517. return $.type(valA) === 'number' ? valA - valB : String(valA).localeCompare(String(valB));
  11518. });
  11519. return arr;
  11520. };
  11521. /**
  11522. * Set order desc
  11523. * @param {Object} self
  11524. * @param {Array} arr - result array
  11525. */
  11526. SelectPage.prototype.sortDesc = function (self, arr) {
  11527. arr.sort(function (a, b) {
  11528. var valA = a[self.option.orderBy[0][0]], valB = b[self.option.orderBy[0][0]];
  11529. return $.type(valA) === 'number' ? valB - valA : String(valB).localeCompare(String(valA));
  11530. });
  11531. return arr;
  11532. };
  11533. /**
  11534. * Not result found handle
  11535. * @param {Object} self
  11536. */
  11537. SelectPage.prototype.notFoundSearch = function (self) {
  11538. self.elem.results.empty();
  11539. self.calcResultsSize(self);
  11540. self.setOpenStatus(self, true);
  11541. self.setCssFocusedInput(self);
  11542. };
  11543. /**
  11544. * Prepare data to show
  11545. * @param {Object} self
  11546. * @param {Object} json - data result
  11547. * @param {Array} q_word - query keyword
  11548. * @param {number} which_page_num - target page number
  11549. */
  11550. SelectPage.prototype.prepareResults = function (self, json, q_word, which_page_num) {
  11551. if (self.option.pagination)
  11552. self.setNavi(self, json.cnt_whole, json.cnt_page, which_page_num);
  11553. if (!json.keyField)
  11554. json.keyField = false;
  11555. if (self.option.selectOnly && json.candidate.length === 1 && json.candidate[0] == q_word[0]) {
  11556. self.elem.hidden.val(json.keyField[0]);
  11557. this.setButtonAttrDefault();
  11558. }
  11559. var is_query = false;
  11560. if (q_word && q_word.length && q_word[0])
  11561. is_query = true;
  11562. self.displayResults(self, json, is_query);
  11563. };
  11564. /**
  11565. * Build page bar
  11566. * @param {Object} self
  11567. * @param {number} cnt_whole - total record count
  11568. * @param {number} cnt_page
  11569. * @param {number} page_num - current page number
  11570. */
  11571. SelectPage.prototype.setNavi = function (self, cnt_whole, cnt_page, page_num) {
  11572. var msg = self.message;
  11573. /**
  11574. * build pagination bar
  11575. */
  11576. var buildPageNav = function (self, pagebar, page_num, last_page) {
  11577. var updatePageInfo = function () {
  11578. var pageInfo = msg.page_info;
  11579. return pageInfo.replace(self.template.page.current, page_num).replace(self.template.page.total, last_page);
  11580. };
  11581. if (pagebar.find('li').size() === 0) {
  11582. pagebar.hide().empty();
  11583. var iconFist = 'spfont sp-first',
  11584. iconPrev = 'spfont sp-previous',
  11585. iconNext = 'spfont sp-next',
  11586. iconLast = 'spfont sp-last';
  11587. pagebar.append('<li class="csFirstPage" title="' + msg.first_title + '" ><a href="javascript:void(0);"> <i class="' + iconFist + '"></i> </a></li>');
  11588. pagebar.append('<li class="csPreviousPage" title="' + msg.prev_title + '" ><a href="javascript:void(0);"><i class="' + iconPrev + '"></i></a></li>');
  11589. //pagination information
  11590. pagebar.append('<li class="pageInfoBox"><a href="javascript:void(0);"> ' + updatePageInfo() + ' </a></li>');
  11591. pagebar.append('<li class="csNextPage" title="' + msg.next_title + '" ><a href="javascript:void(0);"><i class="' + iconNext + '"></i></a></li>');
  11592. pagebar.append('<li class="csLastPage" title="' + msg.last_title + '" ><a href="javascript:void(0);"> <i class="' + iconLast + '"></i> </a></li>');
  11593. pagebar.show();
  11594. } else {
  11595. pagebar.find('li.pageInfoBox a').html(updatePageInfo());
  11596. }
  11597. };
  11598. var pagebar = self.elem.navi.find('ul'),
  11599. last_page = Math.ceil(cnt_whole / self.option.pageSize); //calculate total page
  11600. if (last_page === 0)
  11601. page_num = 0;
  11602. else {
  11603. if (last_page < page_num)
  11604. page_num = last_page;
  11605. else if (page_num === 0)
  11606. page_num = 1;
  11607. }
  11608. self.prop.current_page = page_num;//update current page number
  11609. self.prop.max_page = last_page;//update page count
  11610. buildPageNav(self, pagebar, page_num, last_page);
  11611. //update paging status
  11612. var dClass = 'disabled',
  11613. first = pagebar.find('li.csFirstPage'),
  11614. previous = pagebar.find('li.csPreviousPage'),
  11615. next = pagebar.find('li.csNextPage'),
  11616. last = pagebar.find('li.csLastPage');
  11617. //first and previous
  11618. if (page_num === 1 || page_num === 0) {
  11619. if (!first.hasClass(dClass))
  11620. first.addClass(dClass);
  11621. if (!previous.hasClass(dClass))
  11622. previous.addClass(dClass);
  11623. } else {
  11624. if (first.hasClass(dClass))
  11625. first.removeClass(dClass);
  11626. if (previous.hasClass(dClass))
  11627. previous.removeClass(dClass);
  11628. }
  11629. //next and last
  11630. if (page_num === last_page || last_page === 0) {
  11631. if (!next.hasClass(dClass))
  11632. next.addClass(dClass);
  11633. if (!last.hasClass(dClass))
  11634. last.addClass(dClass);
  11635. } else {
  11636. if (next.hasClass(dClass))
  11637. next.removeClass(dClass);
  11638. if (last.hasClass(dClass))
  11639. last.removeClass(dClass);
  11640. }
  11641. if (last_page > 1)
  11642. self.ePaging(); //pagination event bind
  11643. };
  11644. /**
  11645. * Render result list
  11646. * @param {Object} self
  11647. * @param {Object} json - result data
  11648. * @param {boolean} is_query - used to different from search to open and just click to open
  11649. */
  11650. SelectPage.prototype.displayResults = function (self, json, is_query) {
  11651. var p = self.option, el = self.elem;
  11652. el.results.hide().empty();
  11653. if (p.multiple && $.type(p.maxSelectLimit) === 'number' && p.maxSelectLimit > 0) {
  11654. var selectedSize = el.element_box.find('li.selected_tag').size();
  11655. if (selectedSize > 0 && selectedSize >= p.maxSelectLimit) {
  11656. var msg = self.message.max_selected;
  11657. self.showMessage(self, msg.replace(self.template.msg.maxSelectLimit, p.maxSelectLimit));
  11658. return;
  11659. }
  11660. }
  11661. if (json.candidate.length) {
  11662. var arr_candidate = json.candidate,
  11663. arr_primary_key = json.keyField,
  11664. keystr = el.hidden.val(),
  11665. keyArr = keystr ? keystr.split(',') : new Array(),
  11666. itemText = '';
  11667. for (var i = 0; i < arr_candidate.length; i++) {
  11668. if (p.formatItem && $.isFunction(p.formatItem)) {
  11669. try {
  11670. itemText = p.formatItem(json.originalResult[i]);
  11671. } catch (e) {
  11672. console.error('formatItem内容格式化函数内容设置不正确!');
  11673. itemText = arr_candidate[i];
  11674. }
  11675. } else
  11676. itemText = arr_candidate[i];
  11677. var list = $('<li>').html(itemText).attr({
  11678. pkey: arr_primary_key[i]
  11679. });
  11680. if (!p.formatItem)
  11681. list.attr('title', itemText);
  11682. //Set selected item highlight
  11683. if ($.inArray(arr_primary_key[i].toString(), keyArr) !== -1) {
  11684. list.addClass(self.css_class.selected);
  11685. }
  11686. //cache item data
  11687. list.data('dataObj', json.originalResult[i]);
  11688. el.results.append(list);
  11689. }
  11690. } else {
  11691. var li = '<li class="' + self.css_class.message_box + '"><i class="spfont sp-warning"></i> ' +
  11692. self.message.not_found + '</li>';
  11693. el.results.append(li);
  11694. }
  11695. el.results.show();
  11696. if (p.multiple && p.multipleControlbar)
  11697. el.control.show();
  11698. if (p.pagination)
  11699. el.navi.show();
  11700. self.calcResultsSize(self);
  11701. self.setOpenStatus(self, true);
  11702. //Result item event bind
  11703. self.eResultList();
  11704. //scrolling listen
  11705. self.eScroll();
  11706. //auto highlight first item in search, have result and set autoSelectFirst to true situation
  11707. if (is_query && json.candidate.length && p.autoSelectFirst)
  11708. self.nextLine(self);
  11709. };
  11710. /**
  11711. * Calculate result list size and position
  11712. * @param {Object} self
  11713. */
  11714. SelectPage.prototype.calcResultsSize = function (self) {
  11715. var p = self.option, el = self.elem;
  11716. var rePosition = function () {
  11717. if (el.container.css('position') === 'static') {
  11718. // position: static
  11719. var offset = el.combo_input.offset();
  11720. el.result_area.css({
  11721. top: offset.top + el.combo_input.outerHeight() + 'px',
  11722. left: offset.left + 'px'
  11723. });
  11724. } else {
  11725. if (!p.pagination) {
  11726. var itemHeight = el.results.find('li:first').outerHeight(true),
  11727. listHeight = itemHeight * p.listSize;
  11728. el.results.css({
  11729. 'max-height': listHeight,
  11730. 'overflow-y': 'auto'
  11731. });
  11732. }
  11733. //handle result list show up side(left, right, up or down)
  11734. var docWidth = $(document).width(),
  11735. docHeight = $(document).height(), //the document full height
  11736. viewHeight = $(window).height(), //browser visible area height
  11737. offset = el.container.offset(),
  11738. screenScrollTop = $(window).scrollTop(),
  11739. listWidth = el.result_area.outerWidth(),
  11740. //result list height
  11741. listHeight = el.result_area.outerHeight(),
  11742. //default left used input element left
  11743. defaultLeft = offset.left, //p.multiple ? -1 : 0;
  11744. //input element height
  11745. inputHeight = el.container.outerHeight(),
  11746. left = (offset.left + listWidth) > docWidth ?
  11747. defaultLeft - (listWidth - el.container.outerWidth()) :
  11748. defaultLeft,
  11749. //the actual top coordinate of input element(outer div)
  11750. screenTop = offset.top, //$(el.container).scrollTop();//offset.top - screenScrollTop;
  11751. top = 0, dist = 5, //set distance between input element and result list
  11752. //the actual top coordinate of result list
  11753. listBottom = screenTop + inputHeight + listHeight + dist,
  11754. hasOverflow = docHeight > viewHeight;
  11755. if ((screenTop - screenScrollTop - dist > listHeight) &&
  11756. (hasOverflow && listBottom > (viewHeight + screenScrollTop)) ||
  11757. (!hasOverflow && listBottom > viewHeight)) {
  11758. //open up
  11759. top = offset.top - listHeight - dist;
  11760. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowUp');
  11761. } else {
  11762. //open down
  11763. top = offset.top + (p.multiple ? el.container.outerHeight() : inputHeight);
  11764. el.result_area.removeClass('shadowUp shadowDown').addClass('shadowDown');
  11765. top += dist;
  11766. }
  11767. return {
  11768. top: top + 'px', left: left + 'px'
  11769. };
  11770. }
  11771. };
  11772. if (el.result_area.is(':visible')) {
  11773. el.result_area.css(rePosition());
  11774. } else {
  11775. var pss = rePosition();
  11776. el.result_area.css(pss).show(1, function () {
  11777. var repss = rePosition();
  11778. if (pss.top !== repss.top || pss.left !== repss.left)
  11779. el.result_area.css(repss);
  11780. });
  11781. }
  11782. };
  11783. /**
  11784. * hide result list
  11785. * @param {Object} self
  11786. */
  11787. SelectPage.prototype.hideResults = function (self) {
  11788. if (self.prop.key_paging) {
  11789. self.scrollWindow(self, true);
  11790. self.prop.key_paging = false;
  11791. }
  11792. self.setCssFocusedInput(self);
  11793. if (self.option.autoFillResult) {
  11794. //self.selectCurrentLine(self, true);
  11795. }
  11796. self.elem.results.empty();
  11797. self.elem.result_area.hide();
  11798. self.setOpenStatus(self, false);
  11799. //unbind window scroll listen
  11800. $(window).off('scroll.SelectPage');
  11801. self.abortAjax(self);
  11802. self.setButtonAttrDefault();
  11803. };
  11804. /**
  11805. * set plugin to disabled / enabled
  11806. * @param self
  11807. * @param disabled
  11808. */
  11809. SelectPage.prototype.disabled = function (self, disabled) {
  11810. var p = self.option, el = self.elem;
  11811. if ($.type(disabled) === 'undefined')
  11812. return el.combo_input.prop('disabled');
  11813. if ($.type(disabled) === 'boolean') {
  11814. el.combo_input.prop('disabled', disabled);
  11815. if (disabled)
  11816. el.container.addClass(self.css_class.disabled);
  11817. else
  11818. el.container.removeClass(self.css_class.disabled);
  11819. }
  11820. };
  11821. /**
  11822. * Go fist page
  11823. * @param {Object} self
  11824. */
  11825. SelectPage.prototype.firstPage = function (self) {
  11826. if (self.prop.current_page > 1) {
  11827. self.prop.current_page = 1;
  11828. self.prop.page_move = true;
  11829. self.suggest(self);
  11830. }
  11831. };
  11832. /**
  11833. * Go previous page
  11834. * @param {Object} self
  11835. */
  11836. SelectPage.prototype.prevPage = function (self) {
  11837. if (self.prop.current_page > 1) {
  11838. self.prop.current_page--;
  11839. self.prop.page_move = true;
  11840. self.suggest(self);
  11841. }
  11842. };
  11843. /**
  11844. * Go next page
  11845. * @param {Object} self
  11846. */
  11847. SelectPage.prototype.nextPage = function (self) {
  11848. if (self.prop.current_page < self.prop.max_page) {
  11849. self.prop.current_page++;
  11850. self.prop.page_move = true;
  11851. self.suggest(self);
  11852. }
  11853. };
  11854. /**
  11855. * Go last page
  11856. * @param {Object} self
  11857. */
  11858. SelectPage.prototype.lastPage = function (self) {
  11859. if (self.prop.current_page < self.prop.max_page) {
  11860. self.prop.current_page = self.prop.max_page;
  11861. self.prop.page_move = true;
  11862. self.suggest(self);
  11863. }
  11864. };
  11865. /**
  11866. * do something after select/unSelect action
  11867. * @param {Object} self
  11868. */
  11869. SelectPage.prototype.afterAction = function (self) {
  11870. self.inputResize(self);
  11871. self.elem.combo_input.change();
  11872. self.setCssFocusedInput(self);
  11873. if (self.prop.init_set)
  11874. return;
  11875. if (self.option.multiple) {
  11876. if (self.option.selectToCloseList) {
  11877. self.hideResults(self);
  11878. self.elem.combo_input.blur();
  11879. } else {
  11880. self.suggest(self);
  11881. self.elem.combo_input.focus();
  11882. }
  11883. } else {
  11884. self.hideResults(self);
  11885. self.elem.combo_input.blur();
  11886. }
  11887. };
  11888. /**
  11889. * Select current list item
  11890. * @param {Object} self
  11891. * @param {boolean} is_enter_key
  11892. */
  11893. SelectPage.prototype.selectCurrentLine = function (self, is_enter_key) {
  11894. self.scrollWindow(self, true);
  11895. var p = self.option, current = self.getCurrentLine(self);
  11896. if (current) {
  11897. if (!p.multiple) {
  11898. self.elem.combo_input.val(current.text());
  11899. self.elem.hidden.val(current.attr('pkey'));
  11900. } else {
  11901. //build tags in multiple selection mode
  11902. self.elem.combo_input.val('');
  11903. var item = {text: current.text(), value: current.attr('pkey')};
  11904. if (!self.isAlreadySelected(self, item)) {
  11905. self.addNewTag(self, item);
  11906. self.tagValuesSet(self);
  11907. }
  11908. }
  11909. if (p.selectOnly)
  11910. self.setButtonAttrDefault();
  11911. //Select item callback
  11912. if (p.eSelect && $.isFunction(p.eSelect))
  11913. p.eSelect(current.data('dataObj'), self);
  11914. self.prop.prev_value = self.elem.combo_input.val();
  11915. self.prop.selected_text = self.elem.combo_input.val();
  11916. self.putClearButton();
  11917. }
  11918. self.afterAction(self);
  11919. };
  11920. /**
  11921. * Show clear button when item selected in single selection mode
  11922. */
  11923. SelectPage.prototype.putClearButton = function () {
  11924. if (!this.option.multiple && !this.elem.combo_input.prop('disabled'))
  11925. this.elem.container.append(this.elem.clear_btn);
  11926. };
  11927. /**
  11928. * Select all list item
  11929. * @param {Object} self
  11930. */
  11931. SelectPage.prototype.selectAllLine = function (self) {
  11932. var p = self.option, jsonarr = new Array();
  11933. self.elem.results.find('li').each(function (i, row) {
  11934. var $row = $(row);
  11935. var item = {text: $row.text(), value: $row.attr('pkey')};
  11936. if (!self.isAlreadySelected(self, item)) {
  11937. self.addNewTag(self, item);
  11938. self.tagValuesSet(self);
  11939. }
  11940. jsonarr.push($row.data('dataObj'));
  11941. //limited max selected items
  11942. if ($.type(p.maxSelectLimit) === 'number' &&
  11943. p.maxSelectLimit > 0 &&
  11944. p.maxSelectLimit === self.elem.element_box.find('li.selected_tag').size()) {
  11945. return false;
  11946. }
  11947. });
  11948. if (p.eSelect && $.isFunction(p.eSelect))
  11949. p.eSelect(jsonarr, self);
  11950. self.afterAction(self);
  11951. };
  11952. /**
  11953. * Cancel select all item in current page
  11954. * @param {Object} self
  11955. */
  11956. SelectPage.prototype.unSelectAllLine = function (self) {
  11957. var p = self.option, size = self.elem.results.find('li').size();
  11958. self.elem.results.find('li').each(function (i, row) {
  11959. var key = $(row).attr('pkey');
  11960. var tag = self.elem.element_box.find('li.selected_tag[itemvalue="' + key + '"]');
  11961. self.removeTag(self, tag);
  11962. });
  11963. self.afterAction(self);
  11964. if (p.eTagRemove && $.isFunction(p.eTagRemove))
  11965. p.eTagRemove(size, self);
  11966. };
  11967. /**
  11968. * Clear all selected items
  11969. * @param {Object} self
  11970. */
  11971. SelectPage.prototype.clearAll = function (self) {
  11972. var p = self.option, size = 0;
  11973. if (p.multiple) {
  11974. size = self.elem.element_box.find('li.selected_tag').size();
  11975. self.elem.element_box.find('li.selected_tag').remove();
  11976. }
  11977. self.reset(self);
  11978. self.afterAction(self);
  11979. if (!p.multiple)
  11980. self.elem.clear_btn.remove();
  11981. if (p.multiple) {
  11982. if (p.eTagRemove && $.isFunction(p.eTagRemove))
  11983. p.eTagRemove(size, self);
  11984. }
  11985. };
  11986. /**
  11987. * reset
  11988. */
  11989. SelectPage.prototype.reset = function (self) {
  11990. self.elem.combo_input.val('');
  11991. self.elem.hidden.val('');
  11992. self.prop.prev_value = '';
  11993. self.prop.selected_text = '';
  11994. self.prop.current_page = 1;
  11995. };
  11996. /**
  11997. * Get current highlight item
  11998. * @param {Object} self
  11999. */
  12000. SelectPage.prototype.getCurrentLine = function (self) {
  12001. if (self.elem.result_area.is(':hidden'))
  12002. return false;
  12003. var obj = self.elem.results.find('li.' + self.css_class.select);
  12004. if (obj.size())
  12005. return obj;
  12006. else
  12007. return false;
  12008. };
  12009. /**
  12010. * Check the result item is already selected or not
  12011. * @param {Object} self
  12012. * @param {Object} item - item info
  12013. */
  12014. SelectPage.prototype.isAlreadySelected = function (self, item) {
  12015. var isExist = false;
  12016. if (item.value) {
  12017. var keys = self.elem.hidden.val();
  12018. if (keys) {
  12019. var karr = keys.split(',');
  12020. if (karr && karr.length && $.inArray(item.value, karr) != -1)
  12021. isExist = true;
  12022. }
  12023. }
  12024. return isExist;
  12025. };
  12026. /**
  12027. * Add a new tag in multiple selection mode
  12028. * @param {Object} self
  12029. * @param {Object} item
  12030. */
  12031. SelectPage.prototype.addNewTag = function (self, item) {
  12032. if (!self.option.multiple || !item)
  12033. return;
  12034. var tmp = self.template.tag.content, tag;
  12035. tmp = tmp.replace(self.template.tag.textKey, item.text);
  12036. tmp = tmp.replace(self.template.tag.valueKey, item.value);
  12037. tag = $(tmp);
  12038. if (self.elem.combo_input.prop('disabled'))
  12039. tag.find('span.tag_close').hide();
  12040. self.elem.combo_input.closest('li').before(tag);
  12041. };
  12042. /**
  12043. * Remove a tag in multiple selection mode
  12044. * @param {Object} self
  12045. * @param {Object} item
  12046. */
  12047. SelectPage.prototype.removeTag = function (self, item) {
  12048. var key = $(item).attr('itemvalue');
  12049. var keys = self.elem.hidden.val();
  12050. if ($.type(key) != 'undefined' && keys) {
  12051. var keyarr = keys.split(','),
  12052. index = $.inArray(key.toString(), keyarr);
  12053. if (index != -1) {
  12054. keyarr.splice(index, 1);
  12055. self.elem.hidden.val(keyarr.toString());
  12056. }
  12057. }
  12058. $(item).remove();
  12059. self.afterAction(self);
  12060. };
  12061. /**
  12062. * Selected item value(keyField) put in to hidden element
  12063. * @param {Object} self
  12064. */
  12065. SelectPage.prototype.tagValuesSet = function (self) {
  12066. if (!self.option.multiple)
  12067. return;
  12068. var tags = self.elem.element_box.find('li.selected_tag');
  12069. if (tags && tags.size()) {
  12070. var result = new Array();
  12071. $.each(tags, function (i, li) {
  12072. var v = $(li).attr('itemvalue');
  12073. if ($.type(v) !== 'undefined')
  12074. result.push(v);
  12075. });
  12076. if (result.length) {
  12077. self.elem.hidden.val(result.join(','));
  12078. }
  12079. }
  12080. };
  12081. /**
  12082. * auto resize input element width in multiple select mode
  12083. * @param {Object} self
  12084. */
  12085. SelectPage.prototype.inputResize = function (self) {
  12086. if (!self.option.multiple)
  12087. return;
  12088. var width = '',
  12089. inputLi = self.elem.combo_input.closest('li');
  12090. var setDefaultSize = function (self, inputLi) {
  12091. inputLi.removeClass('full_width');
  12092. var minimumWidth = self.elem.combo_input.val().length + 1,
  12093. width = (minimumWidth * 0.75) + 'em';
  12094. self.elem.combo_input.css('width', width).removeAttr('placeholder');
  12095. };
  12096. if (self.elem.element_box.find('li.selected_tag').size() === 0) {
  12097. if (self.elem.combo_input.attr('placeholder_bak')) {
  12098. if (!inputLi.hasClass('full_width'))
  12099. inputLi.addClass('full_width');
  12100. self.elem.combo_input.attr('placeholder', self.elem.combo_input.attr('placeholder_bak')).removeAttr('style');
  12101. } else
  12102. setDefaultSize(self, inputLi);
  12103. } else
  12104. setDefaultSize(self, inputLi);
  12105. };
  12106. /**
  12107. * Move to next line
  12108. * @param {Object} self
  12109. */
  12110. SelectPage.prototype.nextLine = function (self) {
  12111. var obj = self.getCurrentLine(self), idx;
  12112. if (!obj)
  12113. idx = -1;
  12114. else {
  12115. idx = self.elem.results.children('li').index(obj);
  12116. obj.removeClass(self.css_class.select);
  12117. }
  12118. idx++;
  12119. if (idx < self.elem.results.children('li').length) {
  12120. var next = self.elem.results.children('li').eq(idx);
  12121. next.addClass(self.css_class.select);
  12122. self.setCssFocusedResults(self);
  12123. } else
  12124. self.setCssFocusedInput(self);
  12125. self.scrollWindow(self, false);
  12126. };
  12127. /**
  12128. * Move to previous line
  12129. * @param {Object} self
  12130. */
  12131. SelectPage.prototype.prevLine = function (self) {
  12132. var obj = self.getCurrentLine(self), idx;
  12133. if (!obj)
  12134. idx = self.elem.results.children('li').length;
  12135. else {
  12136. idx = self.elem.results.children('li').index(obj);
  12137. obj.removeClass(self.css_class.select);
  12138. }
  12139. idx--;
  12140. if (idx > -1) {
  12141. var prev = self.elem.results.children('li').eq(idx);
  12142. prev.addClass(self.css_class.select);
  12143. self.setCssFocusedResults(self);
  12144. } else
  12145. self.setCssFocusedInput(self);
  12146. self.scrollWindow(self, false);
  12147. };
  12148. /**
  12149. * SelectPage plugin definition
  12150. * @global
  12151. * @param option {Object} init plugin option
  12152. */
  12153. function Plugin(option) {
  12154. return this.each(function () {
  12155. var $this = $(this),
  12156. data = $this.data(SelectPage.dataKey),
  12157. params = $.extend({}, defaults, $this.data(), data && data.option, typeof option === 'object' && option);
  12158. if (!data)
  12159. $this.data(SelectPage.dataKey, (data = new SelectPage(this, params)));
  12160. });
  12161. }
  12162. /**
  12163. * Get plugin object
  12164. * @param {object} obj
  12165. * @returns
  12166. */
  12167. function getPlugin(obj) {
  12168. return $(obj).closest('div.sp_container').find('input.sp_input');
  12169. }
  12170. /**
  12171. * Clear all selected item
  12172. */
  12173. function ClearSelected() {
  12174. return this.each(function () {
  12175. var $this = getPlugin(this),
  12176. data = $this.data(SelectPage.dataKey);
  12177. if (data) {
  12178. data.prop.init_set = true;
  12179. data.clearAll(data);
  12180. data.prop.init_set = false;
  12181. }
  12182. });
  12183. }
  12184. /**
  12185. * Refresh result list
  12186. * use case:
  12187. * 1.use $(obj).val('xxx') to modify selectpage selected item key
  12188. * 2.refresh selected item show content/tag text
  12189. */
  12190. function SelectedRefresh() {
  12191. return this.each(function () {
  12192. var $this = getPlugin(this),
  12193. data = $this.data(SelectPage.dataKey);
  12194. if (data && data.elem.hidden.val())
  12195. data.setInitRecord(true);
  12196. });
  12197. }
  12198. /**
  12199. * Modify plugin datasource, only work on json datasource mode
  12200. * @param {array} data - new datasource
  12201. * @example
  12202. * [{name:'aa',sex:1},{name:'bb',sex:0},{...}]
  12203. */
  12204. function ModifyDataSource(data) {
  12205. return this.each(function () {
  12206. if (data && $.isArray(data)) {
  12207. var $this = getPlugin(this),
  12208. plugin = $this.data(SelectPage.dataKey);
  12209. if (plugin) {
  12210. plugin.clearAll(plugin);
  12211. plugin.option.data = data;
  12212. }
  12213. }
  12214. });
  12215. }
  12216. /**
  12217. * Get plugin disabled status or Modify plugin disabled status
  12218. * @param disabled {boolean} set disabled status
  12219. */
  12220. function PluginDisabled(disabled) {
  12221. var status = false;
  12222. this.each(function () {
  12223. var $this = getPlugin(this),
  12224. plugin = $this.data(SelectPage.dataKey);
  12225. if (plugin) {
  12226. if ($.type(disabled) !== 'undefined')
  12227. plugin.disabled(plugin, disabled);
  12228. else
  12229. status = plugin.disabled(plugin);
  12230. }
  12231. });
  12232. return status;
  12233. }
  12234. /**
  12235. * Get selected item text
  12236. * @returns {string}
  12237. */
  12238. function GetInputText() {
  12239. var str = '';
  12240. this.each(function () {
  12241. var $this = getPlugin(this), data = $this.data(SelectPage.dataKey);
  12242. if (data) {
  12243. if (data.option.multiple) {
  12244. var tags = [];
  12245. data.elem.element_box.find('li.selected_tag').each(function (i, tag) {
  12246. tags.push($(tag).text());
  12247. });
  12248. str += tags.toString();
  12249. } else {
  12250. str += data.elem.combo_input.val();
  12251. }
  12252. }
  12253. });
  12254. return str;
  12255. }
  12256. var old = $.fn.selectPage;
  12257. $.fn.selectPage = Plugin;
  12258. $.fn.selectPage.Constructor = SelectPage;
  12259. $.fn.selectPageClear = ClearSelected;
  12260. $.fn.selectPageRefresh = SelectedRefresh;
  12261. $.fn.selectPageData = ModifyDataSource;
  12262. $.fn.selectPageDisabled = PluginDisabled;
  12263. $.fn.selectPageText = GetInputText;
  12264. // SelectPage no conflict
  12265. // =================
  12266. $.fn.selectPage.noConflict = function () {
  12267. $.fn.selectPage = old;
  12268. return this;
  12269. };
  12270. })(window.jQuery);
  12271. define("selectpage", function(){});