3174 lines
762 KiB
JavaScript
3174 lines
762 KiB
JavaScript
function _typeof2(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof2=function _typeof2(obj){return typeof obj;};}else{_typeof2=function _typeof2(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof2(obj);}/*!
|
||
* jQuery JavaScript Library v1.11.3
|
||
* http://jquery.com/
|
||
*
|
||
* Includes Sizzle.js
|
||
* http://sizzlejs.com/
|
||
*
|
||
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
|
||
* Released under the MIT license
|
||
* http://jquery.org/license
|
||
*
|
||
* Date: 2015-04-28T16:19Z
|
||
*/(function(global,factory){if((typeof module==="undefined"?"undefined":_typeof2(module))==="object"&&_typeof2(module.exports)==="object"){// For CommonJS and CommonJS-like environments where a proper window is present,
|
||
// execute the factory and get jQuery
|
||
// For environments that do not inherently posses a window with a document
|
||
// (such as Node.js), expose a jQuery-making factory as module.exports
|
||
// This accentuates the need for the creation of a real window
|
||
// e.g. var jQuery = require("jquery")(window);
|
||
// See ticket #14549 for more info
|
||
module.exports=global.document?factory(global,true):function(w){if(!w.document){throw new Error("jQuery requires a window with a document");}return factory(w);};}else{factory(global);}// Pass this if window is not defined yet
|
||
})(typeof window!=="undefined"?window:this,function(window,noGlobal){// Can't do this because several apps including ASP.NET trace
|
||
// the stack via arguments.caller.callee and Firefox dies if
|
||
// you try to trace through "use strict" call chains. (#13335)
|
||
// Support: Firefox 18+
|
||
//
|
||
var deletedIds=[];var _slice=deletedIds.slice;var concat=deletedIds.concat;var push=deletedIds.push;var indexOf=deletedIds.indexOf;var class2type={};var toString=class2type.toString;var hasOwn=class2type.hasOwnProperty;var support={};var version="1.11.3",// Define a local copy of jQuery
|
||
jQuery=function jQuery(selector,context){// The jQuery object is actually just the init constructor 'enhanced'
|
||
// Need init if jQuery is called (just allow error to be thrown if not included)
|
||
return new jQuery.fn.init(selector,context);},// Support: Android<4.1, IE<9
|
||
// Make sure we trim BOM and NBSP
|
||
rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,// Matches dashed string for camelizing
|
||
rmsPrefix=/^-ms-/,rdashAlpha=/-([\da-z])/gi,// Used by jQuery.camelCase as callback to replace()
|
||
fcamelCase=function fcamelCase(all,letter){return letter.toUpperCase();};jQuery.fn=jQuery.prototype={// The current version of jQuery being used
|
||
jquery:version,constructor:jQuery,// Start with an empty selector
|
||
selector:"",// The default length of a jQuery object is 0
|
||
length:0,toArray:function toArray(){return _slice.call(this);},// Get the Nth element in the matched element set OR
|
||
// Get the whole matched element set as a clean array
|
||
get:function get(num){return num!=null?// Return just the one element from the set
|
||
num<0?this[num+this.length]:this[num]:// Return all the elements in a clean array
|
||
_slice.call(this);},// Take an array of elements and push it onto the stack
|
||
// (returning the new matched element set)
|
||
pushStack:function pushStack(elems){// Build a new jQuery matched element set
|
||
var ret=jQuery.merge(this.constructor(),elems);// Add the old object onto the stack (as a reference)
|
||
ret.prevObject=this;ret.context=this.context;// Return the newly-formed element set
|
||
return ret;},// Execute a callback for every element in the matched set.
|
||
// (You can seed the arguments with an array of args, but this is
|
||
// only used internally.)
|
||
each:function each(callback,args){return jQuery.each(this,callback,args);},map:function map(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},slice:function slice(){return this.pushStack(_slice.apply(this,arguments));},first:function first(){return this.eq(0);},last:function last(){return this.eq(-1);},eq:function eq(i){var len=this.length,j=+i+(i<0?len:0);return this.pushStack(j>=0&&j<len?[this[j]]:[]);},end:function end(){return this.prevObject||this.constructor(null);},// For internal use only.
|
||
// Behaves like an Array's method, not like a jQuery method.
|
||
push:push,sort:deletedIds.sort,splice:deletedIds.splice};jQuery.extend=jQuery.fn.extend=function(){var src,copyIsArray,copy,name,options,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;// Handle a deep copy situation
|
||
if(typeof target==="boolean"){deep=target;// skip the boolean and the target
|
||
target=arguments[i]||{};i++;}// Handle case when target is a string or something (possible in deep copy)
|
||
if(_typeof2(target)!=="object"&&!jQuery.isFunction(target)){target={};}// extend jQuery itself if only one argument is passed
|
||
if(i===length){target=this;i--;}for(;i<length;i++){// Only deal with non-null/undefined values
|
||
if((options=arguments[i])!=null){// Extend the base object
|
||
for(name in options){src=target[name];copy=options[name];// Prevent never-ending loop
|
||
if(target===copy){continue;}// Recurse if we're merging plain objects or arrays
|
||
if(deep&©&&(jQuery.isPlainObject(copy)||(copyIsArray=jQuery.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&jQuery.isArray(src)?src:[];}else{clone=src&&jQuery.isPlainObject(src)?src:{};}// Never move original objects, clone them
|
||
target[name]=jQuery.extend(deep,clone,copy);// Don't bring in undefined values
|
||
}else if(copy!==undefined){target[name]=copy;}}}}// Return the modified object
|
||
return target;};jQuery.extend({// Unique for each copy of jQuery on the page
|
||
expando:"jQuery"+(version+Math.random()).replace(/\D/g,""),// Assume jQuery is ready without the ready module
|
||
isReady:true,error:function error(msg){throw new Error(msg);},noop:function noop(){},// See test/unit/core.js for details concerning isFunction.
|
||
// Since version 1.3, DOM methods and functions like alert
|
||
// aren't supported. They return false on IE (#2968).
|
||
isFunction:function isFunction(obj){return jQuery.type(obj)==="function";},isArray:Array.isArray||function(obj){return jQuery.type(obj)==="array";},isWindow:function isWindow(obj){/* jshint eqeqeq: false */return obj!=null&&obj==obj.window;},isNumeric:function isNumeric(obj){// parseFloat NaNs numeric-cast false positives (null|true|false|"")
|
||
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
|
||
// subtraction forces infinities to NaN
|
||
// adding 1 corrects loss of precision from parseFloat (#15100)
|
||
return!jQuery.isArray(obj)&&obj-parseFloat(obj)+1>=0;},isEmptyObject:function isEmptyObject(obj){var name;for(name in obj){return false;}return true;},isPlainObject:function isPlainObject(obj){var key;// Must be an Object.
|
||
// Because of IE, we also have to check the presence of the constructor property.
|
||
// Make sure that DOM nodes and window objects don't pass through, as well
|
||
if(!obj||jQuery.type(obj)!=="object"||obj.nodeType||jQuery.isWindow(obj)){return false;}try{// Not own constructor property must be Object
|
||
if(obj.constructor&&!hasOwn.call(obj,"constructor")&&!hasOwn.call(obj.constructor.prototype,"isPrototypeOf")){return false;}}catch(e){// IE8,9 Will throw exceptions on certain host objects #9897
|
||
return false;}// Support: IE<9
|
||
// Handle iteration over inherited properties before own properties.
|
||
if(support.ownLast){for(key in obj){return hasOwn.call(obj,key);}}// Own properties are enumerated firstly, so to speed up,
|
||
// if last one is own, then all properties are own.
|
||
for(key in obj){}return key===undefined||hasOwn.call(obj,key);},type:function type(obj){if(obj==null){return obj+"";}return _typeof2(obj)==="object"||typeof obj==="function"?class2type[toString.call(obj)]||"object":_typeof2(obj);},// Evaluates a script in a global context
|
||
// Workarounds based on findings by Jim Driscoll
|
||
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
|
||
globalEval:function globalEval(data){if(data&&jQuery.trim(data)){// We use execScript on Internet Explorer
|
||
// We use an anonymous function so that context is window
|
||
// rather than jQuery in Firefox
|
||
(window.execScript||function(data){window["eval"].call(window,data);})(data);}},// Convert dashed to camelCase; used by the css and data modules
|
||
// Microsoft forgot to hump their vendor prefix (#9572)
|
||
camelCase:function camelCase(string){return string.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase);},nodeName:function nodeName(elem,name){return elem.nodeName&&elem.nodeName.toLowerCase()===name.toLowerCase();},// args is for internal usage only
|
||
each:function each(obj,callback,args){var value,i=0,length=obj.length,isArray=isArraylike(obj);if(args){if(isArray){for(;i<length;i++){value=callback.apply(obj[i],args);if(value===false){break;}}}else{for(i in obj){value=callback.apply(obj[i],args);if(value===false){break;}}}// A special, fast, case for the most common use of each
|
||
}else{if(isArray){for(;i<length;i++){value=callback.call(obj[i],i,obj[i]);if(value===false){break;}}}else{for(i in obj){value=callback.call(obj[i],i,obj[i]);if(value===false){break;}}}}return obj;},// Support: Android<4.1, IE<9
|
||
trim:function trim(text){return text==null?"":(text+"").replace(rtrim,"");},// results is for internal usage only
|
||
makeArray:function makeArray(arr,results){var ret=results||[];if(arr!=null){if(isArraylike(Object(arr))){jQuery.merge(ret,typeof arr==="string"?[arr]:arr);}else{push.call(ret,arr);}}return ret;},inArray:function inArray(elem,arr,i){var len;if(arr){if(indexOf){return indexOf.call(arr,elem,i);}len=arr.length;i=i?i<0?Math.max(0,len+i):i:0;for(;i<len;i++){// Skip accessing in sparse arrays
|
||
if(i in arr&&arr[i]===elem){return i;}}}return-1;},merge:function merge(first,second){var len=+second.length,j=0,i=first.length;while(j<len){first[i++]=second[j++];}// Support: IE<9
|
||
// Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
|
||
if(len!==len){while(second[j]!==undefined){first[i++]=second[j++];}}first.length=i;return first;},grep:function grep(elems,callback,invert){var callbackInverse,matches=[],i=0,length=elems.length,callbackExpect=!invert;// Go through the array, only saving the items
|
||
// that pass the validator function
|
||
for(;i<length;i++){callbackInverse=!callback(elems[i],i);if(callbackInverse!==callbackExpect){matches.push(elems[i]);}}return matches;},// arg is for internal usage only
|
||
map:function map(elems,callback,arg){var value,i=0,length=elems.length,isArray=isArraylike(elems),ret=[];// Go through the array, translating each of the items to their new values
|
||
if(isArray){for(;i<length;i++){value=callback(elems[i],i,arg);if(value!=null){ret.push(value);}}// Go through every key on the object,
|
||
}else{for(i in elems){value=callback(elems[i],i,arg);if(value!=null){ret.push(value);}}}// Flatten any nested arrays
|
||
return concat.apply([],ret);},// A global GUID counter for objects
|
||
guid:1,// Bind a function to a context, optionally partially applying any
|
||
// arguments.
|
||
proxy:function proxy(fn,context){var args,proxy,tmp;if(typeof context==="string"){tmp=fn[context];context=fn;fn=tmp;}// Quick check to determine if target is callable, in the spec
|
||
// this throws a TypeError, but we will just return undefined.
|
||
if(!jQuery.isFunction(fn)){return undefined;}// Simulated bind
|
||
args=_slice.call(arguments,2);proxy=function proxy(){return fn.apply(context||this,args.concat(_slice.call(arguments)));};// Set the guid of unique handler to the same of original handler, so it can be removed
|
||
proxy.guid=fn.guid=fn.guid||jQuery.guid++;return proxy;},now:function now(){return+new Date();},// jQuery.support is not used in Core but other projects attach their
|
||
// properties to it so it needs to exist.
|
||
support:support});// Populate the class2type map
|
||
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(i,name){class2type["[object "+name+"]"]=name.toLowerCase();});function isArraylike(obj){// Support: iOS 8.2 (not reproducible in simulator)
|
||
// `in` check used to prevent JIT error (gh-2145)
|
||
// hasOwn isn't used here due to false negatives
|
||
// regarding Nodelist length in IE
|
||
var length="length"in obj&&obj.length,type=jQuery.type(obj);if(type==="function"||jQuery.isWindow(obj)){return false;}if(obj.nodeType===1&&length){return true;}return type==="array"||length===0||typeof length==="number"&&length>0&&length-1 in obj;}var Sizzle=/*!
|
||
* Sizzle CSS Selector Engine v2.2.0-pre
|
||
* http://sizzlejs.com/
|
||
*
|
||
* Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
|
||
* Released under the MIT license
|
||
* http://jquery.org/license
|
||
*
|
||
* Date: 2014-12-16
|
||
*/function(window){var i,support,Expr,getText,isXML,tokenize,compile,select,outermostContext,sortInput,hasDuplicate,// Local document vars
|
||
setDocument,document,docElem,documentIsHTML,rbuggyQSA,rbuggyMatches,matches,contains,// Instance-specific data
|
||
expando="sizzle"+1*new Date(),preferredDoc=window.document,dirruns=0,done=0,classCache=createCache(),tokenCache=createCache(),compilerCache=createCache(),sortOrder=function sortOrder(a,b){if(a===b){hasDuplicate=true;}return 0;},// General-purpose constants
|
||
MAX_NEGATIVE=1<<31,// Instance methods
|
||
hasOwn={}.hasOwnProperty,arr=[],pop=arr.pop,push_native=arr.push,push=arr.push,slice=arr.slice,// Use a stripped-down indexOf as it's faster than native
|
||
// http://jsperf.com/thor-indexof-vs-for/5
|
||
indexOf=function indexOf(list,elem){var i=0,len=list.length;for(;i<len;i++){if(list[i]===elem){return i;}}return-1;},booleans="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",// Regular expressions
|
||
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
|
||
whitespace="[\\x20\\t\\r\\n\\f]",// http://www.w3.org/TR/css3-syntax/#characters
|
||
characterEncoding="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",// Loosely modeled on CSS identifier characters
|
||
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
|
||
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
|
||
identifier=characterEncoding.replace("w","w#"),// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
|
||
attributes="\\["+whitespace+"*("+characterEncoding+")(?:"+whitespace+// Operator (capture 2)
|
||
"*([*^$|!~]?=)"+whitespace+// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
|
||
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+identifier+"))|)"+whitespace+"*\\]",pseudos=":("+characterEncoding+")(?:\\(("+// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
|
||
// 1. quoted (capture 3; capture 4 or capture 5)
|
||
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|"+// 2. simple (capture 6)
|
||
"((?:\\\\.|[^\\\\()[\\]]|"+attributes+")*)|"+// 3. anything else (capture 2)
|
||
".*"+")\\)|)",// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
|
||
rwhitespace=new RegExp(whitespace+"+","g"),rtrim=new RegExp("^"+whitespace+"+|((?:^|[^\\\\])(?:\\\\.)*)"+whitespace+"+$","g"),rcomma=new RegExp("^"+whitespace+"*,"+whitespace+"*"),rcombinators=new RegExp("^"+whitespace+"*([>+~]|"+whitespace+")"+whitespace+"*"),rattributeQuotes=new RegExp("="+whitespace+"*([^\\]'\"]*?)"+whitespace+"*\\]","g"),rpseudo=new RegExp(pseudos),ridentifier=new RegExp("^"+identifier+"$"),matchExpr={"ID":new RegExp("^#("+characterEncoding+")"),"CLASS":new RegExp("^\\.("+characterEncoding+")"),"TAG":new RegExp("^("+characterEncoding.replace("w","w*")+")"),"ATTR":new RegExp("^"+attributes),"PSEUDO":new RegExp("^"+pseudos),"CHILD":new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+whitespace+"*(even|odd|(([+-]|)(\\d*)n|)"+whitespace+"*(?:([+-]|)"+whitespace+"*(\\d+)|))"+whitespace+"*\\)|)","i"),"bool":new RegExp("^(?:"+booleans+")$","i"),// For use in libraries implementing .is()
|
||
// We use this for POS matching in `select`
|
||
"needsContext":new RegExp("^"+whitespace+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+whitespace+"*((?:-\\d)?\\d*)"+whitespace+"*\\)|)(?=[^-]|$)","i")},rinputs=/^(?:input|select|textarea|button)$/i,rheader=/^h\d$/i,rnative=/^[^{]+\{\s*\[native \w/,// Easily-parseable/retrievable ID or TAG or CLASS selectors
|
||
rquickExpr=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,rsibling=/[+~]/,rescape=/'|\\/g,// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
|
||
runescape=new RegExp("\\\\([\\da-f]{1,6}"+whitespace+"?|("+whitespace+")|.)","ig"),funescape=function funescape(_,escaped,escapedWhitespace){var high="0x"+escaped-0x10000;// NaN means non-codepoint
|
||
// Support: Firefox<24
|
||
// Workaround erroneous numeric interpretation of +"0x"
|
||
return high!==high||escapedWhitespace?escaped:high<0?// BMP codepoint
|
||
String.fromCharCode(high+0x10000):// Supplemental Plane codepoint (surrogate pair)
|
||
String.fromCharCode(high>>10|0xD800,high&0x3FF|0xDC00);},// Used for iframes
|
||
// See setDocument()
|
||
// Removing the function wrapper causes a "Permission Denied"
|
||
// error in IE
|
||
unloadHandler=function unloadHandler(){setDocument();};// Optimize for push.apply( _, NodeList )
|
||
try{push.apply(arr=slice.call(preferredDoc.childNodes),preferredDoc.childNodes);// Support: Android<4.0
|
||
// Detect silently failing push.apply
|
||
arr[preferredDoc.childNodes.length].nodeType;}catch(e){push={apply:arr.length?// Leverage slice if possible
|
||
function(target,els){push_native.apply(target,slice.call(els));}:// Support: IE<9
|
||
// Otherwise append directly
|
||
function(target,els){var j=target.length,i=0;// Can't trust NodeList.length
|
||
while(target[j++]=els[i++]){}target.length=j-1;}};}function Sizzle(selector,context,results,seed){var match,elem,m,nodeType,// QSA vars
|
||
i,groups,old,nid,newContext,newSelector;if((context?context.ownerDocument||context:preferredDoc)!==document){setDocument(context);}context=context||document;results=results||[];nodeType=context.nodeType;if(typeof selector!=="string"||!selector||nodeType!==1&&nodeType!==9&&nodeType!==11){return results;}if(!seed&&documentIsHTML){// Try to shortcut find operations when possible (e.g., not under DocumentFragment)
|
||
if(nodeType!==11&&(match=rquickExpr.exec(selector))){// Speed-up: Sizzle("#ID")
|
||
if(m=match[1]){if(nodeType===9){elem=context.getElementById(m);// Check parentNode to catch when Blackberry 4.6 returns
|
||
// nodes that are no longer in the document (jQuery #6963)
|
||
if(elem&&elem.parentNode){// Handle the case where IE, Opera, and Webkit return items
|
||
// by name instead of ID
|
||
if(elem.id===m){results.push(elem);return results;}}else{return results;}}else{// Context is not a document
|
||
if(context.ownerDocument&&(elem=context.ownerDocument.getElementById(m))&&contains(context,elem)&&elem.id===m){results.push(elem);return results;}}// Speed-up: Sizzle("TAG")
|
||
}else if(match[2]){push.apply(results,context.getElementsByTagName(selector));return results;// Speed-up: Sizzle(".CLASS")
|
||
}else if((m=match[3])&&support.getElementsByClassName){push.apply(results,context.getElementsByClassName(m));return results;}}// QSA path
|
||
if(support.qsa&&(!rbuggyQSA||!rbuggyQSA.test(selector))){nid=old=expando;newContext=context;newSelector=nodeType!==1&&selector;// qSA works strangely on Element-rooted queries
|
||
// We can work around this by specifying an extra ID on the root
|
||
// and working up from there (Thanks to Andrew Dupont for the technique)
|
||
// IE 8 doesn't work on object elements
|
||
if(nodeType===1&&context.nodeName.toLowerCase()!=="object"){groups=tokenize(selector);if(old=context.getAttribute("id")){nid=old.replace(rescape,"\\$&");}else{context.setAttribute("id",nid);}nid="[id='"+nid+"'] ";i=groups.length;while(i--){groups[i]=nid+toSelector(groups[i]);}newContext=rsibling.test(selector)&&testContext(context.parentNode)||context;newSelector=groups.join(",");}if(newSelector){try{push.apply(results,newContext.querySelectorAll(newSelector));return results;}catch(qsaError){}finally{if(!old){context.removeAttribute("id");}}}}}// All others
|
||
return select(selector.replace(rtrim,"$1"),context,results,seed);}/**
|
||
* Create key-value caches of limited size
|
||
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
|
||
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
|
||
* deleting the oldest entry
|
||
*/function createCache(){var keys=[];function cache(key,value){// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
|
||
if(keys.push(key+" ")>Expr.cacheLength){// Only keep the most recent entries
|
||
delete cache[keys.shift()];}return cache[key+" "]=value;}return cache;}/**
|
||
* Mark a function for special use by Sizzle
|
||
* @param {Function} fn The function to mark
|
||
*/function markFunction(fn){fn[expando]=true;return fn;}/**
|
||
* Support testing using an element
|
||
* @param {Function} fn Passed the created div and expects a boolean result
|
||
*/function assert(fn){var div=document.createElement("div");try{return!!fn(div);}catch(e){return false;}finally{// Remove from its parent by default
|
||
if(div.parentNode){div.parentNode.removeChild(div);}// release memory in IE
|
||
div=null;}}/**
|
||
* Adds the same handler for all of the specified attrs
|
||
* @param {String} attrs Pipe-separated list of attributes
|
||
* @param {Function} handler The method that will be applied
|
||
*/function addHandle(attrs,handler){var arr=attrs.split("|"),i=attrs.length;while(i--){Expr.attrHandle[arr[i]]=handler;}}/**
|
||
* Checks document order of two siblings
|
||
* @param {Element} a
|
||
* @param {Element} b
|
||
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
|
||
*/function siblingCheck(a,b){var cur=b&&a,diff=cur&&a.nodeType===1&&b.nodeType===1&&(~b.sourceIndex||MAX_NEGATIVE)-(~a.sourceIndex||MAX_NEGATIVE);// Use IE sourceIndex if available on both nodes
|
||
if(diff){return diff;}// Check if b follows a
|
||
if(cur){while(cur=cur.nextSibling){if(cur===b){return-1;}}}return a?1:-1;}/**
|
||
* Returns a function to use in pseudos for input types
|
||
* @param {String} type
|
||
*/function createInputPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type===type;};}/**
|
||
* Returns a function to use in pseudos for buttons
|
||
* @param {String} type
|
||
*/function createButtonPseudo(type){return function(elem){var name=elem.nodeName.toLowerCase();return(name==="input"||name==="button")&&elem.type===type;};}/**
|
||
* Returns a function to use in pseudos for positionals
|
||
* @param {Function} fn
|
||
*/function createPositionalPseudo(fn){return markFunction(function(argument){argument=+argument;return markFunction(function(seed,matches){var j,matchIndexes=fn([],seed.length,argument),i=matchIndexes.length;// Match elements found at the specified indexes
|
||
while(i--){if(seed[j=matchIndexes[i]]){seed[j]=!(matches[j]=seed[j]);}}});});}/**
|
||
* Checks a node for validity as a Sizzle context
|
||
* @param {Element|Object=} context
|
||
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
|
||
*/function testContext(context){return context&&typeof context.getElementsByTagName!=="undefined"&&context;}// Expose support vars for convenience
|
||
support=Sizzle.support={};/**
|
||
* Detects XML nodes
|
||
* @param {Element|Object} elem An element or a document
|
||
* @returns {Boolean} True iff elem is a non-HTML XML node
|
||
*/isXML=Sizzle.isXML=function(elem){// documentElement is verified for cases where it doesn't yet exist
|
||
// (such as loading iframes in IE - #4833)
|
||
var documentElement=elem&&(elem.ownerDocument||elem).documentElement;return documentElement?documentElement.nodeName!=="HTML":false;};/**
|
||
* Sets document-related variables once based on the current document
|
||
* @param {Element|Object} [doc] An element or document object to use to set the document
|
||
* @returns {Object} Returns the current document
|
||
*/setDocument=Sizzle.setDocument=function(node){var hasCompare,parent,doc=node?node.ownerDocument||node:preferredDoc;// If no document and documentElement is available, return
|
||
if(doc===document||doc.nodeType!==9||!doc.documentElement){return document;}// Set our document
|
||
document=doc;docElem=doc.documentElement;parent=doc.defaultView;// Support: IE>8
|
||
// If iframe document is assigned to "document" variable and if iframe has been reloaded,
|
||
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
|
||
// IE6-8 do not support the defaultView property so parent will be undefined
|
||
if(parent&&parent!==parent.top){// IE11 does not have attachEvent, so all must suffer
|
||
if(parent.addEventListener){parent.addEventListener("unload",unloadHandler,false);}else if(parent.attachEvent){parent.attachEvent("onunload",unloadHandler);}}/* Support tests
|
||
---------------------------------------------------------------------- */documentIsHTML=!isXML(doc);/* Attributes
|
||
---------------------------------------------------------------------- */ // Support: IE<8
|
||
// Verify that getAttribute really returns attributes and not properties
|
||
// (excepting IE8 booleans)
|
||
support.attributes=assert(function(div){div.className="i";return!div.getAttribute("className");});/* getElement(s)By*
|
||
---------------------------------------------------------------------- */ // Check if getElementsByTagName("*") returns only elements
|
||
support.getElementsByTagName=assert(function(div){div.appendChild(doc.createComment(""));return!div.getElementsByTagName("*").length;});// Support: IE<9
|
||
support.getElementsByClassName=rnative.test(doc.getElementsByClassName);// Support: IE<10
|
||
// Check if getElementById returns elements by name
|
||
// The broken getElementById methods don't pick up programatically-set names,
|
||
// so use a roundabout getElementsByName test
|
||
support.getById=assert(function(div){docElem.appendChild(div).id=expando;return!doc.getElementsByName||!doc.getElementsByName(expando).length;});// ID find and filter
|
||
if(support.getById){Expr.find["ID"]=function(id,context){if(typeof context.getElementById!=="undefined"&&documentIsHTML){var m=context.getElementById(id);// Check parentNode to catch when Blackberry 4.6 returns
|
||
// nodes that are no longer in the document #6963
|
||
return m&&m.parentNode?[m]:[];}};Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){return elem.getAttribute("id")===attrId;};};}else{// Support: IE6/7
|
||
// getElementById is not reliable as a find shortcut
|
||
delete Expr.find["ID"];Expr.filter["ID"]=function(id){var attrId=id.replace(runescape,funescape);return function(elem){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return node&&node.value===attrId;};};}// Tag
|
||
Expr.find["TAG"]=support.getElementsByTagName?function(tag,context){if(typeof context.getElementsByTagName!=="undefined"){return context.getElementsByTagName(tag);// DocumentFragment nodes don't have gEBTN
|
||
}else if(support.qsa){return context.querySelectorAll(tag);}}:function(tag,context){var elem,tmp=[],i=0,// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
|
||
results=context.getElementsByTagName(tag);// Filter out possible comments
|
||
if(tag==="*"){while(elem=results[i++]){if(elem.nodeType===1){tmp.push(elem);}}return tmp;}return results;};// Class
|
||
Expr.find["CLASS"]=support.getElementsByClassName&&function(className,context){if(documentIsHTML){return context.getElementsByClassName(className);}};/* QSA/matchesSelector
|
||
---------------------------------------------------------------------- */ // QSA and matchesSelector support
|
||
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
|
||
rbuggyMatches=[];// qSa(:focus) reports false when true (Chrome 21)
|
||
// We allow this because of a bug in IE8/9 that throws an error
|
||
// whenever `document.activeElement` is accessed on an iframe
|
||
// So, we allow :focus to pass through QSA all the time to avoid the IE error
|
||
// See http://bugs.jquery.com/ticket/13378
|
||
rbuggyQSA=[];if(support.qsa=rnative.test(doc.querySelectorAll)){// Build QSA regex
|
||
// Regex strategy adopted from Diego Perini
|
||
assert(function(div){// Select is set to empty string on purpose
|
||
// This is to test IE's treatment of not explicitly
|
||
// setting a boolean content attribute,
|
||
// since its presence should be enough
|
||
// http://bugs.jquery.com/ticket/12359
|
||
docElem.appendChild(div).innerHTML="<a id='"+expando+"'></a>"+"<select id='"+expando+"-\f]' msallowcapture=''>"+"<option selected=''></option></select>";// Support: IE8, Opera 11-12.16
|
||
// Nothing should be selected when empty strings follow ^= or $= or *=
|
||
// The test attribute must be unknown in Opera but "safe" for WinRT
|
||
// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
|
||
if(div.querySelectorAll("[msallowcapture^='']").length){rbuggyQSA.push("[*^$]="+whitespace+"*(?:''|\"\")");}// Support: IE8
|
||
// Boolean attributes and "value" are not treated correctly
|
||
if(!div.querySelectorAll("[selected]").length){rbuggyQSA.push("\\["+whitespace+"*(?:value|"+booleans+")");}// Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
|
||
if(!div.querySelectorAll("[id~="+expando+"-]").length){rbuggyQSA.push("~=");}// Webkit/Opera - :checked should return selected option elements
|
||
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
|
||
// IE8 throws error here and will not see later tests
|
||
if(!div.querySelectorAll(":checked").length){rbuggyQSA.push(":checked");}// Support: Safari 8+, iOS 8+
|
||
// https://bugs.webkit.org/show_bug.cgi?id=136851
|
||
// In-page `selector#id sibing-combinator selector` fails
|
||
if(!div.querySelectorAll("a#"+expando+"+*").length){rbuggyQSA.push(".#.+[+~]");}});assert(function(div){// Support: Windows 8 Native Apps
|
||
// The type and name attributes are restricted during .innerHTML assignment
|
||
var input=doc.createElement("input");input.setAttribute("type","hidden");div.appendChild(input).setAttribute("name","D");// Support: IE8
|
||
// Enforce case-sensitivity of name attribute
|
||
if(div.querySelectorAll("[name=d]").length){rbuggyQSA.push("name"+whitespace+"*[*^$|!~]?=");}// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
|
||
// IE8 throws error here and will not see later tests
|
||
if(!div.querySelectorAll(":enabled").length){rbuggyQSA.push(":enabled",":disabled");}// Opera 10-11 does not throw on post-comma invalid pseudos
|
||
div.querySelectorAll("*,:x");rbuggyQSA.push(",.*:");});}if(support.matchesSelector=rnative.test(matches=docElem.matches||docElem.webkitMatchesSelector||docElem.mozMatchesSelector||docElem.oMatchesSelector||docElem.msMatchesSelector)){assert(function(div){// Check to see if it's possible to do matchesSelector
|
||
// on a disconnected node (IE 9)
|
||
support.disconnectedMatch=matches.call(div,"div");// This should fail with an exception
|
||
// Gecko does not error, returns false instead
|
||
matches.call(div,"[s!='']:x");rbuggyMatches.push("!=",pseudos);});}rbuggyQSA=rbuggyQSA.length&&new RegExp(rbuggyQSA.join("|"));rbuggyMatches=rbuggyMatches.length&&new RegExp(rbuggyMatches.join("|"));/* Contains
|
||
---------------------------------------------------------------------- */hasCompare=rnative.test(docElem.compareDocumentPosition);// Element contains another
|
||
// Purposefully does not implement inclusive descendent
|
||
// As in, an element does not contain itself
|
||
contains=hasCompare||rnative.test(docElem.contains)?function(a,b){var adown=a.nodeType===9?a.documentElement:a,bup=b&&b.parentNode;return a===bup||!!(bup&&bup.nodeType===1&&(adown.contains?adown.contains(bup):a.compareDocumentPosition&&a.compareDocumentPosition(bup)&16));}:function(a,b){if(b){while(b=b.parentNode){if(b===a){return true;}}}return false;};/* Sorting
|
||
---------------------------------------------------------------------- */ // Document order sorting
|
||
sortOrder=hasCompare?function(a,b){// Flag for duplicate removal
|
||
if(a===b){hasDuplicate=true;return 0;}// Sort on method existence if only one input has compareDocumentPosition
|
||
var compare=!a.compareDocumentPosition-!b.compareDocumentPosition;if(compare){return compare;}// Calculate position if both inputs belong to the same document
|
||
compare=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):// Otherwise we know they are disconnected
|
||
1;// Disconnected nodes
|
||
if(compare&1||!support.sortDetached&&b.compareDocumentPosition(a)===compare){// Choose the first element that is related to our preferred document
|
||
if(a===doc||a.ownerDocument===preferredDoc&&contains(preferredDoc,a)){return-1;}if(b===doc||b.ownerDocument===preferredDoc&&contains(preferredDoc,b)){return 1;}// Maintain original order
|
||
return sortInput?indexOf(sortInput,a)-indexOf(sortInput,b):0;}return compare&4?-1:1;}:function(a,b){// Exit early if the nodes are identical
|
||
if(a===b){hasDuplicate=true;return 0;}var cur,i=0,aup=a.parentNode,bup=b.parentNode,ap=[a],bp=[b];// Parentless nodes are either documents or disconnected
|
||
if(!aup||!bup){return a===doc?-1:b===doc?1:aup?-1:bup?1:sortInput?indexOf(sortInput,a)-indexOf(sortInput,b):0;// If the nodes are siblings, we can do a quick check
|
||
}else if(aup===bup){return siblingCheck(a,b);}// Otherwise we need full lists of their ancestors for comparison
|
||
cur=a;while(cur=cur.parentNode){ap.unshift(cur);}cur=b;while(cur=cur.parentNode){bp.unshift(cur);}// Walk down the tree looking for a discrepancy
|
||
while(ap[i]===bp[i]){i++;}return i?// Do a sibling check if the nodes have a common ancestor
|
||
siblingCheck(ap[i],bp[i]):// Otherwise nodes in our document sort first
|
||
ap[i]===preferredDoc?-1:bp[i]===preferredDoc?1:0;};return doc;};Sizzle.matches=function(expr,elements){return Sizzle(expr,null,null,elements);};Sizzle.matchesSelector=function(elem,expr){// Set document vars if needed
|
||
if((elem.ownerDocument||elem)!==document){setDocument(elem);}// Make sure that attribute selectors are quoted
|
||
expr=expr.replace(rattributeQuotes,"='$1']");if(support.matchesSelector&&documentIsHTML&&(!rbuggyMatches||!rbuggyMatches.test(expr))&&(!rbuggyQSA||!rbuggyQSA.test(expr))){try{var ret=matches.call(elem,expr);// IE 9's matchesSelector returns false on disconnected nodes
|
||
if(ret||support.disconnectedMatch||// As well, disconnected nodes are said to be in a document
|
||
// fragment in IE 9
|
||
elem.document&&elem.document.nodeType!==11){return ret;}}catch(e){}}return Sizzle(expr,document,null,[elem]).length>0;};Sizzle.contains=function(context,elem){// Set document vars if needed
|
||
if((context.ownerDocument||context)!==document){setDocument(context);}return contains(context,elem);};Sizzle.attr=function(elem,name){// Set document vars if needed
|
||
if((elem.ownerDocument||elem)!==document){setDocument(elem);}var fn=Expr.attrHandle[name.toLowerCase()],// Don't get fooled by Object.prototype properties (jQuery #13807)
|
||
val=fn&&hasOwn.call(Expr.attrHandle,name.toLowerCase())?fn(elem,name,!documentIsHTML):undefined;return val!==undefined?val:support.attributes||!documentIsHTML?elem.getAttribute(name):(val=elem.getAttributeNode(name))&&val.specified?val.value:null;};Sizzle.error=function(msg){throw new Error("Syntax error, unrecognized expression: "+msg);};/**
|
||
* Document sorting and removing duplicates
|
||
* @param {ArrayLike} results
|
||
*/Sizzle.uniqueSort=function(results){var elem,duplicates=[],j=0,i=0;// Unless we *know* we can detect duplicates, assume their presence
|
||
hasDuplicate=!support.detectDuplicates;sortInput=!support.sortStable&&results.slice(0);results.sort(sortOrder);if(hasDuplicate){while(elem=results[i++]){if(elem===results[i]){j=duplicates.push(i);}}while(j--){results.splice(duplicates[j],1);}}// Clear input after sorting to release objects
|
||
// See https://github.com/jquery/sizzle/pull/225
|
||
sortInput=null;return results;};/**
|
||
* Utility function for retrieving the text value of an array of DOM nodes
|
||
* @param {Array|Element} elem
|
||
*/getText=Sizzle.getText=function(elem){var node,ret="",i=0,nodeType=elem.nodeType;if(!nodeType){// If no nodeType, this is expected to be an array
|
||
while(node=elem[i++]){// Do not traverse comment nodes
|
||
ret+=getText(node);}}else if(nodeType===1||nodeType===9||nodeType===11){// Use textContent for elements
|
||
// innerText usage removed for consistency of new lines (jQuery #11153)
|
||
if(typeof elem.textContent==="string"){return elem.textContent;}else{// Traverse its children
|
||
for(elem=elem.firstChild;elem;elem=elem.nextSibling){ret+=getText(elem);}}}else if(nodeType===3||nodeType===4){return elem.nodeValue;}// Do not include comment or processing instruction nodes
|
||
return ret;};Expr=Sizzle.selectors={// Can be adjusted by the user
|
||
cacheLength:50,createPseudo:markFunction,match:matchExpr,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{"ATTR":function ATTR(match){match[1]=match[1].replace(runescape,funescape);// Move the given value to match[3] whether quoted or unquoted
|
||
match[3]=(match[3]||match[4]||match[5]||"").replace(runescape,funescape);if(match[2]==="~="){match[3]=" "+match[3]+" ";}return match.slice(0,4);},"CHILD":function CHILD(match){/* matches from matchExpr["CHILD"]
|
||
1 type (only|nth|...)
|
||
2 what (child|of-type)
|
||
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
|
||
4 xn-component of xn+y argument ([+-]?\d*n|)
|
||
5 sign of xn-component
|
||
6 x of xn-component
|
||
7 sign of y-component
|
||
8 y of y-component
|
||
*/match[1]=match[1].toLowerCase();if(match[1].slice(0,3)==="nth"){// nth-* requires argument
|
||
if(!match[3]){Sizzle.error(match[0]);}// numeric x and y parameters for Expr.filter.CHILD
|
||
// remember that false/true cast respectively to 0/1
|
||
match[4]=+(match[4]?match[5]+(match[6]||1):2*(match[3]==="even"||match[3]==="odd"));match[5]=+(match[7]+match[8]||match[3]==="odd");// other types prohibit arguments
|
||
}else if(match[3]){Sizzle.error(match[0]);}return match;},"PSEUDO":function PSEUDO(match){var excess,unquoted=!match[6]&&match[2];if(matchExpr["CHILD"].test(match[0])){return null;}// Accept quoted arguments as-is
|
||
if(match[3]){match[2]=match[4]||match[5]||"";// Strip excess characters from unquoted arguments
|
||
}else if(unquoted&&rpseudo.test(unquoted)&&(// Get excess from tokenize (recursively)
|
||
excess=tokenize(unquoted,true))&&(// advance to the next closing parenthesis
|
||
excess=unquoted.indexOf(")",unquoted.length-excess)-unquoted.length)){// excess is a negative index
|
||
match[0]=match[0].slice(0,excess);match[2]=unquoted.slice(0,excess);}// Return only captures needed by the pseudo filter method (type and argument)
|
||
return match.slice(0,3);}},filter:{"TAG":function TAG(nodeNameSelector){var nodeName=nodeNameSelector.replace(runescape,funescape).toLowerCase();return nodeNameSelector==="*"?function(){return true;}:function(elem){return elem.nodeName&&elem.nodeName.toLowerCase()===nodeName;};},"CLASS":function CLASS(className){var pattern=classCache[className+" "];return pattern||(pattern=new RegExp("(^|"+whitespace+")"+className+"("+whitespace+"|$)"))&&classCache(className,function(elem){return pattern.test(typeof elem.className==="string"&&elem.className||typeof elem.getAttribute!=="undefined"&&elem.getAttribute("class")||"");});},"ATTR":function ATTR(name,operator,check){return function(elem){var result=Sizzle.attr(elem,name);if(result==null){return operator==="!=";}if(!operator){return true;}result+="";return operator==="="?result===check:operator==="!="?result!==check:operator==="^="?check&&result.indexOf(check)===0:operator==="*="?check&&result.indexOf(check)>-1:operator==="$="?check&&result.slice(-check.length)===check:operator==="~="?(" "+result.replace(rwhitespace," ")+" ").indexOf(check)>-1:operator==="|="?result===check||result.slice(0,check.length+1)===check+"-":false;};},"CHILD":function CHILD(type,what,argument,first,last){var simple=type.slice(0,3)!=="nth",forward=type.slice(-4)!=="last",ofType=what==="of-type";return first===1&&last===0?// Shortcut for :nth-*(n)
|
||
function(elem){return!!elem.parentNode;}:function(elem,context,xml){var cache,outerCache,node,diff,nodeIndex,start,dir=simple!==forward?"nextSibling":"previousSibling",parent=elem.parentNode,name=ofType&&elem.nodeName.toLowerCase(),useCache=!xml&&!ofType;if(parent){// :(first|last|only)-(child|of-type)
|
||
if(simple){while(dir){node=elem;while(node=node[dir]){if(ofType?node.nodeName.toLowerCase()===name:node.nodeType===1){return false;}}// Reverse direction for :only-* (if we haven't yet done so)
|
||
start=dir=type==="only"&&!start&&"nextSibling";}return true;}start=[forward?parent.firstChild:parent.lastChild];// non-xml :nth-child(...) stores cache data on `parent`
|
||
if(forward&&useCache){// Seek `elem` from a previously-cached index
|
||
outerCache=parent[expando]||(parent[expando]={});cache=outerCache[type]||[];nodeIndex=cache[0]===dirruns&&cache[1];diff=cache[0]===dirruns&&cache[2];node=nodeIndex&&parent.childNodes[nodeIndex];while(node=++nodeIndex&&node&&node[dir]||(// Fallback to seeking `elem` from the start
|
||
diff=nodeIndex=0)||start.pop()){// When found, cache indexes on `parent` and break
|
||
if(node.nodeType===1&&++diff&&node===elem){outerCache[type]=[dirruns,nodeIndex,diff];break;}}// Use previously-cached element index if available
|
||
}else if(useCache&&(cache=(elem[expando]||(elem[expando]={}))[type])&&cache[0]===dirruns){diff=cache[1];// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
|
||
}else{// Use the same loop as above to seek `elem` from the start
|
||
while(node=++nodeIndex&&node&&node[dir]||(diff=nodeIndex=0)||start.pop()){if((ofType?node.nodeName.toLowerCase()===name:node.nodeType===1)&&++diff){// Cache the index of each encountered element
|
||
if(useCache){(node[expando]||(node[expando]={}))[type]=[dirruns,diff];}if(node===elem){break;}}}}// Incorporate the offset, then check against cycle size
|
||
diff-=last;return diff===first||diff%first===0&&diff/first>=0;}};},"PSEUDO":function PSEUDO(pseudo,argument){// pseudo-class names are case-insensitive
|
||
// http://www.w3.org/TR/selectors/#pseudo-classes
|
||
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
|
||
// Remember that setFilters inherits from pseudos
|
||
var args,fn=Expr.pseudos[pseudo]||Expr.setFilters[pseudo.toLowerCase()]||Sizzle.error("unsupported pseudo: "+pseudo);// The user may use createPseudo to indicate that
|
||
// arguments are needed to create the filter function
|
||
// just as Sizzle does
|
||
if(fn[expando]){return fn(argument);}// But maintain support for old signatures
|
||
if(fn.length>1){args=[pseudo,pseudo,"",argument];return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase())?markFunction(function(seed,matches){var idx,matched=fn(seed,argument),i=matched.length;while(i--){idx=indexOf(seed,matched[i]);seed[idx]=!(matches[idx]=matched[i]);}}):function(elem){return fn(elem,0,args);};}return fn;}},pseudos:{// Potentially complex pseudos
|
||
"not":markFunction(function(selector){// Trim the selector passed to compile
|
||
// to avoid treating leading and trailing
|
||
// spaces as combinators
|
||
var input=[],results=[],matcher=compile(selector.replace(rtrim,"$1"));return matcher[expando]?markFunction(function(seed,matches,context,xml){var elem,unmatched=matcher(seed,null,xml,[]),i=seed.length;// Match elements unmatched by `matcher`
|
||
while(i--){if(elem=unmatched[i]){seed[i]=!(matches[i]=elem);}}}):function(elem,context,xml){input[0]=elem;matcher(input,null,xml,results);// Don't keep the element (issue #299)
|
||
input[0]=null;return!results.pop();};}),"has":markFunction(function(selector){return function(elem){return Sizzle(selector,elem).length>0;};}),"contains":markFunction(function(text){text=text.replace(runescape,funescape);return function(elem){return(elem.textContent||elem.innerText||getText(elem)).indexOf(text)>-1;};}),// "Whether an element is represented by a :lang() selector
|
||
// is based solely on the element's language value
|
||
// being equal to the identifier C,
|
||
// or beginning with the identifier C immediately followed by "-".
|
||
// The matching of C against the element's language value is performed case-insensitively.
|
||
// The identifier C does not have to be a valid language name."
|
||
// http://www.w3.org/TR/selectors/#lang-pseudo
|
||
"lang":markFunction(function(lang){// lang value must be a valid identifier
|
||
if(!ridentifier.test(lang||"")){Sizzle.error("unsupported lang: "+lang);}lang=lang.replace(runescape,funescape).toLowerCase();return function(elem){var elemLang;do{if(elemLang=documentIsHTML?elem.lang:elem.getAttribute("xml:lang")||elem.getAttribute("lang")){elemLang=elemLang.toLowerCase();return elemLang===lang||elemLang.indexOf(lang+"-")===0;}}while((elem=elem.parentNode)&&elem.nodeType===1);return false;};}),// Miscellaneous
|
||
"target":function target(elem){var hash=window.location&&window.location.hash;return hash&&hash.slice(1)===elem.id;},"root":function root(elem){return elem===docElem;},"focus":function focus(elem){return elem===document.activeElement&&(!document.hasFocus||document.hasFocus())&&!!(elem.type||elem.href||~elem.tabIndex);},// Boolean properties
|
||
"enabled":function enabled(elem){return elem.disabled===false;},"disabled":function disabled(elem){return elem.disabled===true;},"checked":function checked(elem){// In CSS3, :checked should return both checked and selected elements
|
||
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
|
||
var nodeName=elem.nodeName.toLowerCase();return nodeName==="input"&&!!elem.checked||nodeName==="option"&&!!elem.selected;},"selected":function selected(elem){// Accessing this property makes selected-by-default
|
||
// options in Safari work properly
|
||
if(elem.parentNode){elem.parentNode.selectedIndex;}return elem.selected===true;},// Contents
|
||
"empty":function empty(elem){// http://www.w3.org/TR/selectors/#empty-pseudo
|
||
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
|
||
// but not by others (comment: 8; processing instruction: 7; etc.)
|
||
// nodeType < 6 works because attributes (2) do not appear as children
|
||
for(elem=elem.firstChild;elem;elem=elem.nextSibling){if(elem.nodeType<6){return false;}}return true;},"parent":function parent(elem){return!Expr.pseudos["empty"](elem);},// Element/input types
|
||
"header":function header(elem){return rheader.test(elem.nodeName);},"input":function input(elem){return rinputs.test(elem.nodeName);},"button":function button(elem){var name=elem.nodeName.toLowerCase();return name==="input"&&elem.type==="button"||name==="button";},"text":function text(elem){var attr;return elem.nodeName.toLowerCase()==="input"&&elem.type==="text"&&(// Support: IE<8
|
||
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
|
||
(attr=elem.getAttribute("type"))==null||attr.toLowerCase()==="text");},// Position-in-collection
|
||
"first":createPositionalPseudo(function(){return[0];}),"last":createPositionalPseudo(function(matchIndexes,length){return[length-1];}),"eq":createPositionalPseudo(function(matchIndexes,length,argument){return[argument<0?argument+length:argument];}),"even":createPositionalPseudo(function(matchIndexes,length){var i=0;for(;i<length;i+=2){matchIndexes.push(i);}return matchIndexes;}),"odd":createPositionalPseudo(function(matchIndexes,length){var i=1;for(;i<length;i+=2){matchIndexes.push(i);}return matchIndexes;}),"lt":createPositionalPseudo(function(matchIndexes,length,argument){var i=argument<0?argument+length:argument;for(;--i>=0;){matchIndexes.push(i);}return matchIndexes;}),"gt":createPositionalPseudo(function(matchIndexes,length,argument){var i=argument<0?argument+length:argument;for(;++i<length;){matchIndexes.push(i);}return matchIndexes;})}};Expr.pseudos["nth"]=Expr.pseudos["eq"];// Add button/input type pseudos
|
||
for(i in{radio:true,checkbox:true,file:true,password:true,image:true}){Expr.pseudos[i]=createInputPseudo(i);}for(i in{submit:true,reset:true}){Expr.pseudos[i]=createButtonPseudo(i);}// Easy API for creating new setFilters
|
||
function setFilters(){}setFilters.prototype=Expr.filters=Expr.pseudos;Expr.setFilters=new setFilters();tokenize=Sizzle.tokenize=function(selector,parseOnly){var matched,match,tokens,type,soFar,groups,preFilters,cached=tokenCache[selector+" "];if(cached){return parseOnly?0:cached.slice(0);}soFar=selector;groups=[];preFilters=Expr.preFilter;while(soFar){// Comma and first run
|
||
if(!matched||(match=rcomma.exec(soFar))){if(match){// Don't consume trailing commas as valid
|
||
soFar=soFar.slice(match[0].length)||soFar;}groups.push(tokens=[]);}matched=false;// Combinators
|
||
if(match=rcombinators.exec(soFar)){matched=match.shift();tokens.push({value:matched,// Cast descendant combinators to space
|
||
type:match[0].replace(rtrim," ")});soFar=soFar.slice(matched.length);}// Filters
|
||
for(type in Expr.filter){if((match=matchExpr[type].exec(soFar))&&(!preFilters[type]||(match=preFilters[type](match)))){matched=match.shift();tokens.push({value:matched,type:type,matches:match});soFar=soFar.slice(matched.length);}}if(!matched){break;}}// Return the length of the invalid excess
|
||
// if we're just parsing
|
||
// Otherwise, throw an error or return tokens
|
||
return parseOnly?soFar.length:soFar?Sizzle.error(selector):// Cache the tokens
|
||
tokenCache(selector,groups).slice(0);};function toSelector(tokens){var i=0,len=tokens.length,selector="";for(;i<len;i++){selector+=tokens[i].value;}return selector;}function addCombinator(matcher,combinator,base){var dir=combinator.dir,checkNonElements=base&&dir==="parentNode",doneName=done++;return combinator.first?// Check against closest ancestor/preceding element
|
||
function(elem,context,xml){while(elem=elem[dir]){if(elem.nodeType===1||checkNonElements){return matcher(elem,context,xml);}}}:// Check against all ancestor/preceding elements
|
||
function(elem,context,xml){var oldCache,outerCache,newCache=[dirruns,doneName];// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
|
||
if(xml){while(elem=elem[dir]){if(elem.nodeType===1||checkNonElements){if(matcher(elem,context,xml)){return true;}}}}else{while(elem=elem[dir]){if(elem.nodeType===1||checkNonElements){outerCache=elem[expando]||(elem[expando]={});if((oldCache=outerCache[dir])&&oldCache[0]===dirruns&&oldCache[1]===doneName){// Assign to newCache so results back-propagate to previous elements
|
||
return newCache[2]=oldCache[2];}else{// Reuse newcache so results back-propagate to previous elements
|
||
outerCache[dir]=newCache;// A match means we're done; a fail means we have to keep checking
|
||
if(newCache[2]=matcher(elem,context,xml)){return true;}}}}}};}function elementMatcher(matchers){return matchers.length>1?function(elem,context,xml){var i=matchers.length;while(i--){if(!matchers[i](elem,context,xml)){return false;}}return true;}:matchers[0];}function multipleContexts(selector,contexts,results){var i=0,len=contexts.length;for(;i<len;i++){Sizzle(selector,contexts[i],results);}return results;}function condense(unmatched,map,filter,context,xml){var elem,newUnmatched=[],i=0,len=unmatched.length,mapped=map!=null;for(;i<len;i++){if(elem=unmatched[i]){if(!filter||filter(elem,context,xml)){newUnmatched.push(elem);if(mapped){map.push(i);}}}}return newUnmatched;}function setMatcher(preFilter,selector,matcher,postFilter,postFinder,postSelector){if(postFilter&&!postFilter[expando]){postFilter=setMatcher(postFilter);}if(postFinder&&!postFinder[expando]){postFinder=setMatcher(postFinder,postSelector);}return markFunction(function(seed,results,context,xml){var temp,i,elem,preMap=[],postMap=[],preexisting=results.length,// Get initial elements from seed or context
|
||
elems=seed||multipleContexts(selector||"*",context.nodeType?[context]:context,[]),// Prefilter to get matcher input, preserving a map for seed-results synchronization
|
||
matcherIn=preFilter&&(seed||!selector)?condense(elems,preMap,preFilter,context,xml):elems,matcherOut=matcher?// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
|
||
postFinder||(seed?preFilter:preexisting||postFilter)?// ...intermediate processing is necessary
|
||
[]:// ...otherwise use results directly
|
||
results:matcherIn;// Find primary matches
|
||
if(matcher){matcher(matcherIn,matcherOut,context,xml);}// Apply postFilter
|
||
if(postFilter){temp=condense(matcherOut,postMap);postFilter(temp,[],context,xml);// Un-match failing elements by moving them back to matcherIn
|
||
i=temp.length;while(i--){if(elem=temp[i]){matcherOut[postMap[i]]=!(matcherIn[postMap[i]]=elem);}}}if(seed){if(postFinder||preFilter){if(postFinder){// Get the final matcherOut by condensing this intermediate into postFinder contexts
|
||
temp=[];i=matcherOut.length;while(i--){if(elem=matcherOut[i]){// Restore matcherIn since elem is not yet a final match
|
||
temp.push(matcherIn[i]=elem);}}postFinder(null,matcherOut=[],temp,xml);}// Move matched elements from seed to results to keep them synchronized
|
||
i=matcherOut.length;while(i--){if((elem=matcherOut[i])&&(temp=postFinder?indexOf(seed,elem):preMap[i])>-1){seed[temp]=!(results[temp]=elem);}}}// Add elements to results, through postFinder if defined
|
||
}else{matcherOut=condense(matcherOut===results?matcherOut.splice(preexisting,matcherOut.length):matcherOut);if(postFinder){postFinder(null,results,matcherOut,xml);}else{push.apply(results,matcherOut);}}});}function matcherFromTokens(tokens){var checkContext,matcher,j,len=tokens.length,leadingRelative=Expr.relative[tokens[0].type],implicitRelative=leadingRelative||Expr.relative[" "],i=leadingRelative?1:0,// The foundational matcher ensures that elements are reachable from top-level context(s)
|
||
matchContext=addCombinator(function(elem){return elem===checkContext;},implicitRelative,true),matchAnyContext=addCombinator(function(elem){return indexOf(checkContext,elem)>-1;},implicitRelative,true),matchers=[function(elem,context,xml){var ret=!leadingRelative&&(xml||context!==outermostContext)||((checkContext=context).nodeType?matchContext(elem,context,xml):matchAnyContext(elem,context,xml));// Avoid hanging onto element (issue #299)
|
||
checkContext=null;return ret;}];for(;i<len;i++){if(matcher=Expr.relative[tokens[i].type]){matchers=[addCombinator(elementMatcher(matchers),matcher)];}else{matcher=Expr.filter[tokens[i].type].apply(null,tokens[i].matches);// Return special upon seeing a positional matcher
|
||
if(matcher[expando]){// Find the next relative operator (if any) for proper handling
|
||
j=++i;for(;j<len;j++){if(Expr.relative[tokens[j].type]){break;}}return setMatcher(i>1&&elementMatcher(matchers),i>1&&toSelector(// If the preceding token was a descendant combinator, insert an implicit any-element `*`
|
||
tokens.slice(0,i-1).concat({value:tokens[i-2].type===" "?"*":""})).replace(rtrim,"$1"),matcher,i<j&&matcherFromTokens(tokens.slice(i,j)),j<len&&matcherFromTokens(tokens=tokens.slice(j)),j<len&&toSelector(tokens));}matchers.push(matcher);}}return elementMatcher(matchers);}function matcherFromGroupMatchers(elementMatchers,setMatchers){var bySet=setMatchers.length>0,byElement=elementMatchers.length>0,superMatcher=function superMatcher(seed,context,xml,results,outermost){var elem,j,matcher,matchedCount=0,i="0",unmatched=seed&&[],setMatched=[],contextBackup=outermostContext,// We must always have either seed elements or outermost context
|
||
elems=seed||byElement&&Expr.find["TAG"]("*",outermost),// Use integer dirruns iff this is the outermost matcher
|
||
dirrunsUnique=dirruns+=contextBackup==null?1:Math.random()||0.1,len=elems.length;if(outermost){outermostContext=context!==document&&context;}// Add elements passing elementMatchers directly to results
|
||
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
|
||
// Support: IE<9, Safari
|
||
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
|
||
for(;i!==len&&(elem=elems[i])!=null;i++){if(byElement&&elem){j=0;while(matcher=elementMatchers[j++]){if(matcher(elem,context,xml)){results.push(elem);break;}}if(outermost){dirruns=dirrunsUnique;}}// Track unmatched elements for set filters
|
||
if(bySet){// They will have gone through all possible matchers
|
||
if(elem=!matcher&&elem){matchedCount--;}// Lengthen the array for every element, matched or not
|
||
if(seed){unmatched.push(elem);}}}// Apply set filters to unmatched elements
|
||
matchedCount+=i;if(bySet&&i!==matchedCount){j=0;while(matcher=setMatchers[j++]){matcher(unmatched,setMatched,context,xml);}if(seed){// Reintegrate element matches to eliminate the need for sorting
|
||
if(matchedCount>0){while(i--){if(!(unmatched[i]||setMatched[i])){setMatched[i]=pop.call(results);}}}// Discard index placeholder values to get only actual matches
|
||
setMatched=condense(setMatched);}// Add matches to results
|
||
push.apply(results,setMatched);// Seedless set matches succeeding multiple successful matchers stipulate sorting
|
||
if(outermost&&!seed&&setMatched.length>0&&matchedCount+setMatchers.length>1){Sizzle.uniqueSort(results);}}// Override manipulation of globals by nested matchers
|
||
if(outermost){dirruns=dirrunsUnique;outermostContext=contextBackup;}return unmatched;};return bySet?markFunction(superMatcher):superMatcher;}compile=Sizzle.compile=function(selector,match/* Internal Use Only */){var i,setMatchers=[],elementMatchers=[],cached=compilerCache[selector+" "];if(!cached){// Generate a function of recursive functions that can be used to check each element
|
||
if(!match){match=tokenize(selector);}i=match.length;while(i--){cached=matcherFromTokens(match[i]);if(cached[expando]){setMatchers.push(cached);}else{elementMatchers.push(cached);}}// Cache the compiled function
|
||
cached=compilerCache(selector,matcherFromGroupMatchers(elementMatchers,setMatchers));// Save selector and tokenization
|
||
cached.selector=selector;}return cached;};/**
|
||
* A low-level selection function that works with Sizzle's compiled
|
||
* selector functions
|
||
* @param {String|Function} selector A selector or a pre-compiled
|
||
* selector function built with Sizzle.compile
|
||
* @param {Element} context
|
||
* @param {Array} [results]
|
||
* @param {Array} [seed] A set of elements to match against
|
||
*/select=Sizzle.select=function(selector,context,results,seed){var i,tokens,token,type,find,compiled=typeof selector==="function"&&selector,match=!seed&&tokenize(selector=compiled.selector||selector);results=results||[];// Try to minimize operations if there is no seed and only one group
|
||
if(match.length===1){// Take a shortcut and set the context if the root selector is an ID
|
||
tokens=match[0]=match[0].slice(0);if(tokens.length>2&&(token=tokens[0]).type==="ID"&&support.getById&&context.nodeType===9&&documentIsHTML&&Expr.relative[tokens[1].type]){context=(Expr.find["ID"](token.matches[0].replace(runescape,funescape),context)||[])[0];if(!context){return results;// Precompiled matchers will still verify ancestry, so step up a level
|
||
}else if(compiled){context=context.parentNode;}selector=selector.slice(tokens.shift().value.length);}// Fetch a seed set for right-to-left matching
|
||
i=matchExpr["needsContext"].test(selector)?0:tokens.length;while(i--){token=tokens[i];// Abort if we hit a combinator
|
||
if(Expr.relative[type=token.type]){break;}if(find=Expr.find[type]){// Search, expanding context for leading sibling combinators
|
||
if(seed=find(token.matches[0].replace(runescape,funescape),rsibling.test(tokens[0].type)&&testContext(context.parentNode)||context)){// If seed is empty or no tokens remain, we can return early
|
||
tokens.splice(i,1);selector=seed.length&&toSelector(tokens);if(!selector){push.apply(results,seed);return results;}break;}}}}// Compile and execute a filtering function if one is not provided
|
||
// Provide `match` to avoid retokenization if we modified the selector above
|
||
(compiled||compile(selector,match))(seed,context,!documentIsHTML,results,rsibling.test(selector)&&testContext(context.parentNode)||context);return results;};// One-time assignments
|
||
// Sort stability
|
||
support.sortStable=expando.split("").sort(sortOrder).join("")===expando;// Support: Chrome 14-35+
|
||
// Always assume duplicates if they aren't passed to the comparison function
|
||
support.detectDuplicates=!!hasDuplicate;// Initialize against the default document
|
||
setDocument();// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
|
||
// Detached nodes confoundingly follow *each other*
|
||
support.sortDetached=assert(function(div1){// Should return 1, but returns 4 (following)
|
||
return div1.compareDocumentPosition(document.createElement("div"))&1;});// Support: IE<8
|
||
// Prevent attribute/property "interpolation"
|
||
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
|
||
if(!assert(function(div){div.innerHTML="<a href='#'></a>";return div.firstChild.getAttribute("href")==="#";})){addHandle("type|href|height|width",function(elem,name,isXML){if(!isXML){return elem.getAttribute(name,name.toLowerCase()==="type"?1:2);}});}// Support: IE<9
|
||
// Use defaultValue in place of getAttribute("value")
|
||
if(!support.attributes||!assert(function(div){div.innerHTML="<input/>";div.firstChild.setAttribute("value","");return div.firstChild.getAttribute("value")==="";})){addHandle("value",function(elem,name,isXML){if(!isXML&&elem.nodeName.toLowerCase()==="input"){return elem.defaultValue;}});}// Support: IE<9
|
||
// Use getAttributeNode to fetch booleans when getAttribute lies
|
||
if(!assert(function(div){return div.getAttribute("disabled")==null;})){addHandle(booleans,function(elem,name,isXML){var val;if(!isXML){return elem[name]===true?name.toLowerCase():(val=elem.getAttributeNode(name))&&val.specified?val.value:null;}});}return Sizzle;}(window);jQuery.find=Sizzle;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.pseudos;jQuery.unique=Sizzle.uniqueSort;jQuery.text=Sizzle.getText;jQuery.isXMLDoc=Sizzle.isXML;jQuery.contains=Sizzle.contains;var rneedsContext=jQuery.expr.match.needsContext;var rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>|)$/;var risSimple=/^.[^:#\[\.,]*$/;// Implement the identical functionality for filter and not
|
||
function winnow(elements,qualifier,not){if(jQuery.isFunction(qualifier)){return jQuery.grep(elements,function(elem,i){/* jshint -W018 */return!!qualifier.call(elem,i,elem)!==not;});}if(qualifier.nodeType){return jQuery.grep(elements,function(elem){return elem===qualifier!==not;});}if(typeof qualifier==="string"){if(risSimple.test(qualifier)){return jQuery.filter(qualifier,elements,not);}qualifier=jQuery.filter(qualifier,elements);}return jQuery.grep(elements,function(elem){return jQuery.inArray(elem,qualifier)>=0!==not;});}jQuery.filter=function(expr,elems,not){var elem=elems[0];if(not){expr=":not("+expr+")";}return elems.length===1&&elem.nodeType===1?jQuery.find.matchesSelector(elem,expr)?[elem]:[]:jQuery.find.matches(expr,jQuery.grep(elems,function(elem){return elem.nodeType===1;}));};jQuery.fn.extend({find:function find(selector){var i,ret=[],self=this,len=self.length;if(typeof selector!=="string"){return this.pushStack(jQuery(selector).filter(function(){for(i=0;i<len;i++){if(jQuery.contains(self[i],this)){return true;}}}));}for(i=0;i<len;i++){jQuery.find(selector,self[i],ret);}// Needed because $( selector, context ) becomes $( context ).find( selector )
|
||
ret=this.pushStack(len>1?jQuery.unique(ret):ret);ret.selector=this.selector?this.selector+" "+selector:selector;return ret;},filter:function filter(selector){return this.pushStack(winnow(this,selector||[],false));},not:function not(selector){return this.pushStack(winnow(this,selector||[],true));},is:function is(selector){return!!winnow(this,// If this is a positional/relative selector, check membership in the returned set
|
||
// so $("p:first").is("p:last") won't return true for a doc with two "p".
|
||
typeof selector==="string"&&rneedsContext.test(selector)?jQuery(selector):selector||[],false).length;}});// Initialize a jQuery object
|
||
// A central reference to the root jQuery(document)
|
||
var rootjQuery,// Use the correct document accordingly with window argument (sandbox)
|
||
document=window.document,// A simple way to check for HTML strings
|
||
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
||
// Strict HTML recognition (#11290: must start with <)
|
||
rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,init=jQuery.fn.init=function(selector,context){var match,elem;// HANDLE: $(""), $(null), $(undefined), $(false)
|
||
if(!selector){return this;}// Handle HTML strings
|
||
if(typeof selector==="string"){if(selector.charAt(0)==="<"&&selector.charAt(selector.length-1)===">"&&selector.length>=3){// Assume that strings that start and end with <> are HTML and skip the regex check
|
||
match=[null,selector,null];}else{match=rquickExpr.exec(selector);}// Match html or make sure no context is specified for #id
|
||
if(match&&(match[1]||!context)){// HANDLE: $(html) -> $(array)
|
||
if(match[1]){context=context instanceof jQuery?context[0]:context;// scripts is true for back-compat
|
||
// Intentionally let the error be thrown if parseHTML is not present
|
||
jQuery.merge(this,jQuery.parseHTML(match[1],context&&context.nodeType?context.ownerDocument||context:document,true));// HANDLE: $(html, props)
|
||
if(rsingleTag.test(match[1])&&jQuery.isPlainObject(context)){for(match in context){// Properties of context are called as methods if possible
|
||
if(jQuery.isFunction(this[match])){this[match](context[match]);// ...and otherwise set as attributes
|
||
}else{this.attr(match,context[match]);}}}return this;// HANDLE: $(#id)
|
||
}else{elem=document.getElementById(match[2]);// Check parentNode to catch when Blackberry 4.6 returns
|
||
// nodes that are no longer in the document #6963
|
||
if(elem&&elem.parentNode){// Handle the case where IE and Opera return items
|
||
// by name instead of ID
|
||
if(elem.id!==match[2]){return rootjQuery.find(selector);}// Otherwise, we inject the element directly into the jQuery object
|
||
this.length=1;this[0]=elem;}this.context=document;this.selector=selector;return this;}// HANDLE: $(expr, $(...))
|
||
}else if(!context||context.jquery){return(context||rootjQuery).find(selector);// HANDLE: $(expr, context)
|
||
// (which is just equivalent to: $(context).find(expr)
|
||
}else{return this.constructor(context).find(selector);}// HANDLE: $(DOMElement)
|
||
}else if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this;// HANDLE: $(function)
|
||
// Shortcut for document ready
|
||
}else if(jQuery.isFunction(selector)){return typeof rootjQuery.ready!=="undefined"?rootjQuery.ready(selector):// Execute immediately if ready is not present
|
||
selector(jQuery);}if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context;}return jQuery.makeArray(selector,this);};// Give the init function the jQuery prototype for later instantiation
|
||
init.prototype=jQuery.fn;// Initialize central reference
|
||
rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,// methods guaranteed to produce a unique set when starting from a unique set
|
||
guaranteedUnique={children:true,contents:true,next:true,prev:true};jQuery.extend({dir:function dir(elem,_dir,until){var matched=[],cur=elem[_dir];while(cur&&cur.nodeType!==9&&(until===undefined||cur.nodeType!==1||!jQuery(cur).is(until))){if(cur.nodeType===1){matched.push(cur);}cur=cur[_dir];}return matched;},sibling:function sibling(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType===1&&n!==elem){r.push(n);}}return r;}});jQuery.fn.extend({has:function has(target){var i,targets=jQuery(target,this),len=targets.length;return this.filter(function(){for(i=0;i<len;i++){if(jQuery.contains(this,targets[i])){return true;}}});},closest:function closest(selectors,context){var cur,i=0,l=this.length,matched=[],pos=rneedsContext.test(selectors)||typeof selectors!=="string"?jQuery(selectors,context||this.context):0;for(;i<l;i++){for(cur=this[i];cur&&cur!==context;cur=cur.parentNode){// Always skip document fragments
|
||
if(cur.nodeType<11&&(pos?pos.index(cur)>-1:// Don't pass non-elements to Sizzle
|
||
cur.nodeType===1&&jQuery.find.matchesSelector(cur,selectors))){matched.push(cur);break;}}}return this.pushStack(matched.length>1?jQuery.unique(matched):matched);},// Determine the position of an element within
|
||
// the matched set of elements
|
||
index:function index(elem){// No argument, return index in parent
|
||
if(!elem){return this[0]&&this[0].parentNode?this.first().prevAll().length:-1;}// index in selector
|
||
if(typeof elem==="string"){return jQuery.inArray(this[0],jQuery(elem));}// Locate the position of the desired element
|
||
return jQuery.inArray(// If it receives a jQuery object, the first element is used
|
||
elem.jquery?elem[0]:elem,this);},add:function add(selector,context){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),jQuery(selector,context))));},addBack:function addBack(selector){return this.add(selector==null?this.prevObject:this.prevObject.filter(selector));}});function sibling(cur,dir){do{cur=cur[dir];}while(cur&&cur.nodeType!==1);return cur;}jQuery.each({parent:function parent(elem){var parent=elem.parentNode;return parent&&parent.nodeType!==11?parent:null;},parents:function parents(elem){return jQuery.dir(elem,"parentNode");},parentsUntil:function parentsUntil(elem,i,until){return jQuery.dir(elem,"parentNode",until);},next:function next(elem){return sibling(elem,"nextSibling");},prev:function prev(elem){return sibling(elem,"previousSibling");},nextAll:function nextAll(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function prevAll(elem){return jQuery.dir(elem,"previousSibling");},nextUntil:function nextUntil(elem,i,until){return jQuery.dir(elem,"nextSibling",until);},prevUntil:function prevUntil(elem,i,until){return jQuery.dir(elem,"previousSibling",until);},siblings:function siblings(elem){return jQuery.sibling((elem.parentNode||{}).firstChild,elem);},children:function children(elem){return jQuery.sibling(elem.firstChild);},contents:function contents(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.merge([],elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(until,selector){var ret=jQuery.map(this,fn,until);if(name.slice(-5)!=="Until"){selector=until;}if(selector&&typeof selector==="string"){ret=jQuery.filter(selector,ret);}if(this.length>1){// Remove duplicates
|
||
if(!guaranteedUnique[name]){ret=jQuery.unique(ret);}// Reverse order for parents* and prev-derivatives
|
||
if(rparentsprev.test(name)){ret=ret.reverse();}}return this.pushStack(ret);};});var rnotwhite=/\S+/g;// String to Object options format cache
|
||
var optionsCache={};// Convert String-formatted options into Object-formatted ones and store in cache
|
||
function createOptions(options){var object=optionsCache[options]={};jQuery.each(options.match(rnotwhite)||[],function(_,flag){object[flag]=true;});return object;}/*
|
||
* Create a callback list using the following parameters:
|
||
*
|
||
* options: an optional list of space-separated options that will change how
|
||
* the callback list behaves or a more traditional option object
|
||
*
|
||
* By default a callback list will act like an event callback list and can be
|
||
* "fired" multiple times.
|
||
*
|
||
* Possible options:
|
||
*
|
||
* once: will ensure the callback list can only be fired once (like a Deferred)
|
||
*
|
||
* memory: will keep track of previous values and will call any callback added
|
||
* after the list has been fired right away with the latest "memorized"
|
||
* values (like a Deferred)
|
||
*
|
||
* unique: will ensure a callback can only be added once (no duplicate in the list)
|
||
*
|
||
* stopOnFalse: interrupt callings when a callback returns false
|
||
*
|
||
*/jQuery.Callbacks=function(options){// Convert options from String-formatted to Object-formatted if needed
|
||
// (we check in cache first)
|
||
options=typeof options==="string"?optionsCache[options]||createOptions(options):jQuery.extend({},options);var// Flag to know if list is currently firing
|
||
firing,// Last fire value (for non-forgettable lists)
|
||
memory,// Flag to know if list was already fired
|
||
_fired,// End of the loop when firing
|
||
firingLength,// Index of currently firing callback (modified by remove if needed)
|
||
firingIndex,// First callback to fire (used internally by add and fireWith)
|
||
firingStart,// Actual callback list
|
||
list=[],// Stack of fire calls for repeatable lists
|
||
stack=!options.once&&[],// Fire callbacks
|
||
fire=function fire(data){memory=options.memory&&data;_fired=true;firingIndex=firingStart||0;firingStart=0;firingLength=list.length;firing=true;for(;list&&firingIndex<firingLength;firingIndex++){if(list[firingIndex].apply(data[0],data[1])===false&&options.stopOnFalse){memory=false;// To prevent further calls using add
|
||
break;}}firing=false;if(list){if(stack){if(stack.length){fire(stack.shift());}}else if(memory){list=[];}else{self.disable();}}},// Actual Callbacks object
|
||
self={// Add a callback or a collection of callbacks to the list
|
||
add:function add(){if(list){// First, we save the current length
|
||
var start=list.length;(function add(args){jQuery.each(args,function(_,arg){var type=jQuery.type(arg);if(type==="function"){if(!options.unique||!self.has(arg)){list.push(arg);}}else if(arg&&arg.length&&type!=="string"){// Inspect recursively
|
||
add(arg);}});})(arguments);// Do we need to add the callbacks to the
|
||
// current firing batch?
|
||
if(firing){firingLength=list.length;// With memory, if we're not firing then
|
||
// we should call right away
|
||
}else if(memory){firingStart=start;fire(memory);}}return this;},// Remove a callback from the list
|
||
remove:function remove(){if(list){jQuery.each(arguments,function(_,arg){var index;while((index=jQuery.inArray(arg,list,index))>-1){list.splice(index,1);// Handle firing indexes
|
||
if(firing){if(index<=firingLength){firingLength--;}if(index<=firingIndex){firingIndex--;}}}});}return this;},// Check if a given callback is in the list.
|
||
// If no argument is given, return whether or not list has callbacks attached.
|
||
has:function has(fn){return fn?jQuery.inArray(fn,list)>-1:!!(list&&list.length);},// Remove all callbacks from the list
|
||
empty:function empty(){list=[];firingLength=0;return this;},// Have the list do nothing anymore
|
||
disable:function disable(){list=stack=memory=undefined;return this;},// Is it disabled?
|
||
disabled:function disabled(){return!list;},// Lock the list in its current state
|
||
lock:function lock(){stack=undefined;if(!memory){self.disable();}return this;},// Is it locked?
|
||
locked:function locked(){return!stack;},// Call all callbacks with the given context and arguments
|
||
fireWith:function fireWith(context,args){if(list&&(!_fired||stack)){args=args||[];args=[context,args.slice?args.slice():args];if(firing){stack.push(args);}else{fire(args);}}return this;},// Call all the callbacks with the given arguments
|
||
fire:function fire(){self.fireWith(this,arguments);return this;},// To know if the callbacks have already been called at least once
|
||
fired:function fired(){return!!_fired;}};return self;};jQuery.extend({Deferred:function Deferred(func){var tuples=[// action, add listener, listener list, final state
|
||
["resolve","done",jQuery.Callbacks("once memory"),"resolved"],["reject","fail",jQuery.Callbacks("once memory"),"rejected"],["notify","progress",jQuery.Callbacks("memory")]],_state="pending",_promise={state:function state(){return _state;},always:function always(){deferred.done(arguments).fail(arguments);return this;},then:function then()/* fnDone, fnFail, fnProgress */{var fns=arguments;return jQuery.Deferred(function(newDefer){jQuery.each(tuples,function(i,tuple){var fn=jQuery.isFunction(fns[i])&&fns[i];// deferred[ done | fail | progress ] for forwarding actions to newDefer
|
||
deferred[tuple[1]](function(){var returned=fn&&fn.apply(this,arguments);if(returned&&jQuery.isFunction(returned.promise)){returned.promise().done(newDefer.resolve).fail(newDefer.reject).progress(newDefer.notify);}else{newDefer[tuple[0]+"With"](this===_promise?newDefer.promise():this,fn?[returned]:arguments);}});});fns=null;}).promise();},// Get a promise for this deferred
|
||
// If obj is provided, the promise aspect is added to the object
|
||
promise:function promise(obj){return obj!=null?jQuery.extend(obj,_promise):_promise;}},deferred={};// Keep pipe for back-compat
|
||
_promise.pipe=_promise.then;// Add list-specific methods
|
||
jQuery.each(tuples,function(i,tuple){var list=tuple[2],stateString=tuple[3];// promise[ done | fail | progress ] = list.add
|
||
_promise[tuple[1]]=list.add;// Handle state
|
||
if(stateString){list.add(function(){// state = [ resolved | rejected ]
|
||
_state=stateString;// [ reject_list | resolve_list ].disable; progress_list.lock
|
||
},tuples[i^1][2].disable,tuples[2][2].lock);}// deferred[ resolve | reject | notify ]
|
||
deferred[tuple[0]]=function(){deferred[tuple[0]+"With"](this===deferred?_promise:this,arguments);return this;};deferred[tuple[0]+"With"]=list.fireWith;});// Make the deferred a promise
|
||
_promise.promise(deferred);// Call given func if any
|
||
if(func){func.call(deferred,deferred);}// All done!
|
||
return deferred;},// Deferred helper
|
||
when:function when(subordinate/* , ..., subordinateN */){var i=0,resolveValues=_slice.call(arguments),length=resolveValues.length,// the count of uncompleted subordinates
|
||
remaining=length!==1||subordinate&&jQuery.isFunction(subordinate.promise)?length:0,// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
|
||
deferred=remaining===1?subordinate:jQuery.Deferred(),// Update function for both resolve and progress values
|
||
updateFunc=function updateFunc(i,contexts,values){return function(value){contexts[i]=this;values[i]=arguments.length>1?_slice.call(arguments):value;if(values===progressValues){deferred.notifyWith(contexts,values);}else if(! --remaining){deferred.resolveWith(contexts,values);}};},progressValues,progressContexts,resolveContexts;// add listeners to Deferred subordinates; treat others as resolved
|
||
if(length>1){progressValues=new Array(length);progressContexts=new Array(length);resolveContexts=new Array(length);for(;i<length;i++){if(resolveValues[i]&&jQuery.isFunction(resolveValues[i].promise)){resolveValues[i].promise().done(updateFunc(i,resolveContexts,resolveValues)).fail(deferred.reject).progress(updateFunc(i,progressContexts,progressValues));}else{--remaining;}}}// if we're not waiting on anything, resolve the master
|
||
if(!remaining){deferred.resolveWith(resolveContexts,resolveValues);}return deferred.promise();}});// The deferred used on DOM ready
|
||
var readyList;jQuery.fn.ready=function(fn){// Add the callback
|
||
jQuery.ready.promise().done(fn);return this;};jQuery.extend({// Is the DOM ready to be used? Set to true once it occurs.
|
||
isReady:false,// A counter to track how many items to wait for before
|
||
// the ready event fires. See #6781
|
||
readyWait:1,// Hold (or release) the ready event
|
||
holdReady:function holdReady(hold){if(hold){jQuery.readyWait++;}else{jQuery.ready(true);}},// Handle when the DOM is ready
|
||
ready:function ready(wait){// Abort if there are pending holds or we're already ready
|
||
if(wait===true?--jQuery.readyWait:jQuery.isReady){return;}// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
||
if(!document.body){return setTimeout(jQuery.ready);}// Remember that the DOM is ready
|
||
jQuery.isReady=true;// If a normal DOM Ready event fired, decrement, and wait if need be
|
||
if(wait!==true&&--jQuery.readyWait>0){return;}// If there are functions bound, to execute
|
||
readyList.resolveWith(document,[jQuery]);// Trigger any bound ready events
|
||
if(jQuery.fn.triggerHandler){jQuery(document).triggerHandler("ready");jQuery(document).off("ready");}}});/**
|
||
* Clean-up method for dom ready events
|
||
*/function detach(){if(document.addEventListener){document.removeEventListener("DOMContentLoaded",completed,false);window.removeEventListener("load",completed,false);}else{document.detachEvent("onreadystatechange",completed);window.detachEvent("onload",completed);}}/**
|
||
* The ready event handler and self cleanup method
|
||
*/function completed(){// readyState === "complete" is good enough for us to call the dom ready in oldIE
|
||
if(document.addEventListener||event.type==="load"||document.readyState==="complete"){detach();jQuery.ready();}}jQuery.ready.promise=function(obj){if(!readyList){readyList=jQuery.Deferred();// Catch cases where $(document).ready() is called after the browser event has already occurred.
|
||
// we once tried to use readyState "interactive" here, but it caused issues like the one
|
||
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
|
||
if(document.readyState==="complete"){// Handle it asynchronously to allow scripts the opportunity to delay ready
|
||
setTimeout(jQuery.ready);// Standards-based browsers support DOMContentLoaded
|
||
}else if(document.addEventListener){// Use the handy event callback
|
||
document.addEventListener("DOMContentLoaded",completed,false);// A fallback to window.onload, that will always work
|
||
window.addEventListener("load",completed,false);// If IE event model is used
|
||
}else{// Ensure firing before onload, maybe late but safe also for iframes
|
||
document.attachEvent("onreadystatechange",completed);// A fallback to window.onload, that will always work
|
||
window.attachEvent("onload",completed);// If IE and not a frame
|
||
// continually check to see if the document is ready
|
||
var top=false;try{top=window.frameElement==null&&document.documentElement;}catch(e){}if(top&&top.doScroll){(function doScrollCheck(){if(!jQuery.isReady){try{// Use the trick by Diego Perini
|
||
// http://javascript.nwbox.com/IEContentLoaded/
|
||
top.doScroll("left");}catch(e){return setTimeout(doScrollCheck,50);}// detach all dom ready events
|
||
detach();// and execute any waiting functions
|
||
jQuery.ready();}})();}}}return readyList.promise(obj);};var strundefined=typeof undefined==="undefined"?"undefined":_typeof2(undefined);// Support: IE<9
|
||
// Iteration over object's inherited properties before its own
|
||
var i;for(i in jQuery(support)){break;}support.ownLast=i!=="0";// Note: most support tests are defined in their respective modules.
|
||
// false until the test is run
|
||
support.inlineBlockNeedsLayout=false;// Execute ASAP in case we need to set body.style.zoom
|
||
jQuery(function(){// Minified: var a,b,c,d
|
||
var val,div,body,container;body=document.getElementsByTagName("body")[0];if(!body||!body.style){// Return for frameset docs that don't have a body
|
||
return;}// Setup
|
||
div=document.createElement("div");container=document.createElement("div");container.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";body.appendChild(container).appendChild(div);if(_typeof2(div.style.zoom)!==strundefined){// Support: IE<8
|
||
// Check if natively block-level elements act like inline-block
|
||
// elements when setting their display to 'inline' and giving
|
||
// them layout
|
||
div.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";support.inlineBlockNeedsLayout=val=div.offsetWidth===3;if(val){// Prevent IE 6 from affecting layout for positioned elements #11048
|
||
// Prevent IE from shrinking the body in IE 7 mode #12869
|
||
// Support: IE<8
|
||
body.style.zoom=1;}}body.removeChild(container);});(function(){var div=document.createElement("div");// Execute the test only if not already executed in another module.
|
||
if(support.deleteExpando==null){// Support: IE<9
|
||
support.deleteExpando=true;try{delete div.test;}catch(e){support.deleteExpando=false;}}// Null elements to avoid leaks in IE.
|
||
div=null;})();/**
|
||
* Determines whether an object can have data
|
||
*/jQuery.acceptData=function(elem){var noData=jQuery.noData[(elem.nodeName+" ").toLowerCase()],nodeType=+elem.nodeType||1;// Do not set data on non-element DOM nodes because it will not be cleared (#8335).
|
||
return nodeType!==1&&nodeType!==9?false:// Nodes accept data unless otherwise specified; rejection can be conditional
|
||
!noData||noData!==true&&elem.getAttribute("classid")===noData;};var rbrace=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,rmultiDash=/([A-Z])/g;function dataAttr(elem,key,data){// If nothing was found internally, try to fetch any
|
||
// data from the HTML5 data-* attribute
|
||
if(data===undefined&&elem.nodeType===1){var name="data-"+key.replace(rmultiDash,"-$1").toLowerCase();data=elem.getAttribute(name);if(typeof data==="string"){try{data=data==="true"?true:data==="false"?false:data==="null"?null:// Only convert to a number if it doesn't change the string
|
||
+data+""===data?+data:rbrace.test(data)?jQuery.parseJSON(data):data;}catch(e){}// Make sure we set the data so it isn't changed later
|
||
jQuery.data(elem,key,data);}else{data=undefined;}}return data;}// checks a cache object for emptiness
|
||
function isEmptyDataObject(obj){var name;for(name in obj){// if the public data object is empty, the private is still empty
|
||
if(name==="data"&&jQuery.isEmptyObject(obj[name])){continue;}if(name!=="toJSON"){return false;}}return true;}function internalData(elem,name,data,pvt/* Internal Use Only */){if(!jQuery.acceptData(elem)){return;}var ret,thisCache,internalKey=jQuery.expando,// We have to handle DOM nodes and JS objects differently because IE6-7
|
||
// can't GC object references properly across the DOM-JS boundary
|
||
isNode=elem.nodeType,// Only DOM nodes need the global jQuery cache; JS object data is
|
||
// attached directly to the object so GC can occur automatically
|
||
cache=isNode?jQuery.cache:elem,// Only defining an ID for JS objects if its cache already exists allows
|
||
// the code to shortcut on the same path as a DOM node with no cache
|
||
id=isNode?elem[internalKey]:elem[internalKey]&&internalKey;// Avoid doing any more work than we need to when trying to get data on an
|
||
// object that has no data at all
|
||
if((!id||!cache[id]||!pvt&&!cache[id].data)&&data===undefined&&typeof name==="string"){return;}if(!id){// Only DOM nodes need a new unique ID for each element since their data
|
||
// ends up in the global cache
|
||
if(isNode){id=elem[internalKey]=deletedIds.pop()||jQuery.guid++;}else{id=internalKey;}}if(!cache[id]){// Avoid exposing jQuery metadata on plain JS objects when the object
|
||
// is serialized using JSON.stringify
|
||
cache[id]=isNode?{}:{toJSON:jQuery.noop};}// An object can be passed to jQuery.data instead of a key/value pair; this gets
|
||
// shallow copied over onto the existing cache
|
||
if(_typeof2(name)==="object"||typeof name==="function"){if(pvt){cache[id]=jQuery.extend(cache[id],name);}else{cache[id].data=jQuery.extend(cache[id].data,name);}}thisCache=cache[id];// jQuery data() is stored in a separate object inside the object's internal data
|
||
// cache in order to avoid key collisions between internal data and user-defined
|
||
// data.
|
||
if(!pvt){if(!thisCache.data){thisCache.data={};}thisCache=thisCache.data;}if(data!==undefined){thisCache[jQuery.camelCase(name)]=data;}// Check for both converted-to-camel and non-converted data property names
|
||
// If a data property was specified
|
||
if(typeof name==="string"){// First Try to find as-is property data
|
||
ret=thisCache[name];// Test for null|undefined property data
|
||
if(ret==null){// Try to find the camelCased property
|
||
ret=thisCache[jQuery.camelCase(name)];}}else{ret=thisCache;}return ret;}function internalRemoveData(elem,name,pvt){if(!jQuery.acceptData(elem)){return;}var thisCache,i,isNode=elem.nodeType,// See jQuery.data for more information
|
||
cache=isNode?jQuery.cache:elem,id=isNode?elem[jQuery.expando]:jQuery.expando;// If there is already no cache entry for this object, there is no
|
||
// purpose in continuing
|
||
if(!cache[id]){return;}if(name){thisCache=pvt?cache[id]:cache[id].data;if(thisCache){// Support array or space separated string names for data keys
|
||
if(!jQuery.isArray(name)){// try the string as a key before any manipulation
|
||
if(name in thisCache){name=[name];}else{// split the camel cased version by spaces unless a key with the spaces exists
|
||
name=jQuery.camelCase(name);if(name in thisCache){name=[name];}else{name=name.split(" ");}}}else{// If "name" is an array of keys...
|
||
// When data is initially created, via ("key", "val") signature,
|
||
// keys will be converted to camelCase.
|
||
// Since there is no way to tell _how_ a key was added, remove
|
||
// both plain key and camelCase key. #12786
|
||
// This will only penalize the array argument path.
|
||
name=name.concat(jQuery.map(name,jQuery.camelCase));}i=name.length;while(i--){delete thisCache[name[i]];}// If there is no data left in the cache, we want to continue
|
||
// and let the cache object itself get destroyed
|
||
if(pvt?!isEmptyDataObject(thisCache):!jQuery.isEmptyObject(thisCache)){return;}}}// See jQuery.data for more information
|
||
if(!pvt){delete cache[id].data;// Don't destroy the parent cache unless the internal data object
|
||
// had been the only thing left in it
|
||
if(!isEmptyDataObject(cache[id])){return;}}// Destroy the cache
|
||
if(isNode){jQuery.cleanData([elem],true);// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
|
||
/* jshint eqeqeq: false */}else if(support.deleteExpando||cache!=cache.window){/* jshint eqeqeq: true */delete cache[id];// When all else fails, null
|
||
}else{cache[id]=null;}}jQuery.extend({cache:{},// The following elements (space-suffixed to avoid Object.prototype collisions)
|
||
// throw uncatchable exceptions if you attempt to set expando properties
|
||
noData:{"applet ":true,"embed ":true,// ...but Flash objects (which have this classid) *can* handle expandos
|
||
"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function hasData(elem){elem=elem.nodeType?jQuery.cache[elem[jQuery.expando]]:elem[jQuery.expando];return!!elem&&!isEmptyDataObject(elem);},data:function data(elem,name,_data){return internalData(elem,name,_data);},removeData:function removeData(elem,name){return internalRemoveData(elem,name);},// For internal use only.
|
||
_data:function _data(elem,name,data){return internalData(elem,name,data,true);},_removeData:function _removeData(elem,name){return internalRemoveData(elem,name,true);}});jQuery.fn.extend({data:function data(key,value){var i,name,data,elem=this[0],attrs=elem&&elem.attributes;// Special expections of .data basically thwart jQuery.access,
|
||
// so implement the relevant behavior ourselves
|
||
// Gets all values
|
||
if(key===undefined){if(this.length){data=jQuery.data(elem);if(elem.nodeType===1&&!jQuery._data(elem,"parsedAttrs")){i=attrs.length;while(i--){// Support: IE11+
|
||
// The attrs elements can be null (#14894)
|
||
if(attrs[i]){name=attrs[i].name;if(name.indexOf("data-")===0){name=jQuery.camelCase(name.slice(5));dataAttr(elem,name,data[name]);}}}jQuery._data(elem,"parsedAttrs",true);}}return data;}// Sets multiple values
|
||
if(_typeof2(key)==="object"){return this.each(function(){jQuery.data(this,key);});}return arguments.length>1?// Sets one value
|
||
this.each(function(){jQuery.data(this,key,value);}):// Gets one value
|
||
// Try to fetch any internally stored data first
|
||
elem?dataAttr(elem,key,jQuery.data(elem,key)):undefined;},removeData:function removeData(key){return this.each(function(){jQuery.removeData(this,key);});}});jQuery.extend({queue:function queue(elem,type,data){var queue;if(elem){type=(type||"fx")+"queue";queue=jQuery._data(elem,type);// Speed up dequeue by getting out quickly if this is just a lookup
|
||
if(data){if(!queue||jQuery.isArray(data)){queue=jQuery._data(elem,type,jQuery.makeArray(data));}else{queue.push(data);}}return queue||[];}},dequeue:function dequeue(elem,type){type=type||"fx";var queue=jQuery.queue(elem,type),startLength=queue.length,fn=queue.shift(),hooks=jQuery._queueHooks(elem,type),next=function next(){jQuery.dequeue(elem,type);};// If the fx queue is dequeued, always remove the progress sentinel
|
||
if(fn==="inprogress"){fn=queue.shift();startLength--;}if(fn){// Add a progress sentinel to prevent the fx queue from being
|
||
// automatically dequeued
|
||
if(type==="fx"){queue.unshift("inprogress");}// clear up the last queue stop function
|
||
delete hooks.stop;fn.call(elem,next,hooks);}if(!startLength&&hooks){hooks.empty.fire();}},// not intended for public consumption - generates a queueHooks object, or returns the current one
|
||
_queueHooks:function _queueHooks(elem,type){var key=type+"queueHooks";return jQuery._data(elem,key)||jQuery._data(elem,key,{empty:jQuery.Callbacks("once memory").add(function(){jQuery._removeData(elem,type+"queue");jQuery._removeData(elem,key);})});}});jQuery.fn.extend({queue:function queue(type,data){var setter=2;if(typeof type!=="string"){data=type;type="fx";setter--;}if(arguments.length<setter){return jQuery.queue(this[0],type);}return data===undefined?this:this.each(function(){var queue=jQuery.queue(this,type,data);// ensure a hooks for this queue
|
||
jQuery._queueHooks(this,type);if(type==="fx"&&queue[0]!=="inprogress"){jQuery.dequeue(this,type);}});},dequeue:function dequeue(type){return this.each(function(){jQuery.dequeue(this,type);});},clearQueue:function clearQueue(type){return this.queue(type||"fx",[]);},// Get a promise resolved when queues of a certain type
|
||
// are emptied (fx is the type by default)
|
||
promise:function promise(type,obj){var tmp,count=1,defer=jQuery.Deferred(),elements=this,i=this.length,resolve=function resolve(){if(! --count){defer.resolveWith(elements,[elements]);}};if(typeof type!=="string"){obj=type;type=undefined;}type=type||"fx";while(i--){tmp=jQuery._data(elements[i],type+"queueHooks");if(tmp&&tmp.empty){count++;tmp.empty.add(resolve);}}resolve();return defer.promise(obj);}});var pnum=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;var cssExpand=["Top","Right","Bottom","Left"];var isHidden=function isHidden(elem,el){// isHidden might be called from jQuery#filter function;
|
||
// in that case, element will be second argument
|
||
elem=el||elem;return jQuery.css(elem,"display")==="none"||!jQuery.contains(elem.ownerDocument,elem);};// Multifunctional method to get and set values of a collection
|
||
// The value/s can optionally be executed if it's a function
|
||
var access=jQuery.access=function(elems,fn,key,value,chainable,emptyGet,raw){var i=0,length=elems.length,bulk=key==null;// Sets many values
|
||
if(jQuery.type(key)==="object"){chainable=true;for(i in key){jQuery.access(elems,fn,i,key[i],true,emptyGet,raw);}// Sets one value
|
||
}else if(value!==undefined){chainable=true;if(!jQuery.isFunction(value)){raw=true;}if(bulk){// Bulk operations run against the entire set
|
||
if(raw){fn.call(elems,value);fn=null;// ...except when executing function values
|
||
}else{bulk=fn;fn=function fn(elem,key,value){return bulk.call(jQuery(elem),value);};}}if(fn){for(;i<length;i++){fn(elems[i],key,raw?value:value.call(elems[i],i,fn(elems[i],key)));}}}return chainable?elems:// Gets
|
||
bulk?fn.call(elems):length?fn(elems[0],key):emptyGet;};var rcheckableType=/^(?:checkbox|radio)$/i;(function(){// Minified: var a,b,c
|
||
var input=document.createElement("input"),div=document.createElement("div"),fragment=document.createDocumentFragment();// Setup
|
||
div.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";// IE strips leading whitespace when .innerHTML is used
|
||
support.leadingWhitespace=div.firstChild.nodeType===3;// Make sure that tbody elements aren't automatically inserted
|
||
// IE will insert them into empty tables
|
||
support.tbody=!div.getElementsByTagName("tbody").length;// Make sure that link elements get serialized correctly by innerHTML
|
||
// This requires a wrapper element in IE
|
||
support.htmlSerialize=!!div.getElementsByTagName("link").length;// Makes sure cloning an html5 element does not cause problems
|
||
// Where outerHTML is undefined, this still works
|
||
support.html5Clone=document.createElement("nav").cloneNode(true).outerHTML!=="<:nav></:nav>";// Check if a disconnected checkbox will retain its checked
|
||
// value of true after appended to the DOM (IE6/7)
|
||
input.type="checkbox";input.checked=true;fragment.appendChild(input);support.appendChecked=input.checked;// Make sure textarea (and checkbox) defaultValue is properly cloned
|
||
// Support: IE6-IE11+
|
||
div.innerHTML="<textarea>x</textarea>";support.noCloneChecked=!!div.cloneNode(true).lastChild.defaultValue;// #11217 - WebKit loses check when the name is after the checked attribute
|
||
fragment.appendChild(div);div.innerHTML="<input type='radio' checked='checked' name='t'/>";// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
|
||
// old WebKit doesn't clone checked state correctly in fragments
|
||
support.checkClone=div.cloneNode(true).cloneNode(true).lastChild.checked;// Support: IE<9
|
||
// Opera does not clone events (and typeof div.attachEvent === undefined).
|
||
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
|
||
support.noCloneEvent=true;if(div.attachEvent){div.attachEvent("onclick",function(){support.noCloneEvent=false;});div.cloneNode(true).click();}// Execute the test only if not already executed in another module.
|
||
if(support.deleteExpando==null){// Support: IE<9
|
||
support.deleteExpando=true;try{delete div.test;}catch(e){support.deleteExpando=false;}}})();(function(){var i,eventName,div=document.createElement("div");// Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event)
|
||
for(i in{submit:true,change:true,focusin:true}){eventName="on"+i;if(!(support[i+"Bubbles"]=eventName in window)){// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
|
||
div.setAttribute(eventName,"t");support[i+"Bubbles"]=div.attributes[eventName].expando===false;}}// Null elements to avoid leaks in IE.
|
||
div=null;})();var rformElems=/^(?:input|select|textarea)$/i,rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu)|click/,rfocusMorph=/^(?:focusinfocus|focusoutblur)$/,rtypenamespace=/^([^.]*)(?:\.(.+)|)$/;function returnTrue(){return true;}function returnFalse(){return false;}function safeActiveElement(){try{return document.activeElement;}catch(err){}}/*
|
||
* Helper functions for managing events -- not part of the public interface.
|
||
* Props to Dean Edwards' addEvent library for many of the ideas.
|
||
*/jQuery.event={global:{},add:function add(elem,types,handler,data,selector){var tmp,events,t,handleObjIn,special,eventHandle,handleObj,handlers,type,namespaces,origType,elemData=jQuery._data(elem);// Don't attach events to noData or text/comment nodes (but allow plain objects)
|
||
if(!elemData){return;}// Caller can pass in an object of custom data in lieu of the handler
|
||
if(handler.handler){handleObjIn=handler;handler=handleObjIn.handler;selector=handleObjIn.selector;}// Make sure that the handler has a unique ID, used to find/remove it later
|
||
if(!handler.guid){handler.guid=jQuery.guid++;}// Init the element's event structure and main handler, if this is the first
|
||
if(!(events=elemData.events)){events=elemData.events={};}if(!(eventHandle=elemData.handle)){eventHandle=elemData.handle=function(e){// Discard the second event of a jQuery.event.trigger() and
|
||
// when an event is called after a page has unloaded
|
||
return _typeof2(jQuery)!==strundefined&&(!e||jQuery.event.triggered!==e.type)?jQuery.event.dispatch.apply(eventHandle.elem,arguments):undefined;};// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
|
||
eventHandle.elem=elem;}// Handle multiple events separated by a space
|
||
types=(types||"").match(rnotwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();// There *must* be a type, no attaching namespace-only handlers
|
||
if(!type){continue;}// If event changes its type, use the special event handlers for the changed type
|
||
special=jQuery.event.special[type]||{};// If selector defined, determine special event api type, otherwise given type
|
||
type=(selector?special.delegateType:special.bindType)||type;// Update special based on newly reset type
|
||
special=jQuery.event.special[type]||{};// handleObj is passed to all event handlers
|
||
handleObj=jQuery.extend({type:type,origType:origType,data:data,handler:handler,guid:handler.guid,selector:selector,needsContext:selector&&jQuery.expr.match.needsContext.test(selector),namespace:namespaces.join(".")},handleObjIn);// Init the event handler queue if we're the first
|
||
if(!(handlers=events[type])){handlers=events[type]=[];handlers.delegateCount=0;// Only use addEventListener/attachEvent if the special events handler returns false
|
||
if(!special.setup||special.setup.call(elem,data,namespaces,eventHandle)===false){// Bind the global event handler to the element
|
||
if(elem.addEventListener){elem.addEventListener(type,eventHandle,false);}else if(elem.attachEvent){elem.attachEvent("on"+type,eventHandle);}}}if(special.add){special.add.call(elem,handleObj);if(!handleObj.handler.guid){handleObj.handler.guid=handler.guid;}}// Add to the element's handler list, delegates in front
|
||
if(selector){handlers.splice(handlers.delegateCount++,0,handleObj);}else{handlers.push(handleObj);}// Keep track of which events have ever been used, for event optimization
|
||
jQuery.event.global[type]=true;}// Nullify elem to prevent memory leaks in IE
|
||
elem=null;},// Detach an event or set of events from an element
|
||
remove:function remove(elem,types,handler,selector,mappedTypes){var j,handleObj,tmp,origCount,t,events,special,handlers,type,namespaces,origType,elemData=jQuery.hasData(elem)&&jQuery._data(elem);if(!elemData||!(events=elemData.events)){return;}// Once for each type.namespace in types; type may be omitted
|
||
types=(types||"").match(rnotwhite)||[""];t=types.length;while(t--){tmp=rtypenamespace.exec(types[t])||[];type=origType=tmp[1];namespaces=(tmp[2]||"").split(".").sort();// Unbind all events (on this namespace, if provided) for the element
|
||
if(!type){for(type in events){jQuery.event.remove(elem,type+types[t],handler,selector,true);}continue;}special=jQuery.event.special[type]||{};type=(selector?special.delegateType:special.bindType)||type;handlers=events[type]||[];tmp=tmp[2]&&new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)");// Remove matching events
|
||
origCount=j=handlers.length;while(j--){handleObj=handlers[j];if((mappedTypes||origType===handleObj.origType)&&(!handler||handler.guid===handleObj.guid)&&(!tmp||tmp.test(handleObj.namespace))&&(!selector||selector===handleObj.selector||selector==="**"&&handleObj.selector)){handlers.splice(j,1);if(handleObj.selector){handlers.delegateCount--;}if(special.remove){special.remove.call(elem,handleObj);}}}// Remove generic event handler if we removed something and no more handlers exist
|
||
// (avoids potential for endless recursion during removal of special event handlers)
|
||
if(origCount&&!handlers.length){if(!special.teardown||special.teardown.call(elem,namespaces,elemData.handle)===false){jQuery.removeEvent(elem,type,elemData.handle);}delete events[type];}}// Remove the expando if it's no longer used
|
||
if(jQuery.isEmptyObject(events)){delete elemData.handle;// removeData also checks for emptiness and clears the expando if empty
|
||
// so use it instead of delete
|
||
jQuery._removeData(elem,"events");}},trigger:function trigger(event,data,elem,onlyHandlers){var handle,ontype,cur,bubbleType,special,tmp,i,eventPath=[elem||document],type=hasOwn.call(event,"type")?event.type:event,namespaces=hasOwn.call(event,"namespace")?event.namespace.split("."):[];cur=tmp=elem=elem||document;// Don't do events on text and comment nodes
|
||
if(elem.nodeType===3||elem.nodeType===8){return;}// focus/blur morphs to focusin/out; ensure we're not firing them right now
|
||
if(rfocusMorph.test(type+jQuery.event.triggered)){return;}if(type.indexOf(".")>=0){// Namespaced trigger; create a regexp to match event type in handle()
|
||
namespaces=type.split(".");type=namespaces.shift();namespaces.sort();}ontype=type.indexOf(":")<0&&"on"+type;// Caller can pass in a jQuery.Event object, Object, or just an event type string
|
||
event=event[jQuery.expando]?event:new jQuery.Event(type,_typeof2(event)==="object"&&event);// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
|
||
event.isTrigger=onlyHandlers?2:3;event.namespace=namespaces.join(".");event.namespace_re=event.namespace?new RegExp("(^|\\.)"+namespaces.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;// Clean up the event in case it is being reused
|
||
event.result=undefined;if(!event.target){event.target=elem;}// Clone any incoming data and prepend the event, creating the handler arg list
|
||
data=data==null?[event]:jQuery.makeArray(data,[event]);// Allow special events to draw outside the lines
|
||
special=jQuery.event.special[type]||{};if(!onlyHandlers&&special.trigger&&special.trigger.apply(elem,data)===false){return;}// Determine event propagation path in advance, per W3C events spec (#9951)
|
||
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
|
||
if(!onlyHandlers&&!special.noBubble&&!jQuery.isWindow(elem)){bubbleType=special.delegateType||type;if(!rfocusMorph.test(bubbleType+type)){cur=cur.parentNode;}for(;cur;cur=cur.parentNode){eventPath.push(cur);tmp=cur;}// Only add window if we got to document (e.g., not plain obj or detached DOM)
|
||
if(tmp===(elem.ownerDocument||document)){eventPath.push(tmp.defaultView||tmp.parentWindow||window);}}// Fire handlers on the event path
|
||
i=0;while((cur=eventPath[i++])&&!event.isPropagationStopped()){event.type=i>1?bubbleType:special.bindType||type;// jQuery handler
|
||
handle=(jQuery._data(cur,"events")||{})[event.type]&&jQuery._data(cur,"handle");if(handle){handle.apply(cur,data);}// Native handler
|
||
handle=ontype&&cur[ontype];if(handle&&handle.apply&&jQuery.acceptData(cur)){event.result=handle.apply(cur,data);if(event.result===false){event.preventDefault();}}}event.type=type;// If nobody prevented the default action, do it now
|
||
if(!onlyHandlers&&!event.isDefaultPrevented()){if((!special._default||special._default.apply(eventPath.pop(),data)===false)&&jQuery.acceptData(elem)){// Call a native DOM method on the target with the same name name as the event.
|
||
// Can't use an .isFunction() check here because IE6/7 fails that test.
|
||
// Don't do default actions on window, that's where global variables be (#6170)
|
||
if(ontype&&elem[type]&&!jQuery.isWindow(elem)){// Don't re-trigger an onFOO event when we call its FOO() method
|
||
tmp=elem[ontype];if(tmp){elem[ontype]=null;}// Prevent re-triggering of the same event, since we already bubbled it above
|
||
jQuery.event.triggered=type;try{elem[type]();}catch(e){// IE<9 dies on focus/blur to hidden element (#1486,#12518)
|
||
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
|
||
}jQuery.event.triggered=undefined;if(tmp){elem[ontype]=tmp;}}}}return event.result;},dispatch:function dispatch(event){// Make a writable jQuery.Event from the native event object
|
||
event=jQuery.event.fix(event);var i,ret,handleObj,matched,j,handlerQueue=[],args=_slice.call(arguments),handlers=(jQuery._data(this,"events")||{})[event.type]||[],special=jQuery.event.special[event.type]||{};// Use the fix-ed jQuery.Event rather than the (read-only) native event
|
||
args[0]=event;event.delegateTarget=this;// Call the preDispatch hook for the mapped type, and let it bail if desired
|
||
if(special.preDispatch&&special.preDispatch.call(this,event)===false){return;}// Determine handlers
|
||
handlerQueue=jQuery.event.handlers.call(this,event,handlers);// Run delegates first; they may want to stop propagation beneath us
|
||
i=0;while((matched=handlerQueue[i++])&&!event.isPropagationStopped()){event.currentTarget=matched.elem;j=0;while((handleObj=matched.handlers[j++])&&!event.isImmediatePropagationStopped()){// Triggered event must either 1) have no namespace, or
|
||
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
|
||
if(!event.namespace_re||event.namespace_re.test(handleObj.namespace)){event.handleObj=handleObj;event.data=handleObj.data;ret=((jQuery.event.special[handleObj.origType]||{}).handle||handleObj.handler).apply(matched.elem,args);if(ret!==undefined){if((event.result=ret)===false){event.preventDefault();event.stopPropagation();}}}}}// Call the postDispatch hook for the mapped type
|
||
if(special.postDispatch){special.postDispatch.call(this,event);}return event.result;},handlers:function handlers(event,_handlers){var sel,handleObj,matches,i,handlerQueue=[],delegateCount=_handlers.delegateCount,cur=event.target;// Find delegate handlers
|
||
// Black-hole SVG <use> instance trees (#13180)
|
||
// Avoid non-left-click bubbling in Firefox (#3861)
|
||
if(delegateCount&&cur.nodeType&&(!event.button||event.type!=="click")){/* jshint eqeqeq: false */for(;cur!=this;cur=cur.parentNode||this){/* jshint eqeqeq: true */ // Don't check non-elements (#13208)
|
||
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
|
||
if(cur.nodeType===1&&(cur.disabled!==true||event.type!=="click")){matches=[];for(i=0;i<delegateCount;i++){handleObj=_handlers[i];// Don't conflict with Object.prototype properties (#13203)
|
||
sel=handleObj.selector+" ";if(matches[sel]===undefined){matches[sel]=handleObj.needsContext?jQuery(sel,this).index(cur)>=0:jQuery.find(sel,this,null,[cur]).length;}if(matches[sel]){matches.push(handleObj);}}if(matches.length){handlerQueue.push({elem:cur,handlers:matches});}}}}// Add the remaining (directly-bound) handlers
|
||
if(delegateCount<_handlers.length){handlerQueue.push({elem:this,handlers:_handlers.slice(delegateCount)});}return handlerQueue;},fix:function fix(event){if(event[jQuery.expando]){return event;}// Create a writable copy of the event object and normalize some properties
|
||
var i,prop,copy,type=event.type,originalEvent=event,fixHook=this.fixHooks[type];if(!fixHook){this.fixHooks[type]=fixHook=rmouseEvent.test(type)?this.mouseHooks:rkeyEvent.test(type)?this.keyHooks:{};}copy=fixHook.props?this.props.concat(fixHook.props):this.props;event=new jQuery.Event(originalEvent);i=copy.length;while(i--){prop=copy[i];event[prop]=originalEvent[prop];}// Support: IE<9
|
||
// Fix target property (#1925)
|
||
if(!event.target){event.target=originalEvent.srcElement||document;}// Support: Chrome 23+, Safari?
|
||
// Target should not be a text node (#504, #13143)
|
||
if(event.target.nodeType===3){event.target=event.target.parentNode;}// Support: IE<9
|
||
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
|
||
event.metaKey=!!event.metaKey;return fixHook.filter?fixHook.filter(event,originalEvent):event;},// Includes some event props shared by KeyEvent and MouseEvent
|
||
props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function filter(event,original){// Add which for key events
|
||
if(event.which==null){event.which=original.charCode!=null?original.charCode:original.keyCode;}return event;}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function filter(event,original){var body,eventDoc,doc,button=original.button,fromElement=original.fromElement;// Calculate pageX/Y if missing and clientX/Y available
|
||
if(event.pageX==null&&original.clientX!=null){eventDoc=event.target.ownerDocument||document;doc=eventDoc.documentElement;body=eventDoc.body;event.pageX=original.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=original.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0);}// Add relatedTarget, if necessary
|
||
if(!event.relatedTarget&&fromElement){event.relatedTarget=fromElement===event.target?original.toElement:fromElement;}// Add which for click: 1 === left; 2 === middle; 3 === right
|
||
// Note: button is not normalized, so don't use it
|
||
if(!event.which&&button!==undefined){event.which=button&1?1:button&2?3:button&4?2:0;}return event;}},special:{load:{// Prevent triggered image.load events from bubbling to window.load
|
||
noBubble:true},focus:{// Fire native event if possible so blur/focus sequence is correct
|
||
trigger:function trigger(){if(this!==safeActiveElement()&&this.focus){try{this.focus();return false;}catch(e){// Support: IE<9
|
||
// If we error on focus to hidden element (#1486, #12518),
|
||
// let .trigger() run the handlers
|
||
}}},delegateType:"focusin"},blur:{trigger:function trigger(){if(this===safeActiveElement()&&this.blur){this.blur();return false;}},delegateType:"focusout"},click:{// For checkbox, fire native event so checked state will be right
|
||
trigger:function trigger(){if(jQuery.nodeName(this,"input")&&this.type==="checkbox"&&this.click){this.click();return false;}},// For cross-browser consistency, don't fire native .click() on links
|
||
_default:function _default(event){return jQuery.nodeName(event.target,"a");}},beforeunload:{postDispatch:function postDispatch(event){// Support: Firefox 20+
|
||
// Firefox doesn't alert if the returnValue field is not set.
|
||
if(event.result!==undefined&&event.originalEvent){event.originalEvent.returnValue=event.result;}}}},simulate:function simulate(type,elem,event,bubble){// Piggyback on a donor event to simulate a different one.
|
||
// Fake originalEvent to avoid donor's stopPropagation, but if the
|
||
// simulated event prevents default then we do the same on the donor.
|
||
var e=jQuery.extend(new jQuery.Event(),event,{type:type,isSimulated:true,originalEvent:{}});if(bubble){jQuery.event.trigger(e,null,elem);}else{jQuery.event.dispatch.call(elem,e);}if(e.isDefaultPrevented()){event.preventDefault();}}};jQuery.removeEvent=document.removeEventListener?function(elem,type,handle){if(elem.removeEventListener){elem.removeEventListener(type,handle,false);}}:function(elem,type,handle){var name="on"+type;if(elem.detachEvent){// #8545, #7054, preventing memory leaks for custom events in IE6-8
|
||
// detachEvent needed property on element, by name of that event, to properly expose it to GC
|
||
if(_typeof2(elem[name])===strundefined){elem[name]=null;}elem.detachEvent(name,handle);}};jQuery.Event=function(src,props){// Allow instantiation without the 'new' keyword
|
||
if(!(this instanceof jQuery.Event)){return new jQuery.Event(src,props);}// Event object
|
||
if(src&&src.type){this.originalEvent=src;this.type=src.type;// Events bubbling up the document may have been marked as prevented
|
||
// by a handler lower down the tree; reflect the correct value.
|
||
this.isDefaultPrevented=src.defaultPrevented||src.defaultPrevented===undefined&&// Support: IE < 9, Android < 4.0
|
||
src.returnValue===false?returnTrue:returnFalse;// Event type
|
||
}else{this.type=src;}// Put explicitly provided properties onto the event object
|
||
if(props){jQuery.extend(this,props);}// Create a timestamp if incoming event doesn't have one
|
||
this.timeStamp=src&&src.timeStamp||jQuery.now();// Mark it as fixed
|
||
this[jQuery.expando]=true;};// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
|
||
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
|
||
jQuery.Event.prototype={isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse,preventDefault:function preventDefault(){var e=this.originalEvent;this.isDefaultPrevented=returnTrue;if(!e){return;}// If preventDefault exists, run it on the original event
|
||
if(e.preventDefault){e.preventDefault();// Support: IE
|
||
// Otherwise set the returnValue property of the original event to false
|
||
}else{e.returnValue=false;}},stopPropagation:function stopPropagation(){var e=this.originalEvent;this.isPropagationStopped=returnTrue;if(!e){return;}// If stopPropagation exists, run it on the original event
|
||
if(e.stopPropagation){e.stopPropagation();}// Support: IE
|
||
// Set the cancelBubble property of the original event to true
|
||
e.cancelBubble=true;},stopImmediatePropagation:function stopImmediatePropagation(){var e=this.originalEvent;this.isImmediatePropagationStopped=returnTrue;if(e&&e.stopImmediatePropagation){e.stopImmediatePropagation();}this.stopPropagation();}};// Create mouseenter/leave events using mouseover/out and event-time checks
|
||
jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(orig,fix){jQuery.event.special[orig]={delegateType:fix,bindType:fix,handle:function handle(event){var ret,target=this,related=event.relatedTarget,handleObj=event.handleObj;// For mousenter/leave call the handler if related is outside the target.
|
||
// NB: No relatedTarget if the mouse left/entered the browser window
|
||
if(!related||related!==target&&!jQuery.contains(target,related)){event.type=handleObj.origType;ret=handleObj.handler.apply(this,arguments);event.type=fix;}return ret;}};});// IE submit delegation
|
||
if(!support.submitBubbles){jQuery.event.special.submit={setup:function setup(){// Only need this for delegated form submit events
|
||
if(jQuery.nodeName(this,"form")){return false;}// Lazy-add a submit handler when a descendant form may potentially be submitted
|
||
jQuery.event.add(this,"click._submit keypress._submit",function(e){// Node name check avoids a VML-related crash in IE (#9807)
|
||
var elem=e.target,form=jQuery.nodeName(elem,"input")||jQuery.nodeName(elem,"button")?elem.form:undefined;if(form&&!jQuery._data(form,"submitBubbles")){jQuery.event.add(form,"submit._submit",function(event){event._submit_bubble=true;});jQuery._data(form,"submitBubbles",true);}});// return undefined since we don't need an event listener
|
||
},postDispatch:function postDispatch(event){// If form was submitted by the user, bubble the event up the tree
|
||
if(event._submit_bubble){delete event._submit_bubble;if(this.parentNode&&!event.isTrigger){jQuery.event.simulate("submit",this.parentNode,event,true);}}},teardown:function teardown(){// Only need this for delegated form submit events
|
||
if(jQuery.nodeName(this,"form")){return false;}// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
|
||
jQuery.event.remove(this,"._submit");}};}// IE change delegation and checkbox/radio fix
|
||
if(!support.changeBubbles){jQuery.event.special.change={setup:function setup(){if(rformElems.test(this.nodeName)){// IE doesn't fire change on a check/radio until blur; trigger it on click
|
||
// after a propertychange. Eat the blur-change in special.change.handle.
|
||
// This still fires onchange a second time for check/radio after blur.
|
||
if(this.type==="checkbox"||this.type==="radio"){jQuery.event.add(this,"propertychange._change",function(event){if(event.originalEvent.propertyName==="checked"){this._just_changed=true;}});jQuery.event.add(this,"click._change",function(event){if(this._just_changed&&!event.isTrigger){this._just_changed=false;}// Allow triggered, simulated change events (#11500)
|
||
jQuery.event.simulate("change",this,event,true);});}return false;}// Delegated event; lazy-add a change handler on descendant inputs
|
||
jQuery.event.add(this,"beforeactivate._change",function(e){var elem=e.target;if(rformElems.test(elem.nodeName)&&!jQuery._data(elem,"changeBubbles")){jQuery.event.add(elem,"change._change",function(event){if(this.parentNode&&!event.isSimulated&&!event.isTrigger){jQuery.event.simulate("change",this.parentNode,event,true);}});jQuery._data(elem,"changeBubbles",true);}});},handle:function handle(event){var elem=event.target;// Swallow native change events from checkbox/radio, we already triggered them above
|
||
if(this!==elem||event.isSimulated||event.isTrigger||elem.type!=="radio"&&elem.type!=="checkbox"){return event.handleObj.handler.apply(this,arguments);}},teardown:function teardown(){jQuery.event.remove(this,"._change");return!rformElems.test(this.nodeName);}};}// Create "bubbling" focus and blur events
|
||
if(!support.focusinBubbles){jQuery.each({focus:"focusin",blur:"focusout"},function(orig,fix){// Attach a single capturing handler on the document while someone wants focusin/focusout
|
||
var handler=function handler(event){jQuery.event.simulate(fix,event.target,jQuery.event.fix(event),true);};jQuery.event.special[fix]={setup:function setup(){var doc=this.ownerDocument||this,attaches=jQuery._data(doc,fix);if(!attaches){doc.addEventListener(orig,handler,true);}jQuery._data(doc,fix,(attaches||0)+1);},teardown:function teardown(){var doc=this.ownerDocument||this,attaches=jQuery._data(doc,fix)-1;if(!attaches){doc.removeEventListener(orig,handler,true);jQuery._removeData(doc,fix);}else{jQuery._data(doc,fix,attaches);}}};});}jQuery.fn.extend({on:function on(types,selector,data,fn,/*INTERNAL*/one){var type,origFn;// Types can be a map of types/handlers
|
||
if(_typeof2(types)==="object"){// ( types-Object, selector, data )
|
||
if(typeof selector!=="string"){// ( types-Object, data )
|
||
data=data||selector;selector=undefined;}for(type in types){this.on(type,selector,data,types[type],one);}return this;}if(data==null&&fn==null){// ( types, fn )
|
||
fn=selector;data=selector=undefined;}else if(fn==null){if(typeof selector==="string"){// ( types, selector, fn )
|
||
fn=data;data=undefined;}else{// ( types, data, fn )
|
||
fn=data;data=selector;selector=undefined;}}if(fn===false){fn=returnFalse;}else if(!fn){return this;}if(one===1){origFn=fn;fn=function fn(event){// Can use an empty set, since event contains the info
|
||
jQuery().off(event);return origFn.apply(this,arguments);};// Use same guid so caller can remove using origFn
|
||
fn.guid=origFn.guid||(origFn.guid=jQuery.guid++);}return this.each(function(){jQuery.event.add(this,types,fn,data,selector);});},one:function one(types,selector,data,fn){return this.on(types,selector,data,fn,1);},off:function off(types,selector,fn){var handleObj,type;if(types&&types.preventDefault&&types.handleObj){// ( event ) dispatched jQuery.Event
|
||
handleObj=types.handleObj;jQuery(types.delegateTarget).off(handleObj.namespace?handleObj.origType+"."+handleObj.namespace:handleObj.origType,handleObj.selector,handleObj.handler);return this;}if(_typeof2(types)==="object"){// ( types-object [, selector] )
|
||
for(type in types){this.off(type,selector,types[type]);}return this;}if(selector===false||typeof selector==="function"){// ( types [, fn] )
|
||
fn=selector;selector=undefined;}if(fn===false){fn=returnFalse;}return this.each(function(){jQuery.event.remove(this,types,fn,selector);});},trigger:function trigger(type,data){return this.each(function(){jQuery.event.trigger(type,data,this);});},triggerHandler:function triggerHandler(type,data){var elem=this[0];if(elem){return jQuery.event.trigger(type,data,elem,true);}}});function createSafeFragment(document){var list=nodeNames.split("|"),safeFrag=document.createDocumentFragment();if(safeFrag.createElement){while(list.length){safeFrag.createElement(list.pop());}}return safeFrag;}var nodeNames="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|"+"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",rinlinejQuery=/ jQuery\d+="(?:null|\d+)"/g,rnoshimcache=new RegExp("<(?:"+nodeNames+")[\\s/>]","i"),rleadingWhitespace=/^\s+/,rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,rtagName=/<([\w:]+)/,rtbody=/<tbody/i,rhtml=/<|&#?\w+;/,rnoInnerhtml=/<(?:script|style|link)/i,// checked="checked" or checked
|
||
rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptType=/^$|\/(?:java|ecma)script/i,rscriptTypeMasked=/^true\/(.*)/,rcleanScript=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,// We have to close these tags to support XHTML (#13200)
|
||
wrapMap={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
|
||
// unless wrapped in a div with non-breaking characters in front of it.
|
||
_default:support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},safeFragment=createSafeFragment(document),fragmentDiv=safeFragment.appendChild(document.createElement("div"));wrapMap.optgroup=wrapMap.option;wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead;wrapMap.th=wrapMap.td;function getAll(context,tag){var elems,elem,i=0,found=_typeof2(context.getElementsByTagName)!==strundefined?context.getElementsByTagName(tag||"*"):_typeof2(context.querySelectorAll)!==strundefined?context.querySelectorAll(tag||"*"):undefined;if(!found){for(found=[],elems=context.childNodes||context;(elem=elems[i])!=null;i++){if(!tag||jQuery.nodeName(elem,tag)){found.push(elem);}else{jQuery.merge(found,getAll(elem,tag));}}}return tag===undefined||tag&&jQuery.nodeName(context,tag)?jQuery.merge([context],found):found;}// Used in buildFragment, fixes the defaultChecked property
|
||
function fixDefaultChecked(elem){if(rcheckableType.test(elem.type)){elem.defaultChecked=elem.checked;}}// Support: IE<8
|
||
// Manipulating tables requires a tbody
|
||
function manipulationTarget(elem,content){return jQuery.nodeName(elem,"table")&&jQuery.nodeName(content.nodeType!==11?content:content.firstChild,"tr")?elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody")):elem;}// Replace/restore the type attribute of script elements for safe DOM manipulation
|
||
function disableScript(elem){elem.type=(jQuery.find.attr(elem,"type")!==null)+"/"+elem.type;return elem;}function restoreScript(elem){var match=rscriptTypeMasked.exec(elem.type);if(match){elem.type=match[1];}else{elem.removeAttribute("type");}return elem;}// Mark scripts as having already been evaluated
|
||
function setGlobalEval(elems,refElements){var elem,i=0;for(;(elem=elems[i])!=null;i++){jQuery._data(elem,"globalEval",!refElements||jQuery._data(refElements[i],"globalEval"));}}function cloneCopyEvent(src,dest){if(dest.nodeType!==1||!jQuery.hasData(src)){return;}var type,i,l,oldData=jQuery._data(src),curData=jQuery._data(dest,oldData),events=oldData.events;if(events){delete curData.handle;curData.events={};for(type in events){for(i=0,l=events[type].length;i<l;i++){jQuery.event.add(dest,type,events[type][i]);}}}// make the cloned public data object a copy from the original
|
||
if(curData.data){curData.data=jQuery.extend({},curData.data);}}function fixCloneNodeIssues(src,dest){var nodeName,e,data;// We do not need to do anything for non-Elements
|
||
if(dest.nodeType!==1){return;}nodeName=dest.nodeName.toLowerCase();// IE6-8 copies events bound via attachEvent when using cloneNode.
|
||
if(!support.noCloneEvent&&dest[jQuery.expando]){data=jQuery._data(dest);for(e in data.events){jQuery.removeEvent(dest,e,data.handle);}// Event data gets referenced instead of copied if the expando gets copied too
|
||
dest.removeAttribute(jQuery.expando);}// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
|
||
if(nodeName==="script"&&dest.text!==src.text){disableScript(dest).text=src.text;restoreScript(dest);// IE6-10 improperly clones children of object elements using classid.
|
||
// IE10 throws NoModificationAllowedError if parent is null, #12132.
|
||
}else if(nodeName==="object"){if(dest.parentNode){dest.outerHTML=src.outerHTML;}// This path appears unavoidable for IE9. When cloning an object
|
||
// element in IE9, the outerHTML strategy above is not sufficient.
|
||
// If the src has innerHTML and the destination does not,
|
||
// copy the src.innerHTML into the dest.innerHTML. #10324
|
||
if(support.html5Clone&&src.innerHTML&&!jQuery.trim(dest.innerHTML)){dest.innerHTML=src.innerHTML;}}else if(nodeName==="input"&&rcheckableType.test(src.type)){// IE6-8 fails to persist the checked state of a cloned checkbox
|
||
// or radio button. Worse, IE6-7 fail to give the cloned element
|
||
// a checked appearance if the defaultChecked value isn't also set
|
||
dest.defaultChecked=dest.checked=src.checked;// IE6-7 get confused and end up setting the value of a cloned
|
||
// checkbox/radio button to an empty string instead of "on"
|
||
if(dest.value!==src.value){dest.value=src.value;}// IE6-8 fails to return the selected option to the default selected
|
||
// state when cloning options
|
||
}else if(nodeName==="option"){dest.defaultSelected=dest.selected=src.defaultSelected;// IE6-8 fails to set the defaultValue to the correct value when
|
||
// cloning other types of input fields
|
||
}else if(nodeName==="input"||nodeName==="textarea"){dest.defaultValue=src.defaultValue;}}jQuery.extend({clone:function clone(elem,dataAndEvents,deepDataAndEvents){var destElements,node,clone,i,srcElements,inPage=jQuery.contains(elem.ownerDocument,elem);if(support.html5Clone||jQuery.isXMLDoc(elem)||!rnoshimcache.test("<"+elem.nodeName+">")){clone=elem.cloneNode(true);// IE<=8 does not properly clone detached, unknown element nodes
|
||
}else{fragmentDiv.innerHTML=elem.outerHTML;fragmentDiv.removeChild(clone=fragmentDiv.firstChild);}if((!support.noCloneEvent||!support.noCloneChecked)&&(elem.nodeType===1||elem.nodeType===11)&&!jQuery.isXMLDoc(elem)){// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
|
||
destElements=getAll(clone);srcElements=getAll(elem);// Fix all IE cloning issues
|
||
for(i=0;(node=srcElements[i])!=null;++i){// Ensure that the destination node is not null; Fixes #9587
|
||
if(destElements[i]){fixCloneNodeIssues(node,destElements[i]);}}}// Copy the events from the original to the clone
|
||
if(dataAndEvents){if(deepDataAndEvents){srcElements=srcElements||getAll(elem);destElements=destElements||getAll(clone);for(i=0;(node=srcElements[i])!=null;i++){cloneCopyEvent(node,destElements[i]);}}else{cloneCopyEvent(elem,clone);}}// Preserve script evaluation history
|
||
destElements=getAll(clone,"script");if(destElements.length>0){setGlobalEval(destElements,!inPage&&getAll(elem,"script"));}destElements=srcElements=node=null;// Return the cloned set
|
||
return clone;},buildFragment:function buildFragment(elems,context,scripts,selection){var j,elem,contains,tmp,tag,tbody,wrap,l=elems.length,// Ensure a safe fragment
|
||
safe=createSafeFragment(context),nodes=[],i=0;for(;i<l;i++){elem=elems[i];if(elem||elem===0){// Add nodes directly
|
||
if(jQuery.type(elem)==="object"){jQuery.merge(nodes,elem.nodeType?[elem]:elem);// Convert non-html into a text node
|
||
}else if(!rhtml.test(elem)){nodes.push(context.createTextNode(elem));// Convert html into DOM nodes
|
||
}else{tmp=tmp||safe.appendChild(context.createElement("div"));// Deserialize a standard representation
|
||
tag=(rtagName.exec(elem)||["",""])[1].toLowerCase();wrap=wrapMap[tag]||wrapMap._default;tmp.innerHTML=wrap[1]+elem.replace(rxhtmlTag,"<$1></$2>")+wrap[2];// Descend through wrappers to the right content
|
||
j=wrap[0];while(j--){tmp=tmp.lastChild;}// Manually add leading whitespace removed by IE
|
||
if(!support.leadingWhitespace&&rleadingWhitespace.test(elem)){nodes.push(context.createTextNode(rleadingWhitespace.exec(elem)[0]));}// Remove IE's autoinserted <tbody> from table fragments
|
||
if(!support.tbody){// String was a <table>, *may* have spurious <tbody>
|
||
elem=tag==="table"&&!rtbody.test(elem)?tmp.firstChild:// String was a bare <thead> or <tfoot>
|
||
wrap[1]==="<table>"&&!rtbody.test(elem)?tmp:0;j=elem&&elem.childNodes.length;while(j--){if(jQuery.nodeName(tbody=elem.childNodes[j],"tbody")&&!tbody.childNodes.length){elem.removeChild(tbody);}}}jQuery.merge(nodes,tmp.childNodes);// Fix #12392 for WebKit and IE > 9
|
||
tmp.textContent="";// Fix #12392 for oldIE
|
||
while(tmp.firstChild){tmp.removeChild(tmp.firstChild);}// Remember the top-level container for proper cleanup
|
||
tmp=safe.lastChild;}}}// Fix #11356: Clear elements from fragment
|
||
if(tmp){safe.removeChild(tmp);}// Reset defaultChecked for any radios and checkboxes
|
||
// about to be appended to the DOM in IE 6/7 (#8060)
|
||
if(!support.appendChecked){jQuery.grep(getAll(nodes,"input"),fixDefaultChecked);}i=0;while(elem=nodes[i++]){// #4087 - If origin and destination elements are the same, and this is
|
||
// that element, do not do anything
|
||
if(selection&&jQuery.inArray(elem,selection)!==-1){continue;}contains=jQuery.contains(elem.ownerDocument,elem);// Append to fragment
|
||
tmp=getAll(safe.appendChild(elem),"script");// Preserve script evaluation history
|
||
if(contains){setGlobalEval(tmp);}// Capture executables
|
||
if(scripts){j=0;while(elem=tmp[j++]){if(rscriptType.test(elem.type||"")){scripts.push(elem);}}}}tmp=null;return safe;},cleanData:function cleanData(elems,/* internal */acceptData){var elem,type,id,data,i=0,internalKey=jQuery.expando,cache=jQuery.cache,deleteExpando=support.deleteExpando,special=jQuery.event.special;for(;(elem=elems[i])!=null;i++){if(acceptData||jQuery.acceptData(elem)){id=elem[internalKey];data=id&&cache[id];if(data){if(data.events){for(type in data.events){if(special[type]){jQuery.event.remove(elem,type);// This is a shortcut to avoid jQuery.event.remove's overhead
|
||
}else{jQuery.removeEvent(elem,type,data.handle);}}}// Remove cache only if it was not already removed by jQuery.event.remove
|
||
if(cache[id]){delete cache[id];// IE does not allow us to delete expando properties from nodes,
|
||
// nor does it have a removeAttribute function on Document nodes;
|
||
// we must handle all of these cases
|
||
if(deleteExpando){delete elem[internalKey];}else if(_typeof2(elem.removeAttribute)!==strundefined){elem.removeAttribute(internalKey);}else{elem[internalKey]=null;}deletedIds.push(id);}}}}}});jQuery.fn.extend({text:function text(value){return access(this,function(value){return value===undefined?jQuery.text(this):this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(value));},null,value,arguments.length);},append:function append(){return this.domManip(arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.appendChild(elem);}});},prepend:function prepend(){return this.domManip(arguments,function(elem){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var target=manipulationTarget(this,elem);target.insertBefore(elem,target.firstChild);}});},before:function before(){return this.domManip(arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this);}});},after:function after(){return this.domManip(arguments,function(elem){if(this.parentNode){this.parentNode.insertBefore(elem,this.nextSibling);}});},remove:function remove(selector,keepData/* Internal Use Only */){var elem,elems=selector?jQuery.filter(selector,this):this,i=0;for(;(elem=elems[i])!=null;i++){if(!keepData&&elem.nodeType===1){jQuery.cleanData(getAll(elem));}if(elem.parentNode){if(keepData&&jQuery.contains(elem.ownerDocument,elem)){setGlobalEval(getAll(elem,"script"));}elem.parentNode.removeChild(elem);}}return this;},empty:function empty(){var elem,i=0;for(;(elem=this[i])!=null;i++){// Remove element nodes and prevent memory leaks
|
||
if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));}// Remove any remaining nodes
|
||
while(elem.firstChild){elem.removeChild(elem.firstChild);}// If this is a select, ensure that it displays empty (#12336)
|
||
// Support: IE<9
|
||
if(elem.options&&jQuery.nodeName(elem,"select")){elem.options.length=0;}}return this;},clone:function clone(dataAndEvents,deepDataAndEvents){dataAndEvents=dataAndEvents==null?false:dataAndEvents;deepDataAndEvents=deepDataAndEvents==null?dataAndEvents:deepDataAndEvents;return this.map(function(){return jQuery.clone(this,dataAndEvents,deepDataAndEvents);});},html:function html(value){return access(this,function(value){var elem=this[0]||{},i=0,l=this.length;if(value===undefined){return elem.nodeType===1?elem.innerHTML.replace(rinlinejQuery,""):undefined;}// See if we can take a shortcut and just use innerHTML
|
||
if(typeof value==="string"&&!rnoInnerhtml.test(value)&&(support.htmlSerialize||!rnoshimcache.test(value))&&(support.leadingWhitespace||!rleadingWhitespace.test(value))&&!wrapMap[(rtagName.exec(value)||["",""])[1].toLowerCase()]){value=value.replace(rxhtmlTag,"<$1></$2>");try{for(;i<l;i++){// Remove element nodes and prevent memory leaks
|
||
elem=this[i]||{};if(elem.nodeType===1){jQuery.cleanData(getAll(elem,false));elem.innerHTML=value;}}elem=0;// If using innerHTML throws an exception, use the fallback method
|
||
}catch(e){}}if(elem){this.empty().append(value);}},null,value,arguments.length);},replaceWith:function replaceWith(){var arg=arguments[0];// Make the changes, replacing each context element with the new content
|
||
this.domManip(arguments,function(elem){arg=this.parentNode;jQuery.cleanData(getAll(this));if(arg){arg.replaceChild(elem,this);}});// Force removal if there was no new content (e.g., from empty arguments)
|
||
return arg&&(arg.length||arg.nodeType)?this:this.remove();},detach:function detach(selector){return this.remove(selector,true);},domManip:function domManip(args,callback){// Flatten any nested arrays
|
||
args=concat.apply([],args);var first,node,hasScripts,scripts,doc,fragment,i=0,l=this.length,set=this,iNoClone=l-1,value=args[0],isFunction=jQuery.isFunction(value);// We can't cloneNode fragments that contain checked, in WebKit
|
||
if(isFunction||l>1&&typeof value==="string"&&!support.checkClone&&rchecked.test(value)){return this.each(function(index){var self=set.eq(index);if(isFunction){args[0]=value.call(this,index,self.html());}self.domManip(args,callback);});}if(l){fragment=jQuery.buildFragment(args,this[0].ownerDocument,false,this);first=fragment.firstChild;if(fragment.childNodes.length===1){fragment=first;}if(first){scripts=jQuery.map(getAll(fragment,"script"),disableScript);hasScripts=scripts.length;// Use the original fragment for the last item instead of the first because it can end up
|
||
// being emptied incorrectly in certain situations (#8070).
|
||
for(;i<l;i++){node=fragment;if(i!==iNoClone){node=jQuery.clone(node,true,true);// Keep references to cloned scripts for later restoration
|
||
if(hasScripts){jQuery.merge(scripts,getAll(node,"script"));}}callback.call(this[i],node,i);}if(hasScripts){doc=scripts[scripts.length-1].ownerDocument;// Reenable scripts
|
||
jQuery.map(scripts,restoreScript);// Evaluate executable scripts on first document insertion
|
||
for(i=0;i<hasScripts;i++){node=scripts[i];if(rscriptType.test(node.type||"")&&!jQuery._data(node,"globalEval")&&jQuery.contains(doc,node)){if(node.src){// Optional AJAX dependency, but won't run scripts if not present
|
||
if(jQuery._evalUrl){jQuery._evalUrl(node.src);}}else{jQuery.globalEval((node.text||node.textContent||node.innerHTML||"").replace(rcleanScript,""));}}}}// Fix #11809: Avoid leaking memory
|
||
fragment=first=null;}}return this;}});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var elems,i=0,ret=[],insert=jQuery(selector),last=insert.length-1;for(;i<=last;i++){elems=i===last?this:this.clone(true);jQuery(insert[i])[original](elems);// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
|
||
push.apply(ret,elems.get());}return this.pushStack(ret);};});var iframe,elemdisplay={};/**
|
||
* Retrieve the actual display of a element
|
||
* @param {String} name nodeName of the element
|
||
* @param {Object} doc Document object
|
||
*/ // Called only from within defaultDisplay
|
||
function actualDisplay(name,doc){var style,elem=jQuery(doc.createElement(name)).appendTo(doc.body),// getDefaultComputedStyle might be reliably used only on attached element
|
||
display=window.getDefaultComputedStyle&&(style=window.getDefaultComputedStyle(elem[0]))?// Use of this method is a temporary fix (more like optmization) until something better comes along,
|
||
// since it was removed from specification and supported only in FF
|
||
style.display:jQuery.css(elem[0],"display");// We don't have any data stored on the element,
|
||
// so use "detach" method as fast way to get rid of the element
|
||
elem.detach();return display;}/**
|
||
* Try to determine the default display value of an element
|
||
* @param {String} nodeName
|
||
*/function defaultDisplay(nodeName){var doc=document,display=elemdisplay[nodeName];if(!display){display=actualDisplay(nodeName,doc);// If the simple way fails, read from inside an iframe
|
||
if(display==="none"||!display){// Use the already-created iframe if possible
|
||
iframe=(iframe||jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(doc.documentElement);// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
|
||
doc=(iframe[0].contentWindow||iframe[0].contentDocument).document;// Support: IE
|
||
doc.write();doc.close();display=actualDisplay(nodeName,doc);iframe.detach();}// Store the correct default display
|
||
elemdisplay[nodeName]=display;}return display;}(function(){var shrinkWrapBlocksVal;support.shrinkWrapBlocks=function(){if(shrinkWrapBlocksVal!=null){return shrinkWrapBlocksVal;}// Will be changed later if needed.
|
||
shrinkWrapBlocksVal=false;// Minified: var b,c,d
|
||
var div,body,container;body=document.getElementsByTagName("body")[0];if(!body||!body.style){// Test fired too early or in an unsupported environment, exit.
|
||
return;}// Setup
|
||
div=document.createElement("div");container=document.createElement("div");container.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";body.appendChild(container).appendChild(div);// Support: IE6
|
||
// Check if elements with layout shrink-wrap their children
|
||
if(_typeof2(div.style.zoom)!==strundefined){// Reset CSS: box-sizing; display; margin; border
|
||
div.style.cssText=// Support: Firefox<29, Android 2.3
|
||
// Vendor-prefix box-sizing
|
||
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;"+"box-sizing:content-box;display:block;margin:0;border:0;"+"padding:1px;width:1px;zoom:1";div.appendChild(document.createElement("div")).style.width="5px";shrinkWrapBlocksVal=div.offsetWidth!==3;}body.removeChild(container);return shrinkWrapBlocksVal;};})();var rmargin=/^margin/;var rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i");var getStyles,curCSS,rposition=/^(top|right|bottom|left)$/;if(window.getComputedStyle){getStyles=function getStyles(elem){// Support: IE<=11+, Firefox<=30+ (#15098, #14150)
|
||
// IE throws on elements created in popups
|
||
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
|
||
if(elem.ownerDocument.defaultView.opener){return elem.ownerDocument.defaultView.getComputedStyle(elem,null);}return window.getComputedStyle(elem,null);};curCSS=function curCSS(elem,name,computed){var width,minWidth,maxWidth,ret,style=elem.style;computed=computed||getStyles(elem);// getPropertyValue is only needed for .css('filter') in IE9, see #12537
|
||
ret=computed?computed.getPropertyValue(name)||computed[name]:undefined;if(computed){if(ret===""&&!jQuery.contains(elem.ownerDocument,elem)){ret=jQuery.style(elem,name);}// A tribute to the "awesome hack by Dean Edwards"
|
||
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
|
||
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
|
||
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
|
||
if(rnumnonpx.test(ret)&&rmargin.test(name)){// Remember the original values
|
||
width=style.width;minWidth=style.minWidth;maxWidth=style.maxWidth;// Put in the new values to get a computed value out
|
||
style.minWidth=style.maxWidth=style.width=ret;ret=computed.width;// Revert the changed values
|
||
style.width=width;style.minWidth=minWidth;style.maxWidth=maxWidth;}}// Support: IE
|
||
// IE returns zIndex value as an integer.
|
||
return ret===undefined?ret:ret+"";};}else if(document.documentElement.currentStyle){getStyles=function getStyles(elem){return elem.currentStyle;};curCSS=function curCSS(elem,name,computed){var left,rs,rsLeft,ret,style=elem.style;computed=computed||getStyles(elem);ret=computed?computed[name]:undefined;// Avoid setting ret to empty string here
|
||
// so we don't default to auto
|
||
if(ret==null&&style&&style[name]){ret=style[name];}// From the awesome hack by Dean Edwards
|
||
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
|
||
// If we're not dealing with a regular pixel number
|
||
// but a number that has a weird ending, we need to convert it to pixels
|
||
// but not position css attributes, as those are proportional to the parent element instead
|
||
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
|
||
if(rnumnonpx.test(ret)&&!rposition.test(name)){// Remember the original values
|
||
left=style.left;rs=elem.runtimeStyle;rsLeft=rs&&rs.left;// Put in the new values to get a computed value out
|
||
if(rsLeft){rs.left=elem.currentStyle.left;}style.left=name==="fontSize"?"1em":ret;ret=style.pixelLeft+"px";// Revert the changed values
|
||
style.left=left;if(rsLeft){rs.left=rsLeft;}}// Support: IE
|
||
// IE returns zIndex value as an integer.
|
||
return ret===undefined?ret:ret+""||"auto";};}function addGetHookIf(conditionFn,hookFn){// Define the hook, we'll check on the first run if it's really needed.
|
||
return{get:function get(){var condition=conditionFn();if(condition==null){// The test was not ready at this point; screw the hook this time
|
||
// but check again when needed next time.
|
||
return;}if(condition){// Hook not needed (or it's not possible to use it due to missing dependency),
|
||
// remove it.
|
||
// Since there are no other hooks for marginRight, remove the whole object.
|
||
delete this.get;return;}// Hook needed; redefine it so that the support test is not executed again.
|
||
return(this.get=hookFn).apply(this,arguments);}};}(function(){// Minified: var b,c,d,e,f,g, h,i
|
||
var div,style,a,pixelPositionVal,boxSizingReliableVal,reliableHiddenOffsetsVal,reliableMarginRightVal;// Setup
|
||
div=document.createElement("div");div.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";a=div.getElementsByTagName("a")[0];style=a&&a.style;// Finish early in limited (non-browser) environments
|
||
if(!style){return;}style.cssText="float:left;opacity:.5";// Support: IE<9
|
||
// Make sure that element opacity exists (as opposed to filter)
|
||
support.opacity=style.opacity==="0.5";// Verify style float existence
|
||
// (IE uses styleFloat instead of cssFloat)
|
||
support.cssFloat=!!style.cssFloat;div.style.backgroundClip="content-box";div.cloneNode(true).style.backgroundClip="";support.clearCloneStyle=div.style.backgroundClip==="content-box";// Support: Firefox<29, Android 2.3
|
||
// Vendor-prefix box-sizing
|
||
support.boxSizing=style.boxSizing===""||style.MozBoxSizing===""||style.WebkitBoxSizing==="";jQuery.extend(support,{reliableHiddenOffsets:function reliableHiddenOffsets(){if(reliableHiddenOffsetsVal==null){computeStyleTests();}return reliableHiddenOffsetsVal;},boxSizingReliable:function boxSizingReliable(){if(boxSizingReliableVal==null){computeStyleTests();}return boxSizingReliableVal;},pixelPosition:function pixelPosition(){if(pixelPositionVal==null){computeStyleTests();}return pixelPositionVal;},// Support: Android 2.3
|
||
reliableMarginRight:function reliableMarginRight(){if(reliableMarginRightVal==null){computeStyleTests();}return reliableMarginRightVal;}});function computeStyleTests(){// Minified: var b,c,d,j
|
||
var div,body,container,contents;body=document.getElementsByTagName("body")[0];if(!body||!body.style){// Test fired too early or in an unsupported environment, exit.
|
||
return;}// Setup
|
||
div=document.createElement("div");container=document.createElement("div");container.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";body.appendChild(container).appendChild(div);div.style.cssText=// Support: Firefox<29, Android 2.3
|
||
// Vendor-prefix box-sizing
|
||
"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;"+"box-sizing:border-box;display:block;margin-top:1%;top:1%;"+"border:1px;padding:1px;width:4px;position:absolute";// Support: IE<9
|
||
// Assume reasonable values in the absence of getComputedStyle
|
||
pixelPositionVal=boxSizingReliableVal=false;reliableMarginRightVal=true;// Check for getComputedStyle so that this code is not run in IE<9.
|
||
if(window.getComputedStyle){pixelPositionVal=(window.getComputedStyle(div,null)||{}).top!=="1%";boxSizingReliableVal=(window.getComputedStyle(div,null)||{width:"4px"}).width==="4px";// Support: Android 2.3
|
||
// Div with explicit width and no margin-right incorrectly
|
||
// gets computed margin-right based on width of container (#3333)
|
||
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
||
contents=div.appendChild(document.createElement("div"));// Reset CSS: box-sizing; display; margin; border; padding
|
||
contents.style.cssText=div.style.cssText=// Support: Firefox<29, Android 2.3
|
||
// Vendor-prefix box-sizing
|
||
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;"+"box-sizing:content-box;display:block;margin:0;border:0;padding:0";contents.style.marginRight=contents.style.width="0";div.style.width="1px";reliableMarginRightVal=!parseFloat((window.getComputedStyle(contents,null)||{}).marginRight);div.removeChild(contents);}// Support: IE8
|
||
// Check if table cells still have offsetWidth/Height when they are set
|
||
// to display:none and there are still other visible table cells in a
|
||
// table row; if so, offsetWidth/Height are not reliable for use when
|
||
// determining if an element has been hidden directly using
|
||
// display:none (it is still safe to use offsets if a parent element is
|
||
// hidden; don safety goggles and see bug #4512 for more information).
|
||
div.innerHTML="<table><tr><td></td><td>t</td></tr></table>";contents=div.getElementsByTagName("td");contents[0].style.cssText="margin:0;border:0;padding:0;display:none";reliableHiddenOffsetsVal=contents[0].offsetHeight===0;if(reliableHiddenOffsetsVal){contents[0].style.display="";contents[1].style.display="none";reliableHiddenOffsetsVal=contents[0].offsetHeight===0;}body.removeChild(container);}})();// A method for quickly swapping in/out CSS properties to get correct calculations.
|
||
jQuery.swap=function(elem,options,callback,args){var ret,name,old={};// Remember the old values, and insert the new ones
|
||
for(name in options){old[name]=elem.style[name];elem.style[name]=options[name];}ret=callback.apply(elem,args||[]);// Revert the old values
|
||
for(name in options){elem.style[name]=old[name];}return ret;};var ralpha=/alpha\([^)]*\)/i,ropacity=/opacity\s*=\s*([^)]*)/,// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
|
||
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
|
||
rdisplayswap=/^(none|table(?!-c[ea]).+)/,rnumsplit=new RegExp("^("+pnum+")(.*)$","i"),rrelNum=new RegExp("^([+-])=("+pnum+")","i"),cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"},cssPrefixes=["Webkit","O","Moz","ms"];// return a css property mapped to a potentially vendor prefixed property
|
||
function vendorPropName(style,name){// shortcut for names that are not vendor prefixed
|
||
if(name in style){return name;}// check for vendor prefixed names
|
||
var capName=name.charAt(0).toUpperCase()+name.slice(1),origName=name,i=cssPrefixes.length;while(i--){name=cssPrefixes[i]+capName;if(name in style){return name;}}return origName;}function showHide(elements,show){var display,elem,hidden,values=[],index=0,length=elements.length;for(;index<length;index++){elem=elements[index];if(!elem.style){continue;}values[index]=jQuery._data(elem,"olddisplay");display=elem.style.display;if(show){// Reset the inline display of this element to learn if it is
|
||
// being hidden by cascaded rules or not
|
||
if(!values[index]&&display==="none"){elem.style.display="";}// Set elements which have been overridden with display: none
|
||
// in a stylesheet to whatever the default browser style is
|
||
// for such an element
|
||
if(elem.style.display===""&&isHidden(elem)){values[index]=jQuery._data(elem,"olddisplay",defaultDisplay(elem.nodeName));}}else{hidden=isHidden(elem);if(display&&display!=="none"||!hidden){jQuery._data(elem,"olddisplay",hidden?display:jQuery.css(elem,"display"));}}}// Set the display of most of the elements in a second loop
|
||
// to avoid the constant reflow
|
||
for(index=0;index<length;index++){elem=elements[index];if(!elem.style){continue;}if(!show||elem.style.display==="none"||elem.style.display===""){elem.style.display=show?values[index]||"":"none";}}return elements;}function setPositiveNumber(elem,value,subtract){var matches=rnumsplit.exec(value);return matches?// Guard against undefined "subtract", e.g., when used as in cssHooks
|
||
Math.max(0,matches[1]-(subtract||0))+(matches[2]||"px"):value;}function augmentWidthOrHeight(elem,name,extra,isBorderBox,styles){var i=extra===(isBorderBox?"border":"content")?// If we already have the right measurement, avoid augmentation
|
||
4:// Otherwise initialize for horizontal or vertical properties
|
||
name==="width"?1:0,val=0;for(;i<4;i+=2){// both box models exclude margin, so add it if we want it
|
||
if(extra==="margin"){val+=jQuery.css(elem,extra+cssExpand[i],true,styles);}if(isBorderBox){// border-box includes padding, so remove it if we want content
|
||
if(extra==="content"){val-=jQuery.css(elem,"padding"+cssExpand[i],true,styles);}// at this point, extra isn't border nor margin, so remove border
|
||
if(extra!=="margin"){val-=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles);}}else{// at this point, extra isn't content, so add padding
|
||
val+=jQuery.css(elem,"padding"+cssExpand[i],true,styles);// at this point, extra isn't content nor padding, so add border
|
||
if(extra!=="padding"){val+=jQuery.css(elem,"border"+cssExpand[i]+"Width",true,styles);}}}return val;}function getWidthOrHeight(elem,name,extra){// Start with offset property, which is equivalent to the border-box value
|
||
var valueIsBorderBox=true,val=name==="width"?elem.offsetWidth:elem.offsetHeight,styles=getStyles(elem),isBorderBox=support.boxSizing&&jQuery.css(elem,"boxSizing",false,styles)==="border-box";// some non-html elements return undefined for offsetWidth, so check for null/undefined
|
||
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
|
||
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
|
||
if(val<=0||val==null){// Fall back to computed then uncomputed css if necessary
|
||
val=curCSS(elem,name,styles);if(val<0||val==null){val=elem.style[name];}// Computed unit is not pixels. Stop here and return.
|
||
if(rnumnonpx.test(val)){return val;}// we need the check for style in case a browser which returns unreliable values
|
||
// for getComputedStyle silently falls back to the reliable elem.style
|
||
valueIsBorderBox=isBorderBox&&(support.boxSizingReliable()||val===elem.style[name]);// Normalize "", auto, and prepare for extra
|
||
val=parseFloat(val)||0;}// use the active box-sizing model to add/subtract irrelevant styles
|
||
return val+augmentWidthOrHeight(elem,name,extra||(isBorderBox?"border":"content"),valueIsBorderBox,styles)+"px";}jQuery.extend({// Add in style property hooks for overriding the default
|
||
// behavior of getting and setting a style property
|
||
cssHooks:{opacity:{get:function get(elem,computed){if(computed){// We should always get a number back from opacity
|
||
var ret=curCSS(elem,"opacity");return ret===""?"1":ret;}}}},// Don't automatically add "px" to these possibly-unitless properties
|
||
cssNumber:{"columnCount":true,"fillOpacity":true,"flexGrow":true,"flexShrink":true,"fontWeight":true,"lineHeight":true,"opacity":true,"order":true,"orphans":true,"widows":true,"zIndex":true,"zoom":true},// Add in properties whose names you wish to fix before
|
||
// setting or getting the value
|
||
cssProps:{// normalize float css property
|
||
"float":support.cssFloat?"cssFloat":"styleFloat"},// Get and set the style property on a DOM Node
|
||
style:function style(elem,name,value,extra){// Don't set styles on text and comment nodes
|
||
if(!elem||elem.nodeType===3||elem.nodeType===8||!elem.style){return;}// Make sure that we're working with the right name
|
||
var ret,type,hooks,origName=jQuery.camelCase(name),style=elem.style;name=jQuery.cssProps[origName]||(jQuery.cssProps[origName]=vendorPropName(style,origName));// gets hook for the prefixed version
|
||
// followed by the unprefixed version
|
||
hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];// Check if we're setting a value
|
||
if(value!==undefined){type=_typeof2(value);// convert relative number strings (+= or -=) to relative numbers. #7345
|
||
if(type==="string"&&(ret=rrelNum.exec(value))){value=(ret[1]+1)*ret[2]+parseFloat(jQuery.css(elem,name));// Fixes bug #9237
|
||
type="number";}// Make sure that null and NaN values aren't set. See: #7116
|
||
if(value==null||value!==value){return;}// If a number was passed in, add 'px' to the (except for certain CSS properties)
|
||
if(type==="number"&&!jQuery.cssNumber[origName]){value+="px";}// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
|
||
// but it would mean to define eight (for every problematic property) identical functions
|
||
if(!support.clearCloneStyle&&value===""&&name.indexOf("background")===0){style[name]="inherit";}// If a hook was provided, use that value, otherwise just set the specified value
|
||
if(!hooks||!("set"in hooks)||(value=hooks.set(elem,value,extra))!==undefined){// Support: IE
|
||
// Swallow errors from 'invalid' CSS values (#5509)
|
||
try{style[name]=value;}catch(e){}}}else{// If a hook was provided get the non-computed value from there
|
||
if(hooks&&"get"in hooks&&(ret=hooks.get(elem,false,extra))!==undefined){return ret;}// Otherwise just get the value from the style object
|
||
return style[name];}},css:function css(elem,name,extra,styles){var num,val,hooks,origName=jQuery.camelCase(name);// Make sure that we're working with the right name
|
||
name=jQuery.cssProps[origName]||(jQuery.cssProps[origName]=vendorPropName(elem.style,origName));// gets hook for the prefixed version
|
||
// followed by the unprefixed version
|
||
hooks=jQuery.cssHooks[name]||jQuery.cssHooks[origName];// If a hook was provided get the computed value from there
|
||
if(hooks&&"get"in hooks){val=hooks.get(elem,true,extra);}// Otherwise, if a way to get the computed value exists, use that
|
||
if(val===undefined){val=curCSS(elem,name,styles);}//convert "normal" to computed value
|
||
if(val==="normal"&&name in cssNormalTransform){val=cssNormalTransform[name];}// Return, converting to number if forced or a qualifier was provided and val looks numeric
|
||
if(extra===""||extra){num=parseFloat(val);return extra===true||jQuery.isNumeric(num)?num||0:val;}return val;}});jQuery.each(["height","width"],function(i,name){jQuery.cssHooks[name]={get:function get(elem,computed,extra){if(computed){// certain elements can have dimension info if we invisibly show them
|
||
// however, it must have a current display style that would benefit from this
|
||
return rdisplayswap.test(jQuery.css(elem,"display"))&&elem.offsetWidth===0?jQuery.swap(elem,cssShow,function(){return getWidthOrHeight(elem,name,extra);}):getWidthOrHeight(elem,name,extra);}},set:function set(elem,value,extra){var styles=extra&&getStyles(elem);return setPositiveNumber(elem,value,extra?augmentWidthOrHeight(elem,name,extra,support.boxSizing&&jQuery.css(elem,"boxSizing",false,styles)==="border-box",styles):0);}};});if(!support.opacity){jQuery.cssHooks.opacity={get:function get(elem,computed){// IE uses filters for opacity
|
||
return ropacity.test((computed&&elem.currentStyle?elem.currentStyle.filter:elem.style.filter)||"")?0.01*parseFloat(RegExp.$1)+"":computed?"1":"";},set:function set(elem,value){var style=elem.style,currentStyle=elem.currentStyle,opacity=jQuery.isNumeric(value)?"alpha(opacity="+value*100+")":"",filter=currentStyle&¤tStyle.filter||style.filter||"";// IE has trouble with opacity if it does not have layout
|
||
// Force it by setting the zoom level
|
||
style.zoom=1;// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
|
||
// if value === "", then remove inline opacity #12685
|
||
if((value>=1||value==="")&&jQuery.trim(filter.replace(ralpha,""))===""&&style.removeAttribute){// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
|
||
// if "filter:" is present at all, clearType is disabled, we want to avoid this
|
||
// style.removeAttribute is IE Only, but so apparently is this code path...
|
||
style.removeAttribute("filter");// if there is no filter style applied in a css rule or unset inline opacity, we are done
|
||
if(value===""||currentStyle&&!currentStyle.filter){return;}}// otherwise, set new filter values
|
||
style.filter=ralpha.test(filter)?filter.replace(ralpha,opacity):filter+" "+opacity;}};}jQuery.cssHooks.marginRight=addGetHookIf(support.reliableMarginRight,function(elem,computed){if(computed){// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
||
// Work around by temporarily setting element display to inline-block
|
||
return jQuery.swap(elem,{"display":"inline-block"},curCSS,[elem,"marginRight"]);}});// These hooks are used by animate to expand properties
|
||
jQuery.each({margin:"",padding:"",border:"Width"},function(prefix,suffix){jQuery.cssHooks[prefix+suffix]={expand:function expand(value){var i=0,expanded={},// assumes a single number if not a string
|
||
parts=typeof value==="string"?value.split(" "):[value];for(;i<4;i++){expanded[prefix+cssExpand[i]+suffix]=parts[i]||parts[i-2]||parts[0];}return expanded;}};if(!rmargin.test(prefix)){jQuery.cssHooks[prefix+suffix].set=setPositiveNumber;}});jQuery.fn.extend({css:function css(name,value){return access(this,function(elem,name,value){var styles,len,map={},i=0;if(jQuery.isArray(name)){styles=getStyles(elem);len=name.length;for(;i<len;i++){map[name[i]]=jQuery.css(elem,name[i],false,styles);}return map;}return value!==undefined?jQuery.style(elem,name,value):jQuery.css(elem,name);},name,value,arguments.length>1);},show:function show(){return showHide(this,true);},hide:function hide(){return showHide(this);},toggle:function toggle(state){if(typeof state==="boolean"){return state?this.show():this.hide();}return this.each(function(){if(isHidden(this)){jQuery(this).show();}else{jQuery(this).hide();}});}});function Tween(elem,options,prop,end,easing){return new Tween.prototype.init(elem,options,prop,end,easing);}jQuery.Tween=Tween;Tween.prototype={constructor:Tween,init:function init(elem,options,prop,end,easing,unit){this.elem=elem;this.prop=prop;this.easing=easing||"swing";this.options=options;this.start=this.now=this.cur();this.end=end;this.unit=unit||(jQuery.cssNumber[prop]?"":"px");},cur:function cur(){var hooks=Tween.propHooks[this.prop];return hooks&&hooks.get?hooks.get(this):Tween.propHooks._default.get(this);},run:function run(percent){var eased,hooks=Tween.propHooks[this.prop];if(this.options.duration){this.pos=eased=jQuery.easing[this.easing](percent,this.options.duration*percent,0,1,this.options.duration);}else{this.pos=eased=percent;}this.now=(this.end-this.start)*eased+this.start;if(this.options.step){this.options.step.call(this.elem,this.now,this);}if(hooks&&hooks.set){hooks.set(this);}else{Tween.propHooks._default.set(this);}return this;}};Tween.prototype.init.prototype=Tween.prototype;Tween.propHooks={_default:{get:function get(tween){var result;if(tween.elem[tween.prop]!=null&&(!tween.elem.style||tween.elem.style[tween.prop]==null)){return tween.elem[tween.prop];}// passing an empty string as a 3rd parameter to .css will automatically
|
||
// attempt a parseFloat and fallback to a string if the parse fails
|
||
// so, simple values such as "10px" are parsed to Float.
|
||
// complex values such as "rotate(1rad)" are returned as is.
|
||
result=jQuery.css(tween.elem,tween.prop,"");// Empty strings, null, undefined and "auto" are converted to 0.
|
||
return!result||result==="auto"?0:result;},set:function set(tween){// use step hook for back compat - use cssHook if its there - use .style if its
|
||
// available and use plain properties where available
|
||
if(jQuery.fx.step[tween.prop]){jQuery.fx.step[tween.prop](tween);}else if(tween.elem.style&&(tween.elem.style[jQuery.cssProps[tween.prop]]!=null||jQuery.cssHooks[tween.prop])){jQuery.style(tween.elem,tween.prop,tween.now+tween.unit);}else{tween.elem[tween.prop]=tween.now;}}}};// Support: IE <=9
|
||
// Panic based approach to setting things on disconnected nodes
|
||
Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function set(tween){if(tween.elem.nodeType&&tween.elem.parentNode){tween.elem[tween.prop]=tween.now;}}};jQuery.easing={linear:function linear(p){return p;},swing:function swing(p){return 0.5-Math.cos(p*Math.PI)/2;}};jQuery.fx=Tween.prototype.init;// Back Compat <1.8 extension point
|
||
jQuery.fx.step={};var fxNow,timerId,rfxtypes=/^(?:toggle|show|hide)$/,rfxnum=new RegExp("^(?:([+-])=|)("+pnum+")([a-z%]*)$","i"),rrun=/queueHooks$/,animationPrefilters=[defaultPrefilter],tweeners={"*":[function(prop,value){var tween=this.createTween(prop,value),target=tween.cur(),parts=rfxnum.exec(value),unit=parts&&parts[3]||(jQuery.cssNumber[prop]?"":"px"),// Starting value computation is required for potential unit mismatches
|
||
start=(jQuery.cssNumber[prop]||unit!=="px"&&+target)&&rfxnum.exec(jQuery.css(tween.elem,prop)),scale=1,maxIterations=20;if(start&&start[3]!==unit){// Trust units reported by jQuery.css
|
||
unit=unit||start[3];// Make sure we update the tween properties later on
|
||
parts=parts||[];// Iteratively approximate from a nonzero starting point
|
||
start=+target||1;do{// If previous iteration zeroed out, double until we get *something*
|
||
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
|
||
scale=scale||".5";// Adjust and apply
|
||
start=start/scale;jQuery.style(tween.elem,prop,start+unit);// Update scale, tolerating zero or NaN from tween.cur()
|
||
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
|
||
}while(scale!==(scale=tween.cur()/target)&&scale!==1&&--maxIterations);}// Update tween properties
|
||
if(parts){start=tween.start=+start||+target||0;tween.unit=unit;// If a +=/-= token was provided, we're doing a relative animation
|
||
tween.end=parts[1]?start+(parts[1]+1)*parts[2]:+parts[2];}return tween;}]};// Animations created synchronously will run synchronously
|
||
function createFxNow(){setTimeout(function(){fxNow=undefined;});return fxNow=jQuery.now();}// Generate parameters to create a standard animation
|
||
function genFx(type,includeWidth){var which,attrs={height:type},i=0;// if we include width, step value is 1 to do all cssExpand values,
|
||
// if we don't include width, step value is 2 to skip over Left and Right
|
||
includeWidth=includeWidth?1:0;for(;i<4;i+=2-includeWidth){which=cssExpand[i];attrs["margin"+which]=attrs["padding"+which]=type;}if(includeWidth){attrs.opacity=attrs.width=type;}return attrs;}function createTween(value,prop,animation){var tween,collection=(tweeners[prop]||[]).concat(tweeners["*"]),index=0,length=collection.length;for(;index<length;index++){if(tween=collection[index].call(animation,prop,value)){// we're done with this property
|
||
return tween;}}}function defaultPrefilter(elem,props,opts){/* jshint validthis: true */var prop,value,toggle,tween,hooks,oldfire,display,checkDisplay,anim=this,orig={},style=elem.style,hidden=elem.nodeType&&isHidden(elem),dataShow=jQuery._data(elem,"fxshow");// handle queue: false promises
|
||
if(!opts.queue){hooks=jQuery._queueHooks(elem,"fx");if(hooks.unqueued==null){hooks.unqueued=0;oldfire=hooks.empty.fire;hooks.empty.fire=function(){if(!hooks.unqueued){oldfire();}};}hooks.unqueued++;anim.always(function(){// doing this makes sure that the complete handler will be called
|
||
// before this completes
|
||
anim.always(function(){hooks.unqueued--;if(!jQuery.queue(elem,"fx").length){hooks.empty.fire();}});});}// height/width overflow pass
|
||
if(elem.nodeType===1&&("height"in props||"width"in props)){// Make sure that nothing sneaks out
|
||
// Record all 3 overflow attributes because IE does not
|
||
// change the overflow attribute when overflowX and
|
||
// overflowY are set to the same value
|
||
opts.overflow=[style.overflow,style.overflowX,style.overflowY];// Set display property to inline-block for height/width
|
||
// animations on inline elements that are having width/height animated
|
||
display=jQuery.css(elem,"display");// Test default display if display is currently "none"
|
||
checkDisplay=display==="none"?jQuery._data(elem,"olddisplay")||defaultDisplay(elem.nodeName):display;if(checkDisplay==="inline"&&jQuery.css(elem,"float")==="none"){// inline-level elements accept inline-block;
|
||
// block-level elements need to be inline with layout
|
||
if(!support.inlineBlockNeedsLayout||defaultDisplay(elem.nodeName)==="inline"){style.display="inline-block";}else{style.zoom=1;}}}if(opts.overflow){style.overflow="hidden";if(!support.shrinkWrapBlocks()){anim.always(function(){style.overflow=opts.overflow[0];style.overflowX=opts.overflow[1];style.overflowY=opts.overflow[2];});}}// show/hide pass
|
||
for(prop in props){value=props[prop];if(rfxtypes.exec(value)){delete props[prop];toggle=toggle||value==="toggle";if(value===(hidden?"hide":"show")){// If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
|
||
if(value==="show"&&dataShow&&dataShow[prop]!==undefined){hidden=true;}else{continue;}}orig[prop]=dataShow&&dataShow[prop]||jQuery.style(elem,prop);// Any non-fx value stops us from restoring the original display value
|
||
}else{display=undefined;}}if(!jQuery.isEmptyObject(orig)){if(dataShow){if("hidden"in dataShow){hidden=dataShow.hidden;}}else{dataShow=jQuery._data(elem,"fxshow",{});}// store state if its toggle - enables .stop().toggle() to "reverse"
|
||
if(toggle){dataShow.hidden=!hidden;}if(hidden){jQuery(elem).show();}else{anim.done(function(){jQuery(elem).hide();});}anim.done(function(){var prop;jQuery._removeData(elem,"fxshow");for(prop in orig){jQuery.style(elem,prop,orig[prop]);}});for(prop in orig){tween=createTween(hidden?dataShow[prop]:0,prop,anim);if(!(prop in dataShow)){dataShow[prop]=tween.start;if(hidden){tween.end=tween.start;tween.start=prop==="width"||prop==="height"?1:0;}}}// If this is a noop like .hide().hide(), restore an overwritten display value
|
||
}else if((display==="none"?defaultDisplay(elem.nodeName):display)==="inline"){style.display=display;}}function propFilter(props,specialEasing){var index,name,easing,value,hooks;// camelCase, specialEasing and expand cssHook pass
|
||
for(index in props){name=jQuery.camelCase(index);easing=specialEasing[name];value=props[index];if(jQuery.isArray(value)){easing=value[1];value=props[index]=value[0];}if(index!==name){props[name]=value;delete props[index];}hooks=jQuery.cssHooks[name];if(hooks&&"expand"in hooks){value=hooks.expand(value);delete props[name];// not quite $.extend, this wont overwrite keys already present.
|
||
// also - reusing 'index' from above because we have the correct "name"
|
||
for(index in value){if(!(index in props)){props[index]=value[index];specialEasing[index]=easing;}}}else{specialEasing[name]=easing;}}}function Animation(elem,properties,options){var result,stopped,index=0,length=animationPrefilters.length,deferred=jQuery.Deferred().always(function(){// don't match elem in the :animated selector
|
||
delete tick.elem;}),tick=function tick(){if(stopped){return false;}var currentTime=fxNow||createFxNow(),remaining=Math.max(0,animation.startTime+animation.duration-currentTime),// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
|
||
temp=remaining/animation.duration||0,percent=1-temp,index=0,length=animation.tweens.length;for(;index<length;index++){animation.tweens[index].run(percent);}deferred.notifyWith(elem,[animation,percent,remaining]);if(percent<1&&length){return remaining;}else{deferred.resolveWith(elem,[animation]);return false;}},animation=deferred.promise({elem:elem,props:jQuery.extend({},properties),opts:jQuery.extend(true,{specialEasing:{}},options),originalProperties:properties,originalOptions:options,startTime:fxNow||createFxNow(),duration:options.duration,tweens:[],createTween:function createTween(prop,end){var tween=jQuery.Tween(elem,animation.opts,prop,end,animation.opts.specialEasing[prop]||animation.opts.easing);animation.tweens.push(tween);return tween;},stop:function stop(gotoEnd){var index=0,// if we are going to the end, we want to run all the tweens
|
||
// otherwise we skip this part
|
||
length=gotoEnd?animation.tweens.length:0;if(stopped){return this;}stopped=true;for(;index<length;index++){animation.tweens[index].run(1);}// resolve when we played the last frame
|
||
// otherwise, reject
|
||
if(gotoEnd){deferred.resolveWith(elem,[animation,gotoEnd]);}else{deferred.rejectWith(elem,[animation,gotoEnd]);}return this;}}),props=animation.props;propFilter(props,animation.opts.specialEasing);for(;index<length;index++){result=animationPrefilters[index].call(animation,elem,props,animation.opts);if(result){return result;}}jQuery.map(props,createTween,animation);if(jQuery.isFunction(animation.opts.start)){animation.opts.start.call(elem,animation);}jQuery.fx.timer(jQuery.extend(tick,{elem:elem,anim:animation,queue:animation.opts.queue}));// attach callbacks from options
|
||
return animation.progress(animation.opts.progress).done(animation.opts.done,animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);}jQuery.Animation=jQuery.extend(Animation,{tweener:function tweener(props,callback){if(jQuery.isFunction(props)){callback=props;props=["*"];}else{props=props.split(" ");}var prop,index=0,length=props.length;for(;index<length;index++){prop=props[index];tweeners[prop]=tweeners[prop]||[];tweeners[prop].unshift(callback);}},prefilter:function prefilter(callback,prepend){if(prepend){animationPrefilters.unshift(callback);}else{animationPrefilters.push(callback);}}});jQuery.speed=function(speed,easing,fn){var opt=speed&&_typeof2(speed)==="object"?jQuery.extend({},speed):{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:opt.duration in jQuery.fx.speeds?jQuery.fx.speeds[opt.duration]:jQuery.fx.speeds._default;// normalize opt.queue - true/undefined/null -> "fx"
|
||
if(opt.queue==null||opt.queue===true){opt.queue="fx";}// Queueing
|
||
opt.old=opt.complete;opt.complete=function(){if(jQuery.isFunction(opt.old)){opt.old.call(this);}if(opt.queue){jQuery.dequeue(this,opt.queue);}};return opt;};jQuery.fn.extend({fadeTo:function fadeTo(speed,to,easing,callback){// show any hidden elements after setting opacity to 0
|
||
return this.filter(isHidden).css("opacity",0).show()// animate to the value specified
|
||
.end().animate({opacity:to},speed,easing,callback);},animate:function animate(prop,speed,easing,callback){var empty=jQuery.isEmptyObject(prop),optall=jQuery.speed(speed,easing,callback),doAnimation=function doAnimation(){// Operate on a copy of prop so per-property easing won't be lost
|
||
var anim=Animation(this,jQuery.extend({},prop),optall);// Empty animations, or finishing resolves immediately
|
||
if(empty||jQuery._data(this,"finish")){anim.stop(true);}};doAnimation.finish=doAnimation;return empty||optall.queue===false?this.each(doAnimation):this.queue(optall.queue,doAnimation);},stop:function stop(type,clearQueue,gotoEnd){var stopQueue=function stopQueue(hooks){var stop=hooks.stop;delete hooks.stop;stop(gotoEnd);};if(typeof type!=="string"){gotoEnd=clearQueue;clearQueue=type;type=undefined;}if(clearQueue&&type!==false){this.queue(type||"fx",[]);}return this.each(function(){var dequeue=true,index=type!=null&&type+"queueHooks",timers=jQuery.timers,data=jQuery._data(this);if(index){if(data[index]&&data[index].stop){stopQueue(data[index]);}}else{for(index in data){if(data[index]&&data[index].stop&&rrun.test(index)){stopQueue(data[index]);}}}for(index=timers.length;index--;){if(timers[index].elem===this&&(type==null||timers[index].queue===type)){timers[index].anim.stop(gotoEnd);dequeue=false;timers.splice(index,1);}}// start the next in the queue if the last step wasn't forced
|
||
// timers currently will call their complete callbacks, which will dequeue
|
||
// but only if they were gotoEnd
|
||
if(dequeue||!gotoEnd){jQuery.dequeue(this,type);}});},finish:function finish(type){if(type!==false){type=type||"fx";}return this.each(function(){var index,data=jQuery._data(this),queue=data[type+"queue"],hooks=data[type+"queueHooks"],timers=jQuery.timers,length=queue?queue.length:0;// enable finishing flag on private data
|
||
data.finish=true;// empty the queue first
|
||
jQuery.queue(this,type,[]);if(hooks&&hooks.stop){hooks.stop.call(this,true);}// look for any active animations, and finish them
|
||
for(index=timers.length;index--;){if(timers[index].elem===this&&timers[index].queue===type){timers[index].anim.stop(true);timers.splice(index,1);}}// look for any animations in the old queue and finish them
|
||
for(index=0;index<length;index++){if(queue[index]&&queue[index].finish){queue[index].finish.call(this);}}// turn off finishing flag
|
||
delete data.finish;});}});jQuery.each(["toggle","show","hide"],function(i,name){var cssFn=jQuery.fn[name];jQuery.fn[name]=function(speed,easing,callback){return speed==null||typeof speed==="boolean"?cssFn.apply(this,arguments):this.animate(genFx(name,true),speed,easing,callback);};});// Generate shortcuts for custom animations
|
||
jQuery.each({slideDown:genFx("show"),slideUp:genFx("hide"),slideToggle:genFx("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(name,props){jQuery.fn[name]=function(speed,easing,callback){return this.animate(props,speed,easing,callback);};});jQuery.timers=[];jQuery.fx.tick=function(){var timer,timers=jQuery.timers,i=0;fxNow=jQuery.now();for(;i<timers.length;i++){timer=timers[i];// Checks the timer has not already been removed
|
||
if(!timer()&&timers[i]===timer){timers.splice(i--,1);}}if(!timers.length){jQuery.fx.stop();}fxNow=undefined;};jQuery.fx.timer=function(timer){jQuery.timers.push(timer);if(timer()){jQuery.fx.start();}else{jQuery.timers.pop();}};jQuery.fx.interval=13;jQuery.fx.start=function(){if(!timerId){timerId=setInterval(jQuery.fx.tick,jQuery.fx.interval);}};jQuery.fx.stop=function(){clearInterval(timerId);timerId=null;};jQuery.fx.speeds={slow:600,fast:200,// Default speed
|
||
_default:400};// Based off of the plugin by Clint Helfers, with permission.
|
||
// http://blindsignals.com/index.php/2009/07/jquery-delay/
|
||
jQuery.fn.delay=function(time,type){time=jQuery.fx?jQuery.fx.speeds[time]||time:time;type=type||"fx";return this.queue(type,function(next,hooks){var timeout=setTimeout(next,time);hooks.stop=function(){clearTimeout(timeout);};});};(function(){// Minified: var a,b,c,d,e
|
||
var input,div,select,a,opt;// Setup
|
||
div=document.createElement("div");div.setAttribute("className","t");div.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";a=div.getElementsByTagName("a")[0];// First batch of tests.
|
||
select=document.createElement("select");opt=select.appendChild(document.createElement("option"));input=div.getElementsByTagName("input")[0];a.style.cssText="top:1px";// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
|
||
support.getSetAttribute=div.className!=="t";// Get the style information from getAttribute
|
||
// (IE uses .cssText instead)
|
||
support.style=/top/.test(a.getAttribute("style"));// Make sure that URLs aren't manipulated
|
||
// (IE normalizes it by default)
|
||
support.hrefNormalized=a.getAttribute("href")==="/a";// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
|
||
support.checkOn=!!input.value;// Make sure that a selected-by-default option has a working selected property.
|
||
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
|
||
support.optSelected=opt.selected;// Tests for enctype support on a form (#6743)
|
||
support.enctype=!!document.createElement("form").enctype;// Make sure that the options inside disabled selects aren't marked as disabled
|
||
// (WebKit marks them as disabled)
|
||
select.disabled=true;support.optDisabled=!opt.disabled;// Support: IE8 only
|
||
// Check if we can trust getAttribute("value")
|
||
input=document.createElement("input");input.setAttribute("value","");support.input=input.getAttribute("value")==="";// Check if an input maintains its value after becoming a radio
|
||
input.value="t";input.setAttribute("type","radio");support.radioValue=input.value==="t";})();var rreturn=/\r/g;jQuery.fn.extend({val:function val(value){var hooks,ret,isFunction,elem=this[0];if(!arguments.length){if(elem){hooks=jQuery.valHooks[elem.type]||jQuery.valHooks[elem.nodeName.toLowerCase()];if(hooks&&"get"in hooks&&(ret=hooks.get(elem,"value"))!==undefined){return ret;}ret=elem.value;return typeof ret==="string"?// handle most common string cases
|
||
ret.replace(rreturn,""):// handle cases where value is null/undef or number
|
||
ret==null?"":ret;}return;}isFunction=jQuery.isFunction(value);return this.each(function(i){var val;if(this.nodeType!==1){return;}if(isFunction){val=value.call(this,i,jQuery(this).val());}else{val=value;}// Treat null/undefined as ""; convert numbers to string
|
||
if(val==null){val="";}else if(typeof val==="number"){val+="";}else if(jQuery.isArray(val)){val=jQuery.map(val,function(value){return value==null?"":value+"";});}hooks=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];// If set returns undefined, fall back to normal setting
|
||
if(!hooks||!("set"in hooks)||hooks.set(this,val,"value")===undefined){this.value=val;}});}});jQuery.extend({valHooks:{option:{get:function get(elem){var val=jQuery.find.attr(elem,"value");return val!=null?val:// Support: IE10-11+
|
||
// option.text throws exceptions (#14686, #14858)
|
||
jQuery.trim(jQuery.text(elem));}},select:{get:function get(elem){var value,option,options=elem.options,index=elem.selectedIndex,one=elem.type==="select-one"||index<0,values=one?null:[],max=one?index+1:options.length,i=index<0?max:one?index:0;// Loop through all the selected options
|
||
for(;i<max;i++){option=options[i];// oldIE doesn't update selected after form reset (#2551)
|
||
if((option.selected||i===index)&&(// Don't return options that are disabled or in a disabled optgroup
|
||
support.optDisabled?!option.disabled:option.getAttribute("disabled")===null)&&(!option.parentNode.disabled||!jQuery.nodeName(option.parentNode,"optgroup"))){// Get the specific value for the option
|
||
value=jQuery(option).val();// We don't need an array for one selects
|
||
if(one){return value;}// Multi-Selects return an array
|
||
values.push(value);}}return values;},set:function set(elem,value){var optionSet,option,options=elem.options,values=jQuery.makeArray(value),i=options.length;while(i--){option=options[i];if(jQuery.inArray(jQuery.valHooks.option.get(option),values)>=0){// Support: IE6
|
||
// When new option element is added to select box we need to
|
||
// force reflow of newly added node in order to workaround delay
|
||
// of initialization properties
|
||
try{option.selected=optionSet=true;}catch(_){// Will be executed only in IE6
|
||
option.scrollHeight;}}else{option.selected=false;}}// Force browsers to behave consistently when non-matching value is set
|
||
if(!optionSet){elem.selectedIndex=-1;}return options;}}}});// Radios and checkboxes getter/setter
|
||
jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={set:function set(elem,value){if(jQuery.isArray(value)){return elem.checked=jQuery.inArray(jQuery(elem).val(),value)>=0;}}};if(!support.checkOn){jQuery.valHooks[this].get=function(elem){// Support: Webkit
|
||
// "" is returned instead of "on" if a value isn't specified
|
||
return elem.getAttribute("value")===null?"on":elem.value;};}});var nodeHook,boolHook,attrHandle=jQuery.expr.attrHandle,ruseDefault=/^(?:checked|selected)$/i,getSetAttribute=support.getSetAttribute,getSetInput=support.input;jQuery.fn.extend({attr:function attr(name,value){return access(this,jQuery.attr,name,value,arguments.length>1);},removeAttr:function removeAttr(name){return this.each(function(){jQuery.removeAttr(this,name);});}});jQuery.extend({attr:function attr(elem,name,value){var hooks,ret,nType=elem.nodeType;// don't get/set attributes on text, comment and attribute nodes
|
||
if(!elem||nType===3||nType===8||nType===2){return;}// Fallback to prop when attributes are not supported
|
||
if(_typeof2(elem.getAttribute)===strundefined){return jQuery.prop(elem,name,value);}// All attributes are lowercase
|
||
// Grab necessary hook if one is defined
|
||
if(nType!==1||!jQuery.isXMLDoc(elem)){name=name.toLowerCase();hooks=jQuery.attrHooks[name]||(jQuery.expr.match.bool.test(name)?boolHook:nodeHook);}if(value!==undefined){if(value===null){jQuery.removeAttr(elem,name);}else if(hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined){return ret;}else{elem.setAttribute(name,value+"");return value;}}else if(hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null){return ret;}else{ret=jQuery.find.attr(elem,name);// Non-existent attributes return null, we normalize to undefined
|
||
return ret==null?undefined:ret;}},removeAttr:function removeAttr(elem,value){var name,propName,i=0,attrNames=value&&value.match(rnotwhite);if(attrNames&&elem.nodeType===1){while(name=attrNames[i++]){propName=jQuery.propFix[name]||name;// Boolean attributes get special treatment (#10870)
|
||
if(jQuery.expr.match.bool.test(name)){// Set corresponding property to false
|
||
if(getSetInput&&getSetAttribute||!ruseDefault.test(name)){elem[propName]=false;// Support: IE<9
|
||
// Also clear defaultChecked/defaultSelected (if appropriate)
|
||
}else{elem[jQuery.camelCase("default-"+name)]=elem[propName]=false;}// See #9699 for explanation of this approach (setting first, then removal)
|
||
}else{jQuery.attr(elem,name,"");}elem.removeAttribute(getSetAttribute?name:propName);}}},attrHooks:{type:{set:function set(elem,value){if(!support.radioValue&&value==="radio"&&jQuery.nodeName(elem,"input")){// Setting the type on a radio button after the value resets the value in IE6-9
|
||
// Reset value to default in case type is set after value during creation
|
||
var val=elem.value;elem.setAttribute("type",value);if(val){elem.value=val;}return value;}}}}});// Hook for boolean attributes
|
||
boolHook={set:function set(elem,value,name){if(value===false){// Remove boolean attributes when set to false
|
||
jQuery.removeAttr(elem,name);}else if(getSetInput&&getSetAttribute||!ruseDefault.test(name)){// IE<8 needs the *property* name
|
||
elem.setAttribute(!getSetAttribute&&jQuery.propFix[name]||name,name);// Use defaultChecked and defaultSelected for oldIE
|
||
}else{elem[jQuery.camelCase("default-"+name)]=elem[name]=true;}return name;}};// Retrieve booleans specially
|
||
jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),function(i,name){var getter=attrHandle[name]||jQuery.find.attr;attrHandle[name]=getSetInput&&getSetAttribute||!ruseDefault.test(name)?function(elem,name,isXML){var ret,handle;if(!isXML){// Avoid an infinite loop by temporarily removing this function from the getter
|
||
handle=attrHandle[name];attrHandle[name]=ret;ret=getter(elem,name,isXML)!=null?name.toLowerCase():null;attrHandle[name]=handle;}return ret;}:function(elem,name,isXML){if(!isXML){return elem[jQuery.camelCase("default-"+name)]?name.toLowerCase():null;}};});// fix oldIE attroperties
|
||
if(!getSetInput||!getSetAttribute){jQuery.attrHooks.value={set:function set(elem,value,name){if(jQuery.nodeName(elem,"input")){// Does not return so that setAttribute is also used
|
||
elem.defaultValue=value;}else{// Use nodeHook if defined (#1954); otherwise setAttribute is fine
|
||
return nodeHook&&nodeHook.set(elem,value,name);}}};}// IE6/7 do not support getting/setting some attributes with get/setAttribute
|
||
if(!getSetAttribute){// Use this for any attribute in IE6/7
|
||
// This fixes almost every IE6/7 issue
|
||
nodeHook={set:function set(elem,value,name){// Set the existing or create a new attribute node
|
||
var ret=elem.getAttributeNode(name);if(!ret){elem.setAttributeNode(ret=elem.ownerDocument.createAttribute(name));}ret.value=value+="";// Break association with cloned elements by also using setAttribute (#9646)
|
||
if(name==="value"||value===elem.getAttribute(name)){return value;}}};// Some attributes are constructed with empty-string values when not defined
|
||
attrHandle.id=attrHandle.name=attrHandle.coords=function(elem,name,isXML){var ret;if(!isXML){return(ret=elem.getAttributeNode(name))&&ret.value!==""?ret.value:null;}};// Fixing value retrieval on a button requires this module
|
||
jQuery.valHooks.button={get:function get(elem,name){var ret=elem.getAttributeNode(name);if(ret&&ret.specified){return ret.value;}},set:nodeHook.set};// Set contenteditable to false on removals(#10429)
|
||
// Setting to empty string throws an error as an invalid value
|
||
jQuery.attrHooks.contenteditable={set:function set(elem,value,name){nodeHook.set(elem,value===""?false:value,name);}};// Set width and height to auto instead of 0 on empty string( Bug #8150 )
|
||
// This is for removals
|
||
jQuery.each(["width","height"],function(i,name){jQuery.attrHooks[name]={set:function set(elem,value){if(value===""){elem.setAttribute(name,"auto");return value;}}};});}if(!support.style){jQuery.attrHooks.style={get:function get(elem){// Return undefined in the case of empty string
|
||
// Note: IE uppercases css property names, but if we were to .toLowerCase()
|
||
// .cssText, that would destroy case senstitivity in URL's, like in "background"
|
||
return elem.style.cssText||undefined;},set:function set(elem,value){return elem.style.cssText=value+"";}};}var rfocusable=/^(?:input|select|textarea|button|object)$/i,rclickable=/^(?:a|area)$/i;jQuery.fn.extend({prop:function prop(name,value){return access(this,jQuery.prop,name,value,arguments.length>1);},removeProp:function removeProp(name){name=jQuery.propFix[name]||name;return this.each(function(){// try/catch handles cases where IE balks (such as removing a property on window)
|
||
try{this[name]=undefined;delete this[name];}catch(e){}});}});jQuery.extend({propFix:{"for":"htmlFor","class":"className"},prop:function prop(elem,name,value){var ret,hooks,notxml,nType=elem.nodeType;// don't get/set properties on text, comment and attribute nodes
|
||
if(!elem||nType===3||nType===8||nType===2){return;}notxml=nType!==1||!jQuery.isXMLDoc(elem);if(notxml){// Fix name and attach hooks
|
||
name=jQuery.propFix[name]||name;hooks=jQuery.propHooks[name];}if(value!==undefined){return hooks&&"set"in hooks&&(ret=hooks.set(elem,value,name))!==undefined?ret:elem[name]=value;}else{return hooks&&"get"in hooks&&(ret=hooks.get(elem,name))!==null?ret:elem[name];}},propHooks:{tabIndex:{get:function get(elem){// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
||
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
||
// Use proper attribute retrieval(#12072)
|
||
var tabindex=jQuery.find.attr(elem,"tabindex");return tabindex?parseInt(tabindex,10):rfocusable.test(elem.nodeName)||rclickable.test(elem.nodeName)&&elem.href?0:-1;}}}});// Some attributes require a special call on IE
|
||
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
|
||
if(!support.hrefNormalized){// href/src property should get the full normalized URL (#10299/#12915)
|
||
jQuery.each(["href","src"],function(i,name){jQuery.propHooks[name]={get:function get(elem){return elem.getAttribute(name,4);}};});}// Support: Safari, IE9+
|
||
// mis-reports the default selected property of an option
|
||
// Accessing the parent's selectedIndex property fixes it
|
||
if(!support.optSelected){jQuery.propHooks.selected={get:function get(elem){var parent=elem.parentNode;if(parent){parent.selectedIndex;// Make sure that it also works with optgroups, see #5701
|
||
if(parent.parentNode){parent.parentNode.selectedIndex;}}return null;}};}jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){jQuery.propFix[this.toLowerCase()]=this;});// IE6/7 call enctype encoding
|
||
if(!support.enctype){jQuery.propFix.enctype="encoding";}var rclass=/[\t\r\n\f]/g;jQuery.fn.extend({addClass:function addClass(value){var classes,elem,cur,clazz,j,finalValue,i=0,len=this.length,proceed=typeof value==="string"&&value;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).addClass(value.call(this,j,this.className));});}if(proceed){// The disjunction here is for better compressibility (see removeClass)
|
||
classes=(value||"").match(rnotwhite)||[];for(;i<len;i++){elem=this[i];cur=elem.nodeType===1&&(elem.className?(" "+elem.className+" ").replace(rclass," "):" ");if(cur){j=0;while(clazz=classes[j++]){if(cur.indexOf(" "+clazz+" ")<0){cur+=clazz+" ";}}// only assign if different to avoid unneeded rendering.
|
||
finalValue=jQuery.trim(cur);if(elem.className!==finalValue){elem.className=finalValue;}}}}return this;},removeClass:function removeClass(value){var classes,elem,cur,clazz,j,finalValue,i=0,len=this.length,proceed=arguments.length===0||typeof value==="string"&&value;if(jQuery.isFunction(value)){return this.each(function(j){jQuery(this).removeClass(value.call(this,j,this.className));});}if(proceed){classes=(value||"").match(rnotwhite)||[];for(;i<len;i++){elem=this[i];// This expression is here for better compressibility (see addClass)
|
||
cur=elem.nodeType===1&&(elem.className?(" "+elem.className+" ").replace(rclass," "):"");if(cur){j=0;while(clazz=classes[j++]){// Remove *all* instances
|
||
while(cur.indexOf(" "+clazz+" ")>=0){cur=cur.replace(" "+clazz+" "," ");}}// only assign if different to avoid unneeded rendering.
|
||
finalValue=value?jQuery.trim(cur):"";if(elem.className!==finalValue){elem.className=finalValue;}}}}return this;},toggleClass:function toggleClass(value,stateVal){var type=_typeof2(value);if(typeof stateVal==="boolean"&&type==="string"){return stateVal?this.addClass(value):this.removeClass(value);}if(jQuery.isFunction(value)){return this.each(function(i){jQuery(this).toggleClass(value.call(this,i,this.className,stateVal),stateVal);});}return this.each(function(){if(type==="string"){// toggle individual class names
|
||
var className,i=0,self=jQuery(this),classNames=value.match(rnotwhite)||[];while(className=classNames[i++]){// check each className given, space separated list
|
||
if(self.hasClass(className)){self.removeClass(className);}else{self.addClass(className);}}// Toggle whole class name
|
||
}else if(type===strundefined||type==="boolean"){if(this.className){// store className if set
|
||
jQuery._data(this,"__className__",this.className);}// If the element has a class name or if we're passed "false",
|
||
// then remove the whole classname (if there was one, the above saved it).
|
||
// Otherwise bring back whatever was previously saved (if anything),
|
||
// falling back to the empty string if nothing was stored.
|
||
this.className=this.className||value===false?"":jQuery._data(this,"__className__")||"";}});},hasClass:function hasClass(selector){var className=" "+selector+" ",i=0,l=this.length;for(;i<l;i++){if(this[i].nodeType===1&&(" "+this[i].className+" ").replace(rclass," ").indexOf(className)>=0){return true;}}return false;}});// Return jQuery for attributes-only inclusion
|
||
jQuery.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(i,name){// Handle event binding
|
||
jQuery.fn[name]=function(data,fn){return arguments.length>0?this.on(name,null,data,fn):this.trigger(name);};});jQuery.fn.extend({hover:function hover(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut||fnOver);},bind:function bind(types,data,fn){return this.on(types,null,data,fn);},unbind:function unbind(types,fn){return this.off(types,null,fn);},delegate:function delegate(selector,types,data,fn){return this.on(types,selector,data,fn);},undelegate:function undelegate(selector,types,fn){// ( namespace ) or ( selector, types [, fn] )
|
||
return arguments.length===1?this.off(selector,"**"):this.off(types,selector||"**",fn);}});var nonce=jQuery.now();var rquery=/\?/;var rvalidtokens=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;jQuery.parseJSON=function(data){// Attempt to parse using the native JSON parser first
|
||
if(window.JSON&&window.JSON.parse){// Support: Android 2.3
|
||
// Workaround failure to string-cast null input
|
||
return window.JSON.parse(data+"");}var requireNonComma,depth=null,str=jQuery.trim(data+"");// Guard against invalid (and possibly dangerous) input by ensuring that nothing remains
|
||
// after removing valid tokens
|
||
return str&&!jQuery.trim(str.replace(rvalidtokens,function(token,comma,open,close){// Force termination if we see a misplaced comma
|
||
if(requireNonComma&&comma){depth=0;}// Perform no more replacements after returning to outermost depth
|
||
if(depth===0){return token;}// Commas must not follow "[", "{", or ","
|
||
requireNonComma=open||comma;// Determine new depth
|
||
// array/object open ("[" or "{"): depth += true - false (increment)
|
||
// array/object close ("]" or "}"): depth += false - true (decrement)
|
||
// other cases ("," or primitive): depth += true - true (numeric cast)
|
||
depth+=!close-!open;// Remove this token
|
||
return"";}))?Function("return "+str)():jQuery.error("Invalid JSON: "+data);};// Cross-browser xml parsing
|
||
jQuery.parseXML=function(data){var xml,tmp;if(!data||typeof data!=="string"){return null;}try{if(window.DOMParser){// Standard
|
||
tmp=new DOMParser();xml=tmp.parseFromString(data,"text/xml");}else{// IE
|
||
xml=new ActiveXObject("Microsoft.XMLDOM");xml.async="false";xml.loadXML(data);}}catch(e){xml=undefined;}if(!xml||!xml.documentElement||xml.getElementsByTagName("parsererror").length){jQuery.error("Invalid XML: "+data);}return xml;};var// Document location
|
||
ajaxLocParts,ajaxLocation,rhash=/#.*$/,rts=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,// IE leaves an \r character at EOL
|
||
// #7653, #8125, #8152: local protocol detection
|
||
rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,rurl=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,/* Prefilters
|
||
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
|
||
* 2) These are called:
|
||
* - BEFORE asking for a transport
|
||
* - AFTER param serialization (s.data is a string if s.processData is true)
|
||
* 3) key is the dataType
|
||
* 4) the catchall symbol "*" can be used
|
||
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
|
||
*/prefilters={},/* Transports bindings
|
||
* 1) key is the dataType
|
||
* 2) the catchall symbol "*" can be used
|
||
* 3) selection will start with transport dataType and THEN go to "*" if needed
|
||
*/transports={},// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
|
||
allTypes="*/".concat("*");// #8138, IE may throw an exception when accessing
|
||
// a field from window.location if document.domain has been set
|
||
try{ajaxLocation=location.href;}catch(e){// Use the href attribute of an A element
|
||
// since IE will modify it given document.location
|
||
ajaxLocation=document.createElement("a");ajaxLocation.href="";ajaxLocation=ajaxLocation.href;}// Segment location into parts
|
||
ajaxLocParts=rurl.exec(ajaxLocation.toLowerCase())||[];// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
|
||
function addToPrefiltersOrTransports(structure){// dataTypeExpression is optional and defaults to "*"
|
||
return function(dataTypeExpression,func){if(typeof dataTypeExpression!=="string"){func=dataTypeExpression;dataTypeExpression="*";}var dataType,i=0,dataTypes=dataTypeExpression.toLowerCase().match(rnotwhite)||[];if(jQuery.isFunction(func)){// For each dataType in the dataTypeExpression
|
||
while(dataType=dataTypes[i++]){// Prepend if requested
|
||
if(dataType.charAt(0)==="+"){dataType=dataType.slice(1)||"*";(structure[dataType]=structure[dataType]||[]).unshift(func);// Otherwise append
|
||
}else{(structure[dataType]=structure[dataType]||[]).push(func);}}}};}// Base inspection function for prefilters and transports
|
||
function inspectPrefiltersOrTransports(structure,options,originalOptions,jqXHR){var inspected={},seekingTransport=structure===transports;function inspect(dataType){var selected;inspected[dataType]=true;jQuery.each(structure[dataType]||[],function(_,prefilterOrFactory){var dataTypeOrTransport=prefilterOrFactory(options,originalOptions,jqXHR);if(typeof dataTypeOrTransport==="string"&&!seekingTransport&&!inspected[dataTypeOrTransport]){options.dataTypes.unshift(dataTypeOrTransport);inspect(dataTypeOrTransport);return false;}else if(seekingTransport){return!(selected=dataTypeOrTransport);}});return selected;}return inspect(options.dataTypes[0])||!inspected["*"]&&inspect("*");}// A special extend for ajax options
|
||
// that takes "flat" options (not to be deep extended)
|
||
// Fixes #9887
|
||
function ajaxExtend(target,src){var deep,key,flatOptions=jQuery.ajaxSettings.flatOptions||{};for(key in src){if(src[key]!==undefined){(flatOptions[key]?target:deep||(deep={}))[key]=src[key];}}if(deep){jQuery.extend(true,target,deep);}return target;}/* Handles responses to an ajax request:
|
||
* - finds the right dataType (mediates between content-type and expected dataType)
|
||
* - returns the corresponding response
|
||
*/function ajaxHandleResponses(s,jqXHR,responses){var firstDataType,ct,finalDataType,type,contents=s.contents,dataTypes=s.dataTypes;// Remove auto dataType and get content-type in the process
|
||
while(dataTypes[0]==="*"){dataTypes.shift();if(ct===undefined){ct=s.mimeType||jqXHR.getResponseHeader("Content-Type");}}// Check if we're dealing with a known content-type
|
||
if(ct){for(type in contents){if(contents[type]&&contents[type].test(ct)){dataTypes.unshift(type);break;}}}// Check to see if we have a response for the expected dataType
|
||
if(dataTypes[0]in responses){finalDataType=dataTypes[0];}else{// Try convertible dataTypes
|
||
for(type in responses){if(!dataTypes[0]||s.converters[type+" "+dataTypes[0]]){finalDataType=type;break;}if(!firstDataType){firstDataType=type;}}// Or just use first one
|
||
finalDataType=finalDataType||firstDataType;}// If we found a dataType
|
||
// We add the dataType to the list if needed
|
||
// and return the corresponding response
|
||
if(finalDataType){if(finalDataType!==dataTypes[0]){dataTypes.unshift(finalDataType);}return responses[finalDataType];}}/* Chain conversions given the request and the original response
|
||
* Also sets the responseXXX fields on the jqXHR instance
|
||
*/function ajaxConvert(s,response,jqXHR,isSuccess){var conv2,current,conv,tmp,prev,converters={},// Work with a copy of dataTypes in case we need to modify it for conversion
|
||
dataTypes=s.dataTypes.slice();// Create converters map with lowercased keys
|
||
if(dataTypes[1]){for(conv in s.converters){converters[conv.toLowerCase()]=s.converters[conv];}}current=dataTypes.shift();// Convert to each sequential dataType
|
||
while(current){if(s.responseFields[current]){jqXHR[s.responseFields[current]]=response;}// Apply the dataFilter if provided
|
||
if(!prev&&isSuccess&&s.dataFilter){response=s.dataFilter(response,s.dataType);}prev=current;current=dataTypes.shift();if(current){// There's only work to do if current dataType is non-auto
|
||
if(current==="*"){current=prev;// Convert response if prev dataType is non-auto and differs from current
|
||
}else if(prev!=="*"&&prev!==current){// Seek a direct converter
|
||
conv=converters[prev+" "+current]||converters["* "+current];// If none found, seek a pair
|
||
if(!conv){for(conv2 in converters){// If conv2 outputs current
|
||
tmp=conv2.split(" ");if(tmp[1]===current){// If prev can be converted to accepted input
|
||
conv=converters[prev+" "+tmp[0]]||converters["* "+tmp[0]];if(conv){// Condense equivalence converters
|
||
if(conv===true){conv=converters[conv2];// Otherwise, insert the intermediate dataType
|
||
}else if(converters[conv2]!==true){current=tmp[0];dataTypes.unshift(tmp[1]);}break;}}}}// Apply converter (if not an equivalence)
|
||
if(conv!==true){// Unless errors are allowed to bubble, catch and return them
|
||
if(conv&&s["throws"]){response=conv(response);}else{try{response=conv(response);}catch(e){return{state:"parsererror",error:conv?e:"No conversion from "+prev+" to "+current};}}}}}}return{state:"success",data:response};}jQuery.extend({// Counter for holding the number of active queries
|
||
active:0,// Last-Modified header cache for next request
|
||
lastModified:{},etag:{},ajaxSettings:{url:ajaxLocation,type:"GET",isLocal:rlocalProtocol.test(ajaxLocParts[1]),global:true,processData:true,async:true,contentType:"application/x-www-form-urlencoded; charset=UTF-8",/*
|
||
timeout: 0,
|
||
data: null,
|
||
dataType: null,
|
||
username: null,
|
||
password: null,
|
||
cache: null,
|
||
throws: false,
|
||
traditional: false,
|
||
headers: {},
|
||
*/accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},// Data converters
|
||
// Keys separate source (or catchall "*") and destination types with a single space
|
||
converters:{// Convert anything to text
|
||
"* text":String,// Text to html (true = no transformation)
|
||
"text html":true,// Evaluate text as a json expression
|
||
"text json":jQuery.parseJSON,// Parse text as xml
|
||
"text xml":jQuery.parseXML},// For options that shouldn't be deep extended:
|
||
// you can add your own custom options here if
|
||
// and when you create one that shouldn't be
|
||
// deep extended (see ajaxExtend)
|
||
flatOptions:{url:true,context:true}},// Creates a full fledged settings object into target
|
||
// with both ajaxSettings and settings fields.
|
||
// If target is omitted, writes into ajaxSettings.
|
||
ajaxSetup:function ajaxSetup(target,settings){return settings?// Building a settings object
|
||
ajaxExtend(ajaxExtend(target,jQuery.ajaxSettings),settings):// Extending ajaxSettings
|
||
ajaxExtend(jQuery.ajaxSettings,target);},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),// Main method
|
||
ajax:function ajax(url,options){// If url is an object, simulate pre-1.5 signature
|
||
if(_typeof2(url)==="object"){options=url;url=undefined;}// Force options to be an object
|
||
options=options||{};var// Cross-domain detection vars
|
||
parts,// Loop variable
|
||
i,// URL without anti-cache param
|
||
cacheURL,// Response headers as string
|
||
responseHeadersString,// timeout handle
|
||
timeoutTimer,// To know if global events are to be dispatched
|
||
fireGlobals,transport,// Response headers
|
||
responseHeaders,// Create the final options object
|
||
s=jQuery.ajaxSetup({},options),// Callbacks context
|
||
callbackContext=s.context||s,// Context for global events is callbackContext if it is a DOM node or jQuery collection
|
||
globalEventContext=s.context&&(callbackContext.nodeType||callbackContext.jquery)?jQuery(callbackContext):jQuery.event,// Deferreds
|
||
deferred=jQuery.Deferred(),completeDeferred=jQuery.Callbacks("once memory"),// Status-dependent callbacks
|
||
_statusCode=s.statusCode||{},// Headers (they are sent all at once)
|
||
requestHeaders={},requestHeadersNames={},// The jqXHR state
|
||
state=0,// Default abort message
|
||
strAbort="canceled",// Fake xhr
|
||
jqXHR={readyState:0,// Builds headers hashtable if needed
|
||
getResponseHeader:function getResponseHeader(key){var match;if(state===2){if(!responseHeaders){responseHeaders={};while(match=rheaders.exec(responseHeadersString)){responseHeaders[match[1].toLowerCase()]=match[2];}}match=responseHeaders[key.toLowerCase()];}return match==null?null:match;},// Raw string
|
||
getAllResponseHeaders:function getAllResponseHeaders(){return state===2?responseHeadersString:null;},// Caches the header
|
||
setRequestHeader:function setRequestHeader(name,value){var lname=name.toLowerCase();if(!state){name=requestHeadersNames[lname]=requestHeadersNames[lname]||name;requestHeaders[name]=value;}return this;},// Overrides response content-type header
|
||
overrideMimeType:function overrideMimeType(type){if(!state){s.mimeType=type;}return this;},// Status-dependent callbacks
|
||
statusCode:function statusCode(map){var code;if(map){if(state<2){for(code in map){// Lazy-add the new callback in a way that preserves old ones
|
||
_statusCode[code]=[_statusCode[code],map[code]];}}else{// Execute the appropriate callbacks
|
||
jqXHR.always(map[jqXHR.status]);}}return this;},// Cancel the request
|
||
abort:function abort(statusText){var finalText=statusText||strAbort;if(transport){transport.abort(finalText);}done(0,finalText);return this;}};// Attach deferreds
|
||
deferred.promise(jqXHR).complete=completeDeferred.add;jqXHR.success=jqXHR.done;jqXHR.error=jqXHR.fail;// Remove hash character (#7531: and string promotion)
|
||
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
|
||
// Handle falsy url in the settings object (#10093: consistency with old signature)
|
||
// We also use the url parameter if available
|
||
s.url=((url||s.url||ajaxLocation)+"").replace(rhash,"").replace(rprotocol,ajaxLocParts[1]+"//");// Alias method option to type as per ticket #12004
|
||
s.type=options.method||options.type||s.method||s.type;// Extract dataTypes list
|
||
s.dataTypes=jQuery.trim(s.dataType||"*").toLowerCase().match(rnotwhite)||[""];// A cross-domain request is in order when we have a protocol:host:port mismatch
|
||
if(s.crossDomain==null){parts=rurl.exec(s.url.toLowerCase());s.crossDomain=!!(parts&&(parts[1]!==ajaxLocParts[1]||parts[2]!==ajaxLocParts[2]||(parts[3]||(parts[1]==="http:"?"80":"443"))!==(ajaxLocParts[3]||(ajaxLocParts[1]==="http:"?"80":"443"))));}// Convert data if not already a string
|
||
if(s.data&&s.processData&&typeof s.data!=="string"){s.data=jQuery.param(s.data,s.traditional);}// Apply prefilters
|
||
inspectPrefiltersOrTransports(prefilters,s,options,jqXHR);// If request was aborted inside a prefilter, stop there
|
||
if(state===2){return jqXHR;}// We can fire global events as of now if asked to
|
||
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
|
||
fireGlobals=jQuery.event&&s.global;// Watch for a new set of requests
|
||
if(fireGlobals&&jQuery.active++===0){jQuery.event.trigger("ajaxStart");}// Uppercase the type
|
||
s.type=s.type.toUpperCase();// Determine if request has content
|
||
s.hasContent=!rnoContent.test(s.type);// Save the URL in case we're toying with the If-Modified-Since
|
||
// and/or If-None-Match header later on
|
||
cacheURL=s.url;// More options handling for requests with no content
|
||
if(!s.hasContent){// If data is available, append data to url
|
||
if(s.data){cacheURL=s.url+=(rquery.test(cacheURL)?"&":"?")+s.data;// #9682: remove data so that it's not used in an eventual retry
|
||
delete s.data;}// Add anti-cache in url if needed
|
||
if(s.cache===false){s.url=rts.test(cacheURL)?// If there is already a '_' parameter, set its value
|
||
cacheURL.replace(rts,"$1_="+nonce++):// Otherwise add one to the end
|
||
cacheURL+(rquery.test(cacheURL)?"&":"?")+"_="+nonce++;}}// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
||
if(s.ifModified){if(jQuery.lastModified[cacheURL]){jqXHR.setRequestHeader("If-Modified-Since",jQuery.lastModified[cacheURL]);}if(jQuery.etag[cacheURL]){jqXHR.setRequestHeader("If-None-Match",jQuery.etag[cacheURL]);}}// Set the correct header, if data is being sent
|
||
if(s.data&&s.hasContent&&s.contentType!==false||options.contentType){jqXHR.setRequestHeader("Content-Type",s.contentType);}// Set the Accepts header for the server, depending on the dataType
|
||
jqXHR.setRequestHeader("Accept",s.dataTypes[0]&&s.accepts[s.dataTypes[0]]?s.accepts[s.dataTypes[0]]+(s.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):s.accepts["*"]);// Check for headers option
|
||
for(i in s.headers){jqXHR.setRequestHeader(i,s.headers[i]);}// Allow custom headers/mimetypes and early abort
|
||
if(s.beforeSend&&(s.beforeSend.call(callbackContext,jqXHR,s)===false||state===2)){// Abort if not done already and return
|
||
return jqXHR.abort();}// aborting is no longer a cancellation
|
||
strAbort="abort";// Install callbacks on deferreds
|
||
for(i in{success:1,error:1,complete:1}){jqXHR[i](s[i]);}// Get transport
|
||
transport=inspectPrefiltersOrTransports(transports,s,options,jqXHR);// If no transport, we auto-abort
|
||
if(!transport){done(-1,"No Transport");}else{jqXHR.readyState=1;// Send global event
|
||
if(fireGlobals){globalEventContext.trigger("ajaxSend",[jqXHR,s]);}// Timeout
|
||
if(s.async&&s.timeout>0){timeoutTimer=setTimeout(function(){jqXHR.abort("timeout");},s.timeout);}try{state=1;transport.send(requestHeaders,done);}catch(e){// Propagate exception as error if not done
|
||
if(state<2){done(-1,e);// Simply rethrow otherwise
|
||
}else{throw e;}}}// Callback for when everything is done
|
||
function done(status,nativeStatusText,responses,headers){var isSuccess,success,error,response,modified,statusText=nativeStatusText;// Called once
|
||
if(state===2){return;}// State is "done" now
|
||
state=2;// Clear timeout if it exists
|
||
if(timeoutTimer){clearTimeout(timeoutTimer);}// Dereference transport for early garbage collection
|
||
// (no matter how long the jqXHR object will be used)
|
||
transport=undefined;// Cache response headers
|
||
responseHeadersString=headers||"";// Set readyState
|
||
jqXHR.readyState=status>0?4:0;// Determine if successful
|
||
isSuccess=status>=200&&status<300||status===304;// Get response data
|
||
if(responses){response=ajaxHandleResponses(s,jqXHR,responses);}// Convert no matter what (that way responseXXX fields are always set)
|
||
response=ajaxConvert(s,response,jqXHR,isSuccess);// If successful, handle type chaining
|
||
if(isSuccess){// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
||
if(s.ifModified){modified=jqXHR.getResponseHeader("Last-Modified");if(modified){jQuery.lastModified[cacheURL]=modified;}modified=jqXHR.getResponseHeader("etag");if(modified){jQuery.etag[cacheURL]=modified;}}// if no content
|
||
if(status===204||s.type==="HEAD"){statusText="nocontent";// if not modified
|
||
}else if(status===304){statusText="notmodified";// If we have data, let's convert it
|
||
}else{statusText=response.state;success=response.data;error=response.error;isSuccess=!error;}}else{// We extract error from statusText
|
||
// then normalize statusText and status for non-aborts
|
||
error=statusText;if(status||!statusText){statusText="error";if(status<0){status=0;}}}// Set data for the fake xhr object
|
||
jqXHR.status=status;jqXHR.statusText=(nativeStatusText||statusText)+"";// Success/Error
|
||
if(isSuccess){deferred.resolveWith(callbackContext,[success,statusText,jqXHR]);}else{deferred.rejectWith(callbackContext,[jqXHR,statusText,error]);}// Status-dependent callbacks
|
||
jqXHR.statusCode(_statusCode);_statusCode=undefined;if(fireGlobals){globalEventContext.trigger(isSuccess?"ajaxSuccess":"ajaxError",[jqXHR,s,isSuccess?success:error]);}// Complete
|
||
completeDeferred.fireWith(callbackContext,[jqXHR,statusText]);if(fireGlobals){globalEventContext.trigger("ajaxComplete",[jqXHR,s]);// Handle the global AJAX counter
|
||
if(! --jQuery.active){jQuery.event.trigger("ajaxStop");}}}return jqXHR;},getJSON:function getJSON(url,data,callback){return jQuery.get(url,data,callback,"json");},getScript:function getScript(url,callback){return jQuery.get(url,undefined,callback,"script");}});jQuery.each(["get","post"],function(i,method){jQuery[method]=function(url,data,callback,type){// shift arguments if data argument was omitted
|
||
if(jQuery.isFunction(data)){type=type||callback;callback=data;data=undefined;}return jQuery.ajax({url:url,type:method,dataType:type,data:data,success:callback});};});jQuery._evalUrl=function(url){return jQuery.ajax({url:url,type:"GET",dataType:"script",async:false,global:false,"throws":true});};jQuery.fn.extend({wrapAll:function wrapAll(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapAll(html.call(this,i));});}if(this[0]){// The elements to wrap the target around
|
||
var wrap=jQuery(html,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){wrap.insertBefore(this[0]);}wrap.map(function(){var elem=this;while(elem.firstChild&&elem.firstChild.nodeType===1){elem=elem.firstChild;}return elem;}).append(this);}return this;},wrapInner:function wrapInner(html){if(jQuery.isFunction(html)){return this.each(function(i){jQuery(this).wrapInner(html.call(this,i));});}return this.each(function(){var self=jQuery(this),contents=self.contents();if(contents.length){contents.wrapAll(html);}else{self.append(html);}});},wrap:function wrap(html){var isFunction=jQuery.isFunction(html);return this.each(function(i){jQuery(this).wrapAll(isFunction?html.call(this,i):html);});},unwrap:function unwrap(){return this.parent().each(function(){if(!jQuery.nodeName(this,"body")){jQuery(this).replaceWith(this.childNodes);}}).end();}});jQuery.expr.filters.hidden=function(elem){// Support: Opera <= 12.12
|
||
// Opera reports offsetWidths and offsetHeights less than zero on some elements
|
||
return elem.offsetWidth<=0&&elem.offsetHeight<=0||!support.reliableHiddenOffsets()&&(elem.style&&elem.style.display||jQuery.css(elem,"display"))==="none";};jQuery.expr.filters.visible=function(elem){return!jQuery.expr.filters.hidden(elem);};var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;function buildParams(prefix,obj,traditional,add){var name;if(jQuery.isArray(obj)){// Serialize array item.
|
||
jQuery.each(obj,function(i,v){if(traditional||rbracket.test(prefix)){// Treat each array item as a scalar.
|
||
add(prefix,v);}else{// Item is non-scalar (array or object), encode its numeric index.
|
||
buildParams(prefix+"["+(_typeof2(v)==="object"?i:"")+"]",v,traditional,add);}});}else if(!traditional&&jQuery.type(obj)==="object"){// Serialize object item.
|
||
for(name in obj){buildParams(prefix+"["+name+"]",obj[name],traditional,add);}}else{// Serialize scalar item.
|
||
add(prefix,obj);}}// Serialize an array of form elements or a set of
|
||
// key/values into a query string
|
||
jQuery.param=function(a,traditional){var prefix,s=[],add=function add(key,value){// If value is a function, invoke it and return its value
|
||
value=jQuery.isFunction(value)?value():value==null?"":value;s[s.length]=encodeURIComponent(key)+"="+encodeURIComponent(value);};// Set traditional to true for jQuery <= 1.3.2 behavior.
|
||
if(traditional===undefined){traditional=jQuery.ajaxSettings&&jQuery.ajaxSettings.traditional;}// If an array was passed in, assume that it is an array of form elements.
|
||
if(jQuery.isArray(a)||a.jquery&&!jQuery.isPlainObject(a)){// Serialize the form elements
|
||
jQuery.each(a,function(){add(this.name,this.value);});}else{// If traditional, encode the "old" way (the way 1.3.2 or older
|
||
// did it), otherwise encode params recursively.
|
||
for(prefix in a){buildParams(prefix,a[prefix],traditional,add);}}// Return the resulting serialization
|
||
return s.join("&").replace(r20,"+");};jQuery.fn.extend({serialize:function serialize(){return jQuery.param(this.serializeArray());},serializeArray:function serializeArray(){return this.map(function(){// Can add propHook for "elements" to filter or add form elements
|
||
var elements=jQuery.prop(this,"elements");return elements?jQuery.makeArray(elements):this;}).filter(function(){var type=this.type;// Use .is(":disabled") so that fieldset[disabled] works
|
||
return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(type)&&(this.checked||!rcheckableType.test(type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val){return{name:elem.name,value:val.replace(rCRLF,"\r\n")};}):{name:elem.name,value:val.replace(rCRLF,"\r\n")};}).get();}});// Create the request object
|
||
// (This is still attached to ajaxSettings for backward compatibility)
|
||
jQuery.ajaxSettings.xhr=window.ActiveXObject!==undefined?// Support: IE6+
|
||
function(){// XHR cannot access local files, always use ActiveX for that case
|
||
return!this.isLocal&&// Support: IE7-8
|
||
// oldIE XHR does not support non-RFC2616 methods (#13240)
|
||
// See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx
|
||
// and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9
|
||
// Although this check for six methods instead of eight
|
||
// since IE also does not support "trace" and "connect"
|
||
/^(get|post|head|put|delete|options)$/i.test(this.type)&&createStandardXHR()||createActiveXHR();}:// For all other browsers, use the standard XMLHttpRequest object
|
||
createStandardXHR;var xhrId=0,xhrCallbacks={},xhrSupported=jQuery.ajaxSettings.xhr();// Support: IE<10
|
||
// Open requests must be manually aborted on unload (#5280)
|
||
// See https://support.microsoft.com/kb/2856746 for more info
|
||
if(window.attachEvent){window.attachEvent("onunload",function(){for(var key in xhrCallbacks){xhrCallbacks[key](undefined,true);}});}// Determine support properties
|
||
support.cors=!!xhrSupported&&"withCredentials"in xhrSupported;xhrSupported=support.ajax=!!xhrSupported;// Create transport if the browser can provide an xhr
|
||
if(xhrSupported){jQuery.ajaxTransport(function(options){// Cross domain only allowed if supported through XMLHttpRequest
|
||
if(!options.crossDomain||support.cors){var _callback;return{send:function send(headers,complete){var i,xhr=options.xhr(),id=++xhrId;// Open the socket
|
||
xhr.open(options.type,options.url,options.async,options.username,options.password);// Apply custom fields if provided
|
||
if(options.xhrFields){for(i in options.xhrFields){xhr[i]=options.xhrFields[i];}}// Override mime type if needed
|
||
if(options.mimeType&&xhr.overrideMimeType){xhr.overrideMimeType(options.mimeType);}// X-Requested-With header
|
||
// For cross-domain requests, seeing as conditions for a preflight are
|
||
// akin to a jigsaw puzzle, we simply never set it to be sure.
|
||
// (it can always be set on a per-request basis or even using ajaxSetup)
|
||
// For same-domain requests, won't change header if already provided.
|
||
if(!options.crossDomain&&!headers["X-Requested-With"]){headers["X-Requested-With"]="XMLHttpRequest";}// Set headers
|
||
for(i in headers){// Support: IE<9
|
||
// IE's ActiveXObject throws a 'Type Mismatch' exception when setting
|
||
// request header to a null-value.
|
||
//
|
||
// To keep consistent with other XHR implementations, cast the value
|
||
// to string and ignore `undefined`.
|
||
if(headers[i]!==undefined){xhr.setRequestHeader(i,headers[i]+"");}}// Do send the request
|
||
// This may raise an exception which is actually
|
||
// handled in jQuery.ajax (so no try/catch here)
|
||
xhr.send(options.hasContent&&options.data||null);// Listener
|
||
_callback=function callback(_,isAbort){var status,statusText,responses;// Was never called and is aborted or complete
|
||
if(_callback&&(isAbort||xhr.readyState===4)){// Clean up
|
||
delete xhrCallbacks[id];_callback=undefined;xhr.onreadystatechange=jQuery.noop;// Abort manually if needed
|
||
if(isAbort){if(xhr.readyState!==4){xhr.abort();}}else{responses={};status=xhr.status;// Support: IE<10
|
||
// Accessing binary-data responseText throws an exception
|
||
// (#11426)
|
||
if(typeof xhr.responseText==="string"){responses.text=xhr.responseText;}// Firefox throws an exception when accessing
|
||
// statusText for faulty cross-domain requests
|
||
try{statusText=xhr.statusText;}catch(e){// We normalize with Webkit giving an empty statusText
|
||
statusText="";}// Filter status for non standard behaviors
|
||
// If the request is local and we have data: assume a success
|
||
// (success with no data won't get notified, that's the best we
|
||
// can do given current implementations)
|
||
if(!status&&options.isLocal&&!options.crossDomain){status=responses.text?200:404;// IE - #1450: sometimes returns 1223 when it should be 204
|
||
}else if(status===1223){status=204;}}}// Call complete if needed
|
||
if(responses){complete(status,statusText,responses,xhr.getAllResponseHeaders());}};if(!options.async){// if we're in sync mode we fire the callback
|
||
_callback();}else if(xhr.readyState===4){// (IE6 & IE7) if it's in cache and has been
|
||
// retrieved directly we need to fire the callback
|
||
setTimeout(_callback);}else{// Add to the list of active xhr callbacks
|
||
xhr.onreadystatechange=xhrCallbacks[id]=_callback;}},abort:function abort(){if(_callback){_callback(undefined,true);}}};}});}// Functions to create xhrs
|
||
function createStandardXHR(){try{return new window.XMLHttpRequest();}catch(e){}}function createActiveXHR(){try{return new window.ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}// Install script dataType
|
||
jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function textScript(text){jQuery.globalEval(text);return text;}}});// Handle cache's special case and global
|
||
jQuery.ajaxPrefilter("script",function(s){if(s.cache===undefined){s.cache=false;}if(s.crossDomain){s.type="GET";s.global=false;}});// Bind script tag hack transport
|
||
jQuery.ajaxTransport("script",function(s){// This transport only deals with cross domain requests
|
||
if(s.crossDomain){var script,head=document.head||jQuery("head")[0]||document.documentElement;return{send:function send(_,callback){script=document.createElement("script");script.async=true;if(s.scriptCharset){script.charset=s.scriptCharset;}script.src=s.url;// Attach handlers for all browsers
|
||
script.onload=script.onreadystatechange=function(_,isAbort){if(isAbort||!script.readyState||/loaded|complete/.test(script.readyState)){// Handle memory leak in IE
|
||
script.onload=script.onreadystatechange=null;// Remove the script
|
||
if(script.parentNode){script.parentNode.removeChild(script);}// Dereference the script
|
||
script=null;// Callback if not abort
|
||
if(!isAbort){callback(200,"success");}}};// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
|
||
// Use native DOM manipulation to avoid our domManip AJAX trickery
|
||
head.insertBefore(script,head.firstChild);},abort:function abort(){if(script){script.onload(undefined,true);}}};}});var oldCallbacks=[],rjsonp=/(=)\?(?=&|$)|\?\?/;// Default jsonp settings
|
||
jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function jsonpCallback(){var callback=oldCallbacks.pop()||jQuery.expando+"_"+nonce++;this[callback]=true;return callback;}});// Detect, normalize options and install callbacks for jsonp requests
|
||
jQuery.ajaxPrefilter("json jsonp",function(s,originalSettings,jqXHR){var callbackName,overwritten,responseContainer,jsonProp=s.jsonp!==false&&(rjsonp.test(s.url)?"url":typeof s.data==="string"&&!(s.contentType||"").indexOf("application/x-www-form-urlencoded")&&rjsonp.test(s.data)&&"data");// Handle iff the expected data type is "jsonp" or we have a parameter to set
|
||
if(jsonProp||s.dataTypes[0]==="jsonp"){// Get callback name, remembering preexisting value associated with it
|
||
callbackName=s.jsonpCallback=jQuery.isFunction(s.jsonpCallback)?s.jsonpCallback():s.jsonpCallback;// Insert callback into url or form data
|
||
if(jsonProp){s[jsonProp]=s[jsonProp].replace(rjsonp,"$1"+callbackName);}else if(s.jsonp!==false){s.url+=(rquery.test(s.url)?"&":"?")+s.jsonp+"="+callbackName;}// Use data converter to retrieve json after script execution
|
||
s.converters["script json"]=function(){if(!responseContainer){jQuery.error(callbackName+" was not called");}return responseContainer[0];};// force json dataType
|
||
s.dataTypes[0]="json";// Install callback
|
||
overwritten=window[callbackName];window[callbackName]=function(){responseContainer=arguments;};// Clean-up function (fires after converters)
|
||
jqXHR.always(function(){// Restore preexisting value
|
||
window[callbackName]=overwritten;// Save back as free
|
||
if(s[callbackName]){// make sure that re-using the options doesn't screw things around
|
||
s.jsonpCallback=originalSettings.jsonpCallback;// save the callback name for future use
|
||
oldCallbacks.push(callbackName);}// Call if it was a function and we have a response
|
||
if(responseContainer&&jQuery.isFunction(overwritten)){overwritten(responseContainer[0]);}responseContainer=overwritten=undefined;});// Delegate to script
|
||
return"script";}});// data: string of html
|
||
// context (optional): If specified, the fragment will be created in this context, defaults to document
|
||
// keepScripts (optional): If true, will include scripts passed in the html string
|
||
jQuery.parseHTML=function(data,context,keepScripts){if(!data||typeof data!=="string"){return null;}if(typeof context==="boolean"){keepScripts=context;context=false;}context=context||document;var parsed=rsingleTag.exec(data),scripts=!keepScripts&&[];// Single tag
|
||
if(parsed){return[context.createElement(parsed[1])];}parsed=jQuery.buildFragment([data],context,scripts);if(scripts&&scripts.length){jQuery(scripts).remove();}return jQuery.merge([],parsed.childNodes);};// Keep a copy of the old load method
|
||
var _load=jQuery.fn.load;/**
|
||
* Load a url into a page
|
||
*/jQuery.fn.load=function(url,params,callback){if(typeof url!=="string"&&_load){return _load.apply(this,arguments);}var selector,response,type,self=this,off=url.indexOf(" ");if(off>=0){selector=jQuery.trim(url.slice(off,url.length));url=url.slice(0,off);}// If it's a function
|
||
if(jQuery.isFunction(params)){// We assume that it's the callback
|
||
callback=params;params=undefined;// Otherwise, build a param string
|
||
}else if(params&&_typeof2(params)==="object"){type="POST";}// If we have elements to modify, make the request
|
||
if(self.length>0){jQuery.ajax({url:url,// if "type" variable is undefined, then "GET" method will be used
|
||
type:type,dataType:"html",data:params}).done(function(responseText){// Save response for use in complete callback
|
||
response=arguments;self.html(selector?// If a selector was specified, locate the right elements in a dummy div
|
||
// Exclude scripts to avoid IE 'Permission Denied' errors
|
||
jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector):// Otherwise use the full result
|
||
responseText);}).complete(callback&&function(jqXHR,status){self.each(callback,response||[jqXHR.responseText,status,jqXHR]);});}return this;};// Attach a bunch of functions for handling common AJAX events
|
||
jQuery.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(i,type){jQuery.fn[type]=function(fn){return this.on(type,fn);};});jQuery.expr.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem;}).length;};var docElem=window.document.documentElement;/**
|
||
* Gets a window from an element
|
||
*/function getWindow(elem){return jQuery.isWindow(elem)?elem:elem.nodeType===9?elem.defaultView||elem.parentWindow:false;}jQuery.offset={setOffset:function setOffset(elem,options,i){var curPosition,curLeft,curCSSTop,curTop,curOffset,curCSSLeft,calculatePosition,position=jQuery.css(elem,"position"),curElem=jQuery(elem),props={};// set position first, in-case top/left are set even on static elem
|
||
if(position==="static"){elem.style.position="relative";}curOffset=curElem.offset();curCSSTop=jQuery.css(elem,"top");curCSSLeft=jQuery.css(elem,"left");calculatePosition=(position==="absolute"||position==="fixed")&&jQuery.inArray("auto",[curCSSTop,curCSSLeft])>-1;// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
|
||
if(calculatePosition){curPosition=curElem.position();curTop=curPosition.top;curLeft=curPosition.left;}else{curTop=parseFloat(curCSSTop)||0;curLeft=parseFloat(curCSSLeft)||0;}if(jQuery.isFunction(options)){options=options.call(elem,i,curOffset);}if(options.top!=null){props.top=options.top-curOffset.top+curTop;}if(options.left!=null){props.left=options.left-curOffset.left+curLeft;}if("using"in options){options.using.call(elem,props);}else{curElem.css(props);}}};jQuery.fn.extend({offset:function offset(options){if(arguments.length){return options===undefined?this:this.each(function(i){jQuery.offset.setOffset(this,options,i);});}var docElem,win,box={top:0,left:0},elem=this[0],doc=elem&&elem.ownerDocument;if(!doc){return;}docElem=doc.documentElement;// Make sure it's not a disconnected DOM node
|
||
if(!jQuery.contains(docElem,elem)){return box;}// If we don't have gBCR, just use 0,0 rather than error
|
||
// BlackBerry 5, iOS 3 (original iPhone)
|
||
if(_typeof2(elem.getBoundingClientRect)!==strundefined){box=elem.getBoundingClientRect();}win=getWindow(doc);return{top:box.top+(win.pageYOffset||docElem.scrollTop)-(docElem.clientTop||0),left:box.left+(win.pageXOffset||docElem.scrollLeft)-(docElem.clientLeft||0)};},position:function position(){if(!this[0]){return;}var offsetParent,offset,parentOffset={top:0,left:0},elem=this[0];// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
|
||
if(jQuery.css(elem,"position")==="fixed"){// we assume that getBoundingClientRect is available when computed position is fixed
|
||
offset=elem.getBoundingClientRect();}else{// Get *real* offsetParent
|
||
offsetParent=this.offsetParent();// Get correct offsets
|
||
offset=this.offset();if(!jQuery.nodeName(offsetParent[0],"html")){parentOffset=offsetParent.offset();}// Add offsetParent borders
|
||
parentOffset.top+=jQuery.css(offsetParent[0],"borderTopWidth",true);parentOffset.left+=jQuery.css(offsetParent[0],"borderLeftWidth",true);}// Subtract parent offsets and element margins
|
||
// note: when an element has margin: auto the offsetLeft and marginLeft
|
||
// are the same in Safari causing offset.left to incorrectly be 0
|
||
return{top:offset.top-parentOffset.top-jQuery.css(elem,"marginTop",true),left:offset.left-parentOffset.left-jQuery.css(elem,"marginLeft",true)};},offsetParent:function offsetParent(){return this.map(function(){var offsetParent=this.offsetParent||docElem;while(offsetParent&&!jQuery.nodeName(offsetParent,"html")&&jQuery.css(offsetParent,"position")==="static"){offsetParent=offsetParent.offsetParent;}return offsetParent||docElem;});}});// Create scrollLeft and scrollTop methods
|
||
jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(method,prop){var top=/Y/.test(prop);jQuery.fn[method]=function(val){return access(this,function(elem,method,val){var win=getWindow(elem);if(val===undefined){return win?prop in win?win[prop]:win.document.documentElement[method]:elem[method];}if(win){win.scrollTo(!top?val:jQuery(win).scrollLeft(),top?val:jQuery(win).scrollTop());}else{elem[method]=val;}},method,val,arguments.length,null);};});// Add the top/left cssHooks using jQuery.fn.position
|
||
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
|
||
// getComputedStyle returns percent when specified for top/left/bottom/right
|
||
// rather than make the css module depend on the offset module, we just check for it here
|
||
jQuery.each(["top","left"],function(i,prop){jQuery.cssHooks[prop]=addGetHookIf(support.pixelPosition,function(elem,computed){if(computed){computed=curCSS(elem,prop);// if curCSS returns percentage, fallback to offset
|
||
return rnumnonpx.test(computed)?jQuery(elem).position()[prop]+"px":computed;}});});// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
|
||
jQuery.each({Height:"height",Width:"width"},function(name,type){jQuery.each({padding:"inner"+name,content:type,"":"outer"+name},function(defaultExtra,funcName){// margin is only for outerHeight, outerWidth
|
||
jQuery.fn[funcName]=function(margin,value){var chainable=arguments.length&&(defaultExtra||typeof margin!=="boolean"),extra=defaultExtra||(margin===true||value===true?"margin":"border");return access(this,function(elem,type,value){var doc;if(jQuery.isWindow(elem)){// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
|
||
// isn't a whole lot we can do. See pull request at this URL for discussion:
|
||
// https://github.com/jquery/jquery/pull/764
|
||
return elem.document.documentElement["client"+name];}// Get document width or height
|
||
if(elem.nodeType===9){doc=elem.documentElement;// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
|
||
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
|
||
return Math.max(elem.body["scroll"+name],doc["scroll"+name],elem.body["offset"+name],doc["offset"+name],doc["client"+name]);}return value===undefined?// Get width or height on the element, requesting but not forcing parseFloat
|
||
jQuery.css(elem,type,extra):// Set width or height on the element
|
||
jQuery.style(elem,type,value,extra);},type,chainable?margin:undefined,chainable,null);};});});// The number of elements contained in the matched element set
|
||
jQuery.fn.size=function(){return this.length;};jQuery.fn.andSelf=jQuery.fn.addBack;// Register as a named AMD module, since jQuery can be concatenated with other
|
||
// files that may use define, but not via a proper concatenation script that
|
||
// understands anonymous AMD modules. A named AMD is safest and most robust
|
||
// way to register. Lowercase jquery is used because AMD module names are
|
||
// derived from file names, and jQuery is normally delivered in a lowercase
|
||
// file name. Do this after creating the global so that if an AMD module wants
|
||
// to call noConflict to hide this version of jQuery, it will work.
|
||
// Note that for maximum portability, libraries that are not jQuery should
|
||
// declare themselves as anonymous modules, and avoid setting a global if an
|
||
// AMD loader is present. jQuery is a special case. For more information, see
|
||
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
|
||
if(typeof define==="function"&&define.amd){define("jquery",[],function(){return jQuery;});}var// Map over jQuery in case of overwrite
|
||
_jQuery=window.jQuery,// Map over the $ in case of overwrite
|
||
_$=window.$;jQuery.noConflict=function(deep){if(window.$===jQuery){window.$=_$;}if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery;}return jQuery;};// Expose jQuery and $ identifiers, even in
|
||
// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
|
||
// and CommonJS for browser emulators (#13566)
|
||
if(_typeof2(noGlobal)===strundefined){window.jQuery=window.$=jQuery;}return jQuery;});/*! jQuery UI - v1.10.3 - 2013-05-07
|
||
* http://jqueryui.com
|
||
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js
|
||
* Copyright 2013 jQuery Foundation and other contributors Licensed MIT */(function(e,t){function i(t,i){var a,n,r,o=t.nodeName.toLowerCase();return"area"===o?(a=t.parentNode,n=a.name,t.href&&n&&"map"===a.nodeName.toLowerCase()?(r=e("img[usemap=#"+n+"]")[0],!!r&&s(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||i:i)&&s(t);}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility");}).length;}var a=0,n=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t);},i);}):t.apply(this,arguments);};}(e.fn.focus),scrollParent:function scrollParent(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return /(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"));}).eq(0):this.parents().filter(function(){return /(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"));}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t;},zIndex:function zIndex(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var s,a,n=e(this[0]);n.length&&n[0]!==document;){if(s=n.css("position"),("absolute"===s||"relative"===s||"fixed"===s)&&(a=parseInt(n.css("zIndex"),10),!isNaN(a)&&0!==a))return a;n=n.parent();}return 0;},uniqueId:function uniqueId(){return this.each(function(){this.id||(this.id="ui-id-"+ ++a);});},removeUniqueId:function removeUniqueId(){return this.each(function(){n.test(this.id)&&e(this).removeAttr("id");});}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t);};}):function(t,i,s){return!!e.data(t,s[3]);},focusable:function focusable(t){return i(t,!isNaN(e.attr(t,"tabindex")));},tabbable:function tabbable(t){var s=e.attr(t,"tabindex"),a=isNaN(s);return(a||s>=0)&&i(t,!a);}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(i,s){function a(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0);}),i;}var n="Width"===s?["Left","Right"]:["Top","Bottom"],r=s.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+s]=function(i){return i===t?o["inner"+s].call(this):this.each(function(){e(this).css(r,a(this,i)+"px");});},e.fn["outer"+s]=function(t,i){return"number"!=typeof t?o["outer"+s].call(this,t):this.each(function(){e(this).css(r,a(this,t,!0,i)+"px");});};}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e));}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this);};}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function disableSelection(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault();});},enableSelection:function enableSelection(){return this.unbind(".ui-disableSelection");}}),e.extend(e.ui,{plugin:{add:function add(t,i,s){var a,n=e.ui[t].prototype;for(a in s){n.plugins[a]=n.plugins[a]||[],n.plugins[a].push([i,s[a]]);}},call:function call(e,t,i){var s,a=e.plugins[t];if(a&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(s=0;a.length>s;s++){e.options[a[s][0]]&&a[s][1].apply(e.element,i);}}},hasScroll:function hasScroll(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",a=!1;return t[s]>0?!0:(t[s]=1,a=t[s]>0,t[s]=0,a);}});})(jQuery);(function(e,t){var i=0,s=Array.prototype.slice,n=e.cleanData;e.cleanData=function(t){for(var i,s=0;null!=(i=t[s]);s++){try{e(i).triggerHandler("remove");}catch(a){}}n(t);},e.widget=function(i,s,n){var a,r,o,h,l={},u=i.split(".")[0];i=i.split(".")[1],a=u+"-"+i,n||(n=s,s=e.Widget),e.expr[":"][a.toLowerCase()]=function(t){return!!e.data(t,a);},e[u]=e[u]||{},r=e[u][i],o=e[u][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new o(e,i);},e.extend(o,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),h=new s(),h.options=e.widget.extend({},h.options),e.each(n,function(i,n){return e.isFunction(n)?(l[i]=function(){var e=function e(){return s.prototype[i].apply(this,arguments);},t=function t(e){return s.prototype[i].apply(this,e);};return function(){var i,s=this._super,a=this._superApply;return this._super=e,this._superApply=t,i=n.apply(this,arguments),this._super=s,this._superApply=a,i;};}(),t):(l[i]=n,t);}),o.prototype=e.widget.extend(h,{widgetEventPrefix:r?h.widgetEventPrefix:i},l,{constructor:o,namespace:u,widgetName:i,widgetFullName:a}),r?(e.each(r._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto);}),delete r._childConstructors):s._childConstructors.push(o),e.widget.bridge(i,o);},e.widget.extend=function(i){for(var n,a,r=s.call(arguments,1),o=0,h=r.length;h>o;o++){for(n in r[o]){a=r[o][n],r[o].hasOwnProperty(n)&&a!==t&&(i[n]=e.isPlainObject(a)?e.isPlainObject(i[n])?e.widget.extend({},i[n],a):e.widget.extend({},a):a);}}return i;},e.widget.bridge=function(i,n){var a=n.prototype.widgetFullName||i;e.fn[i]=function(r){var o="string"==typeof r,h=s.call(arguments,1),l=this;return r=!o&&h.length?e.widget.extend.apply(null,[r].concat(h)):r,o?this.each(function(){var s,n=e.data(this,a);return n?e.isFunction(n[r])&&"_"!==r.charAt(0)?(s=n[r].apply(n,h),s!==n&&s!==t?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):t):e.error("no such method '"+r+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+r+"'");}):this.each(function(){var t=e.data(this,a);t?t.option(r||{})._init():e.data(this,a,new n(r,this));}),l;};},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function _createWidget(t,s){s=e(s||this.defaultElement||this)[0],this.element=e(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),s!==this&&(e.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function remove(e){e.target===s&&this.destroy();}}),this.document=e(s.style?s.ownerDocument:s.document||s),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init();},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function destroy(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus");},_destroy:e.noop,widget:function widget(){return this.element;},option:function option(i,s){var n,a,r,o=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(o={},n=i.split("."),i=n.shift(),n.length){for(a=o[i]=e.widget.extend({},this.options[i]),r=0;n.length-1>r;r++){a[n[r]]=a[n[r]]||{},a=a[n[r]];}if(i=n.pop(),s===t)return a[i]===t?null:a[i];a[i]=s;}else{if(s===t)return this.options[i]===t?null:this.options[i];o[i]=s;}return this._setOptions(o),this;},_setOptions:function _setOptions(e){var t;for(t in e){this._setOption(t,e[t]);}return this;},_setOption:function _setOption(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this;},enable:function enable(){return this._setOption("disabled",!1);},disable:function disable(){return this._setOption("disabled",!0);},_on:function _on(i,s,n){var a,r=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=a=e(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,a=this.widget()),e.each(n,function(n,o){function h(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?r[o]:o).apply(r,arguments):t;}"string"!=typeof o&&(h.guid=o.guid=o.guid||h.guid||e.guid++);var l=n.match(/^(\w+)\s*(.*)$/),u=l[1]+r.eventNamespace,c=l[2];c?a.delegate(c,u,h):s.bind(u,h);});},_off:function _off(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t);},_delay:function _delay(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments);}var s=this;return setTimeout(i,t||0);},_hoverable:function _hoverable(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function mouseenter(t){e(t.currentTarget).addClass("ui-state-hover");},mouseleave:function mouseleave(t){e(t.currentTarget).removeClass("ui-state-hover");}});},_focusable:function _focusable(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function focusin(t){e(t.currentTarget).addClass("ui-state-focus");},focusout:function focusout(t){e(t.currentTarget).removeClass("ui-state-focus");}});},_trigger:function _trigger(t,i,s){var n,a,r=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a){n in i||(i[n]=a[n]);}return this.element.trigger(i,s),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented());}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var r,o=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),r=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),r&&e.effects&&e.effects.effect[o]?s[t](n):o!==t&&s[o]?s[o](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i();});};});})(jQuery);(function(e){var t=!1;e(document).mouseup(function(){t=!1;}),e.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function _mouseInit(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e);}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined;}),this.started=!1;},_mouseDestroy:function _mouseDestroy(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);},_mouseDown:function _mouseDown(i){if(!t){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,a="string"==typeof this.options.cancel&&i.target.nodeName?e(i.target).closest(this.options.cancel).length:!1;return n&&!a&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0;},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===e.data(i.target,this.widgetName+".preventClickEvent")&&e.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return s._mouseMove(e);},this._mouseUpDelegate=function(e){return s._mouseUp(e);},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),t=!0,!0)):!0;}},_mouseMove:function _mouseMove(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted);},_mouseUp:function _mouseUp(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1;},_mouseDistanceMet:function _mouseDistanceMet(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance;},_mouseDelayMet:function _mouseDelayMet(){return this.mouseDelayMet;},_mouseStart:function _mouseStart(){},_mouseDrag:function _mouseDrag(){},_mouseStop:function _mouseStop(){},_mouseCapture:function _mouseCapture(){return!0;}});})(jQuery);(function(t,e){function i(t,e,i){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?i/100:1)];}function s(e,i){return parseInt(t.css(e,i),10)||0;}function n(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()};}t.ui=t.ui||{};var a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,c=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function scrollbarWidth(){if(a!==e)return a;var i,s,n=t("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=n.children()[0];return t("body").append(n),i=o.offsetWidth,n.css("overflow","scroll"),s=o.offsetWidth,i===s&&(s=n[0].clientWidth),n.remove(),a=i-s;},getScrollInfo:function getScrollInfo(e){var i=e.isWindow?"":e.element.css("overflow-x"),s=e.isWindow?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,a="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:a?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0};},getWithinInfo:function getWithinInfo(e){var i=t(e||window),s=t.isWindow(i[0]);return{element:i,isWindow:s,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s?i.width():i.outerWidth(),height:s?i.height():i.outerHeight()};}},t.fn.position=function(e){if(!e||!e.of)return f.apply(this,arguments);e=t.extend({},e);var a,p,m,g,v,b,_=t(e.of),y=t.position.getWithinInfo(e.within),w=t.position.getScrollInfo(y),x=(e.collision||"flip").split(" "),k={};return b=n(_),_[0].preventDefault&&(e.at="left top"),p=b.width,m=b.height,g=b.offset,v=t.extend({},g),t.each(["my","at"],function(){var t,i,s=(e[this]||"").split(" ");1===s.length&&(s=l.test(s[0])?s.concat(["center"]):c.test(s[0])?["center"].concat(s):["center","center"]),s[0]=l.test(s[0])?s[0]:"center",s[1]=c.test(s[1])?s[1]:"center",t=u.exec(s[0]),i=u.exec(s[1]),k[this]=[t?t[0]:0,i?i[0]:0],e[this]=[d.exec(s[0])[0],d.exec(s[1])[0]];}),1===x.length&&(x[1]=x[0]),"right"===e.at[0]?v.left+=p:"center"===e.at[0]&&(v.left+=p/2),"bottom"===e.at[1]?v.top+=m:"center"===e.at[1]&&(v.top+=m/2),a=i(k.at,p,m),v.left+=a[0],v.top+=a[1],this.each(function(){var n,l,c=t(this),u=c.outerWidth(),d=c.outerHeight(),f=s(this,"marginLeft"),b=s(this,"marginTop"),D=u+f+s(this,"marginRight")+w.width,T=d+b+s(this,"marginBottom")+w.height,C=t.extend({},v),M=i(k.my,c.outerWidth(),c.outerHeight());"right"===e.my[0]?C.left-=u:"center"===e.my[0]&&(C.left-=u/2),"bottom"===e.my[1]?C.top-=d:"center"===e.my[1]&&(C.top-=d/2),C.left+=M[0],C.top+=M[1],t.support.offsetFractions||(C.left=h(C.left),C.top=h(C.top)),n={marginLeft:f,marginTop:b},t.each(["left","top"],function(i,s){t.ui.position[x[i]]&&t.ui.position[x[i]][s](C,{targetWidth:p,targetHeight:m,elemWidth:u,elemHeight:d,collisionPosition:n,collisionWidth:D,collisionHeight:T,offset:[a[0]+M[0],a[1]+M[1]],my:e.my,at:e.at,within:y,elem:c});}),e.using&&(l=function l(t){var i=g.left-C.left,s=i+p-u,n=g.top-C.top,a=n+m-d,h={target:{element:_,left:g.left,top:g.top,width:p,height:m},element:{element:c,left:C.left,top:C.top,width:u,height:d},horizontal:0>s?"left":i>0?"right":"center",vertical:0>a?"top":n>0?"bottom":"middle"};u>p&&p>r(i+s)&&(h.horizontal="center"),d>m&&m>r(n+a)&&(h.vertical="middle"),h.important=o(r(i),r(s))>o(r(n),r(a))?"horizontal":"vertical",e.using.call(this,t,h);}),c.offset(t.extend(C,{using:l}));});},t.ui.position={fit:{left:function left(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left);},top:function top(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top);}},flip:{left:function left(t,e){var i,s,n=e.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-o-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-o-a,(0>i||r(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>r(s))&&(t.left+=d+p+f));},top:function top(t,e){var i,s,n=e.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-o-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(s=t.top+p+f+m+e.collisionHeight-o-a,t.top+p+f+m>c&&(0>s||r(c)>s)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,t.top+p+f+m>u&&(i>0||u>r(i))&&(t.top+=p+f+m));}},flipfit:{left:function left(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments);},top:function top(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments);}}},function(){var e,i,s,n,a,o=document.getElementsByTagName("body")[0],r=document.createElement("div");e=document.createElement(o?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&t.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(a in s){e.style[a]=s[a];}e.appendChild(r),i=o||document.documentElement,i.insertBefore(e,i.firstChild),r.style.cssText="position: absolute; left: 10.7432222px;",n=t(r).offset().left,t.support.offsetFractions=n>10&&11>n,e.innerHTML="",i.removeChild(e);}();})(jQuery);(function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function _create(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit();},_destroy:function _destroy(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy();},_mouseCapture:function _mouseCapture(t){var i=this.options;return this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body");}),!0):!1);},_mouseStart:function _mouseStart(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0);},_mouseDrag:function _mouseDrag(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position;}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1;},_mouseStop:function _mouseStop(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear();}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1;},_mouseUp:function _mouseUp(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this);}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t);},cancel:function cancel(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this;},_getHandle:function _getHandle(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0;},_createHelper:function _createHelper(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s;},_adjustOffsetFromHelper:function _adjustOffsetFromHelper(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top);},_getParentOffset:function _getParentOffset(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function _getRelativeOffset(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}return{top:0,left:0};},_cacheMargins:function _cacheMargins(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0};},_cacheHelperProportions:function _cacheHelperProportions(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function _setContainment(){var t,i,s,n=this.options;return n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===n.containment?(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):n.containment.constructor===Array?(this.containment=n.containment,undefined):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),undefined):(this.containment=null,undefined);},_convertPositionTo:function _convertPositionTo(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:n.scrollTop(),left:n.scrollLeft()}),{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*s};},_generatePosition:function _generatePosition(t){var i,s,n,a,o=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=t.pageX,l=t.pageY;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)};},_clear:function _clear(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1;},_trigger:function _trigger(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,s);},plugins:{},_uiHash:function _uiHash(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs};}}),e.ui.plugin.add("draggable","connectToSortable",{start:function start(t,i){var s=e(this).data("ui-draggable"),n=s.options,a=e.extend({},i,{item:s.element});s.sortables=[],e(n.connectToSortable).each(function(){var i=e.data(this,"ui-sortable");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,a));});},stop:function stop(t,i){var s=e(this).data("ui-draggable"),n=e.extend({},i,{item:s.element});e.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,n));});},drag:function drag(t,i){var s=e(this).data("ui-draggable"),n=this;e.each(s.sortables,function(){var a=!1,o=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(a=!0,e.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(o.instance.element[0],this.instance.element[0])&&(a=!1),a;})),a?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0];},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",t),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",t),s.dropped=!1);});}}),e.ui.plugin.add("draggable","cursor",{start:function start(){var t=e("body"),i=e(this).data("ui-draggable").options;t.css("cursor")&&(i._cursor=t.css("cursor")),t.css("cursor",i.cursor);},stop:function stop(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor);}}),e.ui.plugin.add("draggable","opacity",{start:function start(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity);},stop:function stop(t,i){var s=e(this).data("ui-draggable").options;s._opacity&&e(i.helper).css("opacity",s._opacity);}}),e.ui.plugin.add("draggable","scroll",{start:function start(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset());},drag:function drag(t){var i=e(this).data("ui-draggable"),s=i.options,n=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-t.pageY<s.scrollSensitivity?i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop+s.scrollSpeed:t.pageY-i.overflowOffset.top<s.scrollSensitivity&&(i.scrollParent[0].scrollTop=n=i.scrollParent[0].scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-t.pageX<s.scrollSensitivity?i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft+s.scrollSpeed:t.pageX-i.overflowOffset.left<s.scrollSensitivity&&(i.scrollParent[0].scrollLeft=n=i.scrollParent[0].scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(t.pageY-e(document).scrollTop()<s.scrollSensitivity?n=e(document).scrollTop(e(document).scrollTop()-s.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<s.scrollSensitivity&&(n=e(document).scrollTop(e(document).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(t.pageX-e(document).scrollLeft()<s.scrollSensitivity?n=e(document).scrollLeft(e(document).scrollLeft()-s.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<s.scrollSensitivity&&(n=e(document).scrollLeft(e(document).scrollLeft()+s.scrollSpeed)))),n!==!1&&e.ui.ddmanager&&!s.dropBehaviour&&e.ui.ddmanager.prepareOffsets(i,t);}}),e.ui.plugin.add("draggable","snap",{start:function start(){var t=e(this).data("ui-draggable"),i=t.options;t.snapElements=[],e(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=e(this),s=i.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:s.top,left:s.left});});},drag:function drag(t,i){var s,n,a,o,r,h,l,u,c,d,p=e(this).data("ui-draggable"),f=p.options,m=f.snapTolerance,g=i.offset.left,v=g+p.helperProportions.width,b=i.offset.top,y=b+p.helperProportions.height;for(c=p.snapElements.length-1;c>=0;c--){r=p.snapElements[c].left,h=r+p.snapElements[c].width,l=p.snapElements[c].top,u=l+p.snapElements[c].height,r-m>v||g>h+m||l-m>y||b>u+m||!e.contains(p.snapElements[c].item.ownerDocument,p.snapElements[c].item)?(p.snapElements[c].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(s=m>=Math.abs(l-y),n=m>=Math.abs(u-b),a=m>=Math.abs(r-v),o=m>=Math.abs(h-g),s&&(i.position.top=p._convertPositionTo("relative",{top:l-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h}).left-p.margins.left)),d=s||n||a||o,"outer"!==f.snapMode&&(s=m>=Math.abs(l-b),n=m>=Math.abs(u-y),a=m>=Math.abs(r-g),o=m>=Math.abs(h-v),s&&(i.position.top=p._convertPositionTo("relative",{top:l,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u-p.helperProportions.height,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[c].snapping&&(s||n||a||o||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=s||n||a||o||d);}}}),e.ui.plugin.add("draggable","stack",{start:function start(){var t,i=this.data("ui-draggable").options,s=e.makeArray(e(i.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0);});s.length&&(t=parseInt(e(s[0]).css("zIndex"),10)||0,e(s).each(function(i){e(this).css("zIndex",t+i);}),this.css("zIndex",t+s.length));}}),e.ui.plugin.add("draggable","zIndex",{start:function start(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex);},stop:function stop(t,i){var s=e(this).data("ui-draggable").options;s._zIndex&&e(i.helper).css("zIndex",s._zIndex);}});})(jQuery);(function(e){function t(e,t,i){return e>t&&t+i>e;}e.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function _create(){var t=this.options,i=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(i)?i:function(e){return e.is(i);},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable");},_destroy:function _destroy(){for(var t=0,i=e.ui.ddmanager.droppables[this.options.scope];i.length>t;t++){i[t]===this&&i.splice(t,1);}this.element.removeClass("ui-droppable ui-droppable-disabled");},_setOption:function _setOption(t,i){"accept"===t&&(this.accept=e.isFunction(i)?i:function(e){return e.is(i);}),e.Widget.prototype._setOption.apply(this,arguments);},_activate:function _activate(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i));},_deactivate:function _deactivate(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i));},_over:function _over(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)));},_out:function _out(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)));},_drop:function _drop(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===s.options.scope&&t.accept.call(t.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(n=!0,!1):undefined;}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1;},ui:function ui(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs};}}),e.ui.intersect=function(e,i,s){if(!i.offset)return!1;var n,a,o=(e.positionAbs||e.position.absolute).left,r=o+e.helperProportions.width,h=(e.positionAbs||e.position.absolute).top,l=h+e.helperProportions.height,u=i.offset.left,c=u+i.proportions.width,d=i.offset.top,p=d+i.proportions.height;switch(s){case"fit":return o>=u&&c>=r&&h>=d&&p>=l;case"intersect":return o+e.helperProportions.width/2>u&&c>r-e.helperProportions.width/2&&h+e.helperProportions.height/2>d&&p>l-e.helperProportions.height/2;case"pointer":return n=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,a=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(a,d,i.proportions.height)&&t(n,u,i.proportions.width);case"touch":return(h>=d&&p>=h||l>=d&&p>=l||d>h&&l>p)&&(o>=u&&c>=o||r>=u&&c>=r||u>o&&r>c);default:return!1;}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function prepareOffsets(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++){if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++){if(r[n]===a[s].element[0]){a[s].proportions.height=0;continue e;}}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions={width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight});}}},drop:function drop(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)));}),s;},dragStart:function dragStart(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i);});},drag:function drag(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===n;}),a.length&&(s=e.data(a[0],"ui-droppable"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)));}});},dragStop:function dragStop(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i);}};})(jQuery);(function(e){function t(e){return parseInt(e,10)||0;}function i(e){return!isNaN(parseInt(e,10));}e.widget("ui.resizable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function _create(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++){s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);}this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles){this.handles[i].constructor===String&&(this.handles[i]=e(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),e(this.handles[i]).length;}},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se");}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show());}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide());})),this._mouseInit();},_destroy:function _destroy(){this._mouseDestroy();var t,i=function i(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove();};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this;},_mouseCapture:function _mouseCapture(t){var i,s,n=!1;for(i in this.handles){s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);}return!this.options.disabled&&n;},_mouseStart:function _mouseStart(i){var s,n,a,o=this.options,r=this.element.position(),h=this.element;return this.resizing=!0,/absolute/.test(h.css("position"))?h.css({position:"absolute",top:h.css("top"),left:h.css("left")}):h.is(".ui-draggable")&&h.css({position:"absolute",top:r.top,left:r.left}),this._renderProxy(),s=t(this.helper.css("left")),n=t(this.helper.css("top")),o.containment&&(s+=e(o.containment).scrollLeft()||0,n+=e(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:s,top:n},this.size=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalSize=this._helper?{width:h.outerWidth(),height:h.outerHeight()}:{width:h.width(),height:h.height()},this.originalPosition={left:s,top:n},this.sizeDiff={width:h.outerWidth()-h.width(),height:h.outerHeight()-h.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,a=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===a?this.axis+"-resize":a),h.addClass("ui-resizable-resizing"),this._propagate("start",i),!0;},_mouseDrag:function _mouseDrag(t){var i,s=this.helper,n={},a=this.originalMousePosition,o=this.axis,r=this.position.top,h=this.position.left,l=this.size.width,u=this.size.height,c=t.pageX-a.left||0,d=t.pageY-a.top||0,p=this._change[o];return p?(i=p.apply(this,[t,c,d]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),this.position.top!==r&&(n.top=this.position.top+"px"),this.position.left!==h&&(n.left=this.position.left+"px"),this.size.width!==l&&(n.width=this.size.width+"px"),this.size.height!==u&&(n.height=this.size.height+"px"),s.css(n),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(n)||this._trigger("resize",t,this.ui()),!1):!1;},_mouseStop:function _mouseStop(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&e.ui.hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1;},_updateVirtualBoundaries:function _updateVirtualBoundaries(e){var t,s,n,a,o,r=this.options;o={minWidth:i(r.minWidth)?r.minWidth:0,maxWidth:i(r.maxWidth)?r.maxWidth:1/0,minHeight:i(r.minHeight)?r.minHeight:0,maxHeight:i(r.maxHeight)?r.maxHeight:1/0},(this._aspectRatio||e)&&(t=o.minHeight*this.aspectRatio,n=o.minWidth/this.aspectRatio,s=o.maxHeight*this.aspectRatio,a=o.maxWidth/this.aspectRatio,t>o.minWidth&&(o.minWidth=t),n>o.minHeight&&(o.minHeight=n),o.maxWidth>s&&(o.maxWidth=s),o.maxHeight>a&&(o.maxHeight=a)),this._vBoundaries=o;},_updateCache:function _updateCache(e){this.offset=this.helper.offset(),i(e.left)&&(this.position.left=e.left),i(e.top)&&(this.position.top=e.top),i(e.height)&&(this.size.height=e.height),i(e.width)&&(this.size.width=e.width);},_updateRatio:function _updateRatio(e){var t=this.position,s=this.size,n=this.axis;return i(e.height)?e.width=e.height*this.aspectRatio:i(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===n&&(e.left=t.left+(s.width-e.width),e.top=null),"nw"===n&&(e.top=t.top+(s.height-e.height),e.left=t.left+(s.width-e.width)),e;},_respectSize:function _respectSize(e){var t=this._vBoundaries,s=this.axis,n=i(e.width)&&t.maxWidth&&t.maxWidth<e.width,a=i(e.height)&&t.maxHeight&&t.maxHeight<e.height,o=i(e.width)&&t.minWidth&&t.minWidth>e.width,r=i(e.height)&&t.minHeight&&t.minHeight>e.height,h=this.originalPosition.left+this.originalSize.width,l=this.position.top+this.size.height,u=/sw|nw|w/.test(s),c=/nw|ne|n/.test(s);return o&&(e.width=t.minWidth),r&&(e.height=t.minHeight),n&&(e.width=t.maxWidth),a&&(e.height=t.maxHeight),o&&u&&(e.left=h-t.minWidth),n&&u&&(e.left=h-t.maxWidth),r&&c&&(e.top=l-t.minHeight),a&&c&&(e.top=l-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e;},_proportionallyResize:function _proportionallyResize(){if(this._proportionallyResizeElements.length){var e,t,i,s,n,a=this.helper||this.element;for(e=0;this._proportionallyResizeElements.length>e;e++){if(n=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],i=[n.css("borderTopWidth"),n.css("borderRightWidth"),n.css("borderBottomWidth"),n.css("borderLeftWidth")],s=[n.css("paddingTop"),n.css("paddingRight"),n.css("paddingBottom"),n.css("paddingLeft")],t=0;i.length>t;t++){this.borderDif[t]=(parseInt(i[t],10)||0)+(parseInt(s[t],10)||0);}n.css({height:a.height()-this.borderDif[0]-this.borderDif[2]||0,width:a.width()-this.borderDif[1]-this.borderDif[3]||0});}}},_renderProxy:function _renderProxy(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element;},_change:{e:function e(_e,t){return{width:this.originalSize.width+t};},w:function w(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t};},n:function n(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i};},s:function s(e,t,i){return{height:this.originalSize.height+i};},se:function se(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]));},sw:function sw(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]));},ne:function ne(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]));},nw:function nw(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]));}},_propagate:function _propagate(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui());},plugins:{},ui:function ui(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition};}}),e.ui.plugin.add("resizable","animate",{stop:function stop(t){var i=e(this).data("ui-resizable"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&e.ui.hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function step(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t);}});}}),e.ui.plugin.add("resizable","containment",{start:function start(){var i,s,n,a,o,r,h,l=e(this).data("ui-resizable"),u=l.options,c=l.element,d=u.containment,p=d instanceof e?d.get(0):/parent/.test(d)?c.parent().get(0):d;p&&(l.containerElement=e(p),/document/.test(d)||d===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(i=e(p),s=[],e(["Top","Right","Left","Bottom"]).each(function(e,n){s[e]=t(i.css("padding"+n));}),l.containerOffset=i.offset(),l.containerPosition=i.position(),l.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},n=l.containerOffset,a=l.containerSize.height,o=l.containerSize.width,r=e.ui.hasScroll(p,"left")?p.scrollWidth:o,h=e.ui.hasScroll(p)?p.scrollHeight:a,l.parentData={element:p,left:n.left,top:n.top,width:r,height:h}));},resize:function resize(t){var i,s,n,a,o=e(this).data("ui-resizable"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,c={top:0,left:0},d=o.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(c=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-c.left),u&&(o.size.height=o.size.width/o.aspectRatio),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio),o.position.top=o._helper?h.top:0),o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top,i=Math.abs((o._helper?o.offset.left-c.left:o.offset.left-c.left)+o.sizeDiff.width),s=Math.abs((o._helper?o.offset.top-c.top:o.offset.top-h.top)+o.sizeDiff.height),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a&&(i-=o.parentData.left),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio));},stop:function stop(){var t=e(this).data("ui-resizable"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l});}}),e.ui.plugin.add("resizable","alsoResize",{start:function start(){var t=e(this).data("ui-resizable"),i=t.options,s=function s(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)});});};"object"!=_typeof2(i.alsoResize)||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e);});},resize:function resize(t,i){var s=e(this).data("ui-resizable"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0},h=function h(t,s){e(t).each(function(){var t=e(this),n=e(this).data("ui-resizable-alsoresize"),a={},o=s&&s.length?s:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var i=(n[t]||0)+(r[t]||0);i&&i>=0&&(a[t]=i||null);}),t.css(a);});};"object"!=_typeof2(n.alsoResize)||n.alsoResize.nodeType?h(n.alsoResize):e.each(n.alsoResize,function(e,t){h(e,t);});},stop:function stop(){e(this).removeData("resizable-alsoresize");}}),e.ui.plugin.add("resizable","ghost",{start:function start(){var t=e(this).data("ui-resizable"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper);},resize:function resize(){var t=e(this).data("ui-resizable");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width});},stop:function stop(){var t=e(this).data("ui-resizable");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0));}}),e.ui.plugin.add("resizable","grid",{resize:function resize(){var t=e(this).data("ui-resizable"),i=t.options,s=t.size,n=t.originalSize,a=t.originalPosition,o=t.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,h=r[0]||1,l=r[1]||1,u=Math.round((s.width-n.width)/h)*h,c=Math.round((s.height-n.height)/l)*l,d=n.width+u,p=n.height+c,f=i.maxWidth&&d>i.maxWidth,m=i.maxHeight&&p>i.maxHeight,g=i.minWidth&&i.minWidth>d,v=i.minHeight&&i.minHeight>p;i.grid=r,g&&(d+=h),v&&(p+=l),f&&(d-=h),m&&(p-=l),/^(se|s|e)$/.test(o)?(t.size.width=d,t.size.height=p):/^(ne)$/.test(o)?(t.size.width=d,t.size.height=p,t.position.top=a.top-c):/^(sw)$/.test(o)?(t.size.width=d,t.size.height=p,t.position.left=a.left-u):(t.size.width=d,t.size.height=p,t.position.top=a.top-c,t.position.left=a.left-u);}});})(jQuery);(function(e){e.widget("ui.selectable",e.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function _create(){var t,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")});});},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>");},_destroy:function _destroy(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy();},_mouseStart:function _mouseStart(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}));}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):undefined;}));},_mouseDrag:function _mouseDrag(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))));}),!1;}},_mouseStop:function _mouseStop(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element});}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element});}),this._trigger("stop",t),this.helper.remove(),!1;}});})(jQuery);(function(t){function e(t,e,i){return t>e&&e+i>t;}function i(t){return /left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"));}t.widget("ui.sortable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function _create(){var t=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===t.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0;},_destroy:function _destroy(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--){this.items[t].item.removeData(this.widgetName+"-item");}return this;},_setOption:function _setOption(e,i){"disabled"===e?(this.options[e]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):t.Widget.prototype._setOption.apply(this,arguments);},_mouseCapture:function _mouseCapture(e,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,a.widgetName+"-item")===a?(s=t(this),!1):undefined;}),t.data(e.target,a.widgetName+"-item")===a&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0);}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1);},_mouseStart:function _mouseStart(e,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=t("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--){this.containers[n]._trigger("activate",e,this._uiHash(this));}return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(e),!0;},_mouseDrag:function _mouseDrag(e){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:e.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:e.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(e.pageY-t(document).scrollTop()<o.scrollSensitivity?r=t(document).scrollTop(t(document).scrollTop()-o.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<o.scrollSensitivity&&(r=t(document).scrollTop(t(document).scrollTop()+o.scrollSpeed)),e.pageX-t(document).scrollLeft()<o.scrollSensitivity?r=t(document).scrollLeft(t(document).scrollLeft()-o.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<o.scrollSensitivity&&(r=t(document).scrollLeft(t(document).scrollLeft()+o.scrollSpeed))),r!==!1&&t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--){if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break;}}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1;},_mouseStop:function _mouseStop(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(e);});}else this._clear(e,i);return!1;}},cancel:function cancel(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--){this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0);}}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this;},serialize:function serialize(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]));}),!s.length&&e.key&&s.push(e.key+"="),s.join("&");},toArray:function toArray(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"");}),s;},_intersectsWith:function _intersectsWith(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=t.left,o=a+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>a&&o>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2;},_intersectsWithPointer:function _intersectsWithPointer(t){var i="x"===this.options.axis||e(this.positionAbs.top+this.offset.click.top,t.top,t.height),s="y"===this.options.axis||e(this.positionAbs.left+this.offset.click.left,t.left,t.width),n=i&&s,a=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return n?this.floating?o&&"right"===o||"down"===a?2:1:a&&("down"===a?2:1):!1;},_intersectsWithSides:function _intersectsWithSides(t){var i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),s=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&s||"left"===a&&!s:n&&("down"===n&&i||"up"===n&&!i);},_getDragVerticalDirection:function _getDragVerticalDirection(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up");},_getDragHorizontalDirection:function _getDragHorizontalDirection(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left");},refresh:function refresh(t){return this._refreshItems(t),this.refreshPositions(),this;},_connectWith:function _connectWith(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith;},_getItemsAsjQuery:function _getItemsAsjQuery(e){var i,s,n,a,o=[],r=[],h=this._connectWith();if(h&&e)for(i=h.length-1;i>=0;i--){for(n=t(h[i]),s=n.length-1;s>=0;s--){a=t.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&r.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);}}for(r.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=r.length-1;i>=0;i--){r[i][0].each(function(){o.push(this);});}return t(o);},_removeCurrentsFromItems:function _removeCurrentsFromItems(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++){if(e[i]===t.item[0])return!1;}return!0;});},_refreshItems:function _refreshItems(e){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--){for(n=t(d[i]),s=n.length-1;s>=0;s--){a=t.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(u.push([t.isFunction(a.options.items)?a.options.items.call(a.element[0],e,{item:this.currentItem}):t(a.options.items,a.element),a]),this.containers.push(a));}}for(i=u.length-1;i>=0;i--){for(o=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++){h=t(r[s]),h.data(this.widgetName+"-item",o),c.push({item:h,instance:o,width:0,height:0,left:0,top:0});}}},refreshPositions:function refreshPositions(e){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--){s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.top);}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--){a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();}return this;},_createPlaceholder:function _createPlaceholder(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function element(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]).addClass(i||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?e.currentItem.children().each(function(){t("<td> </td>",e.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(n);}):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n;},update:function update(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)));}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder);},_contactContainers:function _contactContainers(s){var n,a,o,r,h,l,c,u,d,p,f=null,m=null;for(n=this.containers.length-1;n>=0;n--){if(!t.contains(this.currentItem[0],this.containers[n].element[0]))if(this._intersectsWith(this.containers[n].containerCache)){if(f&&t.contains(this.containers[n].element[0],f.element[0]))continue;f=this.containers[n],m=n;}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",s,this._uiHash(this)),this.containers[n].containerCache.over=0);}if(f)if(1===this.containers.length)this.containers[m].containerCache.over||(this.containers[m]._trigger("over",s,this._uiHash(this)),this.containers[m].containerCache.over=1);else{for(o=1e4,r=null,p=f.floating||i(this.currentItem),h=p?"left":"top",l=p?"width":"height",c=this.positionAbs[h]+this.offset.click[h],a=this.items.length-1;a>=0;a--){t.contains(this.containers[m].element[0],this.items[a].item[0])&&this.items[a].item[0]!==this.currentItem[0]&&(!p||e(this.positionAbs.top+this.offset.click.top,this.items[a].top,this.items[a].height))&&(u=this.items[a].item.offset()[h],d=!1,Math.abs(u-c)>Math.abs(u+this.items[a][l]-c)&&(d=!0,u+=this.items[a][l]),o>Math.abs(u-c)&&(o=Math.abs(u-c),r=this.items[a],this.direction=d?"up":"down"));}if(!r&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[m])return;r?this._rearrange(s,r,null,!0):this._rearrange(s,null,this.containers[m].element,!0),this._trigger("change",s,this._uiHash()),this.containers[m]._trigger("change",s,this._uiHash(this)),this.currentContainer=this.containers[m],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[m]._trigger("over",s,this._uiHash(this)),this.containers[m].containerCache.over=1;}},_createHelper:function _createHelper(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s;},_adjustOffsetFromHelper:function _adjustOffsetFromHelper(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top);},_getParentOffset:function _getParentOffset(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)};},_getRelativeOffset:function _getRelativeOffset(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()};}return{top:0,left:0};},_cacheMargins:function _cacheMargins(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0};},_cacheHelperProportions:function _cacheHelperProportions(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()};},_setContainment:function _setContainment(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,t("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,(t("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]);},_convertPositionTo:function _convertPositionTo(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s};},_generatePosition:function _generatePosition(e){var i,s,n=this.options,a=e.pageX,o=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())};},_rearrange:function _rearrange(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s);});},_clear:function _clear(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS){("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");}this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");}else this.currentItem.show();for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside));}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash());}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash());}),s.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this));};}.call(this,this.currentContainer)),s.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this));};}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--){e||s.push(function(t){return function(e){t._trigger("deactivate",e,this._uiHash(this));};}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(function(t){return function(e){t._trigger("out",e,this._uiHash(this));};}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);}if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!e){for(this._trigger("beforeStop",t,this._uiHash()),i=0;s.length>i;i++){s[i].call(this,t);}this._trigger("stop",t,this._uiHash());}return this.fromOutside=!1,!1;}if(e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!e){for(i=0;s.length>i;i++){s[i].call(this,t);}this._trigger("stop",t,this._uiHash());}return this.fromOutside=!1,!0;},_trigger:function _trigger(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel();},_uiHash:function _uiHash(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null};}});})(jQuery);/*!
|
||
* Bootstrap v3.3.0 (http://getbootstrap.com)
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
*/ /*!
|
||
* Generated using the Bootstrap Customizer (http://v3.bootcss.com/customize/?id=035131508a4b1f7c1c5a)
|
||
* Config saved to config.json and https://gist.github.com/035131508a4b1f7c1c5a
|
||
*/if(typeof jQuery==='undefined'){throw new Error('Bootstrap\'s JavaScript requires jQuery');}+function($){var version=$.fn.jquery.split(' ')[0].split('.');if(version[0]<2&&version[1]<9||version[0]==1&&version[1]==9&&version[2]<1){throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher');}}(jQuery);/* ========================================================================
|
||
* Bootstrap: alert.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#alerts
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// ALERT CLASS DEFINITION
|
||
// ======================
|
||
var dismiss='[data-dismiss="alert"]';var Alert=function Alert(el){$(el).on('click',dismiss,this.close);};Alert.VERSION='3.3.0';Alert.TRANSITION_DURATION=150;Alert.prototype.close=function(e){var $this=$(this);var selector=$this.attr('data-target');if(!selector){selector=$this.attr('href');selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,'');// strip for ie7
|
||
}var $parent=$(selector);if(e)e.preventDefault();if(!$parent.length){$parent=$this.closest('.alert');}$parent.trigger(e=$.Event('close.bs.alert'));if(e.isDefaultPrevented())return;$parent.removeClass('in');function removeElement(){// detach from parent, fire event then clean up data
|
||
$parent.detach().trigger('closed.bs.alert').remove();}$.support.transition&&$parent.hasClass('fade')?$parent.one('bsTransitionEnd',removeElement).emulateTransitionEnd(Alert.TRANSITION_DURATION):removeElement();};// ALERT PLUGIN DEFINITION
|
||
// =======================
|
||
function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.alert');if(!data)$this.data('bs.alert',data=new Alert(this));if(typeof option=='string')data[option].call($this);});}var old=$.fn.alert;$.fn.alert=Plugin;$.fn.alert.Constructor=Alert;// ALERT NO CONFLICT
|
||
// =================
|
||
$.fn.alert.noConflict=function(){$.fn.alert=old;return this;};// ALERT DATA-API
|
||
// ==============
|
||
$(document).on('click.bs.alert.data-api',dismiss,Alert.prototype.close);}(jQuery);/* ========================================================================
|
||
* Bootstrap: button.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#buttons
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// BUTTON PUBLIC CLASS DEFINITION
|
||
// ==============================
|
||
var Button=function Button(element,options){this.$element=$(element);this.options=$.extend({},Button.DEFAULTS,options);this.isLoading=false;};Button.VERSION='3.3.0';Button.DEFAULTS={loadingText:'loading...'};Button.prototype.setState=function(state){var d='disabled';var $el=this.$element;var val=$el.is('input')?'val':'html';var data=$el.data();state=state+'Text';if(data.resetText==null)$el.data('resetText',$el[val]());// push to event loop to allow forms to submit
|
||
setTimeout($.proxy(function(){$el[val](data[state]==null?this.options[state]:data[state]);if(state=='loadingText'){this.isLoading=true;$el.addClass(d).attr(d,d);}else if(this.isLoading){this.isLoading=false;$el.removeClass(d).removeAttr(d);}},this),0);};Button.prototype.toggle=function(){var changed=true;var $parent=this.$element.closest('[data-toggle="buttons"]');if($parent.length){var $input=this.$element.find('input');if($input.prop('type')=='radio'){if($input.prop('checked')&&this.$element.hasClass('active'))changed=false;else $parent.find('.active').removeClass('active');}if(changed)$input.prop('checked',!this.$element.hasClass('active')).trigger('change');}else{this.$element.attr('aria-pressed',!this.$element.hasClass('active'));}if(changed)this.$element.toggleClass('active');};// BUTTON PLUGIN DEFINITION
|
||
// ========================
|
||
function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.button');var options=_typeof2(option)=='object'&&option;if(!data)$this.data('bs.button',data=new Button(this,options));if(option=='toggle')data.toggle();else if(option)data.setState(option);});}var old=$.fn.button;$.fn.button=Plugin;$.fn.button.Constructor=Button;// BUTTON NO CONFLICT
|
||
// ==================
|
||
$.fn.button.noConflict=function(){$.fn.button=old;return this;};// BUTTON DATA-API
|
||
// ===============
|
||
$(document).on('click.bs.button.data-api','[data-toggle^="button"]',function(e){var $btn=$(e.target);if(!$btn.hasClass('btn'))$btn=$btn.closest('.btn');Plugin.call($btn,'toggle');e.preventDefault();}).on('focus.bs.button.data-api blur.bs.button.data-api','[data-toggle^="button"]',function(e){$(e.target).closest('.btn').toggleClass('focus',e.type=='focus');});}(jQuery);/* ========================================================================
|
||
* Bootstrap: carousel.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#carousel
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// CAROUSEL CLASS DEFINITION
|
||
// =========================
|
||
var Carousel=function Carousel(element,options){this.$element=$(element);this.$indicators=this.$element.find('.carousel-indicators');this.options=options;this.paused=this.sliding=this.interval=this.$active=this.$items=null;this.options.keyboard&&this.$element.on('keydown.bs.carousel',$.proxy(this.keydown,this));this.options.pause=='hover'&&!('ontouchstart'in document.documentElement)&&this.$element.on('mouseenter.bs.carousel',$.proxy(this.pause,this)).on('mouseleave.bs.carousel',$.proxy(this.cycle,this));};Carousel.VERSION='3.3.0';Carousel.TRANSITION_DURATION=600;Carousel.DEFAULTS={interval:5000,pause:'hover',wrap:true,keyboard:true};Carousel.prototype.keydown=function(e){switch(e.which){case 37:this.prev();break;case 39:this.next();break;default:return;}e.preventDefault();};Carousel.prototype.cycle=function(e){e||(this.paused=false);this.interval&&clearInterval(this.interval);this.options.interval&&!this.paused&&(this.interval=setInterval($.proxy(this.next,this),this.options.interval));return this;};Carousel.prototype.getItemIndex=function(item){this.$items=item.parent().children('.item');return this.$items.index(item||this.$active);};Carousel.prototype.getItemForDirection=function(direction,active){var delta=direction=='prev'?-1:1;var activeIndex=this.getItemIndex(active);var itemIndex=(activeIndex+delta)%this.$items.length;return this.$items.eq(itemIndex);};Carousel.prototype.to=function(pos){var that=this;var activeIndex=this.getItemIndex(this.$active=this.$element.find('.item.active'));if(pos>this.$items.length-1||pos<0)return;if(this.sliding)return this.$element.one('slid.bs.carousel',function(){that.to(pos);});// yes, "slid"
|
||
if(activeIndex==pos)return this.pause().cycle();return this.slide(pos>activeIndex?'next':'prev',this.$items.eq(pos));};Carousel.prototype.pause=function(e){e||(this.paused=true);if(this.$element.find('.next, .prev').length&&$.support.transition){this.$element.trigger($.support.transition.end);this.cycle(true);}this.interval=clearInterval(this.interval);return this;};Carousel.prototype.next=function(){if(this.sliding)return;return this.slide('next');};Carousel.prototype.prev=function(){if(this.sliding)return;return this.slide('prev');};Carousel.prototype.slide=function(type,next){var $active=this.$element.find('.item.active');var $next=next||this.getItemForDirection(type,$active);var isCycling=this.interval;var direction=type=='next'?'left':'right';var fallback=type=='next'?'first':'last';var that=this;if(!$next.length){if(!this.options.wrap)return;$next=this.$element.find('.item')[fallback]();}if($next.hasClass('active'))return this.sliding=false;var relatedTarget=$next[0];var slideEvent=$.Event('slide.bs.carousel',{relatedTarget:relatedTarget,direction:direction});this.$element.trigger(slideEvent);if(slideEvent.isDefaultPrevented())return;this.sliding=true;isCycling&&this.pause();if(this.$indicators.length){this.$indicators.find('.active').removeClass('active');var $nextIndicator=$(this.$indicators.children()[this.getItemIndex($next)]);$nextIndicator&&$nextIndicator.addClass('active');}var slidEvent=$.Event('slid.bs.carousel',{relatedTarget:relatedTarget,direction:direction});// yes, "slid"
|
||
if($.support.transition&&this.$element.hasClass('slide')){$next.addClass(type);$next[0].offsetWidth;// force reflow
|
||
$active.addClass(direction);$next.addClass(direction);$active.one('bsTransitionEnd',function(){$next.removeClass([type,direction].join(' ')).addClass('active');$active.removeClass(['active',direction].join(' '));that.sliding=false;setTimeout(function(){that.$element.trigger(slidEvent);},0);}).emulateTransitionEnd(Carousel.TRANSITION_DURATION);}else{$active.removeClass('active');$next.addClass('active');this.sliding=false;this.$element.trigger(slidEvent);}isCycling&&this.cycle();return this;};// CAROUSEL PLUGIN DEFINITION
|
||
// ==========================
|
||
function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.carousel');var options=$.extend({},Carousel.DEFAULTS,$this.data(),_typeof2(option)=='object'&&option);var action=typeof option=='string'?option:options.slide;if(!data)$this.data('bs.carousel',data=new Carousel(this,options));if(typeof option=='number')data.to(option);else if(action)data[action]();else if(options.interval)data.pause().cycle();});}var old=$.fn.carousel;$.fn.carousel=Plugin;$.fn.carousel.Constructor=Carousel;// CAROUSEL NO CONFLICT
|
||
// ====================
|
||
$.fn.carousel.noConflict=function(){$.fn.carousel=old;return this;};// CAROUSEL DATA-API
|
||
// =================
|
||
var clickHandler=function clickHandler(e){var href;var $this=$(this);var $target=$($this.attr('data-target')||(href=$this.attr('href'))&&href.replace(/.*(?=#[^\s]+$)/,''));// strip for ie7
|
||
if(!$target.hasClass('carousel'))return;var options=$.extend({},$target.data(),$this.data());var slideIndex=$this.attr('data-slide-to');if(slideIndex)options.interval=false;Plugin.call($target,options);if(slideIndex){$target.data('bs.carousel').to(slideIndex);}e.preventDefault();};$(document).on('click.bs.carousel.data-api','[data-slide]',clickHandler).on('click.bs.carousel.data-api','[data-slide-to]',clickHandler);$(window).on('load',function(){$('[data-ride="carousel"]').each(function(){var $carousel=$(this);Plugin.call($carousel,$carousel.data());});});}(jQuery);/* ========================================================================
|
||
* Bootstrap: dropdown.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#dropdowns
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// DROPDOWN CLASS DEFINITION
|
||
// =========================
|
||
var backdrop='.dropdown-backdrop';var toggle='[data-toggle="dropdown"]';var Dropdown=function Dropdown(element){$(element).on('click.bs.dropdown',this.toggle);};Dropdown.VERSION='3.3.0';Dropdown.prototype.toggle=function(e){var $this=$(this);if($this.is('.disabled, :disabled'))return;var $parent=getParent($this);var isActive=$parent.hasClass('open');clearMenus();if(!isActive){if('ontouchstart'in document.documentElement&&!$parent.closest('.navbar-nav').length){// if mobile we use a backdrop because click events don't delegate
|
||
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click',clearMenus);}var relatedTarget={relatedTarget:this};$parent.trigger(e=$.Event('show.bs.dropdown',relatedTarget));if(e.isDefaultPrevented())return;$this.trigger('focus').attr('aria-expanded','true');$parent.toggleClass('open').trigger('shown.bs.dropdown',relatedTarget);}return false;};Dropdown.prototype.keydown=function(e){if(!/(38|40|27|32)/.test(e.which))return;var $this=$(this);e.preventDefault();e.stopPropagation();if($this.is('.disabled, :disabled'))return;var $parent=getParent($this);var isActive=$parent.hasClass('open');if(!isActive&&e.which!=27||isActive&&e.which==27){if(e.which==27)$parent.find(toggle).trigger('focus');return $this.trigger('click');}var desc=' li:not(.divider):visible a';var $items=$parent.find('[role="menu"]'+desc+', [role="listbox"]'+desc);if(!$items.length)return;var index=$items.index(e.target);if(e.which==38&&index>0)index--;// up
|
||
if(e.which==40&&index<$items.length-1)index++;// down
|
||
if(!~index)index=0;$items.eq(index).trigger('focus');};function clearMenus(e){if(e&&e.which===3)return;$(backdrop).remove();$(toggle).each(function(){var $this=$(this);var $parent=getParent($this);var relatedTarget={relatedTarget:this};if(!$parent.hasClass('open'))return;$parent.trigger(e=$.Event('hide.bs.dropdown',relatedTarget));if(e.isDefaultPrevented())return;$this.attr('aria-expanded','false');$parent.removeClass('open').trigger('hidden.bs.dropdown',relatedTarget);});}function getParent($this){var selector=$this.attr('data-target');if(!selector){selector=$this.attr('href');selector=selector&&/#[A-Za-z]/.test(selector)&&selector.replace(/.*(?=#[^\s]*$)/,'');// strip for ie7
|
||
}var $parent=selector&&$(selector);return $parent&&$parent.length?$parent:$this.parent();}// DROPDOWN PLUGIN DEFINITION
|
||
// ==========================
|
||
function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.dropdown');if(!data)$this.data('bs.dropdown',data=new Dropdown(this));if(typeof option=='string')data[option].call($this);});}var old=$.fn.dropdown;$.fn.dropdown=Plugin;$.fn.dropdown.Constructor=Dropdown;// DROPDOWN NO CONFLICT
|
||
// ====================
|
||
$.fn.dropdown.noConflict=function(){$.fn.dropdown=old;return this;};// APPLY TO STANDARD DROPDOWN ELEMENTS
|
||
// ===================================
|
||
$(document).on('click.bs.dropdown.data-api',clearMenus).on('click.bs.dropdown.data-api','.dropdown form',function(e){e.stopPropagation();}).on('click.bs.dropdown.data-api',toggle,Dropdown.prototype.toggle).on('keydown.bs.dropdown.data-api',toggle,Dropdown.prototype.keydown).on('keydown.bs.dropdown.data-api','[role="menu"]',Dropdown.prototype.keydown).on('keydown.bs.dropdown.data-api','[role="listbox"]',Dropdown.prototype.keydown);}(jQuery);/* ========================================================================
|
||
* Bootstrap: modal.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#modals
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// MODAL CLASS DEFINITION
|
||
// ======================
|
||
var Modal=function Modal(element,options){this.options=options;this.$body=$(document.body);this.$element=$(element);this.$backdrop=this.isShown=null;this.scrollbarWidth=0;if(this.options.remote){this.$element.find('.modal-content').load(this.options.remote,$.proxy(function(){this.$element.trigger('loaded.bs.modal');},this));}};Modal.VERSION='3.3.0';Modal.TRANSITION_DURATION=300;Modal.BACKDROP_TRANSITION_DURATION=150;Modal.DEFAULTS={backdrop:true,keyboard:true,show:true};Modal.prototype.toggle=function(_relatedTarget){return this.isShown?this.hide():this.show(_relatedTarget);};Modal.prototype.show=function(_relatedTarget){var that=this;var e=$.Event('show.bs.modal',{relatedTarget:_relatedTarget});this.$element.trigger(e);if(this.isShown||e.isDefaultPrevented())return;this.isShown=true;this.checkScrollbar();this.$body.addClass('modal-open');this.setScrollbar();this.escape();this.$element.on('click.dismiss.bs.modal','[data-dismiss="modal"]',$.proxy(this.hide,this));this.backdrop(function(){var transition=$.support.transition&&that.$element.hasClass('fade');if(!that.$element.parent().length){that.$element.appendTo(that.$body);// don't move modals dom position
|
||
}that.$element.show().scrollTop(0);if(transition){that.$element[0].offsetWidth;// force reflow
|
||
}that.$element.addClass('in').attr('aria-hidden',false);that.enforceFocus();var e=$.Event('shown.bs.modal',{relatedTarget:_relatedTarget});transition?that.$element.find('.modal-dialog')// wait for modal to slide in
|
||
.one('bsTransitionEnd',function(){that.$element.trigger('focus').trigger(e);}).emulateTransitionEnd(Modal.TRANSITION_DURATION):that.$element.trigger('focus').trigger(e);});};Modal.prototype.hide=function(e){if(e)e.preventDefault();e=$.Event('hide.bs.modal');this.$element.trigger(e);if(!this.isShown||e.isDefaultPrevented())return;this.isShown=false;this.escape();$(document).off('focusin.bs.modal');this.$element.removeClass('in').attr('aria-hidden',true).off('click.dismiss.bs.modal');$.support.transition&&this.$element.hasClass('fade')?this.$element.one('bsTransitionEnd',$.proxy(this.hideModal,this)).emulateTransitionEnd(Modal.TRANSITION_DURATION):this.hideModal();};Modal.prototype.enforceFocus=function(){$(document).off('focusin.bs.modal')// guard against infinite focus loop
|
||
.on('focusin.bs.modal',$.proxy(function(e){if(this.$element[0]!==e.target&&!this.$element.has(e.target).length){this.$element.trigger('focus');}},this));};Modal.prototype.escape=function(){if(this.isShown&&this.options.keyboard){this.$element.on('keydown.dismiss.bs.modal',$.proxy(function(e){e.which==27&&this.hide();},this));}else if(!this.isShown){this.$element.off('keydown.dismiss.bs.modal');}};Modal.prototype.hideModal=function(){var that=this;this.$element.hide();this.backdrop(function(){that.$body.removeClass('modal-open');that.resetScrollbar();that.$element.trigger('hidden.bs.modal');});};Modal.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove();this.$backdrop=null;};Modal.prototype.backdrop=function(callback){var that=this;var animate=this.$element.hasClass('fade')?'fade':'';if(this.isShown&&this.options.backdrop){var doAnimate=$.support.transition&&animate;this.$backdrop=$('<div class="modal-backdrop '+animate+'" />').prependTo(this.$element).on('click.dismiss.bs.modal',$.proxy(function(e){if(e.target!==e.currentTarget)return;this.options.backdrop=='static'?this.$element[0].focus.call(this.$element[0]):this.hide.call(this);},this));if(doAnimate)this.$backdrop[0].offsetWidth;// force reflow
|
||
this.$backdrop.addClass('in');if(!callback)return;doAnimate?this.$backdrop.one('bsTransitionEnd',callback).emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION):callback();}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass('in');var callbackRemove=function callbackRemove(){that.removeBackdrop();callback&&callback();};$.support.transition&&this.$element.hasClass('fade')?this.$backdrop.one('bsTransitionEnd',callbackRemove).emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION):callbackRemove();}else if(callback){callback();}};Modal.prototype.checkScrollbar=function(){this.scrollbarWidth=this.measureScrollbar();};Modal.prototype.setScrollbar=function(){var bodyPad=parseInt(this.$body.css('padding-right')||0,10);if(this.scrollbarWidth)this.$body.css('padding-right',bodyPad+this.scrollbarWidth);};Modal.prototype.resetScrollbar=function(){this.$body.css('padding-right','');};Modal.prototype.measureScrollbar=function(){// thx walsh
|
||
if(document.body.clientWidth>=window.innerWidth)return 0;var scrollDiv=document.createElement('div');scrollDiv.className='modal-scrollbar-measure';this.$body.append(scrollDiv);var scrollbarWidth=scrollDiv.offsetWidth-scrollDiv.clientWidth;this.$body[0].removeChild(scrollDiv);return scrollbarWidth;};// MODAL PLUGIN DEFINITION
|
||
// =======================
|
||
function Plugin(option,_relatedTarget){return this.each(function(){var $this=$(this);var data=$this.data('bs.modal');var options=$.extend({},Modal.DEFAULTS,$this.data(),_typeof2(option)=='object'&&option);if(!data)$this.data('bs.modal',data=new Modal(this,options));if(typeof option=='string')data[option](_relatedTarget);else if(options.show)data.show(_relatedTarget);});}var old=$.fn.modal;$.fn.modal=Plugin;$.fn.modal.Constructor=Modal;// MODAL NO CONFLICT
|
||
// =================
|
||
$.fn.modal.noConflict=function(){$.fn.modal=old;return this;};// MODAL DATA-API
|
||
// ==============
|
||
$(document).on('click.bs.modal.data-api','[data-toggle="modal"]',function(e){var $this=$(this);var href=$this.attr('href');var $target=$($this.attr('data-target')||href&&href.replace(/.*(?=#[^\s]+$)/,''));// strip for ie7
|
||
var option=$target.data('bs.modal')?'toggle':$.extend({remote:!/#/.test(href)&&href},$target.data(),$this.data());if($this.is('a'))e.preventDefault();$target.one('show.bs.modal',function(showEvent){if(showEvent.isDefaultPrevented())return;// only register focus restorer if modal will actually get shown
|
||
$target.one('hidden.bs.modal',function(){$this.is(':visible')&&$this.trigger('focus');});});Plugin.call($target,option,this);});}(jQuery);/* ========================================================================
|
||
* Bootstrap: tooltip.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#tooltip
|
||
* Inspired by the original jQuery.tipsy by Jason Frame
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// TOOLTIP PUBLIC CLASS DEFINITION
|
||
// ===============================
|
||
var Tooltip=function Tooltip(element,options){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null;this.init('tooltip',element,options);};Tooltip.VERSION='3.3.0';Tooltip.TRANSITION_DURATION=150;Tooltip.DEFAULTS={animation:true,placement:'top',selector:false,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:'hover focus',title:'',delay:0,html:false,container:false,viewport:{selector:'body',padding:0}};Tooltip.prototype.init=function(type,element,options){this.enabled=true;this.type=type;this.$element=$(element);this.options=this.getOptions(options);this.$viewport=this.options.viewport&&$(this.options.viewport.selector||this.options.viewport);var triggers=this.options.trigger.split(' ');for(var i=triggers.length;i--;){var trigger=triggers[i];if(trigger=='click'){this.$element.on('click.'+this.type,this.options.selector,$.proxy(this.toggle,this));}else if(trigger!='manual'){var eventIn=trigger=='hover'?'mouseenter':'focusin';var eventOut=trigger=='hover'?'mouseleave':'focusout';this.$element.on(eventIn+'.'+this.type,this.options.selector,$.proxy(this.enter,this));this.$element.on(eventOut+'.'+this.type,this.options.selector,$.proxy(this.leave,this));}}this.options.selector?this._options=$.extend({},this.options,{trigger:'manual',selector:''}):this.fixTitle();};Tooltip.prototype.getDefaults=function(){return Tooltip.DEFAULTS;};Tooltip.prototype.getOptions=function(options){options=$.extend({},this.getDefaults(),this.$element.data(),options);if(options.delay&&typeof options.delay=='number'){options.delay={show:options.delay,hide:options.delay};}return options;};Tooltip.prototype.getDelegateOptions=function(){var options={};var defaults=this.getDefaults();this._options&&$.each(this._options,function(key,value){if(defaults[key]!=value)options[key]=value;});return options;};Tooltip.prototype.enter=function(obj){var self=obj instanceof this.constructor?obj:$(obj.currentTarget).data('bs.'+this.type);if(self&&self.$tip&&self.$tip.is(':visible')){self.hoverState='in';return;}if(!self){self=new this.constructor(obj.currentTarget,this.getDelegateOptions());$(obj.currentTarget).data('bs.'+this.type,self);}clearTimeout(self.timeout);self.hoverState='in';if(!self.options.delay||!self.options.delay.show)return self.show();self.timeout=setTimeout(function(){if(self.hoverState=='in')self.show();},self.options.delay.show);};Tooltip.prototype.leave=function(obj){var self=obj instanceof this.constructor?obj:$(obj.currentTarget).data('bs.'+this.type);if(!self){self=new this.constructor(obj.currentTarget,this.getDelegateOptions());$(obj.currentTarget).data('bs.'+this.type,self);}clearTimeout(self.timeout);self.hoverState='out';if(!self.options.delay||!self.options.delay.hide)return self.hide();self.timeout=setTimeout(function(){if(self.hoverState=='out')self.hide();},self.options.delay.hide);};Tooltip.prototype.show=function(){var e=$.Event('show.bs.'+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var inDom=$.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!inDom)return;var that=this;var $tip=this.tip();var tipId=this.getUID(this.type);this.setContent();$tip.attr('id',tipId);this.$element.attr('aria-describedby',tipId);if(this.options.animation)$tip.addClass('fade');var placement=typeof this.options.placement=='function'?this.options.placement.call(this,$tip[0],this.$element[0]):this.options.placement;var autoToken=/\s?auto?\s?/i;var autoPlace=autoToken.test(placement);if(autoPlace)placement=placement.replace(autoToken,'')||'top';$tip.detach().css({top:0,left:0,display:'block'}).addClass(placement).data('bs.'+this.type,this);this.options.container?$tip.appendTo(this.options.container):$tip.insertAfter(this.$element);var pos=this.getPosition();var actualWidth=$tip[0].offsetWidth;var actualHeight=$tip[0].offsetHeight;if(autoPlace){var orgPlacement=placement;var $container=this.options.container?$(this.options.container):this.$element.parent();var containerDim=this.getPosition($container);placement=placement=='bottom'&&pos.bottom+actualHeight>containerDim.bottom?'top':placement=='top'&&pos.top-actualHeight<containerDim.top?'bottom':placement=='right'&&pos.right+actualWidth>containerDim.width?'left':placement=='left'&&pos.left-actualWidth<containerDim.left?'right':placement;$tip.removeClass(orgPlacement).addClass(placement);}var calculatedOffset=this.getCalculatedOffset(placement,pos,actualWidth,actualHeight);this.applyPlacement(calculatedOffset,placement);var complete=function complete(){var prevHoverState=that.hoverState;that.$element.trigger('shown.bs.'+that.type);that.hoverState=null;if(prevHoverState=='out')that.leave(that);};$.support.transition&&this.$tip.hasClass('fade')?$tip.one('bsTransitionEnd',complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION):complete();}};Tooltip.prototype.applyPlacement=function(offset,placement){var $tip=this.tip();var width=$tip[0].offsetWidth;var height=$tip[0].offsetHeight;// manually read margins because getBoundingClientRect includes difference
|
||
var marginTop=parseInt($tip.css('margin-top'),10);var marginLeft=parseInt($tip.css('margin-left'),10);// we must check for NaN for ie 8/9
|
||
if(isNaN(marginTop))marginTop=0;if(isNaN(marginLeft))marginLeft=0;offset.top=offset.top+marginTop;offset.left=offset.left+marginLeft;// $.fn.offset doesn't round pixel values
|
||
// so we use setOffset directly with our own function B-0
|
||
$.offset.setOffset($tip[0],$.extend({using:function using(props){$tip.css({top:Math.round(props.top),left:Math.round(props.left)});}},offset),0);$tip.addClass('in');// check to see if placing tip in new offset caused the tip to resize itself
|
||
var actualWidth=$tip[0].offsetWidth;var actualHeight=$tip[0].offsetHeight;if(placement=='top'&&actualHeight!=height){offset.top=offset.top+height-actualHeight;}var delta=this.getViewportAdjustedDelta(placement,offset,actualWidth,actualHeight);if(delta.left)offset.left+=delta.left;else offset.top+=delta.top;var isVertical=/top|bottom/.test(placement);var arrowDelta=isVertical?delta.left*2-width+actualWidth:delta.top*2-height+actualHeight;var arrowOffsetPosition=isVertical?'offsetWidth':'offsetHeight';$tip.offset(offset);this.replaceArrow(arrowDelta,$tip[0][arrowOffsetPosition],isVertical);};Tooltip.prototype.replaceArrow=function(delta,dimension,isHorizontal){this.arrow().css(isHorizontal?'left':'top',50*(1-delta/dimension)+'%').css(isHorizontal?'top':'left','');};Tooltip.prototype.setContent=function(){var $tip=this.tip();var title=this.getTitle();$tip.find('.tooltip-inner')[this.options.html?'html':'text'](title);$tip.removeClass('fade in top bottom left right');};Tooltip.prototype.hide=function(callback){var that=this;var $tip=this.tip();var e=$.Event('hide.bs.'+this.type);function complete(){if(that.hoverState!='in')$tip.detach();that.$element.removeAttr('aria-describedby').trigger('hidden.bs.'+that.type);callback&&callback();}this.$element.trigger(e);if(e.isDefaultPrevented())return;$tip.removeClass('in');$.support.transition&&this.$tip.hasClass('fade')?$tip.one('bsTransitionEnd',complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION):complete();this.hoverState=null;return this;};Tooltip.prototype.fixTitle=function(){var $e=this.$element;if($e.attr('title')||typeof $e.attr('data-original-title')!='string'){$e.attr('data-original-title',$e.attr('title')||'').attr('title','');}};Tooltip.prototype.hasContent=function(){return this.getTitle();};Tooltip.prototype.getPosition=function($element){$element=$element||this.$element;var el=$element[0];var isBody=el.tagName=='BODY';var elRect=el.getBoundingClientRect();if(elRect.width==null){// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
|
||
elRect=$.extend({},elRect,{width:elRect.right-elRect.left,height:elRect.bottom-elRect.top});}var elOffset=isBody?{top:0,left:0}:$element.offset();var scroll={scroll:isBody?document.documentElement.scrollTop||document.body.scrollTop:$element.scrollTop()};var outerDims=isBody?{width:$(window).width(),height:$(window).height()}:null;return $.extend({},elRect,scroll,outerDims,elOffset);};Tooltip.prototype.getCalculatedOffset=function(placement,pos,actualWidth,actualHeight){return placement=='bottom'?{top:pos.top+pos.height,left:pos.left+pos.width/2-actualWidth/2}:placement=='top'?{top:pos.top-actualHeight,left:pos.left+pos.width/2-actualWidth/2}:placement=='left'?{top:pos.top+pos.height/2-actualHeight/2,left:pos.left-actualWidth}:/* placement == 'right' */{top:pos.top+pos.height/2-actualHeight/2,left:pos.left+pos.width};};Tooltip.prototype.getViewportAdjustedDelta=function(placement,pos,actualWidth,actualHeight){var delta={top:0,left:0};if(!this.$viewport)return delta;var viewportPadding=this.options.viewport&&this.options.viewport.padding||0;var viewportDimensions=this.getPosition(this.$viewport);if(/right|left/.test(placement)){var topEdgeOffset=pos.top-viewportPadding-viewportDimensions.scroll;var bottomEdgeOffset=pos.top+viewportPadding-viewportDimensions.scroll+actualHeight;if(topEdgeOffset<viewportDimensions.top){// top overflow
|
||
delta.top=viewportDimensions.top-topEdgeOffset;}else if(bottomEdgeOffset>viewportDimensions.top+viewportDimensions.height){// bottom overflow
|
||
delta.top=viewportDimensions.top+viewportDimensions.height-bottomEdgeOffset;}}else{var leftEdgeOffset=pos.left-viewportPadding;var rightEdgeOffset=pos.left+viewportPadding+actualWidth;if(leftEdgeOffset<viewportDimensions.left){// left overflow
|
||
delta.left=viewportDimensions.left-leftEdgeOffset;}else if(rightEdgeOffset>viewportDimensions.width){// right overflow
|
||
delta.left=viewportDimensions.left+viewportDimensions.width-rightEdgeOffset;}}return delta;};Tooltip.prototype.getTitle=function(){var title;var $e=this.$element;var o=this.options;title=$e.attr('data-original-title')||(typeof o.title=='function'?o.title.call($e[0]):o.title);return title;};Tooltip.prototype.getUID=function(prefix){do{prefix+=~~(Math.random()*1000000);}while(document.getElementById(prefix));return prefix;};Tooltip.prototype.tip=function(){return this.$tip=this.$tip||$(this.options.template);};Tooltip.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find('.tooltip-arrow');};Tooltip.prototype.enable=function(){this.enabled=true;};Tooltip.prototype.disable=function(){this.enabled=false;};Tooltip.prototype.toggleEnabled=function(){this.enabled=!this.enabled;};Tooltip.prototype.toggle=function(e){var self=this;if(e){self=$(e.currentTarget).data('bs.'+this.type);if(!self){self=new this.constructor(e.currentTarget,this.getDelegateOptions());$(e.currentTarget).data('bs.'+this.type,self);}}self.tip().hasClass('in')?self.leave(self):self.enter(self);};Tooltip.prototype.destroy=function(){var that=this;clearTimeout(this.timeout);this.hide(function(){that.$element.off('.'+that.type).removeData('bs.'+that.type);});};// TOOLTIP PLUGIN DEFINITION
|
||
// =========================
|
||
function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.tooltip');var options=_typeof2(option)=='object'&&option;var selector=options&&options.selector;if(!data&&option=='destroy')return;if(selector){if(!data)$this.data('bs.tooltip',data={});if(!data[selector])data[selector]=new Tooltip(this,options);}else{if(!data)$this.data('bs.tooltip',data=new Tooltip(this,options));}if(typeof option=='string')data[option]();});}var old=$.fn.tooltip;$.fn.tooltip=Plugin;$.fn.tooltip.Constructor=Tooltip;// TOOLTIP NO CONFLICT
|
||
// ===================
|
||
$.fn.tooltip.noConflict=function(){$.fn.tooltip=old;return this;};}(jQuery);/* ========================================================================
|
||
* Bootstrap: popover.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#popovers
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// POPOVER PUBLIC CLASS DEFINITION
|
||
// ===============================
|
||
var Popover=function Popover(element,options){this.init('popover',element,options);};if(!$.fn.tooltip)throw new Error('Popover requires tooltip.js');Popover.VERSION='3.3.0';Popover.DEFAULTS=$.extend({},$.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>'});// NOTE: POPOVER EXTENDS tooltip.js
|
||
// ================================
|
||
Popover.prototype=$.extend({},$.fn.tooltip.Constructor.prototype);Popover.prototype.constructor=Popover;Popover.prototype.getDefaults=function(){return Popover.DEFAULTS;};Popover.prototype.setContent=function(){var $tip=this.tip();var title=this.getTitle();var content=this.getContent();$tip.find('.popover-title')[this.options.html?'html':'text'](title);$tip.find('.popover-content').children().detach().end()[// we use append for html objects to maintain js events
|
||
this.options.html?typeof content=='string'?'html':'append':'text'](content);$tip.removeClass('fade top bottom left right in');// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
|
||
// this manually by checking the contents.
|
||
if(!$tip.find('.popover-title').html())$tip.find('.popover-title').hide();};Popover.prototype.hasContent=function(){return this.getTitle()||this.getContent();};Popover.prototype.getContent=function(){var $e=this.$element;var o=this.options;return $e.attr('data-content')||(typeof o.content=='function'?o.content.call($e[0]):o.content);};Popover.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find('.arrow');};Popover.prototype.tip=function(){if(!this.$tip)this.$tip=$(this.options.template);return this.$tip;};// POPOVER PLUGIN DEFINITION
|
||
// =========================
|
||
function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.popover');var options=_typeof2(option)=='object'&&option;var selector=options&&options.selector;if(!data&&option=='destroy')return;if(selector){if(!data)$this.data('bs.popover',data={});if(!data[selector])data[selector]=new Popover(this,options);}else{if(!data)$this.data('bs.popover',data=new Popover(this,options));}if(typeof option=='string')data[option]();});}var old=$.fn.popover;$.fn.popover=Plugin;$.fn.popover.Constructor=Popover;// POPOVER NO CONFLICT
|
||
// ===================
|
||
$.fn.popover.noConflict=function(){$.fn.popover=old;return this;};}(jQuery);/* ========================================================================
|
||
* Bootstrap: tab.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#tabs
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// TAB CLASS DEFINITION
|
||
// ====================
|
||
var Tab=function Tab(element){this.element=$(element);};Tab.VERSION='3.3.0';Tab.TRANSITION_DURATION=150;Tab.prototype.show=function(){var $this=this.element;var $ul=$this.closest('ul:not(.dropdown-menu)');var selector=$this.data('target');if(!selector){selector=$this.attr('href');selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,'');// strip for ie7
|
||
}if($this.parent('li').hasClass('active'))return;var $previous=$ul.find('.active:last a');var hideEvent=$.Event('hide.bs.tab',{relatedTarget:$this[0]});var showEvent=$.Event('show.bs.tab',{relatedTarget:$previous[0]});$previous.trigger(hideEvent);$this.trigger(showEvent);if(showEvent.isDefaultPrevented()||hideEvent.isDefaultPrevented())return;var $target=$(selector);this.activate($this.closest('li'),$ul);this.activate($target,$target.parent(),function(){$previous.trigger({type:'hidden.bs.tab',relatedTarget:$this[0]});$this.trigger({type:'shown.bs.tab',relatedTarget:$previous[0]});});};Tab.prototype.activate=function(element,container,callback){var $active=container.find('> .active');var transition=callback&&$.support.transition&&($active.length&&$active.hasClass('fade')||!!container.find('> .fade').length);function next(){$active.removeClass('active').find('> .dropdown-menu > .active').removeClass('active').end().find('[data-toggle="tab"]').attr('aria-expanded',false);element.addClass('active').find('[data-toggle="tab"]').attr('aria-expanded',true);if(transition){element[0].offsetWidth;// reflow for transition
|
||
element.addClass('in');}else{element.removeClass('fade');}if(element.parent('.dropdown-menu')){element.closest('li.dropdown').addClass('active').end().find('[data-toggle="tab"]').attr('aria-expanded',true);}callback&&callback();}$active.length&&transition?$active.one('bsTransitionEnd',next).emulateTransitionEnd(Tab.TRANSITION_DURATION):next();$active.removeClass('in');};// TAB PLUGIN DEFINITION
|
||
// =====================
|
||
function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.tab');if(!data)$this.data('bs.tab',data=new Tab(this));if(typeof option=='string')data[option]();});}var old=$.fn.tab;$.fn.tab=Plugin;$.fn.tab.Constructor=Tab;// TAB NO CONFLICT
|
||
// ===============
|
||
$.fn.tab.noConflict=function(){$.fn.tab=old;return this;};// TAB DATA-API
|
||
// ============
|
||
var clickHandler=function clickHandler(e){e.preventDefault();Plugin.call($(this),'show');};$(document).on('click.bs.tab.data-api','[data-toggle="tab"]',clickHandler).on('click.bs.tab.data-api','[data-toggle="pill"]',clickHandler);}(jQuery);/* ========================================================================
|
||
* Bootstrap: affix.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#affix
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// AFFIX CLASS DEFINITION
|
||
// ======================
|
||
var Affix=function Affix(element,options){this.options=$.extend({},Affix.DEFAULTS,options);this.$target=$(this.options.target).on('scroll.bs.affix.data-api',$.proxy(this.checkPosition,this)).on('click.bs.affix.data-api',$.proxy(this.checkPositionWithEventLoop,this));this.$element=$(element);this.affixed=this.unpin=this.pinnedOffset=null;this.checkPosition();};Affix.VERSION='3.3.0';Affix.RESET='affix affix-top affix-bottom';Affix.DEFAULTS={offset:0,target:window};Affix.prototype.getState=function(scrollHeight,height,offsetTop,offsetBottom){var scrollTop=this.$target.scrollTop();var position=this.$element.offset();var targetHeight=this.$target.height();if(offsetTop!=null&&this.affixed=='top')return scrollTop<offsetTop?'top':false;if(this.affixed=='bottom'){if(offsetTop!=null)return scrollTop+this.unpin<=position.top?false:'bottom';return scrollTop+targetHeight<=scrollHeight-offsetBottom?false:'bottom';}var initializing=this.affixed==null;var colliderTop=initializing?scrollTop:position.top;var colliderHeight=initializing?targetHeight:height;if(offsetTop!=null&&colliderTop<=offsetTop)return'top';if(offsetBottom!=null&&colliderTop+colliderHeight>=scrollHeight-offsetBottom)return'bottom';return false;};Affix.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(Affix.RESET).addClass('affix');var scrollTop=this.$target.scrollTop();var position=this.$element.offset();return this.pinnedOffset=position.top-scrollTop;};Affix.prototype.checkPositionWithEventLoop=function(){setTimeout($.proxy(this.checkPosition,this),1);};Affix.prototype.checkPosition=function(){if(!this.$element.is(':visible'))return;var height=this.$element.height();var offset=this.options.offset;var offsetTop=offset.top;var offsetBottom=offset.bottom;var scrollHeight=$('body').height();if(_typeof2(offset)!='object')offsetBottom=offsetTop=offset;if(typeof offsetTop=='function')offsetTop=offset.top(this.$element);if(typeof offsetBottom=='function')offsetBottom=offset.bottom(this.$element);var affix=this.getState(scrollHeight,height,offsetTop,offsetBottom);if(this.affixed!=affix){if(this.unpin!=null)this.$element.css('top','');var affixType='affix'+(affix?'-'+affix:'');var e=$.Event(affixType+'.bs.affix');this.$element.trigger(e);if(e.isDefaultPrevented())return;this.affixed=affix;this.unpin=affix=='bottom'?this.getPinnedOffset():null;this.$element.removeClass(Affix.RESET).addClass(affixType).trigger(affixType.replace('affix','affixed')+'.bs.affix');}if(affix=='bottom'){this.$element.offset({top:scrollHeight-height-offsetBottom});}};// AFFIX PLUGIN DEFINITION
|
||
// =======================
|
||
function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.affix');var options=_typeof2(option)=='object'&&option;if(!data)$this.data('bs.affix',data=new Affix(this,options));if(typeof option=='string')data[option]();});}var old=$.fn.affix;$.fn.affix=Plugin;$.fn.affix.Constructor=Affix;// AFFIX NO CONFLICT
|
||
// =================
|
||
$.fn.affix.noConflict=function(){$.fn.affix=old;return this;};// AFFIX DATA-API
|
||
// ==============
|
||
$(window).on('load',function(){$('[data-spy="affix"]').each(function(){var $spy=$(this);var data=$spy.data();data.offset=data.offset||{};if(data.offsetBottom!=null)data.offset.bottom=data.offsetBottom;if(data.offsetTop!=null)data.offset.top=data.offsetTop;Plugin.call($spy,data);});});}(jQuery);/* ========================================================================
|
||
* Bootstrap: collapse.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#collapse
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// COLLAPSE PUBLIC CLASS DEFINITION
|
||
// ================================
|
||
var Collapse=function Collapse(element,options){this.$element=$(element);this.options=$.extend({},Collapse.DEFAULTS,options);this.$trigger=$(this.options.trigger).filter('[href="#'+element.id+'"], [data-target="#'+element.id+'"]');this.transitioning=null;if(this.options.parent){this.$parent=this.getParent();}else{this.addAriaAndCollapsedClass(this.$element,this.$trigger);}if(this.options.toggle)this.toggle();};Collapse.VERSION='3.3.0';Collapse.TRANSITION_DURATION=350;Collapse.DEFAULTS={toggle:true,trigger:'[data-toggle="collapse"]'};Collapse.prototype.dimension=function(){var hasWidth=this.$element.hasClass('width');return hasWidth?'width':'height';};Collapse.prototype.show=function(){if(this.transitioning||this.$element.hasClass('in'))return;var activesData;var actives=this.$parent&&this.$parent.find('> .panel').children('.in, .collapsing');if(actives&&actives.length){activesData=actives.data('bs.collapse');if(activesData&&activesData.transitioning)return;}var startEvent=$.Event('show.bs.collapse');this.$element.trigger(startEvent);if(startEvent.isDefaultPrevented())return;if(actives&&actives.length){Plugin.call(actives,'hide');activesData||actives.data('bs.collapse',null);}var dimension=this.dimension();this.$element.removeClass('collapse').addClass('collapsing')[dimension](0).attr('aria-expanded',true);this.$trigger.removeClass('collapsed').attr('aria-expanded',true);this.transitioning=1;var complete=function complete(){this.$element.removeClass('collapsing').addClass('collapse in')[dimension]('');this.transitioning=0;this.$element.trigger('shown.bs.collapse');};if(!$.support.transition)return complete.call(this);var scrollSize=$.camelCase(['scroll',dimension].join('-'));this.$element.one('bsTransitionEnd',$.proxy(complete,this)).emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]);};Collapse.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass('in'))return;var startEvent=$.Event('hide.bs.collapse');this.$element.trigger(startEvent);if(startEvent.isDefaultPrevented())return;var dimension=this.dimension();this.$element[dimension](this.$element[dimension]())[0].offsetHeight;this.$element.addClass('collapsing').removeClass('collapse in').attr('aria-expanded',false);this.$trigger.addClass('collapsed').attr('aria-expanded',false);this.transitioning=1;var complete=function complete(){this.transitioning=0;this.$element.removeClass('collapsing').addClass('collapse').trigger('hidden.bs.collapse');};if(!$.support.transition)return complete.call(this);this.$element[dimension](0).one('bsTransitionEnd',$.proxy(complete,this)).emulateTransitionEnd(Collapse.TRANSITION_DURATION);};Collapse.prototype.toggle=function(){this[this.$element.hasClass('in')?'hide':'show']();};Collapse.prototype.getParent=function(){return $(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each($.proxy(function(i,element){var $element=$(element);this.addAriaAndCollapsedClass(getTargetFromTrigger($element),$element);},this)).end();};Collapse.prototype.addAriaAndCollapsedClass=function($element,$trigger){var isOpen=$element.hasClass('in');$element.attr('aria-expanded',isOpen);$trigger.toggleClass('collapsed',!isOpen).attr('aria-expanded',isOpen);};function getTargetFromTrigger($trigger){var href;var target=$trigger.attr('data-target')||(href=$trigger.attr('href'))&&href.replace(/.*(?=#[^\s]+$)/,'');// strip for ie7
|
||
return $(target);}// COLLAPSE PLUGIN DEFINITION
|
||
// ==========================
|
||
function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.collapse');var options=$.extend({},Collapse.DEFAULTS,$this.data(),_typeof2(option)=='object'&&option);if(!data&&options.toggle&&option=='show')options.toggle=false;if(!data)$this.data('bs.collapse',data=new Collapse(this,options));if(typeof option=='string')data[option]();});}var old=$.fn.collapse;$.fn.collapse=Plugin;$.fn.collapse.Constructor=Collapse;// COLLAPSE NO CONFLICT
|
||
// ====================
|
||
$.fn.collapse.noConflict=function(){$.fn.collapse=old;return this;};// COLLAPSE DATA-API
|
||
// =================
|
||
$(document).on('click.bs.collapse.data-api','[data-toggle="collapse"]',function(e){var $this=$(this);if(!$this.attr('data-target'))e.preventDefault();var $target=getTargetFromTrigger($this);var data=$target.data('bs.collapse');var option=data?'toggle':$.extend({},$this.data(),{trigger:this});Plugin.call($target,option);});}(jQuery);/* ========================================================================
|
||
* Bootstrap: scrollspy.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#scrollspy
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// SCROLLSPY CLASS DEFINITION
|
||
// ==========================
|
||
function ScrollSpy(element,options){var process=$.proxy(this.process,this);this.$body=$('body');this.$scrollElement=$(element).is('body')?$(window):$(element);this.options=$.extend({},ScrollSpy.DEFAULTS,options);this.selector=(this.options.target||'')+' .nav li > a';this.offsets=[];this.targets=[];this.activeTarget=null;this.scrollHeight=0;this.$scrollElement.on('scroll.bs.scrollspy',process);this.refresh();this.process();}ScrollSpy.VERSION='3.3.0';ScrollSpy.DEFAULTS={offset:10};ScrollSpy.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight);};ScrollSpy.prototype.refresh=function(){var offsetMethod='offset';var offsetBase=0;if(!$.isWindow(this.$scrollElement[0])){offsetMethod='position';offsetBase=this.$scrollElement.scrollTop();}this.offsets=[];this.targets=[];this.scrollHeight=this.getScrollHeight();var self=this;this.$body.find(this.selector).map(function(){var $el=$(this);var href=$el.data('target')||$el.attr('href');var $href=/^#./.test(href)&&$(href);return $href&&$href.length&&$href.is(':visible')&&[[$href[offsetMethod]().top+offsetBase,href]]||null;}).sort(function(a,b){return a[0]-b[0];}).each(function(){self.offsets.push(this[0]);self.targets.push(this[1]);});};ScrollSpy.prototype.process=function(){var scrollTop=this.$scrollElement.scrollTop()+this.options.offset;var scrollHeight=this.getScrollHeight();var maxScroll=this.options.offset+scrollHeight-this.$scrollElement.height();var offsets=this.offsets;var targets=this.targets;var activeTarget=this.activeTarget;var i;if(this.scrollHeight!=scrollHeight){this.refresh();}if(scrollTop>=maxScroll){return activeTarget!=(i=targets[targets.length-1])&&this.activate(i);}if(activeTarget&&scrollTop<offsets[0]){this.activeTarget=null;return this.clear();}for(i=offsets.length;i--;){activeTarget!=targets[i]&&scrollTop>=offsets[i]&&(!offsets[i+1]||scrollTop<=offsets[i+1])&&this.activate(targets[i]);}};ScrollSpy.prototype.activate=function(target){this.activeTarget=target;this.clear();var selector=this.selector+'[data-target="'+target+'"],'+this.selector+'[href="'+target+'"]';var active=$(selector).parents('li').addClass('active');if(active.parent('.dropdown-menu').length){active=active.closest('li.dropdown').addClass('active');}active.trigger('activate.bs.scrollspy');};ScrollSpy.prototype.clear=function(){$(this.selector).parentsUntil(this.options.target,'.active').removeClass('active');};// SCROLLSPY PLUGIN DEFINITION
|
||
// ===========================
|
||
function Plugin(option){return this.each(function(){var $this=$(this);var data=$this.data('bs.scrollspy');var options=_typeof2(option)=='object'&&option;if(!data)$this.data('bs.scrollspy',data=new ScrollSpy(this,options));if(typeof option=='string')data[option]();});}var old=$.fn.scrollspy;$.fn.scrollspy=Plugin;$.fn.scrollspy.Constructor=ScrollSpy;// SCROLLSPY NO CONFLICT
|
||
// =====================
|
||
$.fn.scrollspy.noConflict=function(){$.fn.scrollspy=old;return this;};// SCROLLSPY DATA-API
|
||
// ==================
|
||
$(window).on('load.bs.scrollspy.data-api',function(){$('[data-spy="scroll"]').each(function(){var $spy=$(this);Plugin.call($spy,$spy.data());});});}(jQuery);/* ========================================================================
|
||
* Bootstrap: transition.js v3.3.0
|
||
* http://getbootstrap.com/javascript/#transitions
|
||
* ========================================================================
|
||
* Copyright 2011-2014 Twitter, Inc.
|
||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||
* ======================================================================== */+function($){'use strict';// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
|
||
// ============================================================
|
||
function transitionEnd(){var el=document.createElement('bootstrap');var transEndEventNames={WebkitTransition:'webkitTransitionEnd',MozTransition:'transitionend',OTransition:'oTransitionEnd otransitionend',transition:'transitionend'};for(var name in transEndEventNames){if(el.style[name]!==undefined){return{end:transEndEventNames[name]};}}return false;// explicit for ie8 ( ._.)
|
||
}// http://blog.alexmaccaw.com/css-transitions
|
||
$.fn.emulateTransitionEnd=function(duration){var called=false;var $el=this;$(this).one('bsTransitionEnd',function(){called=true;});var callback=function callback(){if(!called)$($el).trigger($.support.transition.end);};setTimeout(callback,duration);return this;};$(function(){$.support.transition=transitionEnd();if(!$.support.transition)return;$.event.special.bsTransitionEnd={bindType:$.support.transition.end,delegateType:$.support.transition.end,handle:function handle(e){if($(e.target).is(this))return e.handleObj.handler.apply(this,arguments);}};});}(jQuery);/*!
|
||
* Bootstrap Context Menu
|
||
* Author: @sydcanem
|
||
* https://github.com/sydcanem/bootstrap-contextmenu
|
||
*
|
||
* Inspired by Bootstrap's dropdown plugin.
|
||
* Bootstrap (http://getbootstrap.com).
|
||
*
|
||
* Licensed under MIT
|
||
* ========================================================= */;(function($){'use strict';/* CONTEXTMENU CLASS DEFINITION
|
||
* ============================ */var toggle='[data-toggle="context"]';var ContextMenu=function ContextMenu(element,options){this.$element=$(element);this.before=options.before||this.before;this.onItem=options.onItem||this.onItem;this.scopes=options.scopes||null;if(options.target){this.$element.data('target',options.target);}this.listen();};ContextMenu.prototype={constructor:ContextMenu,show:function show(e){var $menu,evt,tp,items,relatedTarget={relatedTarget:this};if(this.isDisabled())return;this.closemenu();if(!this.before.call(this,e,$(e.currentTarget)))return;$menu=this.getMenu();$menu.trigger(evt=$.Event('show.bs.context',relatedTarget));tp=this.getPosition(e,$menu);items='li:not(.divider)';$menu.attr('style','').css(tp).addClass('open').on('click.context.data-api',items,$.proxy(this.onItem,this,$(e.currentTarget))).trigger('shown.bs.context',relatedTarget);// Delegating the `closemenu` only on the currently opened menu.
|
||
// This prevents other opened menus from closing.
|
||
$('html').on('click.context.data-api',$menu.selector,$.proxy(this.closemenu,this));return false;},closemenu:function closemenu(e){var $menu,evt,items,relatedTarget;$menu=this.getMenu();if(!$menu.hasClass('open'))return;relatedTarget={relatedTarget:this};$menu.trigger(evt=$.Event('hide.bs.context',relatedTarget));items='li:not(.divider)';$menu.removeClass('open').off('click.context.data-api',items).trigger('hidden.bs.context',relatedTarget);$('html').off('click.context.data-api',$menu.selector);// Don't propagate click event so other currently
|
||
// opened menus won't close.
|
||
return false;},keydown:function keydown(e){if(e.which==27)this.closemenu(e);},before:function before(e){return true;},onItem:function onItem(e){return true;},listen:function listen(){this.$element.on('contextmenu.context.data-api',this.scopes,$.proxy(this.show,this));$('html').on('click.context.data-api',$.proxy(this.closemenu,this));$('html').on('keydown.context.data-api',$.proxy(this.keydown,this));},destroy:function destroy(){this.$element.off('.context.data-api').removeData('context');$('html').off('.context.data-api');},isDisabled:function isDisabled(){return this.$element.hasClass('disabled')||this.$element.attr('disabled');},getMenu:function getMenu(){var selector=this.$element.data('target'),$menu;if(!selector){selector=this.$element.attr('href');selector=selector&&selector.replace(/.*(?=#[^\s]*$)/,'');//strip for ie7
|
||
}$menu=$(selector);return $menu&&$menu.length?$menu:this.$element.find(selector);},getPosition:function getPosition(e,$menu){var mouseX=e.clientX,mouseY=e.clientY,boundsX=$(window).width(),boundsY=$(window).height(),menuWidth=$menu.find('.dropdown-menu').outerWidth(),menuHeight=$menu.find('.dropdown-menu').outerHeight(),tp={"position":"absolute","z-index":9999},Y,X,parentOffset;if(mouseY+menuHeight>boundsY){Y={"top":mouseY-menuHeight+$(window).scrollTop()};}else{Y={"top":mouseY+$(window).scrollTop()};}if(mouseX+menuWidth>boundsX&&mouseX-menuWidth>0){X={"left":mouseX-menuWidth+$(window).scrollLeft()};}else{X={"left":mouseX+$(window).scrollLeft()};}// If context-menu's parent is positioned using absolute or relative positioning,
|
||
// the calculated mouse position will be incorrect.
|
||
// Adjust the position of the menu by its offset parent position.
|
||
parentOffset=$menu.offsetParent().offset();X.left=X.left-parentOffset.left;Y.top=Y.top-parentOffset.top;return $.extend(tp,Y,X);}};/* CONTEXT MENU PLUGIN DEFINITION
|
||
* ========================== */$.fn.contextmenu=function(option,e){return this.each(function(){var $this=$(this),data=$this.data('context'),options=_typeof2(option)=='object'&&option;if(!data)$this.data('context',data=new ContextMenu($this,options));if(typeof option=='string')data[option].call(data,e);});};$.fn.contextmenu.Constructor=ContextMenu;/* APPLY TO STANDARD CONTEXT MENU ELEMENTS
|
||
* =================================== */$(document).on('contextmenu.context.data-api',function(){$(toggle).each(function(){var data=$(this).data('context');if(!data)return;data.closemenu();});}).on('contextmenu.context.data-api',toggle,function(e){$(this).contextmenu('show',e);e.preventDefault();e.stopPropagation();});})(jQuery);/**
|
||
* 颜色拾取器
|
||
*
|
||
* @author hawind
|
||
* @url http://gdoo.net
|
||
* @name jquery.colorpicker.js
|
||
* @since 2020-11-16
|
||
*/(function($){var ColorHex=new Array('00','33','66','99','CC','FF');var SpColorHex=new Array('FF0000','00FF00','0000FF','FFFF00','00FFFF','FF00FF');$.fn.colorpicker=function(options){var opts=jQuery.extend({},jQuery.fn.colorpicker.defaults,options);initColor();return this.each(function(){var obj=$(this);obj.on(opts.event+'.colorpicker',function(){var $panel=$("#color-panel");// 定位
|
||
var ttop=$(this).offset().top;// 控件的定位点高
|
||
var thei=$(this).height();//控件本身的高
|
||
var tleft=$(this).offset().left;//控件的定位点宽
|
||
$panel.css({top:ttop+thei+15,left:tleft}).show();var target=opts.target?$(opts.target):obj;if(target.data("color")==null){target.data("color",target.css("color"));}if(target.data("value")==null){target.data("value",target.val());}$("#color-panel-reset").on("click.colorpicker",function(){target.css("color",target.data("color")).val(target.data("value"));var color=target.data("value");color=opts.ishex?color:getRGBColor(color);$panel.hide();opts.reset(obj,color);});$("#color-panel-body").off("click.colorpicker").on('mouseover.colorpicker','tr td',function(){var color=$(this).css("background-color");$("#color-panel-color").css("background",color);$("#color-panel-hex-color").val($(this).attr("rel"));}).on('click.colorpicker','tr td',function(){var color=$(this).attr("rel");color=opts.ishex?color:getRGBColor(color);if(opts.fillcolor)target.val(color);target.css("color",color);$panel.hide();$("#color-panel-reset").off("click.colorpicker");opts.change(obj,color);});setColor(target.val());});});function setColor(color){$("#color-panel-color").css("background",color);$("#color-panel-hex-color").val(color);}function initColor(){$("body").append('<style>.colorpicker-controller{background-color:#fff;border: 1px solid #bbb;width:18px;height:18px;}.colorpicker{margin:2px;outline:none;display:inline-block;cursor:pointer;width:12px;height:12px;}</style><div id="color-panel" style="background-color:#fff;border-radius:6px;box-shadow:0 5px 10px rgba(0,0,0,0.2);padding:5px;border:solid 1px #ccc;position:absolute;z-index:1051;display:none;"></div>');var colorTable='';var colorValue='';for(i=0;i<2;i++){for(j=0;j<6;j++){colorTable=colorTable+'<tr height="12">';colorValue=i==0?ColorHex[j]+ColorHex[j]+ColorHex[j]:SpColorHex[j];colorTable=colorTable+'<td width="11" rel="#'+colorValue+'" style="background-color:#'+colorValue+'">';for(k=0;k<3;k++){for(l=0;l<6;l++){colorValue=ColorHex[k+i*3]+ColorHex[l]+ColorHex[j];colorTable=colorTable+'<td width="11" rel="#'+colorValue+'" style="background-color:#'+colorValue+'">';}}}}colorTable='<table width="230" border="0" cellspacing="0" cellpadding="0">'+'<tr height="30"><td colspan="21" bgcolor="#fff">'+'<table cellpadding="0" cellspacing="1" border="0" style="border-collapse:collapse">'+'<tr><td width="3"><td><input type="text" id="color-panel-color" size="6" disabled style="border:inset 1px #ccc;"></td>'+'<td width="3"><td><input type="text" id="color-panel-hex-color" size="7" style="border:inset 1px #ccc; font-family:Arial;"><a href="javascript:;" id="color-panel-close" style="padding-left:15px;">关闭</a> <a href="javascript:;" style="padding-left:5px;" id="color-panel-reset">重置</a></td></tr></table></td></table>'+'<table width="230" id="color-panel-body" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse" style="cursor:pointer;">'+colorTable+'</table>';var $panel=$("#color-panel");$panel.html(colorTable);$(document).on('mousedown.colorpicker',function(){$panel.hide();});$panel.on('mousedown.colorpicker',function(e){e.stopPropagation();});$("#color-panel-close").on('click.colorpicker',function(){$panel.hide();return false;});}function getRGBColor(color){var result;if(color&&color.constructor==Array&&color.length==3)color=color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))color=[parseInt(result[1]),parseInt(result[2]),parseInt(result[3])];if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))color=[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))color=[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)];if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))color=[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)];return"rgb("+color[0]+","+color[1]+","+color[2]+")";}};jQuery.fn.colorpicker.defaults={ishex:true,// 是否使用16进制颜色值
|
||
fillcolor:false,// 是否将颜色值填充至对象的val中
|
||
target:null,// 目标对象
|
||
event:'click',// 颜色框显示的事件
|
||
change:function change(){},// 回调函数
|
||
reset:function reset(){}};})(jQuery);/*
|
||
* jQuery table2excel - v1.1.2
|
||
* jQuery plugin to export an .xls file in browser from an HTML table
|
||
* https://github.com/rainabba/jquery-table2excel
|
||
*
|
||
* Made by rainabba
|
||
* Under MIT License
|
||
*/ //table2excel.js
|
||
(function($,window,document,undefined){var pluginName="table2excel",defaults={exclude:".noExl",name:"Table2Excel",filename:"table2excel",fileext:".xls",exclude_img:true,exclude_links:true,exclude_inputs:true,preserveColors:false};// The actual plugin constructor
|
||
function Plugin(element,options){this.element=element;// jQuery has an extend method which merges the contents of two or
|
||
// more objects, storing the result in the first object. The first object
|
||
// is generally empty as we don't want to alter the default options for
|
||
// future instances of the plugin
|
||
//
|
||
this.settings=$.extend({},defaults,options);this._defaults=defaults;this._name=pluginName;this.init();}Plugin.prototype={init:function init(){var e=this;var utf8Heading="<meta http-equiv=\"content-type\" content=\"application/vnd.ms-excel; charset=UTF-8\">";e.template={head:"<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\">"+utf8Heading+"<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets>",sheet:{head:"<x:ExcelWorksheet><x:Name>",tail:"</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>"},mid:"</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body>",table:{head:"<table>",tail:"</table>"},foot:"</body></html>"};e.tableRows=[];// Styling variables
|
||
var additionalStyles="";var compStyle=null;// get contents of table except for exclude
|
||
$(e.element).each(function(i,o){var tempRows="";$(o).find("tr").not(e.settings.exclude).each(function(i,p){// Reset for this row
|
||
additionalStyles="";// Preserve background and text colors on the row
|
||
if(e.settings.preserveColors){compStyle=getComputedStyle(p);additionalStyles+=compStyle&&compStyle.backgroundColor?"background-color: "+compStyle.backgroundColor+";":"";additionalStyles+=compStyle&&compStyle.color?"color: "+compStyle.color+";":"";}// Create HTML for Row
|
||
tempRows+="<tr style='"+additionalStyles+"'>";// Loop through each TH and TD
|
||
$(p).find("td,th").not(e.settings.exclude).each(function(i,q){// p did not exist, I corrected
|
||
// Reset for this column
|
||
additionalStyles="";// Preserve background and text colors on the row
|
||
if(e.settings.preserveColors){compStyle=getComputedStyle(q);additionalStyles+=compStyle&&compStyle.backgroundColor?"background-color: "+compStyle.backgroundColor+";":"";additionalStyles+=compStyle&&compStyle.color?"color: "+compStyle.color+";":"";}var rc={rows:$(this).attr("rowspan"),cols:$(this).attr("colspan"),flag:$(q).find(e.settings.exclude)};if(rc.flag.length>0){tempRows+="<td> </td>";// exclude it!!
|
||
}else{tempRows+="<td";if(rc.rows>0){tempRows+=" rowspan='"+rc.rows+"' ";}if(rc.cols>0){tempRows+=" colspan='"+rc.cols+"' ";}if(additionalStyles){tempRows+=" style='"+additionalStyles+"'";}tempRows+=">"+$(q).html()+"</td>";}});tempRows+="</tr>";});// exclude img tags
|
||
if(e.settings.exclude_img){tempRows=exclude_img(tempRows);}// exclude link tags
|
||
if(e.settings.exclude_links){tempRows=exclude_links(tempRows);}// exclude input tags
|
||
if(e.settings.exclude_inputs){tempRows=exclude_inputs(tempRows);}e.tableRows.push(tempRows);});e.tableToExcel(e.tableRows,e.settings.name,e.settings.sheetName);},tableToExcel:function tableToExcel(table,name,sheetName){var e=this,fullTemplate="",i,link,a;e.format=function(s,c){return s.replace(/{(\w+)}/g,function(m,p){return c[p];});};sheetName=typeof sheetName==="undefined"?"Sheet":sheetName;e.ctx={worksheet:name||"Worksheet",table:table,sheetName:sheetName};fullTemplate=e.template.head;if($.isArray(table)){Object.keys(table).forEach(function(i){//fullTemplate += e.template.sheet.head + "{worksheet" + i + "}" + e.template.sheet.tail;
|
||
fullTemplate+=e.template.sheet.head+sheetName+i+e.template.sheet.tail;});}fullTemplate+=e.template.mid;if($.isArray(table)){Object.keys(table).forEach(function(i){fullTemplate+=e.template.table.head+"{table"+i+"}"+e.template.table.tail;});}fullTemplate+=e.template.foot;for(i in table){e.ctx["table"+i]=table[i];}delete e.ctx.table;var isIE=navigator.appVersion.indexOf("MSIE 10")!==-1||navigator.userAgent.indexOf("Trident")!==-1&&navigator.userAgent.indexOf("rv:11")!==-1;// this works with IE10 and IE11 both :)
|
||
//if (typeof msie !== "undefined" && msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // this works ONLY with IE 11!!!
|
||
if(isIE){if(typeof Blob!=="undefined"){//use blobs if we can
|
||
fullTemplate=e.format(fullTemplate,e.ctx);// with this, works with IE
|
||
fullTemplate=[fullTemplate];//convert to array
|
||
var blob1=new Blob(fullTemplate,{type:"text/html"});window.navigator.msSaveBlob(blob1,getFileName(e.settings));}else{//otherwise use the iframe and save
|
||
//requires a blank iframe on page called txtArea1
|
||
txtArea1.document.open("text/html","replace");txtArea1.document.write(e.format(fullTemplate,e.ctx));txtArea1.document.close();txtArea1.focus();sa=txtArea1.document.execCommand("SaveAs",true,getFileName(e.settings));}}else{var blob=new Blob([e.format(fullTemplate,e.ctx)],{type:"application/vnd.ms-excel"});window.URL=window.URL||window.webkitURL;link=window.URL.createObjectURL(blob);a=document.createElement("a");a.download=getFileName(e.settings);a.href=link;document.body.appendChild(a);a.click();document.body.removeChild(a);}return true;}};function getFileName(settings){return settings.filename?settings.filename:"table2excel";}// Removes all img tags
|
||
function exclude_img(string){var _patt=/(\s+alt\s*=\s*"([^"]*)"|\s+alt\s*=\s*'([^']*)')/i;return string.replace(/<img[^>]*>/gi,function myFunction(x){var res=_patt.exec(x);if(res!==null&&res.length>=2){return res[2];}else{return"";}});}// Removes all link tags
|
||
function exclude_links(string){return string.replace(/<a[^>]*>|<\/a>/gi,"");}// Removes input params
|
||
function exclude_inputs(string){var _patt=/(\s+value\s*=\s*"([^"]*)"|\s+value\s*=\s*'([^']*)')/i;return string.replace(/<input[^>]*>|<\/input>/gi,function myFunction(x){var res=_patt.exec(x);if(res!==null&&res.length>=2){return res[2];}else{return"";}});}$.fn[pluginName]=function(options){var e=this;e.each(function(){if(!$.data(e,"plugin_"+pluginName)){$.data(e,"plugin_"+pluginName,new Plugin(this,options));}});// chain jQuery functions
|
||
return e;};})(jQuery,window,document);/*!
|
||
* Viewer.js v1.5.0
|
||
* https://fengyuanchen.github.io/viewerjs
|
||
*
|
||
* Copyright 2015-present Chen Fengyuan
|
||
* Released under the MIT license
|
||
*
|
||
* Date: 2019-11-23T05:10:26.193Z
|
||
*/(function(global,factory){(typeof exports==="undefined"?"undefined":_typeof2(exports))==='object'&&typeof module!=='undefined'?module.exports=factory():typeof define==='function'&&define.amd?define(factory):(global=global||self,global.Viewer=factory());})(this,function(){'use strict';function _typeof(obj){if(typeof Symbol==="function"&&_typeof2(Symbol.iterator)==="symbol"){_typeof=function _typeof(obj){return _typeof2(obj);};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj);};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread2(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}var DEFAULTS={/**
|
||
* Enable a modal backdrop, specify `static` for a backdrop
|
||
* which doesn't close the modal on click.
|
||
* @type {boolean}
|
||
*/backdrop:true,/**
|
||
* Show the button on the top-right of the viewer.
|
||
* @type {boolean}
|
||
*/button:true,/**
|
||
* Show the navbar.
|
||
* @type {boolean | number}
|
||
*/navbar:true,/**
|
||
* Specify the visibility and the content of the title.
|
||
* @type {boolean | number | Function | Array}
|
||
*/title:true,/**
|
||
* Show the toolbar.
|
||
* @type {boolean | number | Object}
|
||
*/toolbar:true,/**
|
||
* Custom class name(s) to add to the viewer's root element.
|
||
* @type {string}
|
||
*/className:'',/**
|
||
* Define where to put the viewer in modal mode.
|
||
* @type {string | Element}
|
||
*/container:'body',/**
|
||
* Filter the images for viewing. Return true if the image is viewable.
|
||
* @type {Function}
|
||
*/filter:null,/**
|
||
* Enable to request fullscreen when play.
|
||
* @type {boolean}
|
||
*/fullscreen:true,/**
|
||
* Define the initial index of image for viewing.
|
||
* @type {number}
|
||
*/initialViewIndex:0,/**
|
||
* Enable inline mode.
|
||
* @type {boolean}
|
||
*/inline:false,/**
|
||
* The amount of time to delay between automatically cycling an image when playing.
|
||
* @type {number}
|
||
*/interval:5000,/**
|
||
* Enable keyboard support.
|
||
* @type {boolean}
|
||
*/keyboard:true,/**
|
||
* Indicate if show a loading spinner when load image or not.
|
||
* @type {boolean}
|
||
*/loading:true,/**
|
||
* Indicate if enable loop viewing or not.
|
||
* @type {boolean}
|
||
*/loop:true,/**
|
||
* Min width of the viewer in inline mode.
|
||
* @type {number}
|
||
*/minWidth:200,/**
|
||
* Min height of the viewer in inline mode.
|
||
* @type {number}
|
||
*/minHeight:100,/**
|
||
* Enable to move the image.
|
||
* @type {boolean}
|
||
*/movable:true,/**
|
||
* Enable to rotate the image.
|
||
* @type {boolean}
|
||
*/rotatable:true,/**
|
||
* Enable to scale the image.
|
||
* @type {boolean}
|
||
*/scalable:true,/**
|
||
* Enable to zoom the image.
|
||
* @type {boolean}
|
||
*/zoomable:true,/**
|
||
* Enable to zoom the current image by dragging on the touch screen.
|
||
* @type {boolean}
|
||
*/zoomOnTouch:true,/**
|
||
* Enable to zoom the image by wheeling mouse.
|
||
* @type {boolean}
|
||
*/zoomOnWheel:true,/**
|
||
* Enable to slide to the next or previous image by swiping on the touch screen.
|
||
* @type {boolean}
|
||
*/slideOnTouch:true,/**
|
||
* Indicate if toggle the image size between its natural size
|
||
* and initial size when double click on the image or not.
|
||
* @type {boolean}
|
||
*/toggleOnDblclick:true,/**
|
||
* Show the tooltip with image ratio (percentage) when zoom in or zoom out.
|
||
* @type {boolean}
|
||
*/tooltip:true,/**
|
||
* Enable CSS3 Transition for some special elements.
|
||
* @type {boolean}
|
||
*/transition:true,/**
|
||
* Define the CSS `z-index` value of viewer in modal mode.
|
||
* @type {number}
|
||
*/zIndex:2015,/**
|
||
* Define the CSS `z-index` value of viewer in inline mode.
|
||
* @type {number}
|
||
*/zIndexInline:0,/**
|
||
* Define the ratio when zoom the image by wheeling mouse.
|
||
* @type {number}
|
||
*/zoomRatio:0.1,/**
|
||
* Define the min ratio of the image when zoom out.
|
||
* @type {number}
|
||
*/minZoomRatio:0.01,/**
|
||
* Define the max ratio of the image when zoom in.
|
||
* @type {number}
|
||
*/maxZoomRatio:100,/**
|
||
* Define where to get the original image URL for viewing.
|
||
* @type {string | Function}
|
||
*/url:'src',/**
|
||
* Event shortcuts.
|
||
* @type {Function}
|
||
*/ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null,zoom:null,zoomed:null};var TEMPLATE='<div class="viewer-container" touch-action="none">'+'<div class="viewer-canvas"></div>'+'<div class="viewer-footer">'+'<div class="viewer-title"></div>'+'<div class="viewer-toolbar"></div>'+'<div class="viewer-navbar">'+'<ul class="viewer-list"></ul>'+'</div>'+'</div>'+'<div class="viewer-tooltip"></div>'+'<div role="button" class="viewer-button" data-viewer-action="mix"></div>'+'<div class="viewer-player"></div>'+'</div>';var IS_BROWSER=typeof window!=='undefined'&&typeof window.document!=='undefined';var WINDOW=IS_BROWSER?window:{};var IS_TOUCH_DEVICE=IS_BROWSER?'ontouchstart'in WINDOW.document.documentElement:false;var HAS_POINTER_EVENT=IS_BROWSER?'PointerEvent'in WINDOW:false;var NAMESPACE='viewer';// Actions
|
||
var ACTION_MOVE='move';var ACTION_SWITCH='switch';var ACTION_ZOOM='zoom';// Classes
|
||
var CLASS_ACTIVE="".concat(NAMESPACE,"-active");var CLASS_CLOSE="".concat(NAMESPACE,"-close");var CLASS_FADE="".concat(NAMESPACE,"-fade");var CLASS_FIXED="".concat(NAMESPACE,"-fixed");var CLASS_FULLSCREEN="".concat(NAMESPACE,"-fullscreen");var CLASS_FULLSCREEN_EXIT="".concat(NAMESPACE,"-fullscreen-exit");var CLASS_HIDE="".concat(NAMESPACE,"-hide");var CLASS_HIDE_MD_DOWN="".concat(NAMESPACE,"-hide-md-down");var CLASS_HIDE_SM_DOWN="".concat(NAMESPACE,"-hide-sm-down");var CLASS_HIDE_XS_DOWN="".concat(NAMESPACE,"-hide-xs-down");var CLASS_IN="".concat(NAMESPACE,"-in");var CLASS_INVISIBLE="".concat(NAMESPACE,"-invisible");var CLASS_LOADING="".concat(NAMESPACE,"-loading");var CLASS_MOVE="".concat(NAMESPACE,"-move");var CLASS_OPEN="".concat(NAMESPACE,"-open");var CLASS_SHOW="".concat(NAMESPACE,"-show");var CLASS_TRANSITION="".concat(NAMESPACE,"-transition");// Events
|
||
var EVENT_CLICK='click';var EVENT_DBLCLICK='dblclick';var EVENT_DRAG_START='dragstart';var EVENT_HIDDEN='hidden';var EVENT_HIDE='hide';var EVENT_KEY_DOWN='keydown';var EVENT_LOAD='load';var EVENT_TOUCH_START=IS_TOUCH_DEVICE?'touchstart':'mousedown';var EVENT_TOUCH_MOVE=IS_TOUCH_DEVICE?'touchmove':'mousemove';var EVENT_TOUCH_END=IS_TOUCH_DEVICE?'touchend touchcancel':'mouseup';var EVENT_POINTER_DOWN=HAS_POINTER_EVENT?'pointerdown':EVENT_TOUCH_START;var EVENT_POINTER_MOVE=HAS_POINTER_EVENT?'pointermove':EVENT_TOUCH_MOVE;var EVENT_POINTER_UP=HAS_POINTER_EVENT?'pointerup pointercancel':EVENT_TOUCH_END;var EVENT_READY='ready';var EVENT_RESIZE='resize';var EVENT_SHOW='show';var EVENT_SHOWN='shown';var EVENT_TRANSITION_END='transitionend';var EVENT_VIEW='view';var EVENT_VIEWED='viewed';var EVENT_WHEEL='wheel';var EVENT_ZOOM='zoom';var EVENT_ZOOMED='zoomed';// Data keys
|
||
var DATA_ACTION="".concat(NAMESPACE,"Action");// RegExps
|
||
var REGEXP_SPACES=/\s\s*/;// Misc
|
||
var BUTTONS=['zoom-in','zoom-out','one-to-one','reset','prev','play','next','rotate-left','rotate-right','flip-horizontal','flip-vertical'];/**
|
||
* Check if the given value is a string.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is a string, else `false`.
|
||
*/function isString(value){return typeof value==='string';}/**
|
||
* Check if the given value is not a number.
|
||
*/var isNaN=Number.isNaN||WINDOW.isNaN;/**
|
||
* Check if the given value is a number.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is a number, else `false`.
|
||
*/function isNumber(value){return typeof value==='number'&&!isNaN(value);}/**
|
||
* Check if the given value is undefined.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is undefined, else `false`.
|
||
*/function isUndefined(value){return typeof value==='undefined';}/**
|
||
* Check if the given value is an object.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is an object, else `false`.
|
||
*/function isObject(value){return _typeof(value)==='object'&&value!==null;}var hasOwnProperty=Object.prototype.hasOwnProperty;/**
|
||
* Check if the given value is a plain object.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is a plain object, else `false`.
|
||
*/function isPlainObject(value){if(!isObject(value)){return false;}try{var _constructor=value.constructor;var prototype=_constructor.prototype;return _constructor&&prototype&&hasOwnProperty.call(prototype,'isPrototypeOf');}catch(error){return false;}}/**
|
||
* Check if the given value is a function.
|
||
* @param {*} value - The value to check.
|
||
* @returns {boolean} Returns `true` if the given value is a function, else `false`.
|
||
*/function isFunction(value){return typeof value==='function';}/**
|
||
* Iterate the given data.
|
||
* @param {*} data - The data to iterate.
|
||
* @param {Function} callback - The process function for each element.
|
||
* @returns {*} The original data.
|
||
*/function forEach(data,callback){if(data&&isFunction(callback)){if(Array.isArray(data)||isNumber(data.length)/* array-like */){var length=data.length;var i;for(i=0;i<length;i+=1){if(callback.call(data,data[i],i,data)===false){break;}}}else if(isObject(data)){Object.keys(data).forEach(function(key){callback.call(data,data[key],key,data);});}}return data;}/**
|
||
* Extend the given object.
|
||
* @param {*} obj - The object to be extended.
|
||
* @param {*} args - The rest objects which will be merged to the first object.
|
||
* @returns {Object} The extended object.
|
||
*/var assign=Object.assign||function assign(obj){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}if(isObject(obj)&&args.length>0){args.forEach(function(arg){if(isObject(arg)){Object.keys(arg).forEach(function(key){obj[key]=arg[key];});}});}return obj;};var REGEXP_SUFFIX=/^(?:width|height|left|top|marginLeft|marginTop)$/;/**
|
||
* Apply styles to the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {Object} styles - The styles for applying.
|
||
*/function setStyle(element,styles){var style=element.style;forEach(styles,function(value,property){if(REGEXP_SUFFIX.test(property)&&isNumber(value)){value+='px';}style[property]=value;});}/**
|
||
* Escape a string for using in HTML.
|
||
* @param {String} value - The string to escape.
|
||
* @returns {String} Returns the escaped string.
|
||
*/function escapeHTMLEntities(value){return isString(value)?value.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,'&').replace(/"/g,'"').replace(/'/g,''').replace(/</g,'<').replace(/>/g,'>'):value;}/**
|
||
* Check if the given element has a special class.
|
||
* @param {Element} element - The element to check.
|
||
* @param {string} value - The class to search.
|
||
* @returns {boolean} Returns `true` if the special class was found.
|
||
*/function hasClass(element,value){if(!element||!value){return false;}return element.classList?element.classList.contains(value):element.className.indexOf(value)>-1;}/**
|
||
* Add classes to the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {string} value - The classes to be added.
|
||
*/function addClass(element,value){if(!element||!value){return;}if(isNumber(element.length)){forEach(element,function(elem){addClass(elem,value);});return;}if(element.classList){element.classList.add(value);return;}var className=element.className.trim();if(!className){element.className=value;}else if(className.indexOf(value)<0){element.className="".concat(className," ").concat(value);}}/**
|
||
* Remove classes from the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {string} value - The classes to be removed.
|
||
*/function removeClass(element,value){if(!element||!value){return;}if(isNumber(element.length)){forEach(element,function(elem){removeClass(elem,value);});return;}if(element.classList){element.classList.remove(value);return;}if(element.className.indexOf(value)>=0){element.className=element.className.replace(value,'');}}/**
|
||
* Add or remove classes from the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {string} value - The classes to be toggled.
|
||
* @param {boolean} added - Add only.
|
||
*/function toggleClass(element,value,added){if(!value){return;}if(isNumber(element.length)){forEach(element,function(elem){toggleClass(elem,value,added);});return;}// IE10-11 doesn't support the second parameter of `classList.toggle`
|
||
if(added){addClass(element,value);}else{removeClass(element,value);}}var REGEXP_HYPHENATE=/([a-z\d])([A-Z])/g;/**
|
||
* Transform the given string from camelCase to kebab-case
|
||
* @param {string} value - The value to transform.
|
||
* @returns {string} The transformed value.
|
||
*/function hyphenate(value){return value.replace(REGEXP_HYPHENATE,'$1-$2').toLowerCase();}/**
|
||
* Get data from the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {string} name - The data key to get.
|
||
* @returns {string} The data value.
|
||
*/function getData(element,name){if(isObject(element[name])){return element[name];}if(element.dataset){return element.dataset[name];}return element.getAttribute("data-".concat(hyphenate(name)));}/**
|
||
* Set data to the given element.
|
||
* @param {Element} element - The target element.
|
||
* @param {string} name - The data key to set.
|
||
* @param {string} data - The data value.
|
||
*/function setData(element,name,data){if(isObject(data)){element[name]=data;}else if(element.dataset){element.dataset[name]=data;}else{element.setAttribute("data-".concat(hyphenate(name)),data);}}var onceSupported=function(){var supported=false;if(IS_BROWSER){var once=false;var listener=function listener(){};var options=Object.defineProperty({},'once',{get:function get(){supported=true;return once;},/**
|
||
* This setter can fix a `TypeError` in strict mode
|
||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
|
||
* @param {boolean} value - The value to set
|
||
*/set:function set(value){once=value;}});WINDOW.addEventListener('test',listener,options);WINDOW.removeEventListener('test',listener,options);}return supported;}();/**
|
||
* Remove event listener from the target element.
|
||
* @param {Element} element - The event target.
|
||
* @param {string} type - The event type(s).
|
||
* @param {Function} listener - The event listener.
|
||
* @param {Object} options - The event options.
|
||
*/function removeListener(element,type,listener){var options=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};var handler=listener;type.trim().split(REGEXP_SPACES).forEach(function(event){if(!onceSupported){var listeners=element.listeners;if(listeners&&listeners[event]&&listeners[event][listener]){handler=listeners[event][listener];delete listeners[event][listener];if(Object.keys(listeners[event]).length===0){delete listeners[event];}if(Object.keys(listeners).length===0){delete element.listeners;}}}element.removeEventListener(event,handler,options);});}/**
|
||
* Add event listener to the target element.
|
||
* @param {Element} element - The event target.
|
||
* @param {string} type - The event type(s).
|
||
* @param {Function} listener - The event listener.
|
||
* @param {Object} options - The event options.
|
||
*/function addListener(element,type,listener){var options=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};var _handler=listener;type.trim().split(REGEXP_SPACES).forEach(function(event){if(options.once&&!onceSupported){var _element$listeners=element.listeners,listeners=_element$listeners===void 0?{}:_element$listeners;_handler=function handler(){delete listeners[event][listener];element.removeEventListener(event,_handler,options);for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}listener.apply(element,args);};if(!listeners[event]){listeners[event]={};}if(listeners[event][listener]){element.removeEventListener(event,listeners[event][listener],options);}listeners[event][listener]=_handler;element.listeners=listeners;}element.addEventListener(event,_handler,options);});}/**
|
||
* Dispatch event on the target element.
|
||
* @param {Element} element - The event target.
|
||
* @param {string} type - The event type(s).
|
||
* @param {Object} data - The additional event data.
|
||
* @returns {boolean} Indicate if the event is default prevented or not.
|
||
*/function dispatchEvent(element,type,data){var event;// Event and CustomEvent on IE9-11 are global objects, not constructors
|
||
if(isFunction(Event)&&isFunction(CustomEvent)){event=new CustomEvent(type,{detail:data,bubbles:true,cancelable:true});}else{event=document.createEvent('CustomEvent');event.initCustomEvent(type,true,true,data);}return element.dispatchEvent(event);}/**
|
||
* Get the offset base on the document.
|
||
* @param {Element} element - The target element.
|
||
* @returns {Object} The offset data.
|
||
*/function getOffset(element){var box=element.getBoundingClientRect();return{left:box.left+(window.pageXOffset-document.documentElement.clientLeft),top:box.top+(window.pageYOffset-document.documentElement.clientTop)};}/**
|
||
* Get transforms base on the given object.
|
||
* @param {Object} obj - The target object.
|
||
* @returns {string} A string contains transform values.
|
||
*/function getTransforms(_ref){var rotate=_ref.rotate,scaleX=_ref.scaleX,scaleY=_ref.scaleY,translateX=_ref.translateX,translateY=_ref.translateY;var values=[];if(isNumber(translateX)&&translateX!==0){values.push("translateX(".concat(translateX,"px)"));}if(isNumber(translateY)&&translateY!==0){values.push("translateY(".concat(translateY,"px)"));}// Rotate should come first before scale to match orientation transform
|
||
if(isNumber(rotate)&&rotate!==0){values.push("rotate(".concat(rotate,"deg)"));}if(isNumber(scaleX)&&scaleX!==1){values.push("scaleX(".concat(scaleX,")"));}if(isNumber(scaleY)&&scaleY!==1){values.push("scaleY(".concat(scaleY,")"));}var transform=values.length?values.join(' '):'none';return{WebkitTransform:transform,msTransform:transform,transform:transform};}/**
|
||
* Get an image name from an image url.
|
||
* @param {string} url - The target url.
|
||
* @example
|
||
* // picture.jpg
|
||
* getImageNameFromURL('https://domain.com/path/to/picture.jpg?size=1280×960')
|
||
* @returns {string} A string contains the image name.
|
||
*/function getImageNameFromURL(url){return isString(url)?decodeURIComponent(url.replace(/^.*\//,'').replace(/[?&#].*$/,'')):'';}var IS_SAFARI=WINDOW.navigator&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(WINDOW.navigator.userAgent);/**
|
||
* Get an image's natural sizes.
|
||
* @param {string} image - The target image.
|
||
* @param {Function} callback - The callback function.
|
||
* @returns {HTMLImageElement} The new image.
|
||
*/function getImageNaturalSizes(image,callback){var newImage=document.createElement('img');// Modern browsers (except Safari)
|
||
if(image.naturalWidth&&!IS_SAFARI){callback(image.naturalWidth,image.naturalHeight);return newImage;}var body=document.body||document.documentElement;newImage.onload=function(){callback(newImage.width,newImage.height);if(!IS_SAFARI){body.removeChild(newImage);}};newImage.src=image.src;// iOS Safari will convert the image automatically
|
||
// with its orientation once append it into DOM
|
||
if(!IS_SAFARI){newImage.style.cssText='left:0;'+'max-height:none!important;'+'max-width:none!important;'+'min-height:0!important;'+'min-width:0!important;'+'opacity:0;'+'position:absolute;'+'top:0;'+'z-index:-1;';body.appendChild(newImage);}return newImage;}/**
|
||
* Get the related class name of a responsive type number.
|
||
* @param {string} type - The responsive type.
|
||
* @returns {string} The related class name.
|
||
*/function getResponsiveClass(type){switch(type){case 2:return CLASS_HIDE_XS_DOWN;case 3:return CLASS_HIDE_SM_DOWN;case 4:return CLASS_HIDE_MD_DOWN;default:return'';}}/**
|
||
* Get the max ratio of a group of pointers.
|
||
* @param {string} pointers - The target pointers.
|
||
* @returns {number} The result ratio.
|
||
*/function getMaxZoomRatio(pointers){var pointers2=_objectSpread2({},pointers);var ratios=[];forEach(pointers,function(pointer,pointerId){delete pointers2[pointerId];forEach(pointers2,function(pointer2){var x1=Math.abs(pointer.startX-pointer2.startX);var y1=Math.abs(pointer.startY-pointer2.startY);var x2=Math.abs(pointer.endX-pointer2.endX);var y2=Math.abs(pointer.endY-pointer2.endY);var z1=Math.sqrt(x1*x1+y1*y1);var z2=Math.sqrt(x2*x2+y2*y2);var ratio=(z2-z1)/z1;ratios.push(ratio);});});ratios.sort(function(a,b){return Math.abs(a)<Math.abs(b);});return ratios[0];}/**
|
||
* Get a pointer from an event object.
|
||
* @param {Object} event - The target event object.
|
||
* @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.
|
||
* @returns {Object} The result pointer contains start and/or end point coordinates.
|
||
*/function getPointer(_ref2,endOnly){var pageX=_ref2.pageX,pageY=_ref2.pageY;var end={endX:pageX,endY:pageY};return endOnly?end:_objectSpread2({timeStamp:Date.now(),startX:pageX,startY:pageY},end);}/**
|
||
* Get the center point coordinate of a group of pointers.
|
||
* @param {Object} pointers - The target pointers.
|
||
* @returns {Object} The center point coordinate.
|
||
*/function getPointersCenter(pointers){var pageX=0;var pageY=0;var count=0;forEach(pointers,function(_ref3){var startX=_ref3.startX,startY=_ref3.startY;pageX+=startX;pageY+=startY;count+=1;});pageX/=count;pageY/=count;return{pageX:pageX,pageY:pageY};}var render={render:function render(){this.initContainer();this.initViewer();this.initList();this.renderViewer();},initContainer:function initContainer(){this.containerData={width:window.innerWidth,height:window.innerHeight};},initViewer:function initViewer(){var options=this.options,parent=this.parent;var viewerData;if(options.inline){viewerData={width:Math.max(parent.offsetWidth,options.minWidth),height:Math.max(parent.offsetHeight,options.minHeight)};this.parentData=viewerData;}if(this.fulled||!viewerData){viewerData=this.containerData;}this.viewerData=assign({},viewerData);},renderViewer:function renderViewer(){if(this.options.inline&&!this.fulled){setStyle(this.viewer,this.viewerData);}},initList:function initList(){var _this=this;var element=this.element,options=this.options,list=this.list;var items=[];// initList may be called in this.update, so should keep idempotent
|
||
list.innerHTML='';forEach(this.images,function(image,index){var src=image.src;var alt=image.alt||getImageNameFromURL(src);var url=options.url;if(isString(url)){url=image.getAttribute(url);}else if(isFunction(url)){url=url.call(_this,image);}if(src||url){var item=document.createElement('li');var img=document.createElement('img');img.src=src||url;img.alt=alt;img.setAttribute('data-index',index);img.setAttribute('data-original-url',url||src);img.setAttribute('data-viewer-action','view');img.setAttribute('role','button');item.appendChild(img);list.appendChild(item);items.push(item);}});this.items=items;forEach(items,function(item){var image=item.firstElementChild;setData(image,'filled',true);if(options.loading){addClass(item,CLASS_LOADING);}addListener(image,EVENT_LOAD,function(event){if(options.loading){removeClass(item,CLASS_LOADING);}_this.loadImage(event);},{once:true});});if(options.transition){addListener(element,EVENT_VIEWED,function(){addClass(list,CLASS_TRANSITION);},{once:true});}},renderList:function renderList(index){var i=index||this.index;var width=this.items[i].offsetWidth||30;var outerWidth=width+1;// 1 pixel of `margin-left` width
|
||
// Place the active item in the center of the screen
|
||
setStyle(this.list,assign({width:outerWidth*this.length},getTransforms({translateX:(this.viewerData.width-width)/2-outerWidth*i})));},resetList:function resetList(){var list=this.list;list.innerHTML='';removeClass(list,CLASS_TRANSITION);setStyle(list,getTransforms({translateX:0}));},initImage:function initImage(done){var _this2=this;var options=this.options,image=this.image,viewerData=this.viewerData;var footerHeight=this.footer.offsetHeight;var viewerWidth=viewerData.width;var viewerHeight=Math.max(viewerData.height-footerHeight,footerHeight);var oldImageData=this.imageData||{};var sizingImage;this.imageInitializing={abort:function abort(){sizingImage.onload=null;}};sizingImage=getImageNaturalSizes(image,function(naturalWidth,naturalHeight){var aspectRatio=naturalWidth/naturalHeight;var width=viewerWidth;var height=viewerHeight;_this2.imageInitializing=false;if(viewerHeight*aspectRatio>viewerWidth){height=viewerWidth/aspectRatio;}else{width=viewerHeight*aspectRatio;}width=Math.min(width*0.9,naturalWidth);height=Math.min(height*0.9,naturalHeight);var imageData={naturalWidth:naturalWidth,naturalHeight:naturalHeight,aspectRatio:aspectRatio,ratio:width/naturalWidth,width:width,height:height,left:(viewerWidth-width)/2,top:(viewerHeight-height)/2};var initialImageData=assign({},imageData);if(options.rotatable){imageData.rotate=oldImageData.rotate||0;initialImageData.rotate=0;}if(options.scalable){imageData.scaleX=oldImageData.scaleX||1;imageData.scaleY=oldImageData.scaleY||1;initialImageData.scaleX=1;initialImageData.scaleY=1;}_this2.imageData=imageData;_this2.initialImageData=initialImageData;if(done){done();}});},renderImage:function renderImage(done){var _this3=this;var image=this.image,imageData=this.imageData;setStyle(image,assign({width:imageData.width,height:imageData.height,// XXX: Not to use translateX/Y to avoid image shaking when zooming
|
||
marginLeft:imageData.left,marginTop:imageData.top},getTransforms(imageData)));if(done){if((this.viewing||this.zooming)&&this.options.transition){var onTransitionEnd=function onTransitionEnd(){_this3.imageRendering=false;done();};this.imageRendering={abort:function abort(){removeListener(image,EVENT_TRANSITION_END,onTransitionEnd);}};addListener(image,EVENT_TRANSITION_END,onTransitionEnd,{once:true});}else{done();}}},resetImage:function resetImage(){// this.image only defined after viewed
|
||
if(this.viewing||this.viewed){var image=this.image;if(this.viewing){this.viewing.abort();}image.parentNode.removeChild(image);this.image=null;}}};var events={bind:function bind(){var options=this.options,viewer=this.viewer,canvas=this.canvas;var document=this.element.ownerDocument;addListener(viewer,EVENT_CLICK,this.onClick=this.click.bind(this));addListener(viewer,EVENT_DRAG_START,this.onDragStart=this.dragstart.bind(this));addListener(canvas,EVENT_POINTER_DOWN,this.onPointerDown=this.pointerdown.bind(this));addListener(document,EVENT_POINTER_MOVE,this.onPointerMove=this.pointermove.bind(this));addListener(document,EVENT_POINTER_UP,this.onPointerUp=this.pointerup.bind(this));addListener(document,EVENT_KEY_DOWN,this.onKeyDown=this.keydown.bind(this));addListener(window,EVENT_RESIZE,this.onResize=this.resize.bind(this));if(options.zoomable&&options.zoomOnWheel){addListener(viewer,EVENT_WHEEL,this.onWheel=this.wheel.bind(this),{passive:false,capture:true});}if(options.toggleOnDblclick){addListener(canvas,EVENT_DBLCLICK,this.onDblclick=this.dblclick.bind(this));}},unbind:function unbind(){var options=this.options,viewer=this.viewer,canvas=this.canvas;var document=this.element.ownerDocument;removeListener(viewer,EVENT_CLICK,this.onClick);removeListener(viewer,EVENT_DRAG_START,this.onDragStart);removeListener(canvas,EVENT_POINTER_DOWN,this.onPointerDown);removeListener(document,EVENT_POINTER_MOVE,this.onPointerMove);removeListener(document,EVENT_POINTER_UP,this.onPointerUp);removeListener(document,EVENT_KEY_DOWN,this.onKeyDown);removeListener(window,EVENT_RESIZE,this.onResize);if(options.zoomable&&options.zoomOnWheel){removeListener(viewer,EVENT_WHEEL,this.onWheel,{passive:false,capture:true});}if(options.toggleOnDblclick){removeListener(canvas,EVENT_DBLCLICK,this.onDblclick);}}};var handlers={click:function click(event){var target=event.target;var options=this.options,imageData=this.imageData;var action=getData(target,DATA_ACTION);// Cancel the emulated click when the native click event was triggered.
|
||
if(IS_TOUCH_DEVICE&&event.isTrusted&&target===this.canvas){clearTimeout(this.clickCanvasTimeout);}switch(action){case'mix':if(this.played){this.stop();}else if(options.inline){if(this.fulled){this.exit();}else{this.full();}}else{this.hide();}break;case'hide':this.hide();break;case'view':this.view(getData(target,'index'));break;case'zoom-in':this.zoom(0.1,true);break;case'zoom-out':this.zoom(-0.1,true);break;case'one-to-one':this.toggle();break;case'reset':this.reset();break;case'prev':this.prev(options.loop);break;case'play':this.play(options.fullscreen);break;case'next':this.next(options.loop);break;case'rotate-left':this.rotate(-90);break;case'rotate-right':this.rotate(90);break;case'flip-horizontal':this.scaleX(-imageData.scaleX||-1);break;case'flip-vertical':this.scaleY(-imageData.scaleY||-1);break;default:if(this.played){this.stop();}}},dblclick:function dblclick(event){event.preventDefault();if(this.viewed&&event.target===this.image){// Cancel the emulated double click when the native dblclick event was triggered.
|
||
if(IS_TOUCH_DEVICE&&event.isTrusted){clearTimeout(this.doubleClickImageTimeout);}this.toggle();}},load:function load(){var _this=this;if(this.timeout){clearTimeout(this.timeout);this.timeout=false;}var element=this.element,options=this.options,image=this.image,index=this.index,viewerData=this.viewerData;removeClass(image,CLASS_INVISIBLE);if(options.loading){removeClass(this.canvas,CLASS_LOADING);}image.style.cssText='height:0;'+"margin-left:".concat(viewerData.width/2,"px;")+"margin-top:".concat(viewerData.height/2,"px;")+'max-width:none!important;'+'position:absolute;'+'width:0;';this.initImage(function(){toggleClass(image,CLASS_MOVE,options.movable);toggleClass(image,CLASS_TRANSITION,options.transition);_this.renderImage(function(){_this.viewed=true;_this.viewing=false;if(isFunction(options.viewed)){addListener(element,EVENT_VIEWED,options.viewed,{once:true});}dispatchEvent(element,EVENT_VIEWED,{originalImage:_this.images[index],index:index,image:image});});});},loadImage:function loadImage(event){var image=event.target;var parent=image.parentNode;var parentWidth=parent.offsetWidth||30;var parentHeight=parent.offsetHeight||50;var filled=!!getData(image,'filled');getImageNaturalSizes(image,function(naturalWidth,naturalHeight){var aspectRatio=naturalWidth/naturalHeight;var width=parentWidth;var height=parentHeight;if(parentHeight*aspectRatio>parentWidth){if(filled){width=parentHeight*aspectRatio;}else{height=parentWidth/aspectRatio;}}else if(filled){height=parentWidth/aspectRatio;}else{width=parentHeight*aspectRatio;}setStyle(image,assign({width:width,height:height},getTransforms({translateX:(parentWidth-width)/2,translateY:(parentHeight-height)/2})));});},keydown:function keydown(event){var options=this.options;if(!this.fulled||!options.keyboard){return;}switch(event.keyCode||event.which||event.charCode){// Escape
|
||
case 27:if(this.played){this.stop();}else if(options.inline){if(this.fulled){this.exit();}}else{this.hide();}break;// Space
|
||
case 32:if(this.played){this.stop();}break;// ArrowLeft
|
||
case 37:this.prev(options.loop);break;// ArrowUp
|
||
case 38:// Prevent scroll on Firefox
|
||
event.preventDefault();// Zoom in
|
||
this.zoom(options.zoomRatio,true);break;// ArrowRight
|
||
case 39:this.next(options.loop);break;// ArrowDown
|
||
case 40:// Prevent scroll on Firefox
|
||
event.preventDefault();// Zoom out
|
||
this.zoom(-options.zoomRatio,true);break;// Ctrl + 0
|
||
case 48:// Fall through
|
||
// Ctrl + 1
|
||
// eslint-disable-next-line no-fallthrough
|
||
case 49:if(event.ctrlKey){event.preventDefault();this.toggle();}break;}},dragstart:function dragstart(event){if(event.target.tagName.toLowerCase()==='img'){event.preventDefault();}},pointerdown:function pointerdown(event){var options=this.options,pointers=this.pointers;var buttons=event.buttons,button=event.button;if(!this.viewed||this.showing||this.viewing||this.hiding// Handle mouse event and pointer event and ignore touch event
|
||
||(event.type==='mousedown'||event.type==='pointerdown'&&event.pointerType==='mouse')&&(// No primary button (Usually the left button)
|
||
isNumber(buttons)&&buttons!==1||isNumber(button)&&button!==0// Open context menu
|
||
||event.ctrlKey)){return;}// Prevent default behaviours as page zooming in touch devices.
|
||
event.preventDefault();if(event.changedTouches){forEach(event.changedTouches,function(touch){pointers[touch.identifier]=getPointer(touch);});}else{pointers[event.pointerId||0]=getPointer(event);}var action=options.movable?ACTION_MOVE:false;if(options.zoomOnTouch&&options.zoomable&&Object.keys(pointers).length>1){action=ACTION_ZOOM;}else if(options.slideOnTouch&&(event.pointerType==='touch'||event.type==='touchstart')&&this.isSwitchable()){action=ACTION_SWITCH;}if(options.transition&&(action===ACTION_MOVE||action===ACTION_ZOOM)){removeClass(this.image,CLASS_TRANSITION);}this.action=action;},pointermove:function pointermove(event){var pointers=this.pointers,action=this.action;if(!this.viewed||!action){return;}event.preventDefault();if(event.changedTouches){forEach(event.changedTouches,function(touch){assign(pointers[touch.identifier]||{},getPointer(touch,true));});}else{assign(pointers[event.pointerId||0]||{},getPointer(event,true));}this.change(event);},pointerup:function pointerup(event){var _this2=this;var options=this.options,action=this.action,pointers=this.pointers;var pointer;if(event.changedTouches){forEach(event.changedTouches,function(touch){pointer=pointers[touch.identifier];delete pointers[touch.identifier];});}else{pointer=pointers[event.pointerId||0];delete pointers[event.pointerId||0];}if(!action){return;}event.preventDefault();if(options.transition&&(action===ACTION_MOVE||action===ACTION_ZOOM)){addClass(this.image,CLASS_TRANSITION);}this.action=false;// Emulate click and double click in touch devices to support backdrop and image zooming (#210).
|
||
if(IS_TOUCH_DEVICE&&action!==ACTION_ZOOM&&pointer&&Date.now()-pointer.timeStamp<500){clearTimeout(this.clickCanvasTimeout);clearTimeout(this.doubleClickImageTimeout);if(options.toggleOnDblclick&&this.viewed&&event.target===this.image){if(this.imageClicked){this.imageClicked=false;// This timeout will be cleared later when a native dblclick event is triggering
|
||
this.doubleClickImageTimeout=setTimeout(function(){dispatchEvent(_this2.image,EVENT_DBLCLICK);},50);}else{this.imageClicked=true;// The default timing of a double click in Windows is 500 ms
|
||
this.doubleClickImageTimeout=setTimeout(function(){_this2.imageClicked=false;},500);}}else{this.imageClicked=false;if(options.backdrop&&options.backdrop!=='static'&&event.target===this.canvas){// This timeout will be cleared later when a native click event is triggering
|
||
this.clickCanvasTimeout=setTimeout(function(){dispatchEvent(_this2.canvas,EVENT_CLICK);},50);}}}},resize:function resize(){var _this3=this;if(!this.isShown||this.hiding){return;}this.initContainer();this.initViewer();this.renderViewer();this.renderList();if(this.viewed){this.initImage(function(){_this3.renderImage();});}if(this.played){if(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){this.stop();return;}forEach(this.player.getElementsByTagName('img'),function(image){addListener(image,EVENT_LOAD,_this3.loadImage.bind(_this3),{once:true});dispatchEvent(image,EVENT_LOAD);});}},wheel:function wheel(event){var _this4=this;if(!this.viewed){return;}event.preventDefault();// Limit wheel speed to prevent zoom too fast
|
||
if(this.wheeling){return;}this.wheeling=true;setTimeout(function(){_this4.wheeling=false;},50);var ratio=Number(this.options.zoomRatio)||0.1;var delta=1;if(event.deltaY){delta=event.deltaY>0?1:-1;}else if(event.wheelDelta){delta=-event.wheelDelta/120;}else if(event.detail){delta=event.detail>0?1:-1;}this.zoom(-delta*ratio,true,event);}};var methods={/** Show the viewer (only available in modal mode)
|
||
* @param {boolean} [immediate=false] - Indicates if show the viewer immediately or not.
|
||
* @returns {Viewer} this
|
||
*/show:function show(){var immediate=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var element=this.element,options=this.options;if(options.inline||this.showing||this.isShown||this.showing){return this;}if(!this.ready){this.build();if(this.ready){this.show(immediate);}return this;}if(isFunction(options.show)){addListener(element,EVENT_SHOW,options.show,{once:true});}if(dispatchEvent(element,EVENT_SHOW)===false||!this.ready){return this;}if(this.hiding){this.transitioning.abort();}this.showing=true;this.open();var viewer=this.viewer;removeClass(viewer,CLASS_HIDE);if(options.transition&&!immediate){var shown=this.shown.bind(this);this.transitioning={abort:function abort(){removeListener(viewer,EVENT_TRANSITION_END,shown);removeClass(viewer,CLASS_IN);}};addClass(viewer,CLASS_TRANSITION);// Force reflow to enable CSS3 transition
|
||
viewer.initialOffsetWidth=viewer.offsetWidth;addListener(viewer,EVENT_TRANSITION_END,shown,{once:true});addClass(viewer,CLASS_IN);}else{addClass(viewer,CLASS_IN);this.shown();}return this;},/**
|
||
* Hide the viewer (only available in modal mode)
|
||
* @param {boolean} [immediate=false] - Indicates if hide the viewer immediately or not.
|
||
* @returns {Viewer} this
|
||
*/hide:function hide(){var immediate=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var element=this.element,options=this.options;if(options.inline||this.hiding||!(this.isShown||this.showing)){return this;}if(isFunction(options.hide)){addListener(element,EVENT_HIDE,options.hide,{once:true});}if(dispatchEvent(element,EVENT_HIDE)===false){return this;}if(this.showing){this.transitioning.abort();}this.hiding=true;if(this.played){this.stop();}else if(this.viewing){this.viewing.abort();}var viewer=this.viewer;if(options.transition&&!immediate){var hidden=this.hidden.bind(this);var hide=function hide(){// XXX: It seems the `event.stopPropagation()` method does not work here
|
||
setTimeout(function(){addListener(viewer,EVENT_TRANSITION_END,hidden,{once:true});removeClass(viewer,CLASS_IN);},0);};this.transitioning={abort:function abort(){if(this.viewed){removeListener(this.image,EVENT_TRANSITION_END,hide);}else{removeListener(viewer,EVENT_TRANSITION_END,hidden);}}};// Note that the `CLASS_TRANSITION` class will be removed on pointer down (#255)
|
||
if(this.viewed&&hasClass(this.image,CLASS_TRANSITION)){addListener(this.image,EVENT_TRANSITION_END,hide,{once:true});this.zoomTo(0,false,false,true);}else{hide();}}else{removeClass(viewer,CLASS_IN);this.hidden();}return this;},/**
|
||
* View one of the images with image's index
|
||
* @param {number} index - The index of the image to view.
|
||
* @returns {Viewer} this
|
||
*/view:function view(){var _this=this;var index=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.options.initialViewIndex;index=Number(index)||0;if(this.hiding||this.played||index<0||index>=this.length||this.viewed&&index===this.index){return this;}if(!this.isShown){this.index=index;return this.show();}if(this.viewing){this.viewing.abort();}var element=this.element,options=this.options,title=this.title,canvas=this.canvas;var item=this.items[index];var img=item.querySelector('img');var url=getData(img,'originalUrl');var alt=img.getAttribute('alt');var image=document.createElement('img');image.src=url;image.alt=alt;if(isFunction(options.view)){addListener(element,EVENT_VIEW,options.view,{once:true});}if(dispatchEvent(element,EVENT_VIEW,{originalImage:this.images[index],index:index,image:image})===false||!this.isShown||this.hiding||this.played){return this;}this.image=image;removeClass(this.items[this.index],CLASS_ACTIVE);addClass(item,CLASS_ACTIVE);this.viewed=false;this.index=index;this.imageData={};addClass(image,CLASS_INVISIBLE);if(options.loading){addClass(canvas,CLASS_LOADING);}canvas.innerHTML='';canvas.appendChild(image);// Center current item
|
||
this.renderList();// Clear title
|
||
title.innerHTML='';// Generate title after viewed
|
||
var onViewed=function onViewed(){var imageData=_this.imageData;var render=Array.isArray(options.title)?options.title[1]:options.title;title.innerHTML=escapeHTMLEntities(isFunction(render)?render.call(_this,image,imageData):"".concat(alt," (").concat(imageData.naturalWidth," \xD7 ").concat(imageData.naturalHeight,")"));};var onLoad;addListener(element,EVENT_VIEWED,onViewed,{once:true});this.viewing={abort:function abort(){removeListener(element,EVENT_VIEWED,onViewed);if(image.complete){if(this.imageRendering){this.imageRendering.abort();}else if(this.imageInitializing){this.imageInitializing.abort();}}else{// Cancel download to save bandwidth.
|
||
image.src='';removeListener(image,EVENT_LOAD,onLoad);if(this.timeout){clearTimeout(this.timeout);}}}};if(image.complete){this.load();}else{addListener(image,EVENT_LOAD,onLoad=this.load.bind(this),{once:true});if(this.timeout){clearTimeout(this.timeout);}// Make the image visible if it fails to load within 1s
|
||
this.timeout=setTimeout(function(){removeClass(image,CLASS_INVISIBLE);_this.timeout=false;},1000);}return this;},/**
|
||
* View the previous image
|
||
* @param {boolean} [loop=false] - Indicate if view the last one
|
||
* when it is the first one at present.
|
||
* @returns {Viewer} this
|
||
*/prev:function prev(){var loop=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var index=this.index-1;if(index<0){index=loop?this.length-1:0;}this.view(index);return this;},/**
|
||
* View the next image
|
||
* @param {boolean} [loop=false] - Indicate if view the first one
|
||
* when it is the last one at present.
|
||
* @returns {Viewer} this
|
||
*/next:function next(){var loop=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var maxIndex=this.length-1;var index=this.index+1;if(index>maxIndex){index=loop?0:maxIndex;}this.view(index);return this;},/**
|
||
* Move the image with relative offsets.
|
||
* @param {number} offsetX - The relative offset distance on the x-axis.
|
||
* @param {number} offsetY - The relative offset distance on the y-axis.
|
||
* @returns {Viewer} this
|
||
*/move:function move(offsetX,offsetY){var imageData=this.imageData;this.moveTo(isUndefined(offsetX)?offsetX:imageData.left+Number(offsetX),isUndefined(offsetY)?offsetY:imageData.top+Number(offsetY));return this;},/**
|
||
* Move the image to an absolute point.
|
||
* @param {number} x - The x-axis coordinate.
|
||
* @param {number} [y=x] - The y-axis coordinate.
|
||
* @returns {Viewer} this
|
||
*/moveTo:function moveTo(x){var y=arguments.length>1&&arguments[1]!==undefined?arguments[1]:x;var imageData=this.imageData;x=Number(x);y=Number(y);if(this.viewed&&!this.played&&this.options.movable){var changed=false;if(isNumber(x)){imageData.left=x;changed=true;}if(isNumber(y)){imageData.top=y;changed=true;}if(changed){this.renderImage();}}return this;},/**
|
||
* Zoom the image with a relative ratio.
|
||
* @param {number} ratio - The target ratio.
|
||
* @param {boolean} [hasTooltip=false] - Indicates if it has a tooltip or not.
|
||
* @param {Event} [_originalEvent=null] - The original event if any.
|
||
* @returns {Viewer} this
|
||
*/zoom:function zoom(ratio){var hasTooltip=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var _originalEvent=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var imageData=this.imageData;ratio=Number(ratio);if(ratio<0){ratio=1/(1-ratio);}else{ratio=1+ratio;}this.zoomTo(imageData.width*ratio/imageData.naturalWidth,hasTooltip,_originalEvent);return this;},/**
|
||
* Zoom the image to an absolute ratio.
|
||
* @param {number} ratio - The target ratio.
|
||
* @param {boolean} [hasTooltip=false] - Indicates if it has a tooltip or not.
|
||
* @param {Event} [_originalEvent=null] - The original event if any.
|
||
* @param {Event} [_zoomable=false] - Indicates if the current zoom is available or not.
|
||
* @returns {Viewer} this
|
||
*/zoomTo:function zoomTo(ratio){var _this2=this;var hasTooltip=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var _originalEvent=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var _zoomable=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var element=this.element,options=this.options,pointers=this.pointers,imageData=this.imageData;var width=imageData.width,height=imageData.height,left=imageData.left,top=imageData.top,naturalWidth=imageData.naturalWidth,naturalHeight=imageData.naturalHeight;ratio=Math.max(0,ratio);if(isNumber(ratio)&&this.viewed&&!this.played&&(_zoomable||options.zoomable)){if(!_zoomable){var minZoomRatio=Math.max(0.01,options.minZoomRatio);var maxZoomRatio=Math.min(100,options.maxZoomRatio);ratio=Math.min(Math.max(ratio,minZoomRatio),maxZoomRatio);}if(_originalEvent&&ratio>0.95&&ratio<1.05){ratio=1;}var newWidth=naturalWidth*ratio;var newHeight=naturalHeight*ratio;var offsetWidth=newWidth-width;var offsetHeight=newHeight-height;var oldRatio=width/naturalWidth;if(isFunction(options.zoom)){addListener(element,EVENT_ZOOM,options.zoom,{once:true});}if(dispatchEvent(element,EVENT_ZOOM,{ratio:ratio,oldRatio:oldRatio,originalEvent:_originalEvent})===false){return this;}this.zooming=true;if(_originalEvent){var offset=getOffset(this.viewer);var center=pointers&&Object.keys(pointers).length?getPointersCenter(pointers):{pageX:_originalEvent.pageX,pageY:_originalEvent.pageY};// Zoom from the triggering point of the event
|
||
imageData.left-=offsetWidth*((center.pageX-offset.left-left)/width);imageData.top-=offsetHeight*((center.pageY-offset.top-top)/height);}else{// Zoom from the center of the image
|
||
imageData.left-=offsetWidth/2;imageData.top-=offsetHeight/2;}imageData.width=newWidth;imageData.height=newHeight;imageData.ratio=ratio;this.renderImage(function(){_this2.zooming=false;if(isFunction(options.zoomed)){addListener(element,EVENT_ZOOMED,options.zoomed,{once:true});}dispatchEvent(element,EVENT_ZOOMED,{ratio:ratio,oldRatio:oldRatio,originalEvent:_originalEvent});});if(hasTooltip){this.tooltip();}}return this;},/**
|
||
* Rotate the image with a relative degree.
|
||
* @param {number} degree - The rotate degree.
|
||
* @returns {Viewer} this
|
||
*/rotate:function rotate(degree){this.rotateTo((this.imageData.rotate||0)+Number(degree));return this;},/**
|
||
* Rotate the image to an absolute degree.
|
||
* @param {number} degree - The rotate degree.
|
||
* @returns {Viewer} this
|
||
*/rotateTo:function rotateTo(degree){var imageData=this.imageData;degree=Number(degree);if(isNumber(degree)&&this.viewed&&!this.played&&this.options.rotatable){imageData.rotate=degree;this.renderImage();}return this;},/**
|
||
* Scale the image on the x-axis.
|
||
* @param {number} scaleX - The scale ratio on the x-axis.
|
||
* @returns {Viewer} this
|
||
*/scaleX:function scaleX(_scaleX){this.scale(_scaleX,this.imageData.scaleY);return this;},/**
|
||
* Scale the image on the y-axis.
|
||
* @param {number} scaleY - The scale ratio on the y-axis.
|
||
* @returns {Viewer} this
|
||
*/scaleY:function scaleY(_scaleY){this.scale(this.imageData.scaleX,_scaleY);return this;},/**
|
||
* Scale the image.
|
||
* @param {number} scaleX - The scale ratio on the x-axis.
|
||
* @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
|
||
* @returns {Viewer} this
|
||
*/scale:function scale(scaleX){var scaleY=arguments.length>1&&arguments[1]!==undefined?arguments[1]:scaleX;var imageData=this.imageData;scaleX=Number(scaleX);scaleY=Number(scaleY);if(this.viewed&&!this.played&&this.options.scalable){var changed=false;if(isNumber(scaleX)){imageData.scaleX=scaleX;changed=true;}if(isNumber(scaleY)){imageData.scaleY=scaleY;changed=true;}if(changed){this.renderImage();}}return this;},/**
|
||
* Play the images
|
||
* @param {boolean} [fullscreen=false] - Indicate if request fullscreen or not.
|
||
* @returns {Viewer} this
|
||
*/play:function play(){var _this3=this;var fullscreen=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(!this.isShown||this.played){return this;}var options=this.options,player=this.player;var onLoad=this.loadImage.bind(this);var list=[];var total=0;var index=0;this.played=true;this.onLoadWhenPlay=onLoad;if(fullscreen){this.requestFullscreen();}addClass(player,CLASS_SHOW);forEach(this.items,function(item,i){var img=item.querySelector('img');var image=document.createElement('img');image.src=getData(img,'originalUrl');image.alt=img.getAttribute('alt');total+=1;addClass(image,CLASS_FADE);toggleClass(image,CLASS_TRANSITION,options.transition);if(hasClass(item,CLASS_ACTIVE)){addClass(image,CLASS_IN);index=i;}list.push(image);addListener(image,EVENT_LOAD,onLoad,{once:true});player.appendChild(image);});if(isNumber(options.interval)&&options.interval>0){var play=function play(){_this3.playing=setTimeout(function(){removeClass(list[index],CLASS_IN);index+=1;index=index<total?index:0;addClass(list[index],CLASS_IN);play();},options.interval);};if(total>1){play();}}return this;},// Stop play
|
||
stop:function stop(){var _this4=this;if(!this.played){return this;}var player=this.player;this.played=false;clearTimeout(this.playing);forEach(player.getElementsByTagName('img'),function(image){removeListener(image,EVENT_LOAD,_this4.onLoadWhenPlay);});removeClass(player,CLASS_SHOW);player.innerHTML='';this.exitFullscreen();return this;},// Enter modal mode (only available in inline mode)
|
||
full:function full(){var _this5=this;var options=this.options,viewer=this.viewer,image=this.image,list=this.list;if(!this.isShown||this.played||this.fulled||!options.inline){return this;}this.fulled=true;this.open();addClass(this.button,CLASS_FULLSCREEN_EXIT);if(options.transition){removeClass(list,CLASS_TRANSITION);if(this.viewed){removeClass(image,CLASS_TRANSITION);}}addClass(viewer,CLASS_FIXED);viewer.setAttribute('style','');setStyle(viewer,{zIndex:options.zIndex});this.initContainer();this.viewerData=assign({},this.containerData);this.renderList();if(this.viewed){this.initImage(function(){_this5.renderImage(function(){if(options.transition){setTimeout(function(){addClass(image,CLASS_TRANSITION);addClass(list,CLASS_TRANSITION);},0);}});});}return this;},// Exit modal mode (only available in inline mode)
|
||
exit:function exit(){var _this6=this;var options=this.options,viewer=this.viewer,image=this.image,list=this.list;if(!this.isShown||this.played||!this.fulled||!options.inline){return this;}this.fulled=false;this.close();removeClass(this.button,CLASS_FULLSCREEN_EXIT);if(options.transition){removeClass(list,CLASS_TRANSITION);if(this.viewed){removeClass(image,CLASS_TRANSITION);}}removeClass(viewer,CLASS_FIXED);setStyle(viewer,{zIndex:options.zIndexInline});this.viewerData=assign({},this.parentData);this.renderViewer();this.renderList();if(this.viewed){this.initImage(function(){_this6.renderImage(function(){if(options.transition){setTimeout(function(){addClass(image,CLASS_TRANSITION);addClass(list,CLASS_TRANSITION);},0);}});});}return this;},// Show the current ratio of the image with percentage
|
||
tooltip:function tooltip(){var _this7=this;var options=this.options,tooltipBox=this.tooltipBox,imageData=this.imageData;if(!this.viewed||this.played||!options.tooltip){return this;}tooltipBox.textContent="".concat(Math.round(imageData.ratio*100),"%");if(!this.tooltipping){if(options.transition){if(this.fading){dispatchEvent(tooltipBox,EVENT_TRANSITION_END);}addClass(tooltipBox,CLASS_SHOW);addClass(tooltipBox,CLASS_FADE);addClass(tooltipBox,CLASS_TRANSITION);// Force reflow to enable CSS3 transition
|
||
tooltipBox.initialOffsetWidth=tooltipBox.offsetWidth;addClass(tooltipBox,CLASS_IN);}else{addClass(tooltipBox,CLASS_SHOW);}}else{clearTimeout(this.tooltipping);}this.tooltipping=setTimeout(function(){if(options.transition){addListener(tooltipBox,EVENT_TRANSITION_END,function(){removeClass(tooltipBox,CLASS_SHOW);removeClass(tooltipBox,CLASS_FADE);removeClass(tooltipBox,CLASS_TRANSITION);_this7.fading=false;},{once:true});removeClass(tooltipBox,CLASS_IN);_this7.fading=true;}else{removeClass(tooltipBox,CLASS_SHOW);}_this7.tooltipping=false;},1000);return this;},// Toggle the image size between its natural size and initial size
|
||
toggle:function toggle(){if(this.imageData.ratio===1){this.zoomTo(this.initialImageData.ratio,true);}else{this.zoomTo(1,true);}return this;},// Reset the image to its initial state
|
||
reset:function reset(){if(this.viewed&&!this.played){this.imageData=assign({},this.initialImageData);this.renderImage();}return this;},// Update viewer when images changed
|
||
update:function update(){var element=this.element,options=this.options,isImg=this.isImg;// Destroy viewer if the target image was deleted
|
||
if(isImg&&!element.parentNode){return this.destroy();}var images=[];forEach(isImg?[element]:element.querySelectorAll('img'),function(image){if(options.filter){if(options.filter(image)){images.push(image);}}else{images.push(image);}});if(!images.length){return this;}this.images=images;this.length=images.length;if(this.ready){var indexes=[];forEach(this.items,function(item,i){var img=item.querySelector('img');var image=images[i];if(image&&img){if(image.src!==img.src){indexes.push(i);}}else{indexes.push(i);}});setStyle(this.list,{width:'auto'});this.initList();if(this.isShown){if(this.length){if(this.viewed){var index=indexes.indexOf(this.index);if(index>=0){this.viewed=false;this.view(Math.max(this.index-(index+1),0));}else{addClass(this.items[this.index],CLASS_ACTIVE);}}}else{this.image=null;this.viewed=false;this.index=0;this.imageData={};this.canvas.innerHTML='';this.title.innerHTML='';}}}else{this.build();}return this;},// Destroy the viewer
|
||
destroy:function destroy(){var element=this.element,options=this.options;if(!element[NAMESPACE]){return this;}this.destroyed=true;if(this.ready){if(this.played){this.stop();}if(options.inline){if(this.fulled){this.exit();}this.unbind();}else if(this.isShown){if(this.viewing){if(this.imageRendering){this.imageRendering.abort();}else if(this.imageInitializing){this.imageInitializing.abort();}}if(this.hiding){this.transitioning.abort();}this.hidden();}else if(this.showing){this.transitioning.abort();this.hidden();}this.ready=false;this.viewer.parentNode.removeChild(this.viewer);}else if(options.inline){if(this.delaying){this.delaying.abort();}else if(this.initializing){this.initializing.abort();}}if(!options.inline){removeListener(element,EVENT_CLICK,this.onStart);}element[NAMESPACE]=undefined;return this;}};var others={open:function open(){var body=this.body;addClass(body,CLASS_OPEN);body.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyPaddingRight)||0),"px");},close:function close(){var body=this.body;removeClass(body,CLASS_OPEN);body.style.paddingRight=this.initialBodyPaddingRight;},shown:function shown(){var element=this.element,options=this.options;this.fulled=true;this.isShown=true;this.render();this.bind();this.showing=false;if(isFunction(options.shown)){addListener(element,EVENT_SHOWN,options.shown,{once:true});}if(dispatchEvent(element,EVENT_SHOWN)===false){return;}if(this.ready&&this.isShown&&!this.hiding){this.view(this.index);}},hidden:function hidden(){var element=this.element,options=this.options;this.fulled=false;this.viewed=false;this.isShown=false;this.close();this.unbind();addClass(this.viewer,CLASS_HIDE);this.resetList();this.resetImage();this.hiding=false;if(!this.destroyed){if(isFunction(options.hidden)){addListener(element,EVENT_HIDDEN,options.hidden,{once:true});}dispatchEvent(element,EVENT_HIDDEN);}},requestFullscreen:function requestFullscreen(){var document=this.element.ownerDocument;if(this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){var documentElement=document.documentElement;// Element.requestFullscreen()
|
||
if(documentElement.requestFullscreen){documentElement.requestFullscreen();}else if(documentElement.webkitRequestFullscreen){documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);}else if(documentElement.mozRequestFullScreen){documentElement.mozRequestFullScreen();}else if(documentElement.msRequestFullscreen){documentElement.msRequestFullscreen();}}},exitFullscreen:function exitFullscreen(){var document=this.element.ownerDocument;if(this.fulled&&(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){// Document.exitFullscreen()
|
||
if(document.exitFullscreen){document.exitFullscreen();}else if(document.webkitExitFullscreen){document.webkitExitFullscreen();}else if(document.mozCancelFullScreen){document.mozCancelFullScreen();}else if(document.msExitFullscreen){document.msExitFullscreen();}}},change:function change(event){var options=this.options,pointers=this.pointers;var pointer=pointers[Object.keys(pointers)[0]];var offsetX=pointer.endX-pointer.startX;var offsetY=pointer.endY-pointer.startY;switch(this.action){// Move the current image
|
||
case ACTION_MOVE:this.move(offsetX,offsetY);break;// Zoom the current image
|
||
case ACTION_ZOOM:this.zoom(getMaxZoomRatio(pointers),false,event);break;case ACTION_SWITCH:{this.action='switched';var absoluteOffsetX=Math.abs(offsetX);if(absoluteOffsetX>1&&absoluteOffsetX>Math.abs(offsetY)){// Empty `pointers` as `touchend` event will not be fired after swiped in iOS browsers.
|
||
this.pointers={};if(offsetX>1){this.prev(options.loop);}else if(offsetX<-1){this.next(options.loop);}}break;}}// Override
|
||
forEach(pointers,function(p){p.startX=p.endX;p.startY=p.endY;});},isSwitchable:function isSwitchable(){var imageData=this.imageData,viewerData=this.viewerData;return this.length>1&&imageData.left>=0&&imageData.top>=0&&imageData.width<=viewerData.width&&imageData.height<=viewerData.height;}};var AnotherViewer=WINDOW.Viewer;var Viewer=/*#__PURE__*/function(){/**
|
||
* Create a new Viewer.
|
||
* @param {Element} element - The target element for viewing.
|
||
* @param {Object} [options={}] - The configuration options.
|
||
*/function Viewer(element){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Viewer);if(!element||element.nodeType!==1){throw new Error('The first argument is required and must be an element.');}this.element=element;this.options=assign({},DEFAULTS,isPlainObject(options)&&options);this.action=false;this.fading=false;this.fulled=false;this.hiding=false;this.imageClicked=false;this.imageData={};this.index=this.options.initialViewIndex;this.isImg=false;this.isShown=false;this.length=0;this.played=false;this.playing=false;this.pointers={};this.ready=false;this.showing=false;this.timeout=false;this.tooltipping=false;this.viewed=false;this.viewing=false;this.wheeling=false;this.zooming=false;this.init();}_createClass(Viewer,[{key:"init",value:function init(){var _this=this;var element=this.element,options=this.options;if(element[NAMESPACE]){return;}element[NAMESPACE]=this;var isImg=element.tagName.toLowerCase()==='img';var images=[];forEach(isImg?[element]:element.querySelectorAll('img'),function(image){if(isFunction(options.filter)){if(options.filter.call(_this,image)){images.push(image);}}else{images.push(image);}});this.isImg=isImg;this.length=images.length;this.images=images;var ownerDocument=element.ownerDocument;var body=ownerDocument.body||ownerDocument.documentElement;this.body=body;this.scrollbarWidth=window.innerWidth-ownerDocument.documentElement.clientWidth;this.initialBodyPaddingRight=window.getComputedStyle(body).paddingRight;// Override `transition` option if it is not supported
|
||
if(isUndefined(document.createElement(NAMESPACE).style.transition)){options.transition=false;}if(options.inline){var count=0;var progress=function progress(){count+=1;if(count===_this.length){var timeout;_this.initializing=false;_this.delaying={abort:function abort(){clearTimeout(timeout);}};// build asynchronously to keep `this.viewer` is accessible in `ready` event handler.
|
||
timeout=setTimeout(function(){_this.delaying=false;_this.build();},0);}};this.initializing={abort:function abort(){forEach(images,function(image){if(!image.complete){removeListener(image,EVENT_LOAD,progress);}});}};forEach(images,function(image){if(image.complete){progress();}else{addListener(image,EVENT_LOAD,progress,{once:true});}});}else{addListener(element,EVENT_CLICK,this.onStart=function(_ref){var target=_ref.target;if(target.tagName.toLowerCase()==='img'&&(!isFunction(options.filter)||options.filter.call(_this,target))){_this.view(_this.images.indexOf(target));}});}}},{key:"build",value:function build(){if(this.ready){return;}var element=this.element,options=this.options;var parent=element.parentNode;var template=document.createElement('div');template.innerHTML=TEMPLATE;var viewer=template.querySelector(".".concat(NAMESPACE,"-container"));var title=viewer.querySelector(".".concat(NAMESPACE,"-title"));var toolbar=viewer.querySelector(".".concat(NAMESPACE,"-toolbar"));var navbar=viewer.querySelector(".".concat(NAMESPACE,"-navbar"));var button=viewer.querySelector(".".concat(NAMESPACE,"-button"));var canvas=viewer.querySelector(".".concat(NAMESPACE,"-canvas"));this.parent=parent;this.viewer=viewer;this.title=title;this.toolbar=toolbar;this.navbar=navbar;this.button=button;this.canvas=canvas;this.footer=viewer.querySelector(".".concat(NAMESPACE,"-footer"));this.tooltipBox=viewer.querySelector(".".concat(NAMESPACE,"-tooltip"));this.player=viewer.querySelector(".".concat(NAMESPACE,"-player"));this.list=viewer.querySelector(".".concat(NAMESPACE,"-list"));addClass(title,!options.title?CLASS_HIDE:getResponsiveClass(Array.isArray(options.title)?options.title[0]:options.title));addClass(navbar,!options.navbar?CLASS_HIDE:getResponsiveClass(options.navbar));toggleClass(button,CLASS_HIDE,!options.button);if(options.backdrop){addClass(viewer,"".concat(NAMESPACE,"-backdrop"));if(!options.inline&&options.backdrop!=='static'){setData(canvas,DATA_ACTION,'hide');}}if(isString(options.className)&&options.className){// In case there are multiple class names
|
||
options.className.split(REGEXP_SPACES).forEach(function(className){addClass(viewer,className);});}if(options.toolbar){var list=document.createElement('ul');var custom=isPlainObject(options.toolbar);var zoomButtons=BUTTONS.slice(0,3);var rotateButtons=BUTTONS.slice(7,9);var scaleButtons=BUTTONS.slice(9);if(!custom){addClass(toolbar,getResponsiveClass(options.toolbar));}forEach(custom?options.toolbar:BUTTONS,function(value,index){var deep=custom&&isPlainObject(value);var name=custom?hyphenate(index):value;var show=deep&&!isUndefined(value.show)?value.show:value;if(!show||!options.zoomable&&zoomButtons.indexOf(name)!==-1||!options.rotatable&&rotateButtons.indexOf(name)!==-1||!options.scalable&&scaleButtons.indexOf(name)!==-1){return;}var size=deep&&!isUndefined(value.size)?value.size:value;var click=deep&&!isUndefined(value.click)?value.click:value;var item=document.createElement('li');item.setAttribute('role','button');addClass(item,"".concat(NAMESPACE,"-").concat(name));if(!isFunction(click)){setData(item,DATA_ACTION,name);}if(isNumber(show)){addClass(item,getResponsiveClass(show));}if(['small','large'].indexOf(size)!==-1){addClass(item,"".concat(NAMESPACE,"-").concat(size));}else if(name==='play'){addClass(item,"".concat(NAMESPACE,"-large"));}if(isFunction(click)){addListener(item,EVENT_CLICK,click);}list.appendChild(item);});toolbar.appendChild(list);}else{addClass(toolbar,CLASS_HIDE);}if(!options.rotatable){var rotates=toolbar.querySelectorAll('li[class*="rotate"]');addClass(rotates,CLASS_INVISIBLE);forEach(rotates,function(rotate){toolbar.appendChild(rotate);});}if(options.inline){addClass(button,CLASS_FULLSCREEN);setStyle(viewer,{zIndex:options.zIndexInline});if(window.getComputedStyle(parent).position==='static'){setStyle(parent,{position:'relative'});}parent.insertBefore(viewer,element.nextSibling);}else{addClass(button,CLASS_CLOSE);addClass(viewer,CLASS_FIXED);addClass(viewer,CLASS_FADE);addClass(viewer,CLASS_HIDE);setStyle(viewer,{zIndex:options.zIndex});var container=options.container;if(isString(container)){container=element.ownerDocument.querySelector(container);}if(!container){container=this.body;}container.appendChild(viewer);}if(options.inline){this.render();this.bind();this.isShown=true;}this.ready=true;if(isFunction(options.ready)){addListener(element,EVENT_READY,options.ready,{once:true});}if(dispatchEvent(element,EVENT_READY)===false){this.ready=false;return;}if(this.ready&&options.inline){this.view(this.index);}}/**
|
||
* Get the no conflict viewer class.
|
||
* @returns {Viewer} The viewer class.
|
||
*/}],[{key:"noConflict",value:function noConflict(){window.Viewer=AnotherViewer;return Viewer;}/**
|
||
* Change the default options.
|
||
* @param {Object} options - The new default options.
|
||
*/},{key:"setDefaults",value:function setDefaults(options){assign(DEFAULTS,isPlainObject(options)&&options);}}]);return Viewer;}();assign(Viewer.prototype,render,events,handlers,methods,others);return Viewer;});/*
|
||
* Toastr
|
||
* Copyright 2012-2015
|
||
* Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
|
||
* All Rights Reserved.
|
||
* Use, reproduction, distribution, and modification of this code is subject to the terms and
|
||
* conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
|
||
*
|
||
* ARIA Support: Greta Krafsig
|
||
*
|
||
* Project: https://github.com/CodeSeven/toastr
|
||
*/ /* global define */(function(define){define(['jquery'],function($){return function(){var $container;var listener;var toastId=0;var toastType={error:'error',info:'info',success:'success',warning:'warning'};var toastr={clear:clear,remove:remove,error:error,getContainer:getContainer,info:info,options:{},subscribe:subscribe,success:success,version:'2.1.3',warning:warning};var previousToast;return toastr;////////////////
|
||
function error(message,title,optionsOverride){return notify({type:toastType.error,iconClass:getOptions().iconClasses.error,message:message,optionsOverride:optionsOverride,title:title});}function getContainer(options,create){if(!options){options=getOptions();}$container=$('#'+options.containerId);if($container.length){return $container;}if(create){$container=createContainer(options);}return $container;}function info(message,title,optionsOverride){return notify({type:toastType.info,iconClass:getOptions().iconClasses.info,message:message,optionsOverride:optionsOverride,title:title});}function subscribe(callback){listener=callback;}function success(message,title,optionsOverride){return notify({type:toastType.success,iconClass:getOptions().iconClasses.success,message:message,optionsOverride:optionsOverride,title:title});}function warning(message,title,optionsOverride){return notify({type:toastType.warning,iconClass:getOptions().iconClasses.warning,message:message,optionsOverride:optionsOverride,title:title});}function clear($toastElement,clearOptions){var options=getOptions();if(!$container){getContainer(options);}if(!clearToast($toastElement,options,clearOptions)){clearContainer(options);}}function remove($toastElement){var options=getOptions();if(!$container){getContainer(options);}if($toastElement&&$(':focus',$toastElement).length===0){removeToast($toastElement);return;}if($container.children().length){$container.remove();}}// internal functions
|
||
function clearContainer(options){var toastsToClear=$container.children();for(var i=toastsToClear.length-1;i>=0;i--){clearToast($(toastsToClear[i]),options);}}function clearToast($toastElement,options,clearOptions){var force=clearOptions&&clearOptions.force?clearOptions.force:false;if($toastElement&&(force||$(':focus',$toastElement).length===0)){$toastElement[options.hideMethod]({duration:options.hideDuration,easing:options.hideEasing,complete:function complete(){removeToast($toastElement);}});return true;}return false;}function createContainer(options){$container=$('<div/>').attr('id',options.containerId).addClass(options.positionClass);$container.appendTo($(options.target));return $container;}function getDefaults(){return{tapToDismiss:true,toastClass:'toast',containerId:'toast-container',debug:false,showMethod:'fadeIn',//fadeIn, slideDown, and show are built into jQuery
|
||
showDuration:300,showEasing:'swing',//swing and linear are built into jQuery
|
||
onShown:undefined,hideMethod:'fadeOut',hideDuration:1000,hideEasing:'swing',onHidden:undefined,closeMethod:false,closeDuration:false,closeEasing:false,closeOnHover:true,extendedTimeOut:1000,iconClasses:{error:'toast-error',info:'toast-info',success:'toast-success',warning:'toast-warning'},iconClass:'toast-info',positionClass:'toast-top-right',timeOut:5000,// Set timeOut and extendedTimeOut to 0 to make it sticky
|
||
titleClass:'toast-title',messageClass:'toast-message',escapeHtml:false,target:'body',closeHtml:'<button type="button">×</button>',closeClass:'toast-close-button',newestOnTop:true,preventDuplicates:false,progressBar:false,progressClass:'toast-progress',rtl:false};}function publish(args){if(!listener){return;}listener(args);}function notify(map){var options=getOptions();var iconClass=map.iconClass||options.iconClass;if(typeof map.optionsOverride!=='undefined'){options=$.extend(options,map.optionsOverride);iconClass=map.optionsOverride.iconClass||iconClass;}if(shouldExit(options,map)){return;}toastId++;$container=getContainer(options,true);var intervalId=null;var $toastElement=$('<div/>');var $titleElement=$('<div/>');var $messageElement=$('<div/>');var $progressElement=$('<div/>');var $closeElement=$(options.closeHtml);var progressBar={intervalId:null,hideEta:null,maxHideTime:null};var response={toastId:toastId,state:'visible',startTime:new Date(),options:options,map:map};personalizeToast();displayToast();handleEvents();publish(response);if(options.debug&&console){console.log(response);}return $toastElement;function escapeHtml(source){if(source==null){source='';}return source.replace(/&/g,'&').replace(/"/g,'"').replace(/'/g,''').replace(/</g,'<').replace(/>/g,'>');}function personalizeToast(){setIcon();setTitle();setMessage();setCloseButton();setProgressBar();setRTL();setSequence();setAria();}function setAria(){var ariaValue='';switch(map.iconClass){case'toast-success':case'toast-info':ariaValue='polite';break;default:ariaValue='assertive';}$toastElement.attr('aria-live',ariaValue);}function handleEvents(){if(options.closeOnHover){$toastElement.hover(stickAround,delayedHideToast);}if(!options.onclick&&options.tapToDismiss){$toastElement.click(hideToast);}if(options.closeButton&&$closeElement){$closeElement.click(function(event){if(event.stopPropagation){event.stopPropagation();}else if(event.cancelBubble!==undefined&&event.cancelBubble!==true){event.cancelBubble=true;}if(options.onCloseClick){options.onCloseClick(event);}hideToast(true);});}if(options.onclick){$toastElement.click(function(event){options.onclick(event);hideToast();});}}function displayToast(){$toastElement.hide();$toastElement[options.showMethod]({duration:options.showDuration,easing:options.showEasing,complete:options.onShown});if(options.timeOut>0){intervalId=setTimeout(hideToast,options.timeOut);progressBar.maxHideTime=parseFloat(options.timeOut);progressBar.hideEta=new Date().getTime()+progressBar.maxHideTime;if(options.progressBar){progressBar.intervalId=setInterval(updateProgress,10);}}}function setIcon(){if(map.iconClass){$toastElement.addClass(options.toastClass).addClass(iconClass);}}function setSequence(){if(options.newestOnTop){$container.prepend($toastElement);}else{$container.append($toastElement);}}function setTitle(){if(map.title){var suffix=map.title;if(options.escapeHtml){suffix=escapeHtml(map.title);}$titleElement.append(suffix).addClass(options.titleClass);$toastElement.append($titleElement);}}function setMessage(){if(map.message){var suffix=map.message;if(options.escapeHtml){suffix=escapeHtml(map.message);}$messageElement.append(suffix).addClass(options.messageClass);$toastElement.append($messageElement);}}function setCloseButton(){if(options.closeButton){$closeElement.addClass(options.closeClass).attr('role','button');$toastElement.prepend($closeElement);}}function setProgressBar(){if(options.progressBar){$progressElement.addClass(options.progressClass);$toastElement.prepend($progressElement);}}function setRTL(){if(options.rtl){$toastElement.addClass('rtl');}}function shouldExit(options,map){if(options.preventDuplicates){if(map.message===previousToast){return true;}else{previousToast=map.message;}}return false;}function hideToast(override){var method=override&&options.closeMethod!==false?options.closeMethod:options.hideMethod;var duration=override&&options.closeDuration!==false?options.closeDuration:options.hideDuration;var easing=override&&options.closeEasing!==false?options.closeEasing:options.hideEasing;if($(':focus',$toastElement).length&&!override){return;}clearTimeout(progressBar.intervalId);return $toastElement[method]({duration:duration,easing:easing,complete:function complete(){removeToast($toastElement);clearTimeout(intervalId);if(options.onHidden&&response.state!=='hidden'){options.onHidden();}response.state='hidden';response.endTime=new Date();publish(response);}});}function delayedHideToast(){if(options.timeOut>0||options.extendedTimeOut>0){intervalId=setTimeout(hideToast,options.extendedTimeOut);progressBar.maxHideTime=parseFloat(options.extendedTimeOut);progressBar.hideEta=new Date().getTime()+progressBar.maxHideTime;}}function stickAround(){clearTimeout(intervalId);progressBar.hideEta=0;$toastElement.stop(true,true)[options.showMethod]({duration:options.showDuration,easing:options.showEasing});}function updateProgress(){var percentage=(progressBar.hideEta-new Date().getTime())/progressBar.maxHideTime*100;$progressElement.width(percentage+'%');}}function getOptions(){return $.extend({},getDefaults(),toastr.options);}function removeToast($toastElement){if(!$container){$container=getContainer();}if($toastElement.is(':visible')){return;}$toastElement.remove();$toastElement=null;if($container.children().length===0){$container.remove();previousToast=undefined;}}}();});})(typeof define==='function'&&define.amd?define:function(deps,factory){if(typeof module!=='undefined'&&module.exports){//Node
|
||
module.exports=factory(require('jquery'));}else{window.toastr=factory(window.jQuery);}});(function(){$.fn.Paging=function(settings){var arr=[];$(this).each(function(){var options=$.extend({target:$(this)},settings);var lz=new Paging();lz.init(options);arr.push(lz);});return arr;};function Paging(){var rnd=Math.random().toString().replace('.','');this.id='paging_'+rnd;}Paging.prototype={init:function init(settings){this.settings=$.extend({callback:null,pagesize:10,current:1,prevTpl:"上一页",nextTpl:"下一页",firstTpl:"首页",lastTpl:"末页",ellipseTpl:"...",toolbar:true,hash:false,pageSizeList:[5,10,15,20]},settings);this.target=$(this.settings.target);this.container=$('<div id="'+this.id+'" class="ui-paging-container" /><div class="clearfix"></div>');this.target.append(this.container);this.render(this.settings);this.format();this.bindEvent();},render:function render(ops){this.count=ops.count||this.settings.count;this.pagesize=ops.pagesize||this.settings.pagesize;this.current=ops.current||this.settings.current;this.pagecount=Math.ceil(this.count/this.pagesize);if(ops.count===0){this.count=0;this.pagecount=0;this.current=0;}this.format();},bindEvent:function bindEvent(){var me=this;this.container.on('click','li.js-page-action, li.ui-pager',function(e){if($(this).hasClass('ui-pager-disabled')||$(this).hasClass('focus')){return false;}if($(this).hasClass('js-page-action')){if($(this).hasClass('js-page-first')){me.current=1;}if($(this).hasClass('js-page-prev')){me.current=Math.max(1,me.current-1);}if($(this).hasClass('js-page-next')){me.current=Math.min(me.pagecount,me.current+1);}if($(this).hasClass('js-page-last')){me.current=me.pagecount;}}else if($(this).data('page')){me.current=parseInt($(this).data('page'));}me.go();});},go:function go(p){var me=this;this.current=p||this.current;this.current=Math.max(1,me.current);this.current=Math.min(this.current,me.pagecount);this.format();if(this.settings.hash){Query.setHash({page:this.current});}this.settings.callback&&this.settings.callback(this.current,this.pagesize,this.pagecount);},changePagesize:function changePagesize(ps){this.render({pagesize:ps});this.settings.callback&&this.settings.callback(this.current,this.pagesize,this.pagecount);},format:function format(){var html='<ul>';html+='<li class="js-page-first js-page-action ui-pager">'+this.settings.firstTpl+'</li>';html+='<li class="js-page-prev js-page-action ui-pager">'+this.settings.prevTpl+'</li>';if(this.pagecount>3){// html += '<li data-page="1" class="ui-pager">1</li>';
|
||
if(this.current<=1){html+='<li data-page="1" class="ui-pager">1</li>';html+='<li data-page="2" class="ui-pager">2</li>';html+='<li data-page="3" class="ui-pager">3</li>';// html += '<li class="ui-paging-ellipse">' + this.settings.ellipseTpl + '</li>';
|
||
}else if(this.current>1&&this.current<=this.pagecount-1){// html += '<li>' + this.settings.ellipseTpl + '</li>';
|
||
html+='<li data-page="'+(this.current-1)+'" class="ui-pager">'+(this.current-1)+'</li>';html+='<li data-page="'+this.current+'" class="ui-pager">'+this.current+'</li>';html+='<li data-page="'+(this.current+1)+'" class="ui-pager">'+(this.current+1)+'</li>';// html += '<li class="ui-paging-ellipse" class="ui-pager">' + this.settings.ellipseTpl + '</li>';
|
||
}else{//html += '<li class="ui-paging-ellipse" >' + this.settings.ellipseTpl + '</li>';
|
||
for(var i=this.pagecount-2;i<this.pagecount+1;i++){html+='<li data-page="'+i+'" class="ui-pager">'+i+'</li>';}}// html += '<li data-page="' + this.pagecount + '" class="ui-pager">' + this.pagecount + '</li>';
|
||
}else{for(var i=1;i<=this.pagecount;i++){html+='<li data-page="'+i+'" class="ui-pager">'+i+'</li>';}}html+='<li class="js-page-next js-page-action ui-pager">'+this.settings.nextTpl+'</li>';html+='<li class="js-page-last js-page-action ui-pager">'+this.settings.lastTpl+'</li>';html+='</ul>';html+='<div class="js-page-total">共'+this.count+'条记录 '+this.current+'/'+this.pagecount+'页</div>';$(this.container[0]).html(html);if(this.current==0||this.current==1){$('.js-page-prev',this.container).addClass('ui-pager-disabled');$('.js-page-first',this.container).addClass('ui-pager-disabled');}if(this.current==this.pagecount){$('.js-page-next',this.container).addClass('ui-pager-disabled');$('.js-page-last',this.container).addClass('ui-pager-disabled');}this.container.find('li[data-page="'+this.current+'"]').addClass('focus').siblings().removeClass('focus');if(this.settings.toolbar){this.bindToolbar();}},bindToolbar:function bindToolbar(){var me=this;var html=$('<li class="ui-paging-toolbar"><select class="ui-select-pagesize form-control input-sm input-inline"></select><input type="text" class="form-control input-sm input-inline ui-paging-count"/><a href="javascript:;">跳转</a></li>');var sel=$('.ui-select-pagesize',html);var str='';for(var i=0,l=this.settings.pageSizeList.length;i<l;i++){str+='<option value="'+this.settings.pageSizeList[i]+'">'+this.settings.pageSizeList[i]+'条/页</option>';}sel.html(str);sel.val(this.pagesize);$('input',html).val(this.current);$('input',html).click(function(){$(this).select();}).keydown(function(e){if(e.keyCode==13){var current=parseInt($(this).val())||1;me.go(current);}});$('a',html).click(function(){var current=parseInt($(this).prev().val())||1;me.go(current);});sel.change(function(){me.changePagesize($(this).val());});this.container.children('ul').append(html);}};return Paging;})();/*!
|
||
* Select2 4.0.5
|
||
* https://select2.github.io
|
||
*
|
||
* Released under the MIT license
|
||
* https://github.com/select2/select2/blob/master/LICENSE.md
|
||
*/(function(factory){if(typeof define==='function'&&define.amd){// AMD. Register as an anonymous module.
|
||
define(['jquery'],factory);}else if((typeof module==="undefined"?"undefined":_typeof2(module))==='object'&&module.exports){// Node/CommonJS
|
||
module.exports=function(root,jQuery){if(jQuery===undefined){// require('jQuery') returns a factory that requires window to
|
||
// build a jQuery instance, we normalize how we use modules
|
||
// that require this pattern but the window provided is a noop
|
||
// if it's defined (how jquery works)
|
||
if(typeof window!=='undefined'){jQuery=require('jquery');}else{jQuery=require('jquery')(root);}}factory(jQuery);return jQuery;};}else{// Browser globals
|
||
factory(jQuery);}})(function(jQuery){// This is needed so we can catch the AMD loader configuration and use it
|
||
// The inner file should be wrapped (by `banner.start.js`) in a function that
|
||
// returns the AMD loader references.
|
||
var S2=function(){// Restore the Select2 AMD loader so it can be used
|
||
// Needed mostly in the language files, where the loader is not inserted
|
||
if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd){var S2=jQuery.fn.select2.amd;}var S2;(function(){if(!S2||!S2.requirejs){if(!S2){S2={};}else{require=S2;}/**
|
||
* @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
|
||
* Released under MIT license, http://github.com/requirejs/almond/LICENSE
|
||
*/ //Going sloppy to avoid 'use strict' string cost, but strict practices should
|
||
//be followed.
|
||
/*global setTimeout: false */var requirejs,require,define;(function(undef){var main,_req,makeMap,handlers,defined={},waiting={},config={},defining={},hasOwn=Object.prototype.hasOwnProperty,aps=[].slice,jsSuffixRegExp=/\.js$/;function hasProp(obj,prop){return hasOwn.call(obj,prop);}/**
|
||
* Given a relative module name, like ./something, normalize it to
|
||
* a real name that can be mapped to a path.
|
||
* @param {String} name the relative name
|
||
* @param {String} baseName a real name that the name arg is relative
|
||
* to.
|
||
* @returns {String} normalized name
|
||
*/function normalize(name,baseName){var nameParts,nameSegment,mapValue,foundMap,lastIndex,foundI,foundStarMap,starI,i,j,part,normalizedBaseParts,baseParts=baseName&&baseName.split("/"),map=config.map,starMap=map&&map['*']||{};//Adjust any relative paths.
|
||
if(name){name=name.split('/');lastIndex=name.length-1;// If wanting node ID compatibility, strip .js from end
|
||
// of IDs. Have to do this here, and not in nameToUrl
|
||
// because node allows either .js or non .js to map
|
||
// to same file.
|
||
if(config.nodeIdCompat&&jsSuffixRegExp.test(name[lastIndex])){name[lastIndex]=name[lastIndex].replace(jsSuffixRegExp,'');}// Starts with a '.' so need the baseName
|
||
if(name[0].charAt(0)==='.'&&baseParts){//Convert baseName to array, and lop off the last part,
|
||
//so that . matches that 'directory' and not name of the baseName's
|
||
//module. For instance, baseName of 'one/two/three', maps to
|
||
//'one/two/three.js', but we want the directory, 'one/two' for
|
||
//this normalization.
|
||
normalizedBaseParts=baseParts.slice(0,baseParts.length-1);name=normalizedBaseParts.concat(name);}//start trimDots
|
||
for(i=0;i<name.length;i++){part=name[i];if(part==='.'){name.splice(i,1);i-=1;}else if(part==='..'){// If at the start, or previous value is still ..,
|
||
// keep them so that when converted to a path it may
|
||
// still work when converted to a path, even though
|
||
// as an ID it is less than ideal. In larger point
|
||
// releases, may be better to just kick out an error.
|
||
if(i===0||i===1&&name[2]==='..'||name[i-1]==='..'){continue;}else if(i>0){name.splice(i-1,2);i-=2;}}}//end trimDots
|
||
name=name.join('/');}//Apply map config if available.
|
||
if((baseParts||starMap)&&map){nameParts=name.split('/');for(i=nameParts.length;i>0;i-=1){nameSegment=nameParts.slice(0,i).join("/");if(baseParts){//Find the longest baseName segment match in the config.
|
||
//So, do joins on the biggest to smallest lengths of baseParts.
|
||
for(j=baseParts.length;j>0;j-=1){mapValue=map[baseParts.slice(0,j).join('/')];//baseName segment has config, find if it has one for
|
||
//this name.
|
||
if(mapValue){mapValue=mapValue[nameSegment];if(mapValue){//Match, update name to the new value.
|
||
foundMap=mapValue;foundI=i;break;}}}}if(foundMap){break;}//Check for a star map match, but just hold on to it,
|
||
//if there is a shorter segment match later in a matching
|
||
//config, then favor over this star map.
|
||
if(!foundStarMap&&starMap&&starMap[nameSegment]){foundStarMap=starMap[nameSegment];starI=i;}}if(!foundMap&&foundStarMap){foundMap=foundStarMap;foundI=starI;}if(foundMap){nameParts.splice(0,foundI,foundMap);name=nameParts.join('/');}}return name;}function makeRequire(relName,forceSync){return function(){//A version of a require function that passes a moduleName
|
||
//value for items that may need to
|
||
//look up paths relative to the moduleName
|
||
var args=aps.call(arguments,0);//If first arg is not require('string'), and there is only
|
||
//one arg, it is the array form without a callback. Insert
|
||
//a null so that the following concat is correct.
|
||
if(typeof args[0]!=='string'&&args.length===1){args.push(null);}return _req.apply(undef,args.concat([relName,forceSync]));};}function makeNormalize(relName){return function(name){return normalize(name,relName);};}function makeLoad(depName){return function(value){defined[depName]=value;};}function callDep(name){if(hasProp(waiting,name)){var args=waiting[name];delete waiting[name];defining[name]=true;main.apply(undef,args);}if(!hasProp(defined,name)&&!hasProp(defining,name)){throw new Error('No '+name);}return defined[name];}//Turns a plugin!resource to [plugin, resource]
|
||
//with the plugin being undefined if the name
|
||
//did not have a plugin prefix.
|
||
function splitPrefix(name){var prefix,index=name?name.indexOf('!'):-1;if(index>-1){prefix=name.substring(0,index);name=name.substring(index+1,name.length);}return[prefix,name];}//Creates a parts array for a relName where first part is plugin ID,
|
||
//second part is resource ID. Assumes relName has already been normalized.
|
||
function makeRelParts(relName){return relName?splitPrefix(relName):[];}/**
|
||
* Makes a name map, normalizing the name, and using a plugin
|
||
* for normalization if necessary. Grabs a ref to plugin
|
||
* too, as an optimization.
|
||
*/makeMap=function makeMap(name,relParts){var plugin,parts=splitPrefix(name),prefix=parts[0],relResourceName=relParts[1];name=parts[1];if(prefix){prefix=normalize(prefix,relResourceName);plugin=callDep(prefix);}//Normalize according
|
||
if(prefix){if(plugin&&plugin.normalize){name=plugin.normalize(name,makeNormalize(relResourceName));}else{name=normalize(name,relResourceName);}}else{name=normalize(name,relResourceName);parts=splitPrefix(name);prefix=parts[0];name=parts[1];if(prefix){plugin=callDep(prefix);}}//Using ridiculous property names for space reasons
|
||
return{f:prefix?prefix+'!'+name:name,//fullName
|
||
n:name,pr:prefix,p:plugin};};function makeConfig(name){return function(){return config&&config.config&&config.config[name]||{};};}handlers={require:function require(name){return makeRequire(name);},exports:function exports(name){var e=defined[name];if(typeof e!=='undefined'){return e;}else{return defined[name]={};}},module:function module(name){return{id:name,uri:'',exports:defined[name],config:makeConfig(name)};}};main=function main(name,deps,callback,relName){var cjsModule,depName,ret,map,i,relParts,args=[],callbackType=_typeof2(callback),usingExports;//Use name if no relName
|
||
relName=relName||name;relParts=makeRelParts(relName);//Call the callback to define the module, if necessary.
|
||
if(callbackType==='undefined'||callbackType==='function'){//Pull out the defined dependencies and pass the ordered
|
||
//values to the callback.
|
||
//Default to [require, exports, module] if no deps
|
||
deps=!deps.length&&callback.length?['require','exports','module']:deps;for(i=0;i<deps.length;i+=1){map=makeMap(deps[i],relParts);depName=map.f;//Fast path CommonJS standard dependencies.
|
||
if(depName==="require"){args[i]=handlers.require(name);}else if(depName==="exports"){//CommonJS module spec 1.1
|
||
args[i]=handlers.exports(name);usingExports=true;}else if(depName==="module"){//CommonJS module spec 1.1
|
||
cjsModule=args[i]=handlers.module(name);}else if(hasProp(defined,depName)||hasProp(waiting,depName)||hasProp(defining,depName)){args[i]=callDep(depName);}else if(map.p){map.p.load(map.n,makeRequire(relName,true),makeLoad(depName),{});args[i]=defined[depName];}else{throw new Error(name+' missing '+depName);}}ret=callback?callback.apply(defined[name],args):undefined;if(name){//If setting exports via "module" is in play,
|
||
//favor that over return value and exports. After that,
|
||
//favor a non-undefined return value over exports use.
|
||
if(cjsModule&&cjsModule.exports!==undef&&cjsModule.exports!==defined[name]){defined[name]=cjsModule.exports;}else if(ret!==undef||!usingExports){//Use the return value from the function.
|
||
defined[name]=ret;}}}else if(name){//May just be an object definition for the module. Only
|
||
//worry about defining if have a module name.
|
||
defined[name]=callback;}};requirejs=require=_req=function req(deps,callback,relName,forceSync,alt){if(typeof deps==="string"){if(handlers[deps]){//callback in this case is really relName
|
||
return handlers[deps](callback);}//Just return the module wanted. In this scenario, the
|
||
//deps arg is the module name, and second arg (if passed)
|
||
//is just the relName.
|
||
//Normalize module name, if it contains . or ..
|
||
return callDep(makeMap(deps,makeRelParts(callback)).f);}else if(!deps.splice){//deps is a config object, not an array.
|
||
config=deps;if(config.deps){_req(config.deps,config.callback);}if(!callback){return;}if(callback.splice){//callback is an array, which means it is a dependency list.
|
||
//Adjust args if there are dependencies
|
||
deps=callback;callback=relName;relName=null;}else{deps=undef;}}//Support require(['a'])
|
||
callback=callback||function(){};//If relName is a function, it is an errback handler,
|
||
//so remove it.
|
||
if(typeof relName==='function'){relName=forceSync;forceSync=alt;}//Simulate async callback;
|
||
if(forceSync){main(undef,deps,callback,relName);}else{//Using a non-zero value because of concern for what old browsers
|
||
//do, and latest browsers "upgrade" to 4 if lower value is used:
|
||
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
|
||
//If want a value immediately, use require('id') instead -- something
|
||
//that works in almond on the global level, but not guaranteed and
|
||
//unlikely to work in other AMD implementations.
|
||
setTimeout(function(){main(undef,deps,callback,relName);},4);}return _req;};/**
|
||
* Just drops the config on the floor, but returns req in case
|
||
* the config return value is used.
|
||
*/_req.config=function(cfg){return _req(cfg);};/**
|
||
* Expose module registry for debugging and tooling
|
||
*/requirejs._defined=defined;define=function define(name,deps,callback){if(typeof name!=='string'){throw new Error('See almond README: incorrect module build, no module name');}//This module may not have dependencies
|
||
if(!deps.splice){//deps is not an array, so probably means
|
||
//an object literal or factory function for
|
||
//the value. Adjust args.
|
||
callback=deps;deps=[];}if(!hasProp(defined,name)&&!hasProp(waiting,name)){waiting[name]=[name,deps,callback];}};define.amd={jQuery:true};})();S2.requirejs=requirejs;S2.require=require;S2.define=define;}})();S2.define("almond",function(){});/* global jQuery:false, $:false */S2.define('jquery',[],function(){var _$=jQuery||$;if(_$==null&&console&&console.error){console.error('Select2: An instance of jQuery or a jQuery-compatible library was not '+'found. Make sure that you are including jQuery before Select2 on your '+'web page.');}return _$;});S2.define('select2/utils',['jquery'],function($){var Utils={};Utils.Extend=function(ChildClass,SuperClass){var __hasProp={}.hasOwnProperty;function BaseConstructor(){this.constructor=ChildClass;}for(var key in SuperClass){if(__hasProp.call(SuperClass,key)){ChildClass[key]=SuperClass[key];}}BaseConstructor.prototype=SuperClass.prototype;ChildClass.prototype=new BaseConstructor();ChildClass.__super__=SuperClass.prototype;return ChildClass;};function getMethods(theClass){var proto=theClass.prototype;var methods=[];for(var methodName in proto){var m=proto[methodName];if(typeof m!=='function'){continue;}if(methodName==='constructor'){continue;}methods.push(methodName);}return methods;}Utils.Decorate=function(SuperClass,DecoratorClass){var decoratedMethods=getMethods(DecoratorClass);var superMethods=getMethods(SuperClass);function DecoratedClass(){var unshift=Array.prototype.unshift;var argCount=DecoratorClass.prototype.constructor.length;var calledConstructor=SuperClass.prototype.constructor;if(argCount>0){unshift.call(arguments,SuperClass.prototype.constructor);calledConstructor=DecoratorClass.prototype.constructor;}calledConstructor.apply(this,arguments);}DecoratorClass.displayName=SuperClass.displayName;function ctr(){this.constructor=DecoratedClass;}DecoratedClass.prototype=new ctr();for(var m=0;m<superMethods.length;m++){var superMethod=superMethods[m];DecoratedClass.prototype[superMethod]=SuperClass.prototype[superMethod];}var calledMethod=function calledMethod(methodName){// Stub out the original method if it's not decorating an actual method
|
||
var originalMethod=function originalMethod(){};if(methodName in DecoratedClass.prototype){originalMethod=DecoratedClass.prototype[methodName];}var decoratedMethod=DecoratorClass.prototype[methodName];return function(){var unshift=Array.prototype.unshift;unshift.call(arguments,originalMethod);return decoratedMethod.apply(this,arguments);};};for(var d=0;d<decoratedMethods.length;d++){var decoratedMethod=decoratedMethods[d];DecoratedClass.prototype[decoratedMethod]=calledMethod(decoratedMethod);}return DecoratedClass;};var Observable=function Observable(){this.listeners={};};Observable.prototype.on=function(event,callback){this.listeners=this.listeners||{};if(event in this.listeners){this.listeners[event].push(callback);}else{this.listeners[event]=[callback];}};Observable.prototype.trigger=function(event){var slice=Array.prototype.slice;var params=slice.call(arguments,1);this.listeners=this.listeners||{};// Params should always come in as an array
|
||
if(params==null){params=[];}// If there are no arguments to the event, use a temporary object
|
||
if(params.length===0){params.push({});}// Set the `_type` of the first object to the event
|
||
params[0]._type=event;if(event in this.listeners){this.invoke(this.listeners[event],slice.call(arguments,1));}if('*'in this.listeners){this.invoke(this.listeners['*'],arguments);}};Observable.prototype.invoke=function(listeners,params){for(var i=0,len=listeners.length;i<len;i++){listeners[i].apply(this,params);}};Utils.Observable=Observable;Utils.generateChars=function(length){var chars='';for(var i=0;i<length;i++){var randomChar=Math.floor(Math.random()*36);chars+=randomChar.toString(36);}return chars;};Utils.bind=function(func,context){return function(){func.apply(context,arguments);};};Utils._convertData=function(data){for(var originalKey in data){var keys=originalKey.split('-');var dataLevel=data;if(keys.length===1){continue;}for(var k=0;k<keys.length;k++){var key=keys[k];// Lowercase the first letter
|
||
// By default, dash-separated becomes camelCase
|
||
key=key.substring(0,1).toLowerCase()+key.substring(1);if(!(key in dataLevel)){dataLevel[key]={};}if(k==keys.length-1){dataLevel[key]=data[originalKey];}dataLevel=dataLevel[key];}delete data[originalKey];}return data;};Utils.hasScroll=function(index,el){// Adapted from the function created by @ShadowScripter
|
||
// and adapted by @BillBarry on the Stack Exchange Code Review website.
|
||
// The original code can be found at
|
||
// http://codereview.stackexchange.com/q/13338
|
||
// and was designed to be used with the Sizzle selector engine.
|
||
var $el=$(el);var overflowX=el.style.overflowX;var overflowY=el.style.overflowY;//Check both x and y declarations
|
||
if(overflowX===overflowY&&(overflowY==='hidden'||overflowY==='visible')){return false;}if(overflowX==='scroll'||overflowY==='scroll'){return true;}return $el.innerHeight()<el.scrollHeight||$el.innerWidth()<el.scrollWidth;};Utils.escapeMarkup=function(markup){var replaceMap={'\\':'\','&':'&','<':'<','>':'>','"':'"','\'':''','/':'/'};// Do not try to escape the markup if it's not a string
|
||
if(typeof markup!=='string'){return markup;}return String(markup).replace(/[&<>"'\/\\]/g,function(match){return replaceMap[match];});};// Append an array of jQuery nodes to a given element.
|
||
Utils.appendMany=function($element,$nodes){// jQuery 1.7.x does not support $.fn.append() with an array
|
||
// Fall back to a jQuery object collection using $.fn.add()
|
||
if($.fn.jquery.substr(0,3)==='1.7'){var $jqNodes=$();$.map($nodes,function(node){$jqNodes=$jqNodes.add(node);});$nodes=$jqNodes;}$element.append($nodes);};return Utils;});S2.define('select2/results',['jquery','./utils'],function($,Utils){function Results($element,options,dataAdapter){this.$element=$element;this.data=dataAdapter;this.options=options;Results.__super__.constructor.call(this);}Utils.Extend(Results,Utils.Observable);Results.prototype.render=function(){var $results=$('<ul class="select2-results__options" role="tree"></ul>');if(this.options.get('multiple')){$results.attr('aria-multiselectable','true');}this.$results=$results;return $results;};Results.prototype.clear=function(){this.$results.empty();};Results.prototype.displayMessage=function(params){var escapeMarkup=this.options.get('escapeMarkup');this.clear();this.hideLoading();var $message=$('<li role="treeitem" aria-live="assertive"'+' class="select2-results__option"></li>');var message=this.options.get('translations').get(params.message);$message.append(escapeMarkup(message(params.args)));$message[0].className+=' select2-results__message';this.$results.append($message);};Results.prototype.hideMessages=function(){this.$results.find('.select2-results__message').remove();};Results.prototype.append=function(data){this.hideLoading();var $options=[];if(data.results==null||data.results.length===0){if(this.$results.children().length===0){this.trigger('results:message',{message:'noResults'});}return;}data.results=this.sort(data.results);for(var d=0;d<data.results.length;d++){var item=data.results[d];var $option=this.option(item);$options.push($option);}this.$results.append($options);};Results.prototype.position=function($results,$dropdown){var $resultsContainer=$dropdown.find('.select2-results');$resultsContainer.append($results);};Results.prototype.sort=function(data){var sorter=this.options.get('sorter');return sorter(data);};Results.prototype.highlightFirstItem=function(){var $options=this.$results.find('.select2-results__option[aria-selected]');var $selected=$options.filter('[aria-selected=true]');// Check if there are any selected options
|
||
if($selected.length>0){// If there are selected options, highlight the first
|
||
$selected.first().trigger('mouseenter');}else{// If there are no selected options, highlight the first option
|
||
// in the dropdown
|
||
$options.first().trigger('mouseenter');}this.ensureHighlightVisible();};Results.prototype.setClasses=function(){var self=this;this.data.current(function(selected){var selectedIds=$.map(selected,function(s){return s.id.toString();});var $options=self.$results.find('.select2-results__option[aria-selected]');$options.each(function(){var $option=$(this);var item=$.data(this,'data');// id needs to be converted to a string when comparing
|
||
var id=''+item.id;if(item.element!=null&&item.element.selected||item.element==null&&$.inArray(id,selectedIds)>-1){$option.attr('aria-selected','true');}else{$option.attr('aria-selected','false');}});});};Results.prototype.showLoading=function(params){this.hideLoading();var loadingMore=this.options.get('translations').get('searching');var loading={disabled:true,loading:true,text:loadingMore(params)};var $loading=this.option(loading);$loading.className+=' loading-results';this.$results.prepend($loading);};Results.prototype.hideLoading=function(){this.$results.find('.loading-results').remove();};Results.prototype.option=function(data){var option=document.createElement('li');option.className='select2-results__option';var attrs={'role':'treeitem','aria-selected':'false'};if(data.disabled){delete attrs['aria-selected'];attrs['aria-disabled']='true';}if(data.id==null){delete attrs['aria-selected'];}if(data._resultId!=null){option.id=data._resultId;}if(data.title){option.title=data.title;}if(data.children){attrs.role='group';attrs['aria-label']=data.text;delete attrs['aria-selected'];}for(var attr in attrs){var val=attrs[attr];option.setAttribute(attr,val);}if(data.children){var $option=$(option);var label=document.createElement('strong');label.className='select2-results__group';var $label=$(label);this.template(data,label);var $children=[];for(var c=0;c<data.children.length;c++){var child=data.children[c];var $child=this.option(child);$children.push($child);}var $childrenContainer=$('<ul></ul>',{'class':'select2-results__options select2-results__options--nested'});$childrenContainer.append($children);$option.append(label);$option.append($childrenContainer);}else{this.template(data,option);}$.data(option,'data',data);return option;};Results.prototype.bind=function(container,$container){var self=this;var id=container.id+'-results';this.$results.attr('id',id);container.on('results:all',function(params){self.clear();self.append(params.data);if(container.isOpen()){self.setClasses();self.highlightFirstItem();}});container.on('results:append',function(params){self.append(params.data);if(container.isOpen()){self.setClasses();}});container.on('query',function(params){self.hideMessages();self.showLoading(params);});container.on('select',function(){if(!container.isOpen()){return;}self.setClasses();self.highlightFirstItem();});container.on('unselect',function(){if(!container.isOpen()){return;}self.setClasses();self.highlightFirstItem();});container.on('open',function(){// When the dropdown is open, aria-expended="true"
|
||
self.$results.attr('aria-expanded','true');self.$results.attr('aria-hidden','false');self.setClasses();self.ensureHighlightVisible();});container.on('close',function(){// When the dropdown is closed, aria-expended="false"
|
||
self.$results.attr('aria-expanded','false');self.$results.attr('aria-hidden','true');self.$results.removeAttr('aria-activedescendant');});container.on('results:toggle',function(){var $highlighted=self.getHighlightedResults();if($highlighted.length===0){return;}$highlighted.trigger('mouseup');});container.on('results:select',function(){var $highlighted=self.getHighlightedResults();if($highlighted.length===0){return;}var data=$highlighted.data('data');if($highlighted.attr('aria-selected')=='true'){self.trigger('close',{});}else{self.trigger('select',{data:data});}});container.on('results:previous',function(){var $highlighted=self.getHighlightedResults();var $options=self.$results.find('[aria-selected]');var currentIndex=$options.index($highlighted);// If we are already at te top, don't move further
|
||
if(currentIndex===0){return;}var nextIndex=currentIndex-1;// If none are highlighted, highlight the first
|
||
if($highlighted.length===0){nextIndex=0;}var $next=$options.eq(nextIndex);$next.trigger('mouseenter');var currentOffset=self.$results.offset().top;var nextTop=$next.offset().top;var nextOffset=self.$results.scrollTop()+(nextTop-currentOffset);if(nextIndex===0){self.$results.scrollTop(0);}else if(nextTop-currentOffset<0){self.$results.scrollTop(nextOffset);}});container.on('results:next',function(){var $highlighted=self.getHighlightedResults();var $options=self.$results.find('[aria-selected]');var currentIndex=$options.index($highlighted);var nextIndex=currentIndex+1;// If we are at the last option, stay there
|
||
if(nextIndex>=$options.length){return;}var $next=$options.eq(nextIndex);$next.trigger('mouseenter');var currentOffset=self.$results.offset().top+self.$results.outerHeight(false);var nextBottom=$next.offset().top+$next.outerHeight(false);var nextOffset=self.$results.scrollTop()+nextBottom-currentOffset;if(nextIndex===0){self.$results.scrollTop(0);}else if(nextBottom>currentOffset){self.$results.scrollTop(nextOffset);}});container.on('results:focus',function(params){params.element.addClass('select2-results__option--highlighted');});container.on('results:message',function(params){self.displayMessage(params);});if($.fn.mousewheel){this.$results.on('mousewheel',function(e){var top=self.$results.scrollTop();var bottom=self.$results.get(0).scrollHeight-top+e.deltaY;var isAtTop=e.deltaY>0&&top-e.deltaY<=0;var isAtBottom=e.deltaY<0&&bottom<=self.$results.height();if(isAtTop){self.$results.scrollTop(0);e.preventDefault();e.stopPropagation();}else if(isAtBottom){self.$results.scrollTop(self.$results.get(0).scrollHeight-self.$results.height());e.preventDefault();e.stopPropagation();}});}this.$results.on('mouseup','.select2-results__option[aria-selected]',function(evt){var $this=$(this);var data=$this.data('data');if($this.attr('aria-selected')==='true'){if(self.options.get('multiple')){self.trigger('unselect',{originalEvent:evt,data:data});}else{self.trigger('close',{});}return;}self.trigger('select',{originalEvent:evt,data:data});});this.$results.on('mouseenter','.select2-results__option[aria-selected]',function(evt){var data=$(this).data('data');self.getHighlightedResults().removeClass('select2-results__option--highlighted');self.trigger('results:focus',{data:data,element:$(this)});});};Results.prototype.getHighlightedResults=function(){var $highlighted=this.$results.find('.select2-results__option--highlighted');return $highlighted;};Results.prototype.destroy=function(){this.$results.remove();};Results.prototype.ensureHighlightVisible=function(){var $highlighted=this.getHighlightedResults();if($highlighted.length===0){return;}var $options=this.$results.find('[aria-selected]');var currentIndex=$options.index($highlighted);var currentOffset=this.$results.offset().top;var nextTop=$highlighted.offset().top;var nextOffset=this.$results.scrollTop()+(nextTop-currentOffset);var offsetDelta=nextTop-currentOffset;nextOffset-=$highlighted.outerHeight(false)*2;if(currentIndex<=2){this.$results.scrollTop(0);}else if(offsetDelta>this.$results.outerHeight()||offsetDelta<0){this.$results.scrollTop(nextOffset);}};Results.prototype.template=function(result,container){var template=this.options.get('templateResult');var escapeMarkup=this.options.get('escapeMarkup');var content=template(result,container);if(content==null){container.style.display='none';}else if(typeof content==='string'){container.innerHTML=escapeMarkup(content);}else{$(container).append(content);}};return Results;});S2.define('select2/keys',[],function(){var KEYS={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return KEYS;});S2.define('select2/selection/base',['jquery','../utils','../keys'],function($,Utils,KEYS){function BaseSelection($element,options){this.$element=$element;this.options=options;BaseSelection.__super__.constructor.call(this);}Utils.Extend(BaseSelection,Utils.Observable);BaseSelection.prototype.render=function(){var $selection=$('<span class="select2-selection" role="combobox" '+' aria-haspopup="true" aria-expanded="false">'+'</span>');this._tabindex=0;if(this.$element.data('old-tabindex')!=null){this._tabindex=this.$element.data('old-tabindex');}else if(this.$element.attr('tabindex')!=null){this._tabindex=this.$element.attr('tabindex');}$selection.attr('title',this.$element.attr('title'));$selection.attr('tabindex',this._tabindex);this.$selection=$selection;return $selection;};BaseSelection.prototype.bind=function(container,$container){var self=this;var id=container.id+'-container';var resultsId=container.id+'-results';this.container=container;this.$selection.on('focus',function(evt){self.trigger('focus',evt);});this.$selection.on('blur',function(evt){self._handleBlur(evt);});this.$selection.on('keydown',function(evt){self.trigger('keypress',evt);if(evt.which===KEYS.SPACE){evt.preventDefault();}});container.on('results:focus',function(params){self.$selection.attr('aria-activedescendant',params.data._resultId);});container.on('selection:update',function(params){self.update(params.data);});container.on('open',function(){// When the dropdown is open, aria-expanded="true"
|
||
self.$selection.attr('aria-expanded','true');self.$selection.attr('aria-owns',resultsId);self._attachCloseHandler(container);});container.on('close',function(){// When the dropdown is closed, aria-expanded="false"
|
||
self.$selection.attr('aria-expanded','false');self.$selection.removeAttr('aria-activedescendant');self.$selection.removeAttr('aria-owns');self.$selection.focus();self._detachCloseHandler(container);});container.on('enable',function(){self.$selection.attr('tabindex',self._tabindex);});container.on('disable',function(){self.$selection.attr('tabindex','-1');});};BaseSelection.prototype._handleBlur=function(evt){var self=this;// This needs to be delayed as the active element is the body when the tab
|
||
// key is pressed, possibly along with others.
|
||
window.setTimeout(function(){// Don't trigger `blur` if the focus is still in the selection
|
||
if(document.activeElement==self.$selection[0]||$.contains(self.$selection[0],document.activeElement)){return;}self.trigger('blur',evt);},1);};BaseSelection.prototype._attachCloseHandler=function(container){var self=this;$(document.body).on('mousedown.select2.'+container.id,function(e){var $target=$(e.target);var $select=$target.closest('.select2');var $all=$('.select2.select2-container--open');$all.each(function(){var $this=$(this);if(this==$select[0]){return;}var $element=$this.data('element');$element.select2('close');});});};BaseSelection.prototype._detachCloseHandler=function(container){$(document.body).off('mousedown.select2.'+container.id);};BaseSelection.prototype.position=function($selection,$container){var $selectionContainer=$container.find('.selection');$selectionContainer.append($selection);};BaseSelection.prototype.destroy=function(){this._detachCloseHandler(this.container);};BaseSelection.prototype.update=function(data){throw new Error('The `update` method must be defined in child classes.');};return BaseSelection;});S2.define('select2/selection/single',['jquery','./base','../utils','../keys'],function($,BaseSelection,Utils,KEYS){function SingleSelection(){SingleSelection.__super__.constructor.apply(this,arguments);}Utils.Extend(SingleSelection,BaseSelection);SingleSelection.prototype.render=function(){var $selection=SingleSelection.__super__.render.call(this);$selection.addClass('select2-selection--single');$selection.html('<span class="select2-selection__rendered"></span>'+'<span class="select2-selection__arrow" role="presentation">'+'<b role="presentation"></b>'+'</span>');return $selection;};SingleSelection.prototype.bind=function(container,$container){var self=this;SingleSelection.__super__.bind.apply(this,arguments);var id=container.id+'-container';this.$selection.find('.select2-selection__rendered').attr('id',id);this.$selection.attr('aria-labelledby',id);this.$selection.on('mousedown',function(evt){// Only respond to left clicks
|
||
if(evt.which!==1){return;}self.trigger('toggle',{originalEvent:evt});});this.$selection.on('focus',function(evt){// User focuses on the container
|
||
});this.$selection.on('blur',function(evt){// User exits the container
|
||
});container.on('focus',function(evt){if(!container.isOpen()){self.$selection.focus();}});container.on('selection:update',function(params){self.update(params.data);});};SingleSelection.prototype.clear=function(){this.$selection.find('.select2-selection__rendered').empty();};SingleSelection.prototype.display=function(data,container){var template=this.options.get('templateSelection');var escapeMarkup=this.options.get('escapeMarkup');return escapeMarkup(template(data,container));};SingleSelection.prototype.selectionContainer=function(){return $('<span></span>');};SingleSelection.prototype.update=function(data){if(data.length===0){this.clear();return;}var selection=data[0];var $rendered=this.$selection.find('.select2-selection__rendered');var formatted=this.display(selection,$rendered);$rendered.empty().append(formatted);$rendered.prop('title',selection.title||selection.text);};return SingleSelection;});S2.define('select2/selection/multiple',['jquery','./base','../utils'],function($,BaseSelection,Utils){function MultipleSelection($element,options){MultipleSelection.__super__.constructor.apply(this,arguments);}Utils.Extend(MultipleSelection,BaseSelection);MultipleSelection.prototype.render=function(){var $selection=MultipleSelection.__super__.render.call(this);$selection.addClass('select2-selection--multiple');$selection.html('<ul class="select2-selection__rendered"></ul>');return $selection;};MultipleSelection.prototype.bind=function(container,$container){var self=this;MultipleSelection.__super__.bind.apply(this,arguments);this.$selection.on('click',function(evt){self.trigger('toggle',{originalEvent:evt});});this.$selection.on('click','.select2-selection__choice__remove',function(evt){// Ignore the event if it is disabled
|
||
if(self.options.get('disabled')){return;}var $remove=$(this);var $selection=$remove.parent();var data=$selection.data('data');self.trigger('unselect',{originalEvent:evt,data:data});});};MultipleSelection.prototype.clear=function(){this.$selection.find('.select2-selection__rendered').empty();};MultipleSelection.prototype.display=function(data,container){var template=this.options.get('templateSelection');var escapeMarkup=this.options.get('escapeMarkup');return escapeMarkup(template(data,container));};MultipleSelection.prototype.selectionContainer=function(){var $container=$('<li class="select2-selection__choice">'+'<span class="select2-selection__choice__remove" role="presentation">'+'×'+'</span>'+'</li>');return $container;};MultipleSelection.prototype.update=function(data){this.clear();if(data.length===0){return;}var $selections=[];for(var d=0;d<data.length;d++){var selection=data[d];var $selection=this.selectionContainer();var formatted=this.display(selection,$selection);$selection.append(formatted);$selection.prop('title',selection.title||selection.text);$selection.data('data',selection);$selections.push($selection);}var $rendered=this.$selection.find('.select2-selection__rendered');Utils.appendMany($rendered,$selections);};return MultipleSelection;});S2.define('select2/selection/placeholder',['../utils'],function(Utils){function Placeholder(decorated,$element,options){this.placeholder=this.normalizePlaceholder(options.get('placeholder'));decorated.call(this,$element,options);}Placeholder.prototype.normalizePlaceholder=function(_,placeholder){if(typeof placeholder==='string'){placeholder={id:'',text:placeholder};}return placeholder;};Placeholder.prototype.createPlaceholder=function(decorated,placeholder){var $placeholder=this.selectionContainer();$placeholder.html(this.display(placeholder));$placeholder.addClass('select2-selection__placeholder').removeClass('select2-selection__choice');return $placeholder;};Placeholder.prototype.update=function(decorated,data){var singlePlaceholder=data.length==1&&data[0].id!=this.placeholder.id;var multipleSelections=data.length>1;if(multipleSelections||singlePlaceholder){return decorated.call(this,data);}this.clear();var $placeholder=this.createPlaceholder(this.placeholder);this.$selection.find('.select2-selection__rendered').append($placeholder);};return Placeholder;});S2.define('select2/selection/allowClear',['jquery','../keys'],function($,KEYS){function AllowClear(){}AllowClear.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);if(this.placeholder==null){if(this.options.get('debug')&&window.console&&console.error){console.error('Select2: The `allowClear` option should be used in combination '+'with the `placeholder` option.');}}this.$selection.on('mousedown','.select2-selection__clear',function(evt){self._handleClear(evt);});container.on('keypress',function(evt){self._handleKeyboardClear(evt,container);});};AllowClear.prototype._handleClear=function(_,evt){// Ignore the event if it is disabled
|
||
if(this.options.get('disabled')){return;}var $clear=this.$selection.find('.select2-selection__clear');// Ignore the event if nothing has been selected
|
||
if($clear.length===0){return;}evt.stopPropagation();var data=$clear.data('data');for(var d=0;d<data.length;d++){var unselectData={data:data[d]};// Trigger the `unselect` event, so people can prevent it from being
|
||
// cleared.
|
||
this.trigger('unselect',unselectData);// If the event was prevented, don't clear it out.
|
||
if(unselectData.prevented){return;}}this.$element.val(this.placeholder.id).trigger('change');this.trigger('toggle',{});};AllowClear.prototype._handleKeyboardClear=function(_,evt,container){if(container.isOpen()){return;}if(evt.which==KEYS.DELETE||evt.which==KEYS.BACKSPACE){this._handleClear(evt);}};AllowClear.prototype.update=function(decorated,data){decorated.call(this,data);if(this.$selection.find('.select2-selection__placeholder').length>0||data.length===0){return;}var $remove=$('<span class="select2-selection__clear">'+'×'+'</span>');$remove.data('data',data);this.$selection.find('.select2-selection__rendered').prepend($remove);};return AllowClear;});S2.define('select2/selection/search',['jquery','../utils','../keys'],function($,Utils,KEYS){function Search(decorated,$element,options){decorated.call(this,$element,options);}Search.prototype.render=function(decorated){var $search=$('<li class="select2-search select2-search--inline">'+'<input class="select2-search__field" type="search" tabindex="-1"'+' autocomplete="off" autocorrect="off" autocapitalize="none"'+' spellcheck="false" role="textbox" aria-autocomplete="list" />'+'</li>');this.$searchContainer=$search;this.$search=$search.find('input');var $rendered=decorated.call(this);this._transferTabIndex();return $rendered;};Search.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on('open',function(){self.$search.trigger('focus');});container.on('close',function(){self.$search.val('');self.$search.removeAttr('aria-activedescendant');self.$search.trigger('focus');});container.on('enable',function(){self.$search.prop('disabled',false);self._transferTabIndex();});container.on('disable',function(){self.$search.prop('disabled',true);});container.on('focus',function(evt){self.$search.trigger('focus');});container.on('results:focus',function(params){self.$search.attr('aria-activedescendant',params.id);});this.$selection.on('focusin','.select2-search--inline',function(evt){self.trigger('focus',evt);});this.$selection.on('focusout','.select2-search--inline',function(evt){self._handleBlur(evt);});this.$selection.on('keydown','.select2-search--inline',function(evt){evt.stopPropagation();self.trigger('keypress',evt);self._keyUpPrevented=evt.isDefaultPrevented();var key=evt.which;if(key===KEYS.BACKSPACE&&self.$search.val()===''){var $previousChoice=self.$searchContainer.prev('.select2-selection__choice');if($previousChoice.length>0){var item=$previousChoice.data('data');self.searchRemoveChoice(item);evt.preventDefault();}}});// Try to detect the IE version should the `documentMode` property that
|
||
// is stored on the document. This is only implemented in IE and is
|
||
// slightly cleaner than doing a user agent check.
|
||
// This property is not available in Edge, but Edge also doesn't have
|
||
// this bug.
|
||
var msie=document.documentMode;var disableInputEvents=msie&&msie<=11;// Workaround for browsers which do not support the `input` event
|
||
// This will prevent double-triggering of events for browsers which support
|
||
// both the `keyup` and `input` events.
|
||
this.$selection.on('input.searchcheck','.select2-search--inline',function(evt){// IE will trigger the `input` event when a placeholder is used on a
|
||
// search box. To get around this issue, we are forced to ignore all
|
||
// `input` events in IE and keep using `keyup`.
|
||
if(disableInputEvents){self.$selection.off('input.search input.searchcheck');return;}// Unbind the duplicated `keyup` event
|
||
self.$selection.off('keyup.search');});this.$selection.on('keyup.search input.search','.select2-search--inline',function(evt){// IE will trigger the `input` event when a placeholder is used on a
|
||
// search box. To get around this issue, we are forced to ignore all
|
||
// `input` events in IE and keep using `keyup`.
|
||
if(disableInputEvents&&evt.type==='input'){self.$selection.off('input.search input.searchcheck');return;}var key=evt.which;// We can freely ignore events from modifier keys
|
||
if(key==KEYS.SHIFT||key==KEYS.CTRL||key==KEYS.ALT){return;}// Tabbing will be handled during the `keydown` phase
|
||
if(key==KEYS.TAB){return;}self.handleSearch(evt);});};/**
|
||
* This method will transfer the tabindex attribute from the rendered
|
||
* selection to the search box. This allows for the search box to be used as
|
||
* the primary focus instead of the selection container.
|
||
*
|
||
* @private
|
||
*/Search.prototype._transferTabIndex=function(decorated){this.$search.attr('tabindex',this.$selection.attr('tabindex'));this.$selection.attr('tabindex','-1');};Search.prototype.createPlaceholder=function(decorated,placeholder){this.$search.attr('placeholder',placeholder.text);};Search.prototype.update=function(decorated,data){var searchHadFocus=this.$search[0]==document.activeElement;this.$search.attr('placeholder','');decorated.call(this,data);this.$selection.find('.select2-selection__rendered').append(this.$searchContainer);this.resizeSearch();if(searchHadFocus){this.$search.focus();}};Search.prototype.handleSearch=function(){this.resizeSearch();if(!this._keyUpPrevented){var input=this.$search.val();this.trigger('query',{term:input});}this._keyUpPrevented=false;};Search.prototype.searchRemoveChoice=function(decorated,item){this.trigger('unselect',{data:item});this.$search.val(item.text);this.handleSearch();};Search.prototype.resizeSearch=function(){this.$search.css('width','25px');var width='';if(this.$search.attr('placeholder')!==''){width=this.$selection.find('.select2-selection__rendered').innerWidth();}else{var minimumWidth=this.$search.val().length+1;width=minimumWidth*0.75+'em';}this.$search.css('width',width);};return Search;});S2.define('select2/selection/eventRelay',['jquery'],function($){function EventRelay(){}EventRelay.prototype.bind=function(decorated,container,$container){var self=this;var relayEvents=['open','opening','close','closing','select','selecting','unselect','unselecting'];var preventableEvents=['opening','closing','selecting','unselecting'];decorated.call(this,container,$container);container.on('*',function(name,params){// Ignore events that should not be relayed
|
||
if($.inArray(name,relayEvents)===-1){return;}// The parameters should always be an object
|
||
params=params||{};// Generate the jQuery event for the Select2 event
|
||
var evt=$.Event('select2:'+name,{params:params});self.$element.trigger(evt);// Only handle preventable events if it was one
|
||
if($.inArray(name,preventableEvents)===-1){return;}params.prevented=evt.isDefaultPrevented();});};return EventRelay;});S2.define('select2/translation',['jquery','require'],function($,require){function Translation(dict){this.dict=dict||{};}Translation.prototype.all=function(){return this.dict;};Translation.prototype.get=function(key){return this.dict[key];};Translation.prototype.extend=function(translation){this.dict=$.extend({},translation.all(),this.dict);};// Static functions
|
||
Translation._cache={};Translation.loadPath=function(path){if(!(path in Translation._cache)){var translations=require(path);Translation._cache[path]=translations;}return new Translation(Translation._cache[path]);};return Translation;});S2.define('select2/diacritics',[],function(){var diacritics={"\u24B6":'A',"\uFF21":'A',"\xC0":'A',"\xC1":'A',"\xC2":'A',"\u1EA6":'A',"\u1EA4":'A',"\u1EAA":'A',"\u1EA8":'A',"\xC3":'A',"\u0100":'A',"\u0102":'A',"\u1EB0":'A',"\u1EAE":'A',"\u1EB4":'A',"\u1EB2":'A',"\u0226":'A',"\u01E0":'A',"\xC4":'A',"\u01DE":'A',"\u1EA2":'A',"\xC5":'A',"\u01FA":'A',"\u01CD":'A',"\u0200":'A',"\u0202":'A',"\u1EA0":'A',"\u1EAC":'A',"\u1EB6":'A',"\u1E00":'A',"\u0104":'A',"\u023A":'A',"\u2C6F":'A',"\uA732":'AA',"\xC6":'AE',"\u01FC":'AE',"\u01E2":'AE',"\uA734":'AO',"\uA736":'AU',"\uA738":'AV',"\uA73A":'AV',"\uA73C":'AY',"\u24B7":'B',"\uFF22":'B',"\u1E02":'B',"\u1E04":'B',"\u1E06":'B',"\u0243":'B',"\u0182":'B',"\u0181":'B',"\u24B8":'C',"\uFF23":'C',"\u0106":'C',"\u0108":'C',"\u010A":'C',"\u010C":'C',"\xC7":'C',"\u1E08":'C',"\u0187":'C',"\u023B":'C',"\uA73E":'C',"\u24B9":'D',"\uFF24":'D',"\u1E0A":'D',"\u010E":'D',"\u1E0C":'D',"\u1E10":'D',"\u1E12":'D',"\u1E0E":'D',"\u0110":'D',"\u018B":'D',"\u018A":'D',"\u0189":'D',"\uA779":'D',"\u01F1":'DZ',"\u01C4":'DZ',"\u01F2":'Dz',"\u01C5":'Dz',"\u24BA":'E',"\uFF25":'E',"\xC8":'E',"\xC9":'E',"\xCA":'E',"\u1EC0":'E',"\u1EBE":'E',"\u1EC4":'E',"\u1EC2":'E',"\u1EBC":'E',"\u0112":'E',"\u1E14":'E',"\u1E16":'E',"\u0114":'E',"\u0116":'E',"\xCB":'E',"\u1EBA":'E',"\u011A":'E',"\u0204":'E',"\u0206":'E',"\u1EB8":'E',"\u1EC6":'E',"\u0228":'E',"\u1E1C":'E',"\u0118":'E',"\u1E18":'E',"\u1E1A":'E',"\u0190":'E',"\u018E":'E',"\u24BB":'F',"\uFF26":'F',"\u1E1E":'F',"\u0191":'F',"\uA77B":'F',"\u24BC":'G',"\uFF27":'G',"\u01F4":'G',"\u011C":'G',"\u1E20":'G',"\u011E":'G',"\u0120":'G',"\u01E6":'G',"\u0122":'G',"\u01E4":'G',"\u0193":'G',"\uA7A0":'G',"\uA77D":'G',"\uA77E":'G',"\u24BD":'H',"\uFF28":'H',"\u0124":'H',"\u1E22":'H',"\u1E26":'H',"\u021E":'H',"\u1E24":'H',"\u1E28":'H',"\u1E2A":'H',"\u0126":'H',"\u2C67":'H',"\u2C75":'H',"\uA78D":'H',"\u24BE":'I',"\uFF29":'I',"\xCC":'I',"\xCD":'I',"\xCE":'I',"\u0128":'I',"\u012A":'I',"\u012C":'I',"\u0130":'I',"\xCF":'I',"\u1E2E":'I',"\u1EC8":'I',"\u01CF":'I',"\u0208":'I',"\u020A":'I',"\u1ECA":'I',"\u012E":'I',"\u1E2C":'I',"\u0197":'I',"\u24BF":'J',"\uFF2A":'J',"\u0134":'J',"\u0248":'J',"\u24C0":'K',"\uFF2B":'K',"\u1E30":'K',"\u01E8":'K',"\u1E32":'K',"\u0136":'K',"\u1E34":'K',"\u0198":'K',"\u2C69":'K',"\uA740":'K',"\uA742":'K',"\uA744":'K',"\uA7A2":'K',"\u24C1":'L',"\uFF2C":'L',"\u013F":'L',"\u0139":'L',"\u013D":'L',"\u1E36":'L',"\u1E38":'L',"\u013B":'L',"\u1E3C":'L',"\u1E3A":'L',"\u0141":'L',"\u023D":'L',"\u2C62":'L',"\u2C60":'L',"\uA748":'L',"\uA746":'L',"\uA780":'L',"\u01C7":'LJ',"\u01C8":'Lj',"\u24C2":'M',"\uFF2D":'M',"\u1E3E":'M',"\u1E40":'M',"\u1E42":'M',"\u2C6E":'M',"\u019C":'M',"\u24C3":'N',"\uFF2E":'N',"\u01F8":'N',"\u0143":'N',"\xD1":'N',"\u1E44":'N',"\u0147":'N',"\u1E46":'N',"\u0145":'N',"\u1E4A":'N',"\u1E48":'N',"\u0220":'N',"\u019D":'N',"\uA790":'N',"\uA7A4":'N',"\u01CA":'NJ',"\u01CB":'Nj',"\u24C4":'O',"\uFF2F":'O',"\xD2":'O',"\xD3":'O',"\xD4":'O',"\u1ED2":'O',"\u1ED0":'O',"\u1ED6":'O',"\u1ED4":'O',"\xD5":'O',"\u1E4C":'O',"\u022C":'O',"\u1E4E":'O',"\u014C":'O',"\u1E50":'O',"\u1E52":'O',"\u014E":'O',"\u022E":'O',"\u0230":'O',"\xD6":'O',"\u022A":'O',"\u1ECE":'O',"\u0150":'O',"\u01D1":'O',"\u020C":'O',"\u020E":'O',"\u01A0":'O',"\u1EDC":'O',"\u1EDA":'O',"\u1EE0":'O',"\u1EDE":'O',"\u1EE2":'O',"\u1ECC":'O',"\u1ED8":'O',"\u01EA":'O',"\u01EC":'O',"\xD8":'O',"\u01FE":'O',"\u0186":'O',"\u019F":'O',"\uA74A":'O',"\uA74C":'O',"\u01A2":'OI',"\uA74E":'OO',"\u0222":'OU',"\u24C5":'P',"\uFF30":'P',"\u1E54":'P',"\u1E56":'P',"\u01A4":'P',"\u2C63":'P',"\uA750":'P',"\uA752":'P',"\uA754":'P',"\u24C6":'Q',"\uFF31":'Q',"\uA756":'Q',"\uA758":'Q',"\u024A":'Q',"\u24C7":'R',"\uFF32":'R',"\u0154":'R',"\u1E58":'R',"\u0158":'R',"\u0210":'R',"\u0212":'R',"\u1E5A":'R',"\u1E5C":'R',"\u0156":'R',"\u1E5E":'R',"\u024C":'R',"\u2C64":'R',"\uA75A":'R',"\uA7A6":'R',"\uA782":'R',"\u24C8":'S',"\uFF33":'S',"\u1E9E":'S',"\u015A":'S',"\u1E64":'S',"\u015C":'S',"\u1E60":'S',"\u0160":'S',"\u1E66":'S',"\u1E62":'S',"\u1E68":'S',"\u0218":'S',"\u015E":'S',"\u2C7E":'S',"\uA7A8":'S',"\uA784":'S',"\u24C9":'T',"\uFF34":'T',"\u1E6A":'T',"\u0164":'T',"\u1E6C":'T',"\u021A":'T',"\u0162":'T',"\u1E70":'T',"\u1E6E":'T',"\u0166":'T',"\u01AC":'T',"\u01AE":'T',"\u023E":'T',"\uA786":'T',"\uA728":'TZ',"\u24CA":'U',"\uFF35":'U',"\xD9":'U',"\xDA":'U',"\xDB":'U',"\u0168":'U',"\u1E78":'U',"\u016A":'U',"\u1E7A":'U',"\u016C":'U',"\xDC":'U',"\u01DB":'U',"\u01D7":'U',"\u01D5":'U',"\u01D9":'U',"\u1EE6":'U',"\u016E":'U',"\u0170":'U',"\u01D3":'U',"\u0214":'U',"\u0216":'U',"\u01AF":'U',"\u1EEA":'U',"\u1EE8":'U',"\u1EEE":'U',"\u1EEC":'U',"\u1EF0":'U',"\u1EE4":'U',"\u1E72":'U',"\u0172":'U',"\u1E76":'U',"\u1E74":'U',"\u0244":'U',"\u24CB":'V',"\uFF36":'V',"\u1E7C":'V',"\u1E7E":'V',"\u01B2":'V',"\uA75E":'V',"\u0245":'V',"\uA760":'VY',"\u24CC":'W',"\uFF37":'W',"\u1E80":'W',"\u1E82":'W',"\u0174":'W',"\u1E86":'W',"\u1E84":'W',"\u1E88":'W',"\u2C72":'W',"\u24CD":'X',"\uFF38":'X',"\u1E8A":'X',"\u1E8C":'X',"\u24CE":'Y',"\uFF39":'Y',"\u1EF2":'Y',"\xDD":'Y',"\u0176":'Y',"\u1EF8":'Y',"\u0232":'Y',"\u1E8E":'Y',"\u0178":'Y',"\u1EF6":'Y',"\u1EF4":'Y',"\u01B3":'Y',"\u024E":'Y',"\u1EFE":'Y',"\u24CF":'Z',"\uFF3A":'Z',"\u0179":'Z',"\u1E90":'Z',"\u017B":'Z',"\u017D":'Z',"\u1E92":'Z',"\u1E94":'Z',"\u01B5":'Z',"\u0224":'Z',"\u2C7F":'Z',"\u2C6B":'Z',"\uA762":'Z',"\u24D0":'a',"\uFF41":'a',"\u1E9A":'a',"\xE0":'a',"\xE1":'a',"\xE2":'a',"\u1EA7":'a',"\u1EA5":'a',"\u1EAB":'a',"\u1EA9":'a',"\xE3":'a',"\u0101":'a',"\u0103":'a',"\u1EB1":'a',"\u1EAF":'a',"\u1EB5":'a',"\u1EB3":'a',"\u0227":'a',"\u01E1":'a',"\xE4":'a',"\u01DF":'a',"\u1EA3":'a',"\xE5":'a',"\u01FB":'a',"\u01CE":'a',"\u0201":'a',"\u0203":'a',"\u1EA1":'a',"\u1EAD":'a',"\u1EB7":'a',"\u1E01":'a',"\u0105":'a',"\u2C65":'a',"\u0250":'a',"\uA733":'aa',"\xE6":'ae',"\u01FD":'ae',"\u01E3":'ae',"\uA735":'ao',"\uA737":'au',"\uA739":'av',"\uA73B":'av',"\uA73D":'ay',"\u24D1":'b',"\uFF42":'b',"\u1E03":'b',"\u1E05":'b',"\u1E07":'b',"\u0180":'b',"\u0183":'b',"\u0253":'b',"\u24D2":'c',"\uFF43":'c',"\u0107":'c',"\u0109":'c',"\u010B":'c',"\u010D":'c',"\xE7":'c',"\u1E09":'c',"\u0188":'c',"\u023C":'c',"\uA73F":'c',"\u2184":'c',"\u24D3":'d',"\uFF44":'d',"\u1E0B":'d',"\u010F":'d',"\u1E0D":'d',"\u1E11":'d',"\u1E13":'d',"\u1E0F":'d',"\u0111":'d',"\u018C":'d',"\u0256":'d',"\u0257":'d',"\uA77A":'d',"\u01F3":'dz',"\u01C6":'dz',"\u24D4":'e',"\uFF45":'e',"\xE8":'e',"\xE9":'e',"\xEA":'e',"\u1EC1":'e',"\u1EBF":'e',"\u1EC5":'e',"\u1EC3":'e',"\u1EBD":'e',"\u0113":'e',"\u1E15":'e',"\u1E17":'e',"\u0115":'e',"\u0117":'e',"\xEB":'e',"\u1EBB":'e',"\u011B":'e',"\u0205":'e',"\u0207":'e',"\u1EB9":'e',"\u1EC7":'e',"\u0229":'e',"\u1E1D":'e',"\u0119":'e',"\u1E19":'e',"\u1E1B":'e',"\u0247":'e',"\u025B":'e',"\u01DD":'e',"\u24D5":'f',"\uFF46":'f',"\u1E1F":'f',"\u0192":'f',"\uA77C":'f',"\u24D6":'g',"\uFF47":'g',"\u01F5":'g',"\u011D":'g',"\u1E21":'g',"\u011F":'g',"\u0121":'g',"\u01E7":'g',"\u0123":'g',"\u01E5":'g',"\u0260":'g',"\uA7A1":'g',"\u1D79":'g',"\uA77F":'g',"\u24D7":'h',"\uFF48":'h',"\u0125":'h',"\u1E23":'h',"\u1E27":'h',"\u021F":'h',"\u1E25":'h',"\u1E29":'h',"\u1E2B":'h',"\u1E96":'h',"\u0127":'h',"\u2C68":'h',"\u2C76":'h',"\u0265":'h',"\u0195":'hv',"\u24D8":'i',"\uFF49":'i',"\xEC":'i',"\xED":'i',"\xEE":'i',"\u0129":'i',"\u012B":'i',"\u012D":'i',"\xEF":'i',"\u1E2F":'i',"\u1EC9":'i',"\u01D0":'i',"\u0209":'i',"\u020B":'i',"\u1ECB":'i',"\u012F":'i',"\u1E2D":'i',"\u0268":'i',"\u0131":'i',"\u24D9":'j',"\uFF4A":'j',"\u0135":'j',"\u01F0":'j',"\u0249":'j',"\u24DA":'k',"\uFF4B":'k',"\u1E31":'k',"\u01E9":'k',"\u1E33":'k',"\u0137":'k',"\u1E35":'k',"\u0199":'k',"\u2C6A":'k',"\uA741":'k',"\uA743":'k',"\uA745":'k',"\uA7A3":'k',"\u24DB":'l',"\uFF4C":'l',"\u0140":'l',"\u013A":'l',"\u013E":'l',"\u1E37":'l',"\u1E39":'l',"\u013C":'l',"\u1E3D":'l',"\u1E3B":'l',"\u017F":'l',"\u0142":'l',"\u019A":'l',"\u026B":'l',"\u2C61":'l',"\uA749":'l',"\uA781":'l',"\uA747":'l',"\u01C9":'lj',"\u24DC":'m',"\uFF4D":'m',"\u1E3F":'m',"\u1E41":'m',"\u1E43":'m',"\u0271":'m',"\u026F":'m',"\u24DD":'n',"\uFF4E":'n',"\u01F9":'n',"\u0144":'n',"\xF1":'n',"\u1E45":'n',"\u0148":'n',"\u1E47":'n',"\u0146":'n',"\u1E4B":'n',"\u1E49":'n',"\u019E":'n',"\u0272":'n',"\u0149":'n',"\uA791":'n',"\uA7A5":'n',"\u01CC":'nj',"\u24DE":'o',"\uFF4F":'o',"\xF2":'o',"\xF3":'o',"\xF4":'o',"\u1ED3":'o',"\u1ED1":'o',"\u1ED7":'o',"\u1ED5":'o',"\xF5":'o',"\u1E4D":'o',"\u022D":'o',"\u1E4F":'o',"\u014D":'o',"\u1E51":'o',"\u1E53":'o',"\u014F":'o',"\u022F":'o',"\u0231":'o',"\xF6":'o',"\u022B":'o',"\u1ECF":'o',"\u0151":'o',"\u01D2":'o',"\u020D":'o',"\u020F":'o',"\u01A1":'o',"\u1EDD":'o',"\u1EDB":'o',"\u1EE1":'o',"\u1EDF":'o',"\u1EE3":'o',"\u1ECD":'o',"\u1ED9":'o',"\u01EB":'o',"\u01ED":'o',"\xF8":'o',"\u01FF":'o',"\u0254":'o',"\uA74B":'o',"\uA74D":'o',"\u0275":'o',"\u01A3":'oi',"\u0223":'ou',"\uA74F":'oo',"\u24DF":'p',"\uFF50":'p',"\u1E55":'p',"\u1E57":'p',"\u01A5":'p',"\u1D7D":'p',"\uA751":'p',"\uA753":'p',"\uA755":'p',"\u24E0":'q',"\uFF51":'q',"\u024B":'q',"\uA757":'q',"\uA759":'q',"\u24E1":'r',"\uFF52":'r',"\u0155":'r',"\u1E59":'r',"\u0159":'r',"\u0211":'r',"\u0213":'r',"\u1E5B":'r',"\u1E5D":'r',"\u0157":'r',"\u1E5F":'r',"\u024D":'r',"\u027D":'r',"\uA75B":'r',"\uA7A7":'r',"\uA783":'r',"\u24E2":'s',"\uFF53":'s',"\xDF":'s',"\u015B":'s',"\u1E65":'s',"\u015D":'s',"\u1E61":'s',"\u0161":'s',"\u1E67":'s',"\u1E63":'s',"\u1E69":'s',"\u0219":'s',"\u015F":'s',"\u023F":'s',"\uA7A9":'s',"\uA785":'s',"\u1E9B":'s',"\u24E3":'t',"\uFF54":'t',"\u1E6B":'t',"\u1E97":'t',"\u0165":'t',"\u1E6D":'t',"\u021B":'t',"\u0163":'t',"\u1E71":'t',"\u1E6F":'t',"\u0167":'t',"\u01AD":'t',"\u0288":'t',"\u2C66":'t',"\uA787":'t',"\uA729":'tz',"\u24E4":'u',"\uFF55":'u',"\xF9":'u',"\xFA":'u',"\xFB":'u',"\u0169":'u',"\u1E79":'u',"\u016B":'u',"\u1E7B":'u',"\u016D":'u',"\xFC":'u',"\u01DC":'u',"\u01D8":'u',"\u01D6":'u',"\u01DA":'u',"\u1EE7":'u',"\u016F":'u',"\u0171":'u',"\u01D4":'u',"\u0215":'u',"\u0217":'u',"\u01B0":'u',"\u1EEB":'u',"\u1EE9":'u',"\u1EEF":'u',"\u1EED":'u',"\u1EF1":'u',"\u1EE5":'u',"\u1E73":'u',"\u0173":'u',"\u1E77":'u',"\u1E75":'u',"\u0289":'u',"\u24E5":'v',"\uFF56":'v',"\u1E7D":'v',"\u1E7F":'v',"\u028B":'v',"\uA75F":'v',"\u028C":'v',"\uA761":'vy',"\u24E6":'w',"\uFF57":'w',"\u1E81":'w',"\u1E83":'w',"\u0175":'w',"\u1E87":'w',"\u1E85":'w',"\u1E98":'w',"\u1E89":'w',"\u2C73":'w',"\u24E7":'x',"\uFF58":'x',"\u1E8B":'x',"\u1E8D":'x',"\u24E8":'y',"\uFF59":'y',"\u1EF3":'y',"\xFD":'y',"\u0177":'y',"\u1EF9":'y',"\u0233":'y',"\u1E8F":'y',"\xFF":'y',"\u1EF7":'y',"\u1E99":'y',"\u1EF5":'y',"\u01B4":'y',"\u024F":'y',"\u1EFF":'y',"\u24E9":'z',"\uFF5A":'z',"\u017A":'z',"\u1E91":'z',"\u017C":'z',"\u017E":'z',"\u1E93":'z',"\u1E95":'z',"\u01B6":'z',"\u0225":'z',"\u0240":'z',"\u2C6C":'z',"\uA763":'z',"\u0386":"\u0391","\u0388":"\u0395","\u0389":"\u0397","\u038A":"\u0399","\u03AA":"\u0399","\u038C":"\u039F","\u038E":"\u03A5","\u03AB":"\u03A5","\u038F":"\u03A9","\u03AC":"\u03B1","\u03AD":"\u03B5","\u03AE":"\u03B7","\u03AF":"\u03B9","\u03CA":"\u03B9","\u0390":"\u03B9","\u03CC":"\u03BF","\u03CD":"\u03C5","\u03CB":"\u03C5","\u03B0":"\u03C5","\u03C9":"\u03C9","\u03C2":"\u03C3"};return diacritics;});S2.define('select2/data/base',['../utils'],function(Utils){function BaseAdapter($element,options){BaseAdapter.__super__.constructor.call(this);}Utils.Extend(BaseAdapter,Utils.Observable);BaseAdapter.prototype.current=function(callback){throw new Error('The `current` method must be defined in child classes.');};BaseAdapter.prototype.query=function(params,callback){throw new Error('The `query` method must be defined in child classes.');};BaseAdapter.prototype.bind=function(container,$container){// Can be implemented in subclasses
|
||
};BaseAdapter.prototype.destroy=function(){// Can be implemented in subclasses
|
||
};BaseAdapter.prototype.generateResultId=function(container,data){var id=container.id+'-result-';id+=Utils.generateChars(4);if(data.id!=null){id+='-'+data.id.toString();}else{id+='-'+Utils.generateChars(4);}return id;};return BaseAdapter;});S2.define('select2/data/select',['./base','../utils','jquery'],function(BaseAdapter,Utils,$){function SelectAdapter($element,options){this.$element=$element;this.options=options;SelectAdapter.__super__.constructor.call(this);}Utils.Extend(SelectAdapter,BaseAdapter);SelectAdapter.prototype.current=function(callback){var data=[];var self=this;this.$element.find(':selected').each(function(){var $option=$(this);var option=self.item($option);data.push(option);});callback(data);};SelectAdapter.prototype.select=function(data){var self=this;data.selected=true;// If data.element is a DOM node, use it instead
|
||
if($(data.element).is('option')){data.element.selected=true;this.$element.trigger('change');return;}if(this.$element.prop('multiple')){this.current(function(currentData){var val=[];data=[data];data.push.apply(data,currentData);for(var d=0;d<data.length;d++){var id=data[d].id;if($.inArray(id,val)===-1){val.push(id);}}self.$element.val(val);self.$element.trigger('change');});}else{var val=data.id;this.$element.val(val);this.$element.trigger('change');}};SelectAdapter.prototype.unselect=function(data){var self=this;if(!this.$element.prop('multiple')){return;}data.selected=false;if($(data.element).is('option')){data.element.selected=false;this.$element.trigger('change');return;}this.current(function(currentData){var val=[];for(var d=0;d<currentData.length;d++){var id=currentData[d].id;if(id!==data.id&&$.inArray(id,val)===-1){val.push(id);}}self.$element.val(val);self.$element.trigger('change');});};SelectAdapter.prototype.bind=function(container,$container){var self=this;this.container=container;container.on('select',function(params){self.select(params.data);});container.on('unselect',function(params){self.unselect(params.data);});};SelectAdapter.prototype.destroy=function(){// Remove anything added to child elements
|
||
this.$element.find('*').each(function(){// Remove any custom data set by Select2
|
||
$.removeData(this,'data');});};SelectAdapter.prototype.query=function(params,callback){var data=[];var self=this;var $options=this.$element.children();$options.each(function(){var $option=$(this);if(!$option.is('option')&&!$option.is('optgroup')){return;}var option=self.item($option);var matches=self.matches(params,option);if(matches!==null){data.push(matches);}});callback({results:data});};SelectAdapter.prototype.addOptions=function($options){Utils.appendMany(this.$element,$options);};SelectAdapter.prototype.option=function(data){var option;if(data.children){option=document.createElement('optgroup');option.label=data.text;}else{option=document.createElement('option');if(option.textContent!==undefined){option.textContent=data.text;}else{option.innerText=data.text;}}if(data.id!==undefined){option.value=data.id;}if(data.disabled){option.disabled=true;}if(data.selected){option.selected=true;}if(data.title){option.title=data.title;}var $option=$(option);var normalizedData=this._normalizeItem(data);normalizedData.element=option;// Override the option's data with the combined data
|
||
$.data(option,'data',normalizedData);return $option;};SelectAdapter.prototype.item=function($option){var data={};data=$.data($option[0],'data');if(data!=null){return data;}if($option.is('option')){data={id:$option.val(),text:$option.text(),disabled:$option.prop('disabled'),selected:$option.prop('selected'),title:$option.prop('title')};}else if($option.is('optgroup')){data={text:$option.prop('label'),children:[],title:$option.prop('title')};var $children=$option.children('option');var children=[];for(var c=0;c<$children.length;c++){var $child=$($children[c]);var child=this.item($child);children.push(child);}data.children=children;}data=this._normalizeItem(data);data.element=$option[0];$.data($option[0],'data',data);return data;};SelectAdapter.prototype._normalizeItem=function(item){if(!$.isPlainObject(item)){item={id:item,text:item};}item=$.extend({},{text:''},item);var defaults={selected:false,disabled:false};if(item.id!=null){item.id=item.id.toString();}if(item.text!=null){item.text=item.text.toString();}if(item._resultId==null&&item.id&&this.container!=null){item._resultId=this.generateResultId(this.container,item);}return $.extend({},defaults,item);};SelectAdapter.prototype.matches=function(params,data){var matcher=this.options.get('matcher');return matcher(params,data);};return SelectAdapter;});S2.define('select2/data/array',['./select','../utils','jquery'],function(SelectAdapter,Utils,$){function ArrayAdapter($element,options){var data=options.get('data')||[];ArrayAdapter.__super__.constructor.call(this,$element,options);this.addOptions(this.convertToOptions(data));}Utils.Extend(ArrayAdapter,SelectAdapter);ArrayAdapter.prototype.select=function(data){var $option=this.$element.find('option').filter(function(i,elm){return elm.value==data.id.toString();});if($option.length===0){$option=this.option(data);this.addOptions($option);}ArrayAdapter.__super__.select.call(this,data);};ArrayAdapter.prototype.convertToOptions=function(data){var self=this;var $existing=this.$element.find('option');var existingIds=$existing.map(function(){return self.item($(this)).id;}).get();var $options=[];// Filter out all items except for the one passed in the argument
|
||
function onlyItem(item){return function(){return $(this).val()==item.id;};}for(var d=0;d<data.length;d++){var item=this._normalizeItem(data[d]);// Skip items which were pre-loaded, only merge the data
|
||
if($.inArray(item.id,existingIds)>=0){var $existingOption=$existing.filter(onlyItem(item));var existingData=this.item($existingOption);var newData=$.extend(true,{},item,existingData);var $newOption=this.option(newData);$existingOption.replaceWith($newOption);continue;}var $option=this.option(item);if(item.children){var $children=this.convertToOptions(item.children);Utils.appendMany($option,$children);}$options.push($option);}return $options;};return ArrayAdapter;});S2.define('select2/data/ajax',['./array','../utils','jquery'],function(ArrayAdapter,Utils,$){function AjaxAdapter($element,options){this.ajaxOptions=this._applyDefaults(options.get('ajax'));if(this.ajaxOptions.processResults!=null){this.processResults=this.ajaxOptions.processResults;}AjaxAdapter.__super__.constructor.call(this,$element,options);}Utils.Extend(AjaxAdapter,ArrayAdapter);AjaxAdapter.prototype._applyDefaults=function(options){var defaults={data:function data(params){return $.extend({},params,{q:params.term});},transport:function transport(params,success,failure){var $request=$.ajax(params);$request.then(success);$request.fail(failure);return $request;}};return $.extend({},defaults,options,true);};AjaxAdapter.prototype.processResults=function(results){return results;};AjaxAdapter.prototype.query=function(params,callback){var matches=[];var self=this;if(this._request!=null){// JSONP requests cannot always be aborted
|
||
if($.isFunction(this._request.abort)){this._request.abort();}this._request=null;}var options=$.extend({type:'GET'},this.ajaxOptions);if(typeof options.url==='function'){options.url=options.url.call(this.$element,params);}if(typeof options.data==='function'){options.data=options.data.call(this.$element,params);}function request(){var $request=options.transport(options,function(data){var results=self.processResults(data,params);if(self.options.get('debug')&&window.console&&console.error){// Check to make sure that the response included a `results` key.
|
||
if(!results||!results.results||!$.isArray(results.results)){console.error('Select2: The AJAX results did not return an array in the '+'`results` key of the response.');}}callback(results);},function(){// Attempt to detect if a request was aborted
|
||
// Only works if the transport exposes a status property
|
||
if($request.status&&$request.status==='0'){return;}self.trigger('results:message',{message:'errorLoading'});});self._request=$request;}if(this.ajaxOptions.delay){// if (this.ajaxOptions.delay && params.term != null) {
|
||
if(this._queryTimeout){window.clearTimeout(this._queryTimeout);}this._queryTimeout=window.setTimeout(request,this.ajaxOptions.delay);}else{request();}};return AjaxAdapter;});S2.define('select2/data/tags',['jquery'],function($){function Tags(decorated,$element,options){var tags=options.get('tags');var createTag=options.get('createTag');if(createTag!==undefined){this.createTag=createTag;}var insertTag=options.get('insertTag');if(insertTag!==undefined){this.insertTag=insertTag;}decorated.call(this,$element,options);if($.isArray(tags)){for(var t=0;t<tags.length;t++){var tag=tags[t];var item=this._normalizeItem(tag);var $option=this.option(item);this.$element.append($option);}}}Tags.prototype.query=function(decorated,params,callback){var self=this;this._removeOldTags();if(params.term==null||params.page!=null){decorated.call(this,params,callback);return;}function wrapper(obj,child){var data=obj.results;for(var i=0;i<data.length;i++){var option=data[i];var checkChildren=option.children!=null&&!wrapper({results:option.children},true);var optionText=(option.text||'').toUpperCase();var paramsTerm=(params.term||'').toUpperCase();var checkText=optionText===paramsTerm;if(checkText||checkChildren){if(child){return false;}obj.data=data;callback(obj);return;}}if(child){return true;}var tag=self.createTag(params);if(tag!=null){var $option=self.option(tag);$option.attr('data-select2-tag',true);self.addOptions([$option]);self.insertTag(data,tag);}obj.results=data;callback(obj);}decorated.call(this,params,wrapper);};Tags.prototype.createTag=function(decorated,params){var term=$.trim(params.term);if(term===''){return null;}return{id:term,text:term};};Tags.prototype.insertTag=function(_,data,tag){data.unshift(tag);};Tags.prototype._removeOldTags=function(_){var tag=this._lastTag;var $options=this.$element.find('option[data-select2-tag]');$options.each(function(){if(this.selected){return;}$(this).remove();});};return Tags;});S2.define('select2/data/tokenizer',['jquery'],function($){function Tokenizer(decorated,$element,options){var tokenizer=options.get('tokenizer');if(tokenizer!==undefined){this.tokenizer=tokenizer;}decorated.call(this,$element,options);}Tokenizer.prototype.bind=function(decorated,container,$container){decorated.call(this,container,$container);this.$search=container.dropdown.$search||container.selection.$search||$container.find('.select2-search__field');};Tokenizer.prototype.query=function(decorated,params,callback){var self=this;function createAndSelect(data){// Normalize the data object so we can use it for checks
|
||
var item=self._normalizeItem(data);// Check if the data object already exists as a tag
|
||
// Select it if it doesn't
|
||
var $existingOptions=self.$element.find('option').filter(function(){return $(this).val()===item.id;});// If an existing option wasn't found for it, create the option
|
||
if(!$existingOptions.length){var $option=self.option(item);$option.attr('data-select2-tag',true);self._removeOldTags();self.addOptions([$option]);}// Select the item, now that we know there is an option for it
|
||
select(item);}function select(data){self.trigger('select',{data:data});}params.term=params.term||'';var tokenData=this.tokenizer(params,this.options,createAndSelect);if(tokenData.term!==params.term){// Replace the search term if we have the search box
|
||
if(this.$search.length){this.$search.val(tokenData.term);this.$search.focus();}params.term=tokenData.term;}decorated.call(this,params,callback);};Tokenizer.prototype.tokenizer=function(_,params,options,callback){var separators=options.get('tokenSeparators')||[];var term=params.term;var i=0;var createTag=this.createTag||function(params){return{id:params.term,text:params.term};};while(i<term.length){var termChar=term[i];if($.inArray(termChar,separators)===-1){i++;continue;}var part=term.substr(0,i);var partParams=$.extend({},params,{term:part});var data=createTag(partParams);if(data==null){i++;continue;}callback(data);// Reset the term to not include the tokenized portion
|
||
term=term.substr(i+1)||'';i=0;}return{term:term};};return Tokenizer;});S2.define('select2/data/minimumInputLength',[],function(){function MinimumInputLength(decorated,$e,options){this.minimumInputLength=options.get('minimumInputLength');decorated.call(this,$e,options);}MinimumInputLength.prototype.query=function(decorated,params,callback){params.term=params.term||'';if(params.term.length<this.minimumInputLength){this.trigger('results:message',{message:'inputTooShort',args:{minimum:this.minimumInputLength,input:params.term,params:params}});return;}decorated.call(this,params,callback);};return MinimumInputLength;});S2.define('select2/data/maximumInputLength',[],function(){function MaximumInputLength(decorated,$e,options){this.maximumInputLength=options.get('maximumInputLength');decorated.call(this,$e,options);}MaximumInputLength.prototype.query=function(decorated,params,callback){params.term=params.term||'';if(this.maximumInputLength>0&¶ms.term.length>this.maximumInputLength){this.trigger('results:message',{message:'inputTooLong',args:{maximum:this.maximumInputLength,input:params.term,params:params}});return;}decorated.call(this,params,callback);};return MaximumInputLength;});S2.define('select2/data/maximumSelectionLength',[],function(){function MaximumSelectionLength(decorated,$e,options){this.maximumSelectionLength=options.get('maximumSelectionLength');decorated.call(this,$e,options);}MaximumSelectionLength.prototype.query=function(decorated,params,callback){var self=this;this.current(function(currentData){var count=currentData!=null?currentData.length:0;if(self.maximumSelectionLength>0&&count>=self.maximumSelectionLength){self.trigger('results:message',{message:'maximumSelected',args:{maximum:self.maximumSelectionLength}});return;}decorated.call(self,params,callback);});};return MaximumSelectionLength;});S2.define('select2/dropdown',['jquery','./utils'],function($,Utils){function Dropdown($element,options){this.$element=$element;this.options=options;Dropdown.__super__.constructor.call(this);}Utils.Extend(Dropdown,Utils.Observable);Dropdown.prototype.render=function(){var $dropdown=$('<span class="select2-dropdown">'+'<span class="select2-results"></span>'+'</span>');$dropdown.attr('dir',this.options.get('dir'));this.$dropdown=$dropdown;return $dropdown;};Dropdown.prototype.bind=function(){// Should be implemented in subclasses
|
||
};Dropdown.prototype.position=function($dropdown,$container){// Should be implmented in subclasses
|
||
};Dropdown.prototype.destroy=function(){// Remove the dropdown from the DOM
|
||
this.$dropdown.remove();};return Dropdown;});S2.define('select2/dropdown/search',['jquery','../utils'],function($,Utils){function Search(){}Search.prototype.render=function(decorated){var $rendered=decorated.call(this);var $search=$('<span class="select2-search select2-search--dropdown">'+'<input class="select2-search__field" type="search" tabindex="-1"'+' autocomplete="off" autocorrect="off" autocapitalize="none"'+' spellcheck="false" role="textbox" />'+'</span>');this.$searchContainer=$search;this.$search=$search.find('input');$rendered.prepend($search);return $rendered;};Search.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);this.$search.on('keydown',function(evt){self.trigger('keypress',evt);self._keyUpPrevented=evt.isDefaultPrevented();});// Workaround for browsers which do not support the `input` event
|
||
// This will prevent double-triggering of events for browsers which support
|
||
// both the `keyup` and `input` events.
|
||
this.$search.on('input',function(evt){// Unbind the duplicated `keyup` event
|
||
$(this).off('keyup');});this.$search.on('keyup input',function(evt){self.handleSearch(evt);});container.on('open',function(){self.$search.attr('tabindex',0);self.$search.focus();window.setTimeout(function(){self.$search.focus();},0);});container.on('close',function(){self.$search.attr('tabindex',-1);self.$search.val('');});container.on('focus',function(){if(!container.isOpen()){self.$search.focus();}});container.on('results:all',function(params){if(params.query.term==null||params.query.term===''){var showSearch=self.showSearch(params);if(showSearch){self.$searchContainer.removeClass('select2-search--hide');}else{self.$searchContainer.addClass('select2-search--hide');}}});};Search.prototype.handleSearch=function(evt){if(!this._keyUpPrevented){var input=this.$search.val();this.trigger('query',{term:input});}this._keyUpPrevented=false;};Search.prototype.showSearch=function(_,params){return true;};return Search;});S2.define('select2/dropdown/hidePlaceholder',[],function(){function HidePlaceholder(decorated,$element,options,dataAdapter){this.placeholder=this.normalizePlaceholder(options.get('placeholder'));decorated.call(this,$element,options,dataAdapter);}HidePlaceholder.prototype.append=function(decorated,data){data.results=this.removePlaceholder(data.results);decorated.call(this,data);};HidePlaceholder.prototype.normalizePlaceholder=function(_,placeholder){if(typeof placeholder==='string'){placeholder={id:'',text:placeholder};}return placeholder;};HidePlaceholder.prototype.removePlaceholder=function(_,data){var modifiedData=data.slice(0);for(var d=data.length-1;d>=0;d--){var item=data[d];if(this.placeholder.id===item.id){modifiedData.splice(d,1);}}return modifiedData;};return HidePlaceholder;});S2.define('select2/dropdown/infiniteScroll',['jquery'],function($){function InfiniteScroll(decorated,$element,options,dataAdapter){this.lastParams={};decorated.call(this,$element,options,dataAdapter);this.$loadingMore=this.createLoadingMore();this.loading=false;}InfiniteScroll.prototype.append=function(decorated,data){this.$loadingMore.remove();this.loading=false;decorated.call(this,data);if(this.showLoadingMore(data)){this.$results.append(this.$loadingMore);}};InfiniteScroll.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on('query',function(params){self.lastParams=params;self.loading=true;});container.on('query:append',function(params){self.lastParams=params;self.loading=true;});this.$results.on('scroll',function(){var isLoadMoreVisible=$.contains(document.documentElement,self.$loadingMore[0]);if(self.loading||!isLoadMoreVisible){return;}var currentOffset=self.$results.offset().top+self.$results.outerHeight(false);var loadingMoreOffset=self.$loadingMore.offset().top+self.$loadingMore.outerHeight(false);if(currentOffset+50>=loadingMoreOffset){self.loadMore();}});};InfiniteScroll.prototype.loadMore=function(){this.loading=true;var params=$.extend({},{page:1},this.lastParams);params.page++;this.trigger('query:append',params);};InfiniteScroll.prototype.showLoadingMore=function(_,data){return data.pagination&&data.pagination.more;};InfiniteScroll.prototype.createLoadingMore=function(){var $option=$('<li '+'class="select2-results__option select2-results__option--load-more"'+'role="treeitem" aria-disabled="true"></li>');var message=this.options.get('translations').get('loadingMore');$option.html(message(this.lastParams));return $option;};return InfiniteScroll;});S2.define('select2/dropdown/attachBody',['jquery','../utils'],function($,Utils){function AttachBody(decorated,$element,options){this.$dropdownParent=options.get('dropdownParent')||$(document.body);decorated.call(this,$element,options);}AttachBody.prototype.bind=function(decorated,container,$container){var self=this;var setupResultsEvents=false;decorated.call(this,container,$container);container.on('open',function(){self._showDropdown();self._attachPositioningHandler(container);if(!setupResultsEvents){setupResultsEvents=true;container.on('results:all',function(){self._positionDropdown();self._resizeDropdown();});container.on('results:append',function(){self._positionDropdown();self._resizeDropdown();});}});container.on('close',function(){self._hideDropdown();self._detachPositioningHandler(container);});this.$dropdownContainer.on('mousedown',function(evt){evt.stopPropagation();});};AttachBody.prototype.destroy=function(decorated){decorated.call(this);this.$dropdownContainer.remove();};AttachBody.prototype.position=function(decorated,$dropdown,$container){// Clone all of the container classes
|
||
$dropdown.attr('class',$container.attr('class'));$dropdown.removeClass('select2');$dropdown.addClass('select2-container--open');$dropdown.css({position:'absolute',top:-999999});this.$container=$container;};AttachBody.prototype.render=function(decorated){var $container=$('<span></span>');var $dropdown=decorated.call(this);$container.append($dropdown);this.$dropdownContainer=$container;return $container;};AttachBody.prototype._hideDropdown=function(decorated){this.$dropdownContainer.detach();};AttachBody.prototype._attachPositioningHandler=function(decorated,container){var self=this;var scrollEvent='scroll.select2.'+container.id;var resizeEvent='resize.select2.'+container.id;var orientationEvent='orientationchange.select2.'+container.id;var $watchers=this.$container.parents().filter(Utils.hasScroll);$watchers.each(function(){$(this).data('select2-scroll-position',{x:$(this).scrollLeft(),y:$(this).scrollTop()});});$watchers.on(scrollEvent,function(ev){var position=$(this).data('select2-scroll-position');$(this).scrollTop(position.y);});$(window).on(scrollEvent+' '+resizeEvent+' '+orientationEvent,function(e){self._positionDropdown();self._resizeDropdown();});};AttachBody.prototype._detachPositioningHandler=function(decorated,container){var scrollEvent='scroll.select2.'+container.id;var resizeEvent='resize.select2.'+container.id;var orientationEvent='orientationchange.select2.'+container.id;var $watchers=this.$container.parents().filter(Utils.hasScroll);$watchers.off(scrollEvent);$(window).off(scrollEvent+' '+resizeEvent+' '+orientationEvent);};AttachBody.prototype._positionDropdown=function(){var $window=$(window);var isCurrentlyAbove=this.$dropdown.hasClass('select2-dropdown--above');var isCurrentlyBelow=this.$dropdown.hasClass('select2-dropdown--below');var newDirection=null;var offset=this.$container.offset();offset.bottom=offset.top+this.$container.outerHeight(false);var container={height:this.$container.outerHeight(false)};container.top=offset.top;container.bottom=offset.top+container.height;var dropdown={height:this.$dropdown.outerHeight(false)};var viewport={top:$window.scrollTop(),bottom:$window.scrollTop()+$window.height()};var enoughRoomAbove=viewport.top<offset.top-dropdown.height;var enoughRoomBelow=viewport.bottom>offset.bottom+dropdown.height;var css={left:offset.left,top:container.bottom};// Determine what the parent element is to use for calciulating the offset
|
||
var $offsetParent=this.$dropdownParent;// For statically positoned elements, we need to get the element
|
||
// that is determining the offset
|
||
if($offsetParent.css('position')==='static'){$offsetParent=$offsetParent.offsetParent();}var parentOffset=$offsetParent.offset();css.top-=parentOffset.top;css.left-=parentOffset.left;if(!isCurrentlyAbove&&!isCurrentlyBelow){newDirection='below';}if(!enoughRoomBelow&&enoughRoomAbove&&!isCurrentlyAbove){newDirection='above';}else if(!enoughRoomAbove&&enoughRoomBelow&&isCurrentlyAbove){newDirection='below';}if(newDirection=='above'||isCurrentlyAbove&&newDirection!=='below'){css.top=container.top-parentOffset.top-dropdown.height;}if(newDirection!=null){this.$dropdown.removeClass('select2-dropdown--below select2-dropdown--above').addClass('select2-dropdown--'+newDirection);this.$container.removeClass('select2-container--below select2-container--above').addClass('select2-container--'+newDirection);}this.$dropdownContainer.css(css);};AttachBody.prototype._resizeDropdown=function(){var css={width:this.$container.outerWidth(false)+'px'};if(this.options.get('dropdownAutoWidth')){css.minWidth=css.width;css.position='relative';css.width='auto';}this.$dropdown.css(css);};AttachBody.prototype._showDropdown=function(decorated){this.$dropdownContainer.appendTo(this.$dropdownParent);this._positionDropdown();this._resizeDropdown();};return AttachBody;});S2.define('select2/dropdown/minimumResultsForSearch',[],function(){function countResults(data){var count=0;for(var d=0;d<data.length;d++){var item=data[d];if(item.children){count+=countResults(item.children);}else{count++;}}return count;}function MinimumResultsForSearch(decorated,$element,options,dataAdapter){this.minimumResultsForSearch=options.get('minimumResultsForSearch');if(this.minimumResultsForSearch<0){this.minimumResultsForSearch=Infinity;}decorated.call(this,$element,options,dataAdapter);}MinimumResultsForSearch.prototype.showSearch=function(decorated,params){if(countResults(params.data.results)<this.minimumResultsForSearch){return false;}return decorated.call(this,params);};return MinimumResultsForSearch;});S2.define('select2/dropdown/selectOnClose',[],function(){function SelectOnClose(){}SelectOnClose.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on('close',function(params){self._handleSelectOnClose(params);});};SelectOnClose.prototype._handleSelectOnClose=function(_,params){if(params&¶ms.originalSelect2Event!=null){var event=params.originalSelect2Event;// Don't select an item if the close event was triggered from a select or
|
||
// unselect event
|
||
if(event._type==='select'||event._type==='unselect'){return;}}var $highlightedResults=this.getHighlightedResults();// Only select highlighted results
|
||
if($highlightedResults.length<1){return;}var data=$highlightedResults.data('data');// Don't re-select already selected resulte
|
||
if(data.element!=null&&data.element.selected||data.element==null&&data.selected){return;}this.trigger('select',{data:data});};return SelectOnClose;});S2.define('select2/dropdown/closeOnSelect',[],function(){function CloseOnSelect(){}CloseOnSelect.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on('select',function(evt){self._selectTriggered(evt);});container.on('unselect',function(evt){self._selectTriggered(evt);});};CloseOnSelect.prototype._selectTriggered=function(_,evt){var originalEvent=evt.originalEvent;// Don't close if the control key is being held
|
||
if(originalEvent&&originalEvent.ctrlKey){return;}this.trigger('close',{originalEvent:originalEvent,originalSelect2Event:evt});};return CloseOnSelect;});S2.define('select2/i18n/en',[],function(){// English
|
||
return{errorLoading:function errorLoading(){return'The results could not be loaded.';},inputTooLong:function inputTooLong(args){var overChars=args.input.length-args.maximum;var message='Please delete '+overChars+' character';if(overChars!=1){message+='s';}return message;},inputTooShort:function inputTooShort(args){var remainingChars=args.minimum-args.input.length;var message='Please enter '+remainingChars+' or more characters';return message;},loadingMore:function loadingMore(){return'Loading more results…';},maximumSelected:function maximumSelected(args){var message='You can only select '+args.maximum+' item';if(args.maximum!=1){message+='s';}return message;},noResults:function noResults(){return'No results found';},searching:function searching(){return'Searching…';}};});S2.define('select2/defaults',['jquery','require','./results','./selection/single','./selection/multiple','./selection/placeholder','./selection/allowClear','./selection/search','./selection/eventRelay','./utils','./translation','./diacritics','./data/select','./data/array','./data/ajax','./data/tags','./data/tokenizer','./data/minimumInputLength','./data/maximumInputLength','./data/maximumSelectionLength','./dropdown','./dropdown/search','./dropdown/hidePlaceholder','./dropdown/infiniteScroll','./dropdown/attachBody','./dropdown/minimumResultsForSearch','./dropdown/selectOnClose','./dropdown/closeOnSelect','./i18n/en'],function($,require,ResultsList,SingleSelection,MultipleSelection,Placeholder,AllowClear,SelectionSearch,EventRelay,Utils,Translation,DIACRITICS,SelectData,ArrayData,AjaxData,Tags,Tokenizer,MinimumInputLength,MaximumInputLength,MaximumSelectionLength,Dropdown,DropdownSearch,HidePlaceholder,InfiniteScroll,AttachBody,MinimumResultsForSearch,SelectOnClose,CloseOnSelect,EnglishTranslation){function Defaults(){this.reset();}Defaults.prototype.apply=function(options){options=$.extend(true,{},this.defaults,options);if(options.dataAdapter==null){if(options.ajax!=null){options.dataAdapter=AjaxData;}else if(options.data!=null){options.dataAdapter=ArrayData;}else{options.dataAdapter=SelectData;}if(options.minimumInputLength>0){options.dataAdapter=Utils.Decorate(options.dataAdapter,MinimumInputLength);}if(options.maximumInputLength>0){options.dataAdapter=Utils.Decorate(options.dataAdapter,MaximumInputLength);}if(options.maximumSelectionLength>0){options.dataAdapter=Utils.Decorate(options.dataAdapter,MaximumSelectionLength);}if(options.tags){options.dataAdapter=Utils.Decorate(options.dataAdapter,Tags);}if(options.tokenSeparators!=null||options.tokenizer!=null){options.dataAdapter=Utils.Decorate(options.dataAdapter,Tokenizer);}if(options.query!=null){var Query=require(options.amdBase+'compat/query');options.dataAdapter=Utils.Decorate(options.dataAdapter,Query);}if(options.initSelection!=null){var InitSelection=require(options.amdBase+'compat/initSelection');options.dataAdapter=Utils.Decorate(options.dataAdapter,InitSelection);}}if(options.resultsAdapter==null){options.resultsAdapter=ResultsList;if(options.ajax!=null){options.resultsAdapter=Utils.Decorate(options.resultsAdapter,InfiniteScroll);}if(options.placeholder!=null){options.resultsAdapter=Utils.Decorate(options.resultsAdapter,HidePlaceholder);}if(options.selectOnClose){options.resultsAdapter=Utils.Decorate(options.resultsAdapter,SelectOnClose);}}if(options.dropdownAdapter==null){if(options.multiple){options.dropdownAdapter=Dropdown;}else{var SearchableDropdown=Utils.Decorate(Dropdown,DropdownSearch);options.dropdownAdapter=SearchableDropdown;}if(options.minimumResultsForSearch!==0){options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,MinimumResultsForSearch);}if(options.closeOnSelect){options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,CloseOnSelect);}if(options.dropdownCssClass!=null||options.dropdownCss!=null||options.adaptDropdownCssClass!=null){var DropdownCSS=require(options.amdBase+'compat/dropdownCss');options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,DropdownCSS);}options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,AttachBody);}if(options.selectionAdapter==null){if(options.multiple){options.selectionAdapter=MultipleSelection;}else{options.selectionAdapter=SingleSelection;}// Add the placeholder mixin if a placeholder was specified
|
||
if(options.placeholder!=null){options.selectionAdapter=Utils.Decorate(options.selectionAdapter,Placeholder);}if(options.allowClear){options.selectionAdapter=Utils.Decorate(options.selectionAdapter,AllowClear);}if(options.multiple){options.selectionAdapter=Utils.Decorate(options.selectionAdapter,SelectionSearch);}if(options.containerCssClass!=null||options.containerCss!=null||options.adaptContainerCssClass!=null){var ContainerCSS=require(options.amdBase+'compat/containerCss');options.selectionAdapter=Utils.Decorate(options.selectionAdapter,ContainerCSS);}options.selectionAdapter=Utils.Decorate(options.selectionAdapter,EventRelay);}if(typeof options.language==='string'){// Check if the language is specified with a region
|
||
if(options.language.indexOf('-')>0){// Extract the region information if it is included
|
||
var languageParts=options.language.split('-');var baseLanguage=languageParts[0];options.language=[options.language,baseLanguage];}else{options.language=[options.language];}}if($.isArray(options.language)){var languages=new Translation();options.language.push('en');var languageNames=options.language;for(var l=0;l<languageNames.length;l++){var name=languageNames[l];var language={};try{// Try to load it with the original name
|
||
language=Translation.loadPath(name);}catch(e){try{// If we couldn't load it, check if it wasn't the full path
|
||
name=this.defaults.amdLanguageBase+name;language=Translation.loadPath(name);}catch(ex){// The translation could not be loaded at all. Sometimes this is
|
||
// because of a configuration problem, other times this can be
|
||
// because of how Select2 helps load all possible translation files.
|
||
if(options.debug&&window.console&&console.warn){console.warn('Select2: The language file for "'+name+'" could not be '+'automatically loaded. A fallback will be used instead.');}continue;}}languages.extend(language);}options.translations=languages;}else{var baseTranslation=Translation.loadPath(this.defaults.amdLanguageBase+'en');var customTranslation=new Translation(options.language);customTranslation.extend(baseTranslation);options.translations=customTranslation;}return options;};Defaults.prototype.reset=function(){function stripDiacritics(text){// Used 'uni range + named function' from http://jsperf.com/diacritics/18
|
||
function match(a){return DIACRITICS[a]||a;}return text.replace(/[^\u0000-\u007E]/g,match);}function matcher(params,data){// Always return the object if there is nothing to compare
|
||
if($.trim(params.term)===''){return data;}// Do a recursive check for options with children
|
||
if(data.children&&data.children.length>0){// Clone the data object if there are children
|
||
// This is required as we modify the object to remove any non-matches
|
||
var match=$.extend(true,{},data);// Check each child of the option
|
||
for(var c=data.children.length-1;c>=0;c--){var child=data.children[c];var matches=matcher(params,child);// If there wasn't a match, remove the object in the array
|
||
if(matches==null){match.children.splice(c,1);}}// If any children matched, return the new object
|
||
if(match.children.length>0){return match;}// If there were no matching children, check just the plain object
|
||
return matcher(params,match);}var original=stripDiacritics(data.text).toUpperCase();var term=stripDiacritics(params.term).toUpperCase();// Check if the text contains the term
|
||
if(original.indexOf(term)>-1){return data;}// If it doesn't contain the term, don't return anything
|
||
return null;}this.defaults={amdBase:'./',amdLanguageBase:'./i18n/',closeOnSelect:true,debug:false,dropdownAutoWidth:false,escapeMarkup:Utils.escapeMarkup,language:EnglishTranslation,matcher:matcher,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:false,sorter:function sorter(data){return data;},templateResult:function templateResult(result){return result.text;},templateSelection:function templateSelection(selection){return selection.text;},theme:'default',width:'resolve'};};Defaults.prototype.set=function(key,value){var camelKey=$.camelCase(key);var data={};data[camelKey]=value;var convertedData=Utils._convertData(data);$.extend(this.defaults,convertedData);};var defaults=new Defaults();return defaults;});S2.define('select2/options',['require','jquery','./defaults','./utils'],function(require,$,Defaults,Utils){function Options(options,$element){this.options=options;if($element!=null){this.fromElement($element);}this.options=Defaults.apply(this.options);if($element&&$element.is('input')){var InputCompat=require(this.get('amdBase')+'compat/inputData');this.options.dataAdapter=Utils.Decorate(this.options.dataAdapter,InputCompat);}}Options.prototype.fromElement=function($e){var excludedData=['select2'];if(this.options.multiple==null){this.options.multiple=$e.prop('multiple');}if(this.options.disabled==null){this.options.disabled=$e.prop('disabled');}if(this.options.language==null){if($e.prop('lang')){this.options.language=$e.prop('lang').toLowerCase();}else if($e.closest('[lang]').prop('lang')){this.options.language=$e.closest('[lang]').prop('lang');}}if(this.options.dir==null){if($e.prop('dir')){this.options.dir=$e.prop('dir');}else if($e.closest('[dir]').prop('dir')){this.options.dir=$e.closest('[dir]').prop('dir');}else{this.options.dir='ltr';}}$e.prop('disabled',this.options.disabled);$e.prop('multiple',this.options.multiple);if($e.data('select2Tags')){if(this.options.debug&&window.console&&console.warn){console.warn('Select2: The `data-select2-tags` attribute has been changed to '+'use the `data-data` and `data-tags="true"` attributes and will be '+'removed in future versions of Select2.');}$e.data('data',$e.data('select2Tags'));$e.data('tags',true);}if($e.data('ajaxUrl')){if(this.options.debug&&window.console&&console.warn){console.warn('Select2: The `data-ajax-url` attribute has been changed to '+'`data-ajax--url` and support for the old attribute will be removed'+' in future versions of Select2.');}$e.attr('ajax--url',$e.data('ajaxUrl'));$e.data('ajax--url',$e.data('ajaxUrl'));}var dataset={};// Prefer the element's `dataset` attribute if it exists
|
||
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
||
if($.fn.jquery&&$.fn.jquery.substr(0,2)=='1.'&&$e[0].dataset){dataset=$.extend(true,{},$e[0].dataset,$e.data());}else{dataset=$e.data();}var data=$.extend(true,{},dataset);data=Utils._convertData(data);for(var key in data){if($.inArray(key,excludedData)>-1){continue;}if($.isPlainObject(this.options[key])){$.extend(this.options[key],data[key]);}else{this.options[key]=data[key];}}return this;};Options.prototype.get=function(key){return this.options[key];};Options.prototype.set=function(key,val){this.options[key]=val;};return Options;});S2.define('select2/core',['jquery','./options','./utils','./keys'],function($,Options,Utils,KEYS){var Select2=function Select2($element,options){if($element.data('select2')!=null){$element.data('select2').destroy();}this.$element=$element;this.id=this._generateId($element);options=options||{};this.options=new Options(options,$element);Select2.__super__.constructor.call(this);// Set up the tabindex
|
||
var tabindex=$element.attr('tabindex')||0;$element.data('old-tabindex',tabindex);$element.attr('tabindex','-1');// Set up containers and adapters
|
||
var DataAdapter=this.options.get('dataAdapter');this.dataAdapter=new DataAdapter($element,this.options);var $container=this.render();this._placeContainer($container);var SelectionAdapter=this.options.get('selectionAdapter');this.selection=new SelectionAdapter($element,this.options);this.$selection=this.selection.render();this.selection.position(this.$selection,$container);var DropdownAdapter=this.options.get('dropdownAdapter');this.dropdown=new DropdownAdapter($element,this.options);this.$dropdown=this.dropdown.render();this.dropdown.position(this.$dropdown,$container);var ResultsAdapter=this.options.get('resultsAdapter');this.results=new ResultsAdapter($element,this.options,this.dataAdapter);this.$results=this.results.render();this.results.position(this.$results,this.$dropdown);// Bind events
|
||
var self=this;// Bind the container to all of the adapters
|
||
this._bindAdapters();// Register any DOM event handlers
|
||
this._registerDomEvents();// Register any internal event handlers
|
||
this._registerDataEvents();this._registerSelectionEvents();this._registerDropdownEvents();this._registerResultsEvents();this._registerEvents();// Set the initial state
|
||
this.dataAdapter.current(function(initialData){self.trigger('selection:update',{data:initialData});});// Hide the original select
|
||
$element.addClass('select2-hidden-accessible');$element.attr('aria-hidden','true');// Synchronize any monitored attributes
|
||
this._syncAttributes();$element.data('select2',this);};Utils.Extend(Select2,Utils.Observable);Select2.prototype._generateId=function($element){var id='';if($element.attr('id')!=null){id=$element.attr('id');}else if($element.attr('name')!=null){id=$element.attr('name')+'-'+Utils.generateChars(2);}else{id=Utils.generateChars(4);}id=id.replace(/(:|\.|\[|\]|,)/g,'');id='select2-'+id;return id;};Select2.prototype._placeContainer=function($container){$container.insertAfter(this.$element);var width=this._resolveWidth(this.$element,this.options.get('width'));if(width!=null){$container.css('width',width);}};Select2.prototype._resolveWidth=function($element,method){var WIDTH=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if(method=='resolve'){var styleWidth=this._resolveWidth($element,'style');if(styleWidth!=null){return styleWidth;}return this._resolveWidth($element,'element');}if(method=='element'){var elementWidth=$element.outerWidth(false);if(elementWidth<=0){return'auto';}return elementWidth+'px';}if(method=='style'){var style=$element.attr('style');if(typeof style!=='string'){return null;}var attrs=style.split(';');for(var i=0,l=attrs.length;i<l;i=i+1){var attr=attrs[i].replace(/\s/g,'');var matches=attr.match(WIDTH);if(matches!==null&&matches.length>=1){return matches[1];}}return null;}return method;};Select2.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container);this.selection.bind(this,this.$container);this.dropdown.bind(this,this.$container);this.results.bind(this,this.$container);};Select2.prototype._registerDomEvents=function(){var self=this;this.$element.on('change.select2',function(){self.dataAdapter.current(function(data){self.trigger('selection:update',{data:data});});});this.$element.on('focus.select2',function(evt){self.trigger('focus',evt);});this._syncA=Utils.bind(this._syncAttributes,this);this._syncS=Utils.bind(this._syncSubtree,this);if(this.$element[0].attachEvent){this.$element[0].attachEvent('onpropertychange',this._syncA);}var observer=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;if(observer!=null){this._observer=new observer(function(mutations){$.each(mutations,self._syncA);$.each(mutations,self._syncS);});this._observer.observe(this.$element[0],{attributes:true,childList:true,subtree:false});}else if(this.$element[0].addEventListener){this.$element[0].addEventListener('DOMAttrModified',self._syncA,false);this.$element[0].addEventListener('DOMNodeInserted',self._syncS,false);this.$element[0].addEventListener('DOMNodeRemoved',self._syncS,false);}};Select2.prototype._registerDataEvents=function(){var self=this;this.dataAdapter.on('*',function(name,params){self.trigger(name,params);});};Select2.prototype._registerSelectionEvents=function(){var self=this;var nonRelayEvents=['toggle','focus'];this.selection.on('toggle',function(){self.toggleDropdown();});this.selection.on('focus',function(params){self.focus(params);});this.selection.on('*',function(name,params){if($.inArray(name,nonRelayEvents)!==-1){return;}self.trigger(name,params);});};Select2.prototype._registerDropdownEvents=function(){var self=this;this.dropdown.on('*',function(name,params){self.trigger(name,params);});};Select2.prototype._registerResultsEvents=function(){var self=this;this.results.on('*',function(name,params){self.trigger(name,params);});};Select2.prototype._registerEvents=function(){var self=this;self.lastPage=1;self.lastResults=null;self.lastTerm=null;this.on('open',function(){self.$container.addClass('select2-container--open');});this.on('close',function(){self.$container.removeClass('select2-container--open');});this.on('enable',function(){self.$container.removeClass('select2-container--disabled');});this.on('disable',function(){self.$container.addClass('select2-container--disabled');});this.on('blur',function(){self.$container.removeClass('select2-container--focus');});this.on('query',function(params){if(!self.isOpen()){self.trigger('open',{});// 单选设置输入值
|
||
if(self.dropdown.$search!==undefined){self.dropdown.$search.val(self.lastTerm);}}// 改造搜索前显示
|
||
if(self.options.options.resultCache==true&&self.lastResults&¶ms.term==undefined){params.page=self.lastPage;self.trigger('results:all',{data:self.lastResults,query:params});}else{self.lastTerm=params.term;self.lastPage=1;this.dataAdapter.query(params,function(data){self.lastResults=data;self.trigger('results:all',{data:data,query:params});});}});this.on('query:append',function(params){if(self.lastPage<params.page){self.lastPage=params.page;this.dataAdapter.query(params,function(data){$.each(data.results,function(k,v){self.lastResults.results.push(v);});self.lastResults.pagination.more=data.pagination.more;self.trigger('results:append',{data:data,query:params});});}});this.on('keypress',function(evt){var key=evt.which;if(self.isOpen()){if(key===KEYS.ESC||key===KEYS.TAB||key===KEYS.UP&&evt.altKey){self.close();evt.preventDefault();}else if(key===KEYS.ENTER){self.trigger('results:select',{});evt.preventDefault();}else if(key===KEYS.SPACE&&evt.ctrlKey){self.trigger('results:toggle',{});evt.preventDefault();}else if(key===KEYS.UP){self.trigger('results:previous',{});evt.preventDefault();}else if(key===KEYS.DOWN){self.trigger('results:next',{});evt.preventDefault();}}else{if(key===KEYS.ENTER||key===KEYS.SPACE||key===KEYS.DOWN&&evt.altKey){self.open();evt.preventDefault();}}});};Select2.prototype._syncAttributes=function(){this.options.set('disabled',this.$element.prop('disabled'));if(this.options.get('disabled')){if(this.isOpen()){this.close();}this.trigger('disable',{});}else{this.trigger('enable',{});}};Select2.prototype._syncSubtree=function(evt,mutations){var changed=false;var self=this;// Ignore any mutation events raised for elements that aren't options or
|
||
// optgroups. This handles the case when the select element is destroyed
|
||
if(evt&&evt.target&&evt.target.nodeName!=='OPTION'&&evt.target.nodeName!=='OPTGROUP'){return;}if(!mutations){// If mutation events aren't supported, then we can only assume that the
|
||
// change affected the selections
|
||
changed=true;}else if(mutations.addedNodes&&mutations.addedNodes.length>0){for(var n=0;n<mutations.addedNodes.length;n++){var node=mutations.addedNodes[n];if(node.selected){changed=true;}}}else if(mutations.removedNodes&&mutations.removedNodes.length>0){changed=true;}// Only re-pull the data if we think there is a change
|
||
if(changed){this.dataAdapter.current(function(currentData){self.trigger('selection:update',{data:currentData});});}};/**
|
||
* Override the trigger method to automatically trigger pre-events when
|
||
* there are events that can be prevented.
|
||
*/Select2.prototype.trigger=function(name,args){var actualTrigger=Select2.__super__.trigger;var preTriggerMap={'open':'opening','close':'closing','select':'selecting','unselect':'unselecting'};if(args===undefined){args={};}if(name in preTriggerMap){var preTriggerName=preTriggerMap[name];var preTriggerArgs={prevented:false,name:name,args:args};actualTrigger.call(this,preTriggerName,preTriggerArgs);if(preTriggerArgs.prevented){args.prevented=true;return;}}actualTrigger.call(this,name,args);};Select2.prototype.toggleDropdown=function(){if(this.options.get('disabled')){return;}if(this.isOpen()){this.close();}else{this.open();}};Select2.prototype.open=function(){if(this.isOpen()){return;}this.trigger('query',{});};Select2.prototype.close=function(){if(!this.isOpen()){return;}this.trigger('close',{});};Select2.prototype.isOpen=function(){return this.$container.hasClass('select2-container--open');};Select2.prototype.hasFocus=function(){return this.$container.hasClass('select2-container--focus');};Select2.prototype.focus=function(data){// No need to re-trigger focus events if we are already focused
|
||
if(this.hasFocus()){return;}this.$container.addClass('select2-container--focus');this.trigger('focus',{});};Select2.prototype.enable=function(args){if(this.options.get('debug')&&window.console&&console.warn){console.warn('Select2: The `select2("enable")` method has been deprecated and will'+' be removed in later Select2 versions. Use $element.prop("disabled")'+' instead.');}if(args==null||args.length===0){args=[true];}var disabled=!args[0];this.$element.prop('disabled',disabled);};Select2.prototype.data=function(){if(this.options.get('debug')&&arguments.length>0&&window.console&&console.warn){console.warn('Select2: Data can no longer be set using `select2("data")`. You '+'should consider setting the value instead using `$element.val()`.');}var data=[];this.dataAdapter.current(function(currentData){data=currentData;});return data;};Select2.prototype.val=function(args){if(this.options.get('debug')&&window.console&&console.warn){console.warn('Select2: The `select2("val")` method has been deprecated and will be'+' removed in later Select2 versions. Use $element.val() instead.');}if(args==null||args.length===0){return this.$element.val();}var newVal=args[0];if($.isArray(newVal)){newVal=$.map(newVal,function(obj){return obj.toString();});}this.$element.val(newVal).trigger('change');};Select2.prototype.destroy=function(){this.$container.remove();if(this.$element[0].detachEvent){this.$element[0].detachEvent('onpropertychange',this._syncA);}if(this._observer!=null){this._observer.disconnect();this._observer=null;}else if(this.$element[0].removeEventListener){this.$element[0].removeEventListener('DOMAttrModified',this._syncA,false);this.$element[0].removeEventListener('DOMNodeInserted',this._syncS,false);this.$element[0].removeEventListener('DOMNodeRemoved',this._syncS,false);}this._syncA=null;this._syncS=null;this.$element.off('.select2');this.$element.attr('tabindex',this.$element.data('old-tabindex'));this.$element.removeClass('select2-hidden-accessible');this.$element.attr('aria-hidden','false');this.$element.removeData('select2');this.dataAdapter.destroy();this.selection.destroy();this.dropdown.destroy();this.results.destroy();this.dataAdapter=null;this.selection=null;this.dropdown=null;this.results=null;};Select2.prototype.render=function(){var $container=$('<span class="select2 select2-container">'+'<span class="selection"></span>'+'<span class="dropdown-wrapper" aria-hidden="true"></span>'+'</span>');$container.attr('dir',this.options.get('dir'));this.$container=$container;this.$container.addClass('select2-container--'+this.options.get('theme'));$container.data('element',this.$element);return $container;};return Select2;});S2.define('select2/compat/utils',['jquery'],function($){function syncCssClasses($dest,$src,adapter){var classes,replacements=[],adapted;classes=$.trim($dest.attr('class'));if(classes){classes=''+classes;// for IE which returns object
|
||
$(classes.split(/\s+/)).each(function(){// Save all Select2 classes
|
||
if(this.indexOf('select2-')===0){replacements.push(this);}});}classes=$.trim($src.attr('class'));if(classes){classes=''+classes;// for IE which returns object
|
||
$(classes.split(/\s+/)).each(function(){// Only adapt non-Select2 classes
|
||
if(this.indexOf('select2-')!==0){adapted=adapter(this);if(adapted!=null){replacements.push(adapted);}}});}$dest.attr('class',replacements.join(' '));}return{syncCssClasses:syncCssClasses};});S2.define('select2/compat/containerCss',['jquery','./utils'],function($,CompatUtils){// No-op CSS adapter that discards all classes by default
|
||
function _containerAdapter(clazz){return null;}function ContainerCSS(){}ContainerCSS.prototype.render=function(decorated){var $container=decorated.call(this);var containerCssClass=this.options.get('containerCssClass')||'';if($.isFunction(containerCssClass)){containerCssClass=containerCssClass(this.$element);}var containerCssAdapter=this.options.get('adaptContainerCssClass');containerCssAdapter=containerCssAdapter||_containerAdapter;if(containerCssClass.indexOf(':all:')!==-1){containerCssClass=containerCssClass.replace(':all:','');var _cssAdapter=containerCssAdapter;containerCssAdapter=function containerCssAdapter(clazz){var adapted=_cssAdapter(clazz);if(adapted!=null){// Append the old one along with the adapted one
|
||
return adapted+' '+clazz;}return clazz;};}var containerCss=this.options.get('containerCss')||{};if($.isFunction(containerCss)){containerCss=containerCss(this.$element);}CompatUtils.syncCssClasses($container,this.$element,containerCssAdapter);$container.css(containerCss);$container.addClass(containerCssClass);return $container;};return ContainerCSS;});S2.define('select2/compat/dropdownCss',['jquery','./utils'],function($,CompatUtils){// No-op CSS adapter that discards all classes by default
|
||
function _dropdownAdapter(clazz){return null;}function DropdownCSS(){}DropdownCSS.prototype.render=function(decorated){var $dropdown=decorated.call(this);var dropdownCssClass=this.options.get('dropdownCssClass')||'';if($.isFunction(dropdownCssClass)){dropdownCssClass=dropdownCssClass(this.$element);}var dropdownCssAdapter=this.options.get('adaptDropdownCssClass');dropdownCssAdapter=dropdownCssAdapter||_dropdownAdapter;if(dropdownCssClass.indexOf(':all:')!==-1){dropdownCssClass=dropdownCssClass.replace(':all:','');var _cssAdapter=dropdownCssAdapter;dropdownCssAdapter=function dropdownCssAdapter(clazz){var adapted=_cssAdapter(clazz);if(adapted!=null){// Append the old one along with the adapted one
|
||
return adapted+' '+clazz;}return clazz;};}var dropdownCss=this.options.get('dropdownCss')||{};if($.isFunction(dropdownCss)){dropdownCss=dropdownCss(this.$element);}CompatUtils.syncCssClasses($dropdown,this.$element,dropdownCssAdapter);$dropdown.css(dropdownCss);$dropdown.addClass(dropdownCssClass);return $dropdown;};return DropdownCSS;});S2.define('select2/compat/initSelection',['jquery'],function($){function InitSelection(decorated,$element,options){if(options.get('debug')&&window.console&&console.warn){console.warn('Select2: The `initSelection` option has been deprecated in favor'+' of a custom data adapter that overrides the `current` method. '+'This method is now called multiple times instead of a single '+'time when the instance is initialized. Support will be removed '+'for the `initSelection` option in future versions of Select2');}this.initSelection=options.get('initSelection');this._isInitialized=false;decorated.call(this,$element,options);}InitSelection.prototype.current=function(decorated,callback){var self=this;if(this._isInitialized){decorated.call(this,callback);return;}this.initSelection.call(null,this.$element,function(data){self._isInitialized=true;if(!$.isArray(data)){data=[data];}callback(data);});};return InitSelection;});S2.define('select2/compat/inputData',['jquery'],function($){function InputData(decorated,$element,options){this._currentData=[];this._valueSeparator=options.get('valueSeparator')||',';if($element.prop('type')==='hidden'){if(options.get('debug')&&console&&console.warn){console.warn('Select2: Using a hidden input with Select2 is no longer '+'supported and may stop working in the future. It is recommended '+'to use a `<select>` element instead.');}}decorated.call(this,$element,options);}InputData.prototype.current=function(_,callback){function getSelected(data,selectedIds){var selected=[];if(data.selected||$.inArray(data.id,selectedIds)!==-1){data.selected=true;selected.push(data);}else{data.selected=false;}if(data.children){selected.push.apply(selected,getSelected(data.children,selectedIds));}return selected;}var selected=[];for(var d=0;d<this._currentData.length;d++){var data=this._currentData[d];selected.push.apply(selected,getSelected(data,this.$element.val().split(this._valueSeparator)));}callback(selected);};InputData.prototype.select=function(_,data){if(!this.options.get('multiple')){this.current(function(allData){$.map(allData,function(data){data.selected=false;});});this.$element.val(data.id);this.$element.trigger('change');}else{var value=this.$element.val();value+=this._valueSeparator+data.id;this.$element.val(value);this.$element.trigger('change');}};InputData.prototype.unselect=function(_,data){var self=this;data.selected=false;this.current(function(allData){var values=[];for(var d=0;d<allData.length;d++){var item=allData[d];if(data.id==item.id){continue;}values.push(item.id);}self.$element.val(values.join(self._valueSeparator));self.$element.trigger('change');});};InputData.prototype.query=function(_,params,callback){var results=[];for(var d=0;d<this._currentData.length;d++){var data=this._currentData[d];var matches=this.matches(params,data);if(matches!==null){results.push(matches);}}callback({results:results});};InputData.prototype.addOptions=function(_,$options){var options=$.map($options,function($option){return $.data($option[0],'data');});this._currentData.push.apply(this._currentData,options);};return InputData;});S2.define('select2/compat/matcher',['jquery'],function($){function oldMatcher(matcher){function wrappedMatcher(params,data){var match=$.extend(true,{},data);if(params.term==null||$.trim(params.term)===''){return match;}if(data.children){for(var c=data.children.length-1;c>=0;c--){var child=data.children[c];// Check if the child object matches
|
||
// The old matcher returned a boolean true or false
|
||
var doesMatch=matcher(params.term,child.text,child);// If the child didn't match, pop it off
|
||
if(!doesMatch){match.children.splice(c,1);}}if(match.children.length>0){return match;}}if(matcher(params.term,data.text,data)){return match;}return null;}return wrappedMatcher;}return oldMatcher;});S2.define('select2/compat/query',[],function(){function Query(decorated,$element,options){if(options.get('debug')&&window.console&&console.warn){console.warn('Select2: The `query` option has been deprecated in favor of a '+'custom data adapter that overrides the `query` method. Support '+'will be removed for the `query` option in future versions of '+'Select2.');}decorated.call(this,$element,options);}Query.prototype.query=function(_,params,callback){params.callback=callback;var query=this.options.get('query');query.call(null,params);};return Query;});S2.define('select2/dropdown/attachContainer',[],function(){function AttachContainer(decorated,$element,options){decorated.call(this,$element,options);}AttachContainer.prototype.position=function(decorated,$dropdown,$container){var $dropdownContainer=$container.find('.dropdown-wrapper');$dropdownContainer.append($dropdown);$dropdown.addClass('select2-dropdown--below');$container.addClass('select2-container--below');};return AttachContainer;});S2.define('select2/dropdown/stopPropagation',[],function(){function StopPropagation(){}StopPropagation.prototype.bind=function(decorated,container,$container){decorated.call(this,container,$container);var stoppedEvents=['blur','change','click','dblclick','focus','focusin','focusout','input','keydown','keyup','keypress','mousedown','mouseenter','mouseleave','mousemove','mouseover','mouseup','search','touchend','touchstart'];this.$dropdown.on(stoppedEvents.join(' '),function(evt){evt.stopPropagation();});};return StopPropagation;});S2.define('select2/selection/stopPropagation',[],function(){function StopPropagation(){}StopPropagation.prototype.bind=function(decorated,container,$container){decorated.call(this,container,$container);var stoppedEvents=['blur','change','click','dblclick','focus','focusin','focusout','input','keydown','keyup','keypress','mousedown','mouseenter','mouseleave','mousemove','mouseover','mouseup','search','touchend','touchstart'];this.$selection.on(stoppedEvents.join(' '),function(evt){evt.stopPropagation();});};return StopPropagation;});/*!
|
||
* jQuery Mousewheel 3.1.13
|
||
*
|
||
* Copyright jQuery Foundation and other contributors
|
||
* Released under the MIT license
|
||
* http://jquery.org/license
|
||
*/(function(factory){if(typeof S2.define==='function'&&S2.define.amd){// AMD. Register as an anonymous module.
|
||
S2.define('jquery-mousewheel',['jquery'],factory);}else if((typeof exports==="undefined"?"undefined":_typeof2(exports))==='object'){// Node/CommonJS style for Browserify
|
||
module.exports=factory;}else{// Browser globals
|
||
factory(jQuery);}})(function($){var toFix=['wheel','mousewheel','DOMMouseScroll','MozMousePixelScroll'],toBind='onwheel'in document||document.documentMode>=9?['wheel']:['mousewheel','DomMouseScroll','MozMousePixelScroll'],slice=Array.prototype.slice,nullLowestDeltaTimeout,lowestDelta;if($.event.fixHooks){for(var i=toFix.length;i;){$.event.fixHooks[toFix[--i]]=$.event.mouseHooks;}}var special=$.event.special.mousewheel={version:'3.1.12',setup:function setup(){if(this.addEventListener){for(var i=toBind.length;i;){this.addEventListener(toBind[--i],handler,false);}}else{this.onmousewheel=handler;}// Store the line height and page height for this particular element
|
||
$.data(this,'mousewheel-line-height',special.getLineHeight(this));$.data(this,'mousewheel-page-height',special.getPageHeight(this));},teardown:function teardown(){if(this.removeEventListener){for(var i=toBind.length;i;){this.removeEventListener(toBind[--i],handler,false);}}else{this.onmousewheel=null;}// Clean up the data we added to the element
|
||
$.removeData(this,'mousewheel-line-height');$.removeData(this,'mousewheel-page-height');},getLineHeight:function getLineHeight(elem){var $elem=$(elem),$parent=$elem['offsetParent'in $.fn?'offsetParent':'parent']();if(!$parent.length){$parent=$('body');}return parseInt($parent.css('fontSize'),10)||parseInt($elem.css('fontSize'),10)||16;},getPageHeight:function getPageHeight(elem){return $(elem).height();},settings:{adjustOldDeltas:true,// see shouldAdjustOldDeltas() below
|
||
normalizeOffset:true// calls getBoundingClientRect for each event
|
||
}};$.fn.extend({mousewheel:function mousewheel(fn){return fn?this.bind('mousewheel',fn):this.trigger('mousewheel');},unmousewheel:function unmousewheel(fn){return this.unbind('mousewheel',fn);}});function handler(event){var orgEvent=event||window.event,args=slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,offsetX=0,offsetY=0;event=$.event.fix(orgEvent);event.type='mousewheel';// Old school scrollwheel delta
|
||
if('detail'in orgEvent){deltaY=orgEvent.detail*-1;}if('wheelDelta'in orgEvent){deltaY=orgEvent.wheelDelta;}if('wheelDeltaY'in orgEvent){deltaY=orgEvent.wheelDeltaY;}if('wheelDeltaX'in orgEvent){deltaX=orgEvent.wheelDeltaX*-1;}// Firefox < 17 horizontal scrolling related to DOMMouseScroll event
|
||
if('axis'in orgEvent&&orgEvent.axis===orgEvent.HORIZONTAL_AXIS){deltaX=deltaY*-1;deltaY=0;}// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
|
||
delta=deltaY===0?deltaX:deltaY;// New school wheel delta (wheel event)
|
||
if('deltaY'in orgEvent){deltaY=orgEvent.deltaY*-1;delta=deltaY;}if('deltaX'in orgEvent){deltaX=orgEvent.deltaX;if(deltaY===0){delta=deltaX*-1;}}// No change actually happened, no reason to go any further
|
||
if(deltaY===0&&deltaX===0){return;}// Need to convert lines and pages to pixels if we aren't already in pixels
|
||
// There are three delta modes:
|
||
// * deltaMode 0 is by pixels, nothing to do
|
||
// * deltaMode 1 is by lines
|
||
// * deltaMode 2 is by pages
|
||
if(orgEvent.deltaMode===1){var lineHeight=$.data(this,'mousewheel-line-height');delta*=lineHeight;deltaY*=lineHeight;deltaX*=lineHeight;}else if(orgEvent.deltaMode===2){var pageHeight=$.data(this,'mousewheel-page-height');delta*=pageHeight;deltaY*=pageHeight;deltaX*=pageHeight;}// Store lowest absolute delta to normalize the delta values
|
||
absDelta=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDelta||absDelta<lowestDelta){lowestDelta=absDelta;// Adjust older deltas if necessary
|
||
if(shouldAdjustOldDeltas(orgEvent,absDelta)){lowestDelta/=40;}}// Adjust older deltas if necessary
|
||
if(shouldAdjustOldDeltas(orgEvent,absDelta)){// Divide all the things by 40!
|
||
delta/=40;deltaX/=40;deltaY/=40;}// Get a whole, normalized value for the deltas
|
||
delta=Math[delta>=1?'floor':'ceil'](delta/lowestDelta);deltaX=Math[deltaX>=1?'floor':'ceil'](deltaX/lowestDelta);deltaY=Math[deltaY>=1?'floor':'ceil'](deltaY/lowestDelta);// Normalise offsetX and offsetY properties
|
||
if(special.settings.normalizeOffset&&this.getBoundingClientRect){var boundingRect=this.getBoundingClientRect();offsetX=event.clientX-boundingRect.left;offsetY=event.clientY-boundingRect.top;}// Add information to the event object
|
||
event.deltaX=deltaX;event.deltaY=deltaY;event.deltaFactor=lowestDelta;event.offsetX=offsetX;event.offsetY=offsetY;// Go ahead and set deltaMode to 0 since we converted to pixels
|
||
// Although this is a little odd since we overwrite the deltaX/Y
|
||
// properties with normalized deltas.
|
||
event.deltaMode=0;// Add event and delta to the front of the arguments
|
||
args.unshift(event,delta,deltaX,deltaY);// Clearout lowestDelta after sometime to better
|
||
// handle multiple device types that give different
|
||
// a different lowestDelta
|
||
// Ex: trackpad = 3 and mouse wheel = 120
|
||
if(nullLowestDeltaTimeout){clearTimeout(nullLowestDeltaTimeout);}nullLowestDeltaTimeout=setTimeout(nullLowestDelta,200);return($.event.dispatch||$.event.handle).apply(this,args);}function nullLowestDelta(){lowestDelta=null;}function shouldAdjustOldDeltas(orgEvent,absDelta){// If this is an older event and the delta is divisable by 120,
|
||
// then we are assuming that the browser is treating this as an
|
||
// older mouse wheel event and that we should divide the deltas
|
||
// by 40 to try and get a more usable deltaFactor.
|
||
// Side note, this actually impacts the reported scroll distance
|
||
// in older browsers and can cause scrolling to be slower than native.
|
||
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
|
||
return special.settings.adjustOldDeltas&&orgEvent.type==='mousewheel'&&absDelta%120===0;}});S2.define('jquery.select2',['jquery','jquery-mousewheel','./select2/core','./select2/defaults'],function($,_,Select2,Defaults){if($.fn.select2==null){// All methods that should return the element
|
||
var thisMethods=['open','close','destroy'];$.fn.select2=function(options){options=options||{};if(_typeof2(options)==='object'){this.each(function(){var instanceOptions=$.extend(true,{},options);var instance=new Select2($(this),instanceOptions);});return this;}else if(typeof options==='string'){var ret;var args=Array.prototype.slice.call(arguments,1);this.each(function(){var instance=$(this).data('select2');if(instance==null&&window.console&&console.error){console.error('The select2(\''+options+'\') method was called on an '+'element that is not using Select2.');}ret=instance[options].apply(instance,args);});// Check if we should be returning `this`
|
||
if($.inArray(options,thisMethods)>-1){return this;}return ret;}else{throw new Error('Invalid arguments for Select2: '+options);}};}if($.fn.select2.defaults==null){$.fn.select2.defaults=Defaults;}return Select2;});// Return the AMD loader configuration so it can be used outside of this file
|
||
return{define:S2.define,require:S2.require};}();// Autoload the jQuery bindings
|
||
// We know that all of the modules exist above this, so we're safe
|
||
var select2=S2.require('jquery.select2');// Hold the AMD module references on the jQuery function that was just loaded
|
||
// This allows Select2 to use the internal loader outside of this file, such
|
||
// as in the language files.
|
||
jQuery.fn.select2.amd=S2;// Return the Select2 instance for anyone who is importing it.
|
||
return select2;});/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function errorLoading(){return"无法载入结果。";},inputTooLong:function inputTooLong(e){var t=e.input.length-e.maximum,n="请删除"+t+"个字符";return n;},inputTooShort:function inputTooShort(e){var t=e.minimum-e.input.length,n="请再输入至少"+t+"个字符";return n;},loadingMore:function loadingMore(){return"载入更多结果…";},maximumSelected:function maximumSelected(e){var t="最多只能选择"+e.maximum+"个项目";return t;},noResults:function noResults(){return"未找到结果";},searching:function searching(){return"搜索中…";}};}),{define:e.define,require:e.require};})();(function($,undefined){var pluginName='agDropdownCellEditor',dataKey='ag.dropdown.celleditor';var defaults={maxHeight:200};// Utility functions
|
||
var keys={ESC:27,TAB:9,RETURN:13,LEFT:37,UP:38,RIGHT:39,DOWN:40,ENTER:13,SHIFT:16};/**
|
||
* Constructor
|
||
* @param {[Node]} element [Select element]
|
||
* @param {[Object]} options [Option object]
|
||
*/var Plugin=function Plugin(input,options){this.grid=options.grid;this.config=options.config;this.items=options.data.items;this.selected=options.data.selected;this.hook=options.hook;this.arrow=options.arrow||'icon-search';this.name=options.name;this.onSelect=options.select||function(){};this.$input=$(input);// Settings
|
||
this.settings=$.extend({},defaults,options);// Initialize
|
||
this.init();$.fn[pluginName].instances.push(this);};$.extend(Plugin.prototype,{init:function init(){// Construct the comboselect
|
||
this._construct();// Add event bindings
|
||
this._events();},_construct:function _construct(){var me=this;// Wrap the Select
|
||
this.$container=$('<div class="combo-select combo-open combo-'+me.name+'" />');// Append dropdown arrow
|
||
this.$arrow=$('<div class="combo-arrow"><i class="fa '+this.arrow+'"></i></div>');// Append dropdown
|
||
this.$dropdown=$('<ul class="combo-dropdown" />').appendTo(this.$container);// Create dropdown options
|
||
this._build();this.$input.after(this.$arrow);$('body').append(this.$container);var height=this.$input.outerHeight();var width=this.$input.outerWidth();var offset=this.$input.offset();this.$container.css({width:width+2,left:offset.left-1,top:offset.top+height+1});},_build:function _build(){var me=this;var o='',k=0;o+='<li class="option-item-empty">无匹配选项</li>';$.each(this.items,function(i,e){if(e=='optgroup'){return o+='<li class="option-group">'+this.label+'</li>';}o+='<li class="'+(this.disabled?'option-disabled':"option-item")+' '+(this.id==me.selected?'option-selected':'')+'" data-index="'+k+'" data-value="'+this.id+'">'+this.name+'<i>'+this.code+'</i></li>';k++;});this.$dropdown.html(o);// Items
|
||
this.$items=this.$dropdown.children();},_events:function _events(){var me=this;this.$arrow.off();this.$container.off();this.$input.off();// Dropdown Arrow: click
|
||
this.$arrow.on('click.arrow',$.proxy(this._toggle,this));// Dropdown: close
|
||
this.$container.on('dropdown:close',$.proxy(this._close,this));// Dropdown: open
|
||
this.$container.on('dropdown:open',$.proxy(this._open,this));// Dropdown: update
|
||
this.$container.on('dropdown:update',$.proxy(this._update,this));// Input: keydown
|
||
this.$input.on('keydown',$.proxy(this._keydown,this));// Input: keyup
|
||
this.$input.on('keyup',$.proxy(this._keyup,this));// Dropdown item: click
|
||
this.$container.on('click.item','.option-item',$.proxy(this._select,this));},_keydown:function _keydown(event){switch(event.which){case keys.ESC:this.$container.trigger('dropdown:close');break;case keys.UP:this._move('up',event);event.stopPropagation();break;case keys.DOWN:this._move('down',event);event.stopPropagation();break;case keys.TAB:this._enter(event);break;case keys.RIGHT://this._autofill(event);
|
||
break;case keys.ENTER:this._enter(event);break;default:break;}},_keyup:function _keyup(event){switch(event.which){case keys.ESC:case keys.ENTER:case keys.UP:case keys.DOWN:case keys.LEFT:case keys.RIGHT:case keys.TAB:case keys.SHIFT:break;default:this._filter(event.target.value);break;}},_enter:function _enter(event){var item=this._getHovered();this._select(item);},_move:function _move(dir,event){var items=this._getVisible(),current=this._getHovered(),index=current.prevAll('.option-item').filter(':visible').length,total=items.length;switch(dir){case'up':index--;index<0&&(index=total-1);break;case'down':index++;index>=total&&(index=0);break;}items.removeClass('option-hover').eq(index).addClass('option-hover');if(!this.opened)this.$container.trigger('dropdown:open');this._fixScroll();},_select:function _select(event){var item=event.currentTarget?$(event.currentTarget):$(event);//if (!item.length) return;
|
||
var index=item.data('index');this._selectByIndex(index);this.$container.trigger('dropdown:close');},/**
|
||
* Set selected index and trigger change
|
||
* @type {[type]}
|
||
*/_selectByIndex:function _selectByIndex(index){if(typeof index=='undefined'){// 为空设置不选中
|
||
index=-1;}this._getAll().removeClass('option-selected').filter(function(){return $(this).data('index')==index;}).addClass('option-selected');this._change();},_autofill:function _autofill(){var item=this._getHovered();if(item.length){var index=item.data('index');this._selectByIndex(index);}},_filter:function _filter(search){var self=this,items=this._getAll(),needle=$.trim(search).toLowerCase(),reEscape=new RegExp('(\\'+['/','.','*','+','?','|','(',')','[',']','{','}','\\'].join('|\\')+')','g'),pattern='('+search.replace(reEscape,'\\$1')+')';// Unwrap all markers
|
||
$('.combo-marker',items).contents().unwrap();// Search
|
||
if(needle){// Hide Disabled and optgroups
|
||
this.$items.filter('.option-group, .option-disabled').hide();items.hide().filter(function(){var $this=$(this),text=$.trim($this.text()).toLowerCase();// Found
|
||
if(text.toString().indexOf(needle)!=-1){// Wrap the selection
|
||
$this.html(function(index,oldhtml){return oldhtml.replace(new RegExp(pattern,'gi'),'<span class="combo-marker">$1</span>');});return true;}}).show();}else{items.show();}// Open the dropdown
|
||
this.$container.trigger('dropdown:open');// 搜索结果为不存在时候显示
|
||
if(this._getVisible().length==0){this.$items.filter('.option-item-empty').show();}else{this.$items.filter('.option-item-empty').hide();}},_highlight:function _highlight(){/*
|
||
1. Check if there is a selected item
|
||
2. Add hover class to it
|
||
3. If not add hover class to first item
|
||
*/var visible=this._getVisible().removeClass('option-hover'),$selected=visible.filter('.option-selected');if($selected.length){$selected.addClass('option-hover');}else{visible.removeClass('option-hover').first().addClass('option-hover');}},_updateInput:function _updateInput(){var item=this._getAll().filter('.option-selected');var index=item.data('index');this.onSelect.call(this,this.items[index]);/*
|
||
if (index) {
|
||
this.onSelect.call(this, this.items[index]);
|
||
} else {
|
||
this.onSelect.call(this, this.items[index]);
|
||
}*/},_focus:function _focus(event){// Toggle focus class
|
||
this.$container.toggleClass('combo-focus',!this.opened);// Open combo
|
||
if(!this.opened)this.$container.trigger('dropdown:open');},_change:function _change(){this._updateInput();},_getAll:function _getAll(){return this.$items.filter('.option-item');},_getVisible:function _getVisible(){return this.$items.filter('.option-item').filter(':visible');},_getHovered:function _getHovered(){return this._getVisible().filter('.option-hover');},_open:function _open(){var self=this;this.$container.addClass('combo-open');this.$arrow.addClass('combo-arrow-open');this.opened=true;// Highligh the items
|
||
this._highlight();// Fix scroll
|
||
this._fixScroll();// Close all others
|
||
$.each($.fn[pluginName].instances,function(i,plugin){if(plugin!=self&&plugin.opened)plugin.$container.trigger('dropdown:close');});},_toggle:function _toggle(e){this.opened?this._close.call(this):this._open.call(this);this.$input.focus();e.stopPropagation();},_close:function _close(){this.$container.removeClass('combo-open combo-focus');this.$arrow.removeClass('combo-arrow-open');this.$container.trigger('dropdown:closed');this.opened=false;// Show all items
|
||
this.$items.filter('.option-item').show();},_fixScroll:function _fixScroll(){// If dropdown is hidden
|
||
if(this.$dropdown.is(':hidden'))return;// Else
|
||
var item=this._getHovered();if(!item.length)return;// Scroll
|
||
var offsetTop,upperBound,lowerBound,heightDelta=item.outerHeight();offsetTop=item[0].offsetTop;upperBound=this.$dropdown.scrollTop();lowerBound=upperBound+this.settings.maxHeight-heightDelta;if(offsetTop<upperBound){this.$dropdown.scrollTop(offsetTop);}else if(offsetTop>lowerBound){this.$dropdown.scrollTop(offsetTop-this.settings.maxHeight+heightDelta);}},/**
|
||
* 更新
|
||
*/_update:function _update(){this.$dropdown.empty();this._build();},/**
|
||
* 销毁
|
||
*/dispose:function dispose(){// 删除dom
|
||
this.$arrow.remove();this.$input.remove();this.$dropdown.remove();}});$.fn[pluginName]=function(options,args){this.each(function(){var $e=$(this),instance=$e.data('plugin_'+dataKey);if(typeof options==='string'){if(instance&&typeof instance[options]==='function'){instance[options](args);}}else{if(instance&&instance.dispose){instance.dispose();}$.data(this,"plugin_"+dataKey,new Plugin(this,options));}});return this;};$.fn[pluginName].instances=[];})(jQuery);;(function($){var inputLock;// 用于中文输入法输入时锁定搜索
|
||
var grid=null;/**
|
||
* 设置或获取输入框的 alt 值
|
||
*/function setOrGetAlt($input,val){return val!==undefined?$input.attr('alt',val):$input.attr('alt');}/**
|
||
* 判断字段名是否在 options.effectiveFields 配置项中
|
||
* @param {String} field 要判断的字段名
|
||
* @param {Object} options
|
||
* @return {Boolean} effectiveFields 为空时始终返回 true
|
||
*/function inEffectiveFields(field,options){var effectiveFields=options.effectiveFields;return!(field==='__index'||effectiveFields.length&&!~$.inArray(field,effectiveFields));}/**
|
||
* 判断字段名是否在 options.searchFields 搜索字段配置中
|
||
*/function inSearchFields(field,options){return~$.inArray(field,options.searchFields);}/**
|
||
* 显示下拉列表
|
||
*/function showDropMenu($input,options){var $dropdownMenu=$('#gdoo-gird-suggest');if(!$dropdownMenu.is(':visible')){$dropdownMenu.show();$input.trigger('onShowDropdown',[options?options.data:[]]);}}/**
|
||
* 隐藏下拉列表
|
||
*/function hideDropMenu($input,options){var $dropdownMenu=$('#gdoo-gird-suggest');if($dropdownMenu.is(':visible')){$dropdownMenu.hide();$input.trigger('onHideDropdown',[options?options.data:[]]);}}/**
|
||
* 下拉列表刷新
|
||
* 作为 fnGetData 的 callback 函数调用
|
||
*/function refreshDropMenu($input,data,options){showDropMenu($input,options);grid.remoteParams.q=$input.val();// 读取数据
|
||
grid.remoteData();return $input;}/**
|
||
* 下拉列表刷新
|
||
* 作为 fnGetData 的 callback 函数调用
|
||
*/function refreshDropMenu2($input,options){var params=options.query;params.suggest=true;var $dropdownMenu=$('#gdoo-gird-suggest');$dropdownMenu.html('<div style="height:180px;overflow:auto;width:auto;"><div id="suggest-'+params.id+'" class="ag-theme-balham" style="width:100%;height:180px;border-left:1px solid #BDC3C7;border-right:1px solid #BDC3C7;"></div></div>');var option=gdoo.formKey(params);var event=gdoo.event.get(option.key);event.trigger('query',params);event.trigger('open',params);var sid=params.prefix==1?'sid':'id';var gridDiv=document.querySelector("#suggest-"+params.id);grid=new agGridOptions();var multiple=params.multi==0?false:true;grid.remoteDataUrl=app.url(params.url);grid.remoteParams=params;grid.rowSelection=multiple?'multiple':'single';grid.suppressRowClickSelection=true;grid.columnDefs=[//{suppressMenu: true, cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: multiple, suppressSizeToFit: true, sortable: false, width: 40},
|
||
//{suppressMenu: true, cellClass:'text-center', sortable: false, suppressSizeToFit: true, cellRenderer: 'htmlCellRenderer', field: 'images', headerName: '图片', width: 40},
|
||
{suppressMenu:true,cellClass:'text-center',sortable:true,field:'code',headerName:'存货编码',width:100},{suppressMenu:true,cellClass:'text-left',sortable:true,field:'name',headerName:'产品名称',minWidth:140},{suppressMenu:true,cellClass:'text-center',sortable:true,field:'spec',headerName:'规格型号',width:100},{suppressMenu:true,cellClass:'text-center',sortable:true,field:'barcode',headerName:'产品条码',width:120},{suppressMenu:true,cellClass:'text-center',sortable:true,field:'unit_id_name',headerName:'计量单位',width:80},{suppressMenu:true,cellClass:'text-right',field:'price',headerName:'价格',width:80}];grid.onRowClicked=function(row){var ret=grid.writeSelected(row.data);if(ret){hideDropMenu($input,options);}};/**
|
||
* 写入选中
|
||
*/grid.writeSelected=function(selectedRow){var ret=true;var list=gdoo.forms[params.form_id];var links=list.links[params.id];var item=options.item;// 如果传入的行id为0
|
||
if(query.grid_id==0){query.grid_id=list.lastEditCell.data.id;}for(key in links){item[key]=selectedRow[links[key]];}if(event.exist('onSelect')){ret=event.trigger('onSelect',item,selectedRow);}list.lastEditCell.data=item;list.api.memoryStore.update(item);$input.trigger('onSelect',[item]);list.generatePinnedBottomData();return ret;};new agGrid.Grid(gridDiv,grid);return $input;}/**
|
||
* 检测 keyword 与 value 是否存在互相包含
|
||
* @param {String} keyword 用户输入的关键字
|
||
* @param {String} key 匹配字段的 key
|
||
* @param {String} value key 字段对应的值
|
||
* @param {Object} options
|
||
* @return {Boolean} 包含/不包含
|
||
*/function isInWord(keyword,key,value,options){value=$.trim(value);if(options.ignorecase){keyword=keyword.toLocaleLowerCase();value=value.toLocaleLowerCase();}return value&&(inEffectiveFields(key,options)||inSearchFields(key,options))&&(// 必须在有效的搜索字段中
|
||
~value.indexOf(keyword)||// 匹配值包含关键字
|
||
options.twoWayMatch&&~keyword.indexOf(value)// 关键字包含匹配值
|
||
);}/**
|
||
* 通过 ajax 或 json 参数获取数据
|
||
*/function getData(keyword,$input,callback,options){var data,validData,filterData=[],i,key,len;keyword=keyword||'';// 给了url参数,则从服务器 ajax 请求
|
||
if(options.url){callback($input,options.data,options);}else{data=options.data;validData=data;// 本地的 data 数据,则在本地过滤
|
||
if(validData){if(keyword){// 输入不为空时则进行匹配
|
||
len=data.length;for(i=0;i<len;i++){for(key in data[i]){if(data[i][key]&&isInWord(keyword,key,data[i][key]+'',options)){filterData.push(data[i]);filterData[filterData.length-1].__index=i;break;}}}}else{filterData=data;}}callback($input,filterData,options);}}/**
|
||
* 取得 clearable 清除按钮
|
||
*/function getIClear($input,options){var $iClear=$input.prev('i.clearable');// 是否可清除已输入的内容(添加清除按钮)
|
||
if(options.clearable&&!$iClear.length){$iClear=$('<i class="clearable glyphicon glyphicon-remove"></i>').prependTo($input.parent());}return $iClear.css({position:'absolute',top:12,// right: options.showBtn ? Math.max($input.next('.input-group-btn').width(), 33) + 2 : 12,
|
||
zIndex:4,cursor:'pointer',fontSize:12}).hide();}/**
|
||
* 默认的配置选项
|
||
* @type {Object}
|
||
*/var defaultOptions={query:{},item:{},data:[],allowNoKeyword:true,ignorecase:false,searchFields:[],twoWayMatch:true,delay:300,showBtn:true,clearable:false,/* key */keyLeft:37,keyUp:38,keyRight:39,keyDown:40,keyEnter:13,fnGetData:getData};var methods={init:function init(options){// 参数设置
|
||
var self=this;options=options||{};options=$.extend(true,{},defaultOptions,options);return self.each(function(){var $input=$(this),$parent=$input.parent(),$iClear=getIClear($input,options),isMouseenterMenu,keyupTimer;// keyup 与 input 事件延时定时器
|
||
var $dropdownMenu=$('#gdoo-gird-suggest');if($dropdownMenu.length===0){$dropdownMenu=$('<div class="gdoo-gird-suggest" id="gdoo-gird-suggest" style="position:absolute;display:none;box-shadow:0 2px 5px 0 rgb(0 0 0 / 26%);"></div>');$('body').append($dropdownMenu);}refreshDropMenu2($input,options);/*
|
||
var offset = $input.offset();
|
||
var height = $input.outerHeight();
|
||
$dropdownMenu.css({left: offset.left - 1, top: offset.top + height - 1});
|
||
*/$input.off();// 是否显示 button 按钮
|
||
if(!options.showBtn){$input.css('borderRadius',4);$parent.css('width','100%').find('.btn:eq(0)').hide();}// 移除 disabled 类,并禁用自动完成
|
||
$input.removeClass('disabled').prop('disabled',false).attr('autocomplete','off');// 开始事件处理
|
||
$input.on('keydown',function(event){// 当提示层显示时才对键盘事件处理
|
||
if(!$dropdownMenu.is(':visible')){return;}if(event.keyCode===options.keyEnter){hideDropMenu($input,options);}}).on('compositionstart',function(event){// 中文输入开始,锁定
|
||
inputLock=true;}).on('compositionend',function(event){// 中文输入结束,解除锁定
|
||
inputLock=false;}).on('keyup input paste',function(event){var word;// 如果弹起的键是回车、向上或向下方向键则返回
|
||
if(~$.inArray(event.keyCode,[options.keyDown,options.keyUp,options.keyEnter])){$input.val($input.val());// 让鼠标输入跳到最后
|
||
return;}clearTimeout(keyupTimer);keyupTimer=setTimeout(function(){// 锁定状态,返回
|
||
if(inputLock){return;}word=$input.val();// 若输入框值没有改变则返回
|
||
if($.trim(word)&&word===setOrGetAlt($input)){return;}// 是否允许空数据查询
|
||
if(!word.length&&!options.allowNoKeyword){return;}options.fnGetData($.trim(word),$input,refreshDropMenu,options);},options.delay||300);}).on('blur',function(){// 不是进入下拉列表状态,则隐藏列表
|
||
if(!isMouseenterMenu){hideDropMenu($input,options);}}).on('focus',function(){$dropdownMenu.off();var w=$(window).width();var h=$(window).height();var width=$input.outerWidth();var height=$input.outerHeight();var offset=$input.offset();var dw=$dropdownMenu.outerWidth();var dh=$dropdownMenu.outerHeight();var css={top:offset.top+height};// 判断是否小于768
|
||
if(w<768){css.minWidth=360;css.left=14;css.right=14;}else{css.left=offset.left-1;// 右边超出
|
||
if(w<offset.left+dw+10){css.left=offset.left-dw+width+1;}// 下边超出
|
||
if(h<offset.top+dh+10){css.top=offset.top-dh;}}$dropdownMenu.css(css);// 列表中滑动时,输入框失去焦点
|
||
$dropdownMenu.on('mouseenter',function(){isMouseenterMenu=1;$input.blur();}).on('mouseleave',function(){isMouseenterMenu=0;$input.focus();}).on('click',function(){// 阻止冒泡
|
||
return false;});});// 存在清空按钮
|
||
if($iClear.length){$iClear.click(function(){});$parent.mouseenter(function(){if(!$input.prop('disabled')){$iClear.css('right',options.showBtn?Math.max($input.next('.input-group-btn').width(),33)+2:12).show();}}).mouseleave(function(){$iClear.hide();});}});},show:function show(){return this.each(function(){$(this).click();});},hide:function hide(){return this.each(function(){hideDropMenu($(this));});},disable:function disable(){return this.each(function(){$(this).attr('disabled',true).parent().find('.btn:eq(0)').prop('disabled',true);});},enable:function enable(){return this.each(function(){$(this).attr('disabled',false).parent().find('.btn:eq(0)').prop('disabled',false);});},destroy:function destroy(){return this.each(function(){$(this).off().removeData('gdooSuggest').removeAttr('style').parent().find('.btn:eq(0)').off().show().attr('data-toggle','dropdown').prop('disabled',false)// .addClass(disabled);
|
||
.next().css('display','').off();});}};$.fn['gdooSuggest']=function(options){// 方法判断
|
||
if(typeof options==='string'&&methods[options]){var inited=true;this.each(function(){if(!$(this).data('gdooSuggest')){return inited=false;}});// 只要有一个未初始化,则全部都不执行方法,除非是 init 或 version
|
||
if(!inited&&'init'!==options&&'version'!==options){return this;}// 如果是方法,则参数第一个为函数名,从第二个开始为函数参数
|
||
return methods[options].apply(this,[].slice.call(arguments,1));}else{// 调用初始化方法
|
||
return methods.init.apply(this,arguments);}};})(jQuery);var formGridList={};function gridForms(master,table,options){options.master=master;var grid=gridForm(table,options);formGridList[master].push(grid);return grid;}function gridForm(table,options){var defaults={heightTop:70,data:[],dataType:'local'};options=$.extend(defaults,options);var grid=new agGridOptions();grid.suppressLoadingOverlay=true;grid.suppressNoRowsOverlay=true;grid.rowMultiSelectWithClick=false;grid.singleClickEdit=true;grid.rowSelection='single';grid.suppressCellSelection=false;grid.suppressRowClickSelection=false;grid.columnDefs=options.columns;grid.links=options.links;grid.tableTitle=options.title;grid.tableKey=options.table;grid.defaultColDef.sortable=false;grid.defaultColDef.filter=false;grid.defaultColDef.suppressMenu=true;grid.defaultColDef.suppressNavigable=true;grid.isEditing=false;grid.isEditingDialog=false;var event=gdoo.event.get('grid.'+table);var editable=event.editable||{};grid.defaultColDef.editable=function(params){if(params.node.rowPinned){return false;}var col=params.colDef;var fun=editable[col.field];if(typeof fun=='function'){return fun.call(grid,params);}else{if(params.colDef._editable){return true;}return false;}};grid.getRowNodeId=function(data){if(data.id){return data.id;}};grid.onRowClicked=function(row){};grid.stopEditingWhenGridLosesFocus=false;grid.onRowDoubleClicked=function(row){};grid.onCellEditingStarted=function(params){grid.lastEditCell=params;grid.isEditingDialog=params.colDef.cellEditor=='dialogCellEditor';grid.isEditing=true;};grid.onCellEditingStopped=function(){grid.isEditing=false;if(grid.isEditingDialog){$('#gdoo-gird-suggest').hide();}};var autoHeight=false;var gridDiv=document.querySelector('#grid_'+table);if(gridDiv.style.height==''){autoHeight=true;gridDiv.style.height=getTabContentHeight()+'px';}event.trigger('init',grid);new agGrid.Grid(gridDiv,grid);grid.api.dialogSelected=function(query){var dialogEvent=gdoo.event.get(query.form_id+'.'+query.id);var links=options.links[query.id];var dialog=gdoo.dialogs[query.form_id+'_'+query.id];var selectedRows=dialog.getSelectedRows();var store=grid.api.memoryStore;var rows=[];grid.api.forEachNode(function(rowNode,index){if(rowNode.data[query.id]==undefined){rows.push(rowNode.data);}});// 如果传入的行id为0
|
||
if(query.grid_id==0){query.grid_id=grid.lastEditCell.data.id;}for(var _i=0;_i<selectedRows.length;_i++){var row=rows[_i];var update=true;if(row==undefined){row={};update=false;}if(selectedRows.length==1){var res=grid.api.getSelectedRows();if(res.length==0){row={};if(query.grid_id){var node=grid.api.getRowNode(query.grid_id);row=node.data;update=true;}}else{if(query.grid_id){row=res[0];update=true;}}}var selectedRow=selectedRows[_i];for(key in links){row[key]=selectedRow[links[key]];}dialogEvent.trigger('onSelect',row,selectedRow);if(update){store.update(row);}else{store.create(row);}// 数据设置
|
||
if(selectedRows.length==1){if(query.grid_id){$('#'+query.name+'_'+query.grid_id).val(row[query.name]);}}}grid.generatePinnedBottomData();};grid.api.memoryStore={lastIndex:1,created:[],updated:[],deleted:[],create:function create(row,index){this.lastIndex++;row['id']='draft_'+this.lastIndex;row=grid.calcRow(row);this.created.push(row);grid.api.updateRowData({add:[row],addIndex:index});},update:function update(row){row=grid.calcRow(row);this.updated.push(row);grid.api.updateRowData({update:[row]});},"delete":function _delete(row,draft){if(draft==false){this.deleted.push(row);}// 删除创建里的草稿数据
|
||
this.created=this.created.filter(function(item){return item.id==row.id?false:true;});// 删除更新后的数据
|
||
this.updated=this.updated.filter(function(item){return item.id==row.id?false:true;});var res=grid.api.updateRowData({remove:[row]});grid.generatePinnedBottomData();}};grid.onFirstDataRendered=function(params){var api=this.api;// 计算合计行
|
||
this.generatePinnedBottomData();};grid.calcRow=function(row,col){for(var i=0;i<options.columns.length;i++){var column=options.columns[i];if(column.calcRow){var fun=new Function('data','column',column.calcRow);var value=parseFloat(fun(row,col||{}));if(isNaN(value)||value===0){value='';}row[column.field]=value;}}return row;};grid.onCellValueChanged=function(params){var me=this;if(params.oldValue==params.newValue){return;}var data=params.data;data=me.calcRow(data,params.column);me.api.updateRowData({update:[data]});me.generatePinnedBottomData();};// 本地数据类型,初始化一条数据
|
||
if(options.dataType=='local'){if(options.data.length>0){if(typeof event.dataLoaded=='function'){event.dataLoaded.call(grid,options.data);}grid.api.updateRowData({add:options.data});}else{grid.api.memoryStore.create({});}}// 删除方法
|
||
grid.api.deleteRow=function(data){var rowNode=grid.api.getRowNode(data.id);var row=rowNode.data;// 检查删除的是否是草稿
|
||
var id=''+row.id;var draft=id.indexOf('draft_');if(draft===0){grid.api.memoryStore["delete"](row,true);}else{grid.api.memoryStore["delete"](row,false);}};// 绑定自定义事件
|
||
var $gridDiv=$(gridDiv);$gridDiv.off();$gridDiv.on('click','[data-toggle="event"]',function(){var data=$(this).data();if(data.action=='option'){if(data.type=='add'){grid.api.memoryStore.create({});}else{// 最后一行不能删除
|
||
var count=grid.api.getDisplayedRowCount();if(count>1){grid.api.deleteRow(data);}}}});// 编辑器失去焦点关闭
|
||
$gridDiv.on('blur','.ag-input-wrapper',function(){if(grid.isEditingDialog){return;}if(grid.isEditing){grid.api.stopEditing();}});function getTabContentHeight(){var list=$('#tab-content-'+options.master).position();var height=$(window).height()-list.top-options.heightTop;return height>320?height:320;}grid.onGridReady=function(params){event.trigger('ready',grid);if(autoHeight){window.addEventListener('resize',function(){setTimeout(function(){gridDiv.style.height=getTabContentHeight()+'px';});});}};gdoo.forms[table]=grid;return grid;}function getPanelHeight(v){var list=$('.gdoo-list-grid').position();var position=list.top+v+'px';return'calc(100vh - '+position+')';}(function(window,$){var localeText={page:"页",more:"更多",to:"到",of:"至",next:"下一页",last:"上一页",first:"首页",previous:"上一页",loadingOoo:"加载中...",selectAll:"查询全部",searchOoo:"查询...",blanks:"空白",filterOoo:"过滤...",applyFilter:"daApplyFilter...",equals:"相等",notEqual:"不相等",lessThan:"小于",greaterThan:"大于",lessThanOrEqual:"小于等于",greaterThanOrEqual:"大于等于",inRange:"范围",contains:"包含",notContains:"不包含",startsWith:"开始于",endsWith:"结束于",group:"组",columns:"列",filters:"筛选",rowGroupColumns:"laPivot Cols",rowGroupColumnsEmptyMessage:"la drag cols to group",valueColumns:"laValue Cols",pivotMode:"laPivot-Mode",groups:"laGroups",values:"值",pivots:"laPivots",valueColumnsEmptyMessage:"la drag cols to aggregate",pivotColumnsEmptyMessage:"la drag here to pivot",toolPanelButton:"la tool panel",noRowsToShow:"数据为空",pinColumn:"laPin Column",//valueAggregation: "laValue Agg",
|
||
//autosizeThiscolumn: "laAutosize Diz",
|
||
//autosizeAllColumns: "laAutsoie em All",
|
||
groupBy:"排序",ungroupBy:"不排序",resetColumns:"重置列",expandAll:"展开全部",collapseAll:"关闭",toolPanel:"工具面板","export":"导出",csvExport:"导出为CSV格式文件",excelExport:"导出到Excel",//pinLeft: "laPin <<",
|
||
//pinRight: "laPin >>",
|
||
//noPin: "laDontPin <>",
|
||
sum:"总数",min:"最小值",max:"最大值",none:"无",count:"总",average:"平均值",copy:"复制",copyWithHeaders:"携带表头复制",ctrlC:"ctrl + C",paste:"粘贴",ctrlV:"ctrl + V"};function OptionCellRenderer(){}OptionCellRenderer.prototype.init=function(params){if(params.node.rowPinned){return;}this.eGui=document.createElement('div');this.eGui.className='options';this.eGui.innerHTML='<a data-toggle="event" data-action="option" data-type="add" data-index="'+params.rowIndex+'" data-id="'+params.data.id+'" class="fa fa-plus" title="新增行"></a> <a data-toggle="event" data-action="option" data-type="delete" data-id="'+params.data.id+'" data-index="'+params.rowIndex+'" class="fa fa-times" title="删除行"></a></div>';};OptionCellRenderer.prototype.getGui=function(){return this.eGui;};function HtmlCellRenderer(){}HtmlCellRenderer.prototype.init=function(params){this.eGui=document.createElement('span');this.eGui.innerHTML=params.value||'';};HtmlCellRenderer.prototype.getGui=function(){return this.eGui;};function ActionCellRenderer(){}ActionCellRenderer.prototype.init=function(params){var gridOptions=params.api.gridCore.gridOptions;if(params.node.rowPinned){return;}if(params.data==undefined){return;}var data=params.data;var links='';if(data.master_id>0){params.colDef.options.forEach(function(action){if(action.display){var html='<a data-toggle="event" class="option" data-action="'+action.action+'" data-master_name="'+data.name+'" data-master_id="'+data.master_id+'" href="javascript:;">'+action.name+'</a>';links+=gridOptions.actionCellBeforeRender(html,action,data)||'';}});}this.eGui=document.createElement('span');this.eGui.innerHTML=links;};ActionCellRenderer.prototype.getGui=function(){return this.eGui;};function SelectCellEditor(){}SelectCellEditor.prototype.init=function(params){this.grid=params;this.selectedKey=null;this.items=params.colDef.cellEditorParams.values;this.eInput=document.createElement('input');this.eInput.value=params.value||'';this.eInput.className='ag-cell-edit-input form-control';};SelectCellEditor.prototype.getGui=function(params){return this.eInput;};SelectCellEditor.prototype.afterGuiAttached=function(){var me=this;var grid=me.grid;var oValue=me.eInput.value;// 初始化编辑器
|
||
$(me.eInput).agDropdownCellEditor({grid:me,arrow:'fa-caret-down',data:{items:me.items,selected:grid.data[grid.select_key]},select:function select(item){if(item){grid.data[grid.select_key]=item.id;me.eInput.value=item.name;me.selectedKey=item.id;}else{me.eInput.value=oValue;}grid.stopEditing();}});me.eInput.focus();me.eInput.select();};SelectCellEditor.prototype.getValue=function(){return this.eInput.value;};SelectCellEditor.prototype.destroy=function(){$('body').find('.combo-select').remove();};function CheckboxCellRenderer(){}CheckboxCellRenderer.prototype.init=function(params){var value=params.value;var values=params.colDef.cellEditorParams.values;this.eGui=document.createElement('div');this.eGui.innerHTML=values[value]||values[0];};CheckboxCellRenderer.prototype.getGui=function(){return this.eGui;};function CheckboxCellEditor(){}CheckboxCellEditor.prototype.init=function(params){var value=params.value;this.eInput=document.createElement('input');this.eInput.type='checkbox';this.eInput.checked=value;this.eInput.value=value;};CheckboxCellEditor.prototype.getGui=function(params){return this.eInput;};CheckboxCellEditor.prototype.afterGuiAttached=function(){var me=this;me.eInput.focus();me.eInput.select();};CheckboxCellEditor.prototype.getValue=function(){return this.eInput.checked?1:0;};CheckboxCellEditor.prototype.destroy=function(){};function DialogCellEditor(){}DialogCellEditor.prototype.init=function(params){this.params=params;this.eInput=document.createElement('div');this.eInput.tabIndex='-1';var key=params.colDef.field+'_'+params.data.id;var query=params.query;query.multi=1;query.is_grid=1;query.url=params.url;query.grid_id=params.data.id;query.title=params.title;var url='';$.each(query,function(k,v){url+=' data-'+k+'="'+v+'"';});this.query=query;this.eInput.innerHTML='<input class="ag-cell-edit-input" value="'+(params.value||'')+'" id="'+key+'"><a class="combo-arrow" data-toggle="dialog-view" '+url+'><i class="fa fa-search"></i></a>';this.eInput.className='ag-input-wrapper ag-input-dialog-wrapper';};DialogCellEditor.prototype.getGui=function(params){return this.eInput;};DialogCellEditor.prototype.afterGuiAttached=function(){var me=this;$(me.eInput).find('input').gdooSuggest({item:me.params.data,query:me.query}).on('onSelect',function(e,item){me.params.data[me.query.name]=item[me.query.name];me.eInput.querySelector('input').value=item[me.query.name];});me.eInput.querySelector('input').select();};DialogCellEditor.prototype.getValue=function(){return this.params.data[this.params.query.name];};DialogCellEditor.prototype.destroy=function(){var me=this;$(me.eInput).find('input').off();};DialogCellEditor.prototype.isPopup=function(){return false;};function DateCellEditor(){}DateCellEditor.prototype.init=function(params){this.params=params.colDef.cellEditorParams;this.eInput=document.createElement('div');this.eInput.innerHTML='<input type="text" class="ag-cell-edit-input" data-toggle="date" value="'+(params.value||'')+'">';this.eInput.className='ag-input-wrapper ag-input-date-wrapper';};DateCellEditor.prototype.getGui=function(params){return this.eInput;};DateCellEditor.prototype.afterGuiAttached=function(){this.eInput.querySelector('input').click();};DateCellEditor.prototype.getValue=function(){return this.eInput.querySelector('input').value;};DateCellEditor.prototype.destroy=function(){};function agGridOptions(){// 定义ag-grid默认参数
|
||
var gridOptions={defaultColDef:{minWidth:100,enableRowGroup:true,enablePivot:true,enableValue:true,sortable:true,resizable:true,filter:true,comparator:function comparator(a,b){if(this.cellRenderer=='htmlCellRenderer'){a=delHtmlTag(a);b=delHtmlTag(b);return a.localeCompare(b);}return typeof a==='string'?a.localeCompare(b):a>b?1:a<b?-1:0;}},pinnedBottomRowData:[],rowDragManaged:true,suppressRowClickSelection:true,rowMultiSelectWithClick:false,rowSelection:'multiple',localeText:localeText,suppressAnimationFrame:true,// suppressAutoSize: true,
|
||
suppressContextMenu:true,// 关闭参数检查
|
||
suppressPropertyNamesCheck:true,// pagination: true,
|
||
// rowModelType: 'infinite',
|
||
// paginationPageSize: 25,
|
||
// cacheBlockSize: 25,
|
||
// suppressPaginationPanel: true,
|
||
suppressCellSelection:true,enableCellTextSelection:true,// 自定义后端数据地址
|
||
remoteDataUrl:'',remoteParams:{},dialogList:{},editableList:{},autoColumnsToFit:true,lastEditCell:{},selectedRows:[],pager:false,pagerDom:null,pagePer:50,// 格式化数字时候默认值是否强行为空
|
||
numberEmptyDefaultValue:false,pageList:[50,100,500,1000,2000,5000,10000,20000,50000],onCellEditingStarted:function onCellEditingStarted(params){this.lastEditCell=params;},remoteSuccessed:function remoteSuccessed(){},onGridSizeChanged:function onGridSizeChanged(params){},onGridReady:function onGridReady(params){},onFirstDataRendered:function onFirstDataRendered(params){var me=this;var api=me.api;if(me.autoColumnsToFit){api.sizeColumnsToFit();}if(typeof me.onCustomFirstDataRendered=="function"){me.onCustomFirstDataRendered.call(me,params);}// 计算合计行
|
||
me.generatePinnedBottomData();},onCellValueChanged:function onCellValueChanged(params){this.generatePinnedBottomData();},getRowStyle:function getRowStyle(params){},onRowClicked:function onRowClicked(params){var selected=params.node.isSelected();if(selected===false){params.node.setSelected(true,true);}},getSelectedRows:function getSelectedRows(){return this.selectedRows;},onRowSelected:function onRowSelected(params){var me=this;var node=params.node;if(node.selected){me.selectedRows.push(node.data);}else{for(var _i2=0;_i2<me.selectedRows.length;_i2++){var select=me.selectedRows[_i2];if(node.data.id==select.id){me.selectedRows.splice(_i2,1);}}}if(typeof me.onCustomRowSelected=="function"){me.onCustomRowSelected.call(me,params);}},onRowDoubleClicked:function onRowDoubleClicked(params){console.log('onRowDoubleClicked');},/*
|
||
getRowNodeId_bak(data) {
|
||
if (data.id) {
|
||
return data.id;
|
||
}
|
||
},
|
||
*/columnTypes:{number:{cellClass:'ag-cell-number',valueFormatter:function valueFormatter(params){var me=this;if(params.node.rowPinned){if(params.colDef.calcFooter){}else{return'';}}var options=params.colDef.numberOptions||{};var places=options.places==undefined?2:options.places;var separator=options.separator==undefined?'.':options.separator;var thousands=options.thousands==undefined?',':options.thousands;var defaultValue=options["default"]==undefined?0:options["default"];var value=parseFloat(params.value);if(isNaN(value)||value==0){return gridOptions.numberEmptyDefaultValue==false?defaultValue:'';}value=number_format(value,places,separator,thousands);return value;},valueParser:function valueParser(params){var value=parseFloat(params.newValue);if(isNaN(value)){return 0;}return value;}},sn:{cellClass:'ag-cell-sn',valueFormatter:function valueFormatter(params){if(params.node.rowPinned){return'';}return parseInt(params.node.childIndex)+1;},valueParser:function valueParser(params){return parseFloat(params.newValue);}},datetime:{cellClass:'ag-cell-datetime',valueFormatter:function valueFormatter(params){if(params.node.rowPinned){return'';}return format_datetime(params.value);},valueParser:function valueParser(params){return parseFloat(params.newValue);}},date:{cellClass:'ag-cell-date',valueFormatter:function valueFormatter(params){if(params.node.rowPinned){return'';}return format_date(params.value);},valueParser:function valueParser(params){return parseFloat(params.newValue);}}},components:{'optionCellRenderer':OptionCellRenderer,'actionCellRenderer':ActionCellRenderer,'htmlCellRenderer':HtmlCellRenderer,'selectCellEditor':SelectCellEditor,'dialogCellEditor':DialogCellEditor,'dateCellEditor':DateCellEditor,'checkboxCellEditor':CheckboxCellEditor,'checkboxCellRenderer':CheckboxCellRenderer},overlayLoadingTemplate:'<span class="ag-overlay-loading-center">数据加载中...</span>',overlayNoRowsTemplate:'<div style="padding-top:20px;"><img alt="暂无数据" src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxKSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxlbGxpcHNlIGZpbGw9IiNGNUY1RjUiIGN4PSIzMiIgY3k9IjMzIiByeD0iMzIiIHJ5PSI3Ii8+CiAgICA8ZyBmaWxsLXJ1bGU9Im5vbnplcm8iIHN0cm9rZT0iI0Q5RDlEOSI+CiAgICAgIDxwYXRoIGQ9Ik01NSAxMi43Nkw0NC44NTQgMS4yNThDNDQuMzY3LjQ3NCA0My42NTYgMCA0Mi45MDcgMEgyMS4wOTNjLS43NDkgMC0xLjQ2LjQ3NC0xLjk0NyAxLjI1N0w5IDEyLjc2MVYyMmg0NnYtOS4yNHoiLz4KICAgICAgPHBhdGggZD0iTTQxLjYxMyAxNS45MzFjMC0xLjYwNS45OTQtMi45MyAyLjIyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAgMS42MDUgMS4wMDUgMi45MDEgMi4yMzcgMi45MDFoMTQuNzUyYzEuMjMyIDAgMi4yMzctMS4zMDggMi4yMzctMi45MTN2LS4wMDd6IiBmaWxsPSIjRkFGQUZBIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"><div style="padding-top:5px;color:#999;">暂无数据</div></div>'};gridOptions.generatePinnedBottomData=function(){var me=this;var result={};var renderer=false;var columns=gridOptions.columnApi.getAllGridColumns();columns.forEach(function(item){if(item.colDef.calcFooter){renderer=true;result[item.colId]=me.calculatePinnedBottomData(item);}});if(renderer){me.api.setPinnedBottomRowData([result]);}};gridOptions.calculatePinnedBottomData=function(item){var value=0;gridOptions.api.forEachNode(function(row){value+=toNumber(row.data[item.colId]);});return value==0?'':value;};// 格式化行按钮
|
||
gridOptions.actionCellBeforeRender=function(html,action,data){return html;};gridOptions.remoteData=function(params,success){var me=this;var remoteParams=gridOptions.remoteParams;for(var _key3 in params){remoteParams[_key3]=params[_key3];}gridOptions.api.showLoadingOverlay();$.post(gridOptions.remoteDataUrl,remoteParams,function(res){if(typeof success==='function'){success(res);}gridOptions.remoteSuccessed.call(gridOptions,res);if(res.per_page){if(me.pagerDom===null){var div=me.api.gridCore.eGridDiv;var pageId=div.id+'-pager';$(div).after('<div id="'+pageId+'" class="ag-pager"></div>');me.pagerDom=$('#'+pageId).Paging({pagesize:res.per_page,count:res.total,current:res.current_page,pageSizeList:[50,100,500,1000,2000,5000,10000,20000,50000],callback:function callback(page,size,count){me.remoteData2({page:page,limit:size});}});}else{me.pagerDom[0].render({pagesize:res.per_page,count:res.total,current:res.current_page});}}gridOptions.api.hideOverlay();gridOptions.api.setRowData(res.data);gridOptions.generatePinnedBottomData();},'json');};gridOptions.remoteData2=function(params,success){var me=this;var remoteParams=gridOptions.remoteParams;for(var _key4 in params){remoteParams[_key4]=params[_key4];}gridOptions.api.showLoadingOverlay();$.post(gridOptions.remoteDataUrl,remoteParams,function(res){if(typeof success==='function'){success(res);}gridOptions.remoteSuccessed.call(gridOptions,res);gridOptions.api.hideOverlay();gridOptions.api.setRowData(res.data);gridOptions.generatePinnedBottomData();},'json');};return gridOptions;}window.agGridOptions=agGridOptions;})(window,jQuery);/*
|
||
http://www.popub.net/script/pcasunzip.html
|
||
*/var PCAD="北京市$市辖区,东城区,西城区,朝阳区,丰台区,石景山区,海淀区,门头沟区,房山区,通州区,顺义区,昌平区,大兴区,怀柔区,平谷区|市辖县,密云县,延庆县#天津市$市辖区,和平区,河东区,河西区,南开区,河北区,红桥区,东丽区,西青区,津南区,北辰区,武清区,宝坻区,滨海新区|市辖县,宁河县,静海县,蓟县#河北省$石家庄市,市辖区,长安区,桥东区,桥西区,新华区,井陉矿区,裕华区,井陉县,正定县,栾城县,行唐县,灵寿县,高邑县,深泽县,赞皇县,无极县,平山县,元氏县,赵县,辛集市,藁城市,晋州市,新乐市,鹿泉市|唐山市,市辖区,路南区,路北区,古冶区,开平区,丰南区,丰润区,滦县,滦南县,乐亭县,迁西县,玉田县,唐海县,遵化市,迁安市|秦皇岛市,市辖区,海港区,山海关区,北戴河区,青龙满族自治县,昌黎县,抚宁县,卢龙县|邯郸市,市辖区,邯山区,丛台区,复兴区,峰峰矿区,邯郸县,临漳县,成安县,大名县,涉县,磁县,肥乡县,永年县,邱县,鸡泽县,广平县,馆陶县,魏县,曲周县,武安市|邢台市,市辖区,桥东区,桥西区,邢台县,临城县,内丘县,柏乡县,隆尧县,任县,南和县,宁晋县,巨鹿县,新河县,广宗县,平乡县,威县,清河县,临西县,南宫市,沙河市|保定市,市辖区,新市区,北市区,南市区,满城县,清苑县,涞水县,阜平县,徐水县,定兴县,唐县,高阳县,容城县,涞源县,望都县,安新县,易县,曲阳县,蠡县,顺平县,博野县,雄县,涿州市,定州市,安国市,高碑店市|张家口市,市辖区,桥东区,桥西区,宣化区,下花园区,宣化县,张北县,康保县,沽源县,尚义县,蔚县,阳原县,怀安县,万全县,怀来县,涿鹿县,赤城县,崇礼县|承德市,市辖区,双桥区,双滦区,鹰手营子矿区,承德县,兴隆县,平泉县,滦平县,隆化县,丰宁满族自治县,宽城满族自治县,围场满族蒙古族自治县|沧州市,市辖区,新华区,运河区,沧县,青县,东光县,海兴县,盐山县,肃宁县,南皮县,吴桥县,献县,孟村回族自治县,泊头市,任丘市,黄骅市,河间市|廊坊市,市辖区,安次区,广阳区,固安县,永清县,香河县,大城县,文安县,大厂回族自治县,霸州市,三河市|衡水市,市辖区,桃城区,枣强县,武邑县,武强县,饶阳县,安平县,故城县,景县,阜城县,冀州市,深州市#山西省$太原市,市辖区,小店区,迎泽区,杏花岭区,尖草坪区,万柏林区,晋源区,清徐县,阳曲县,娄烦县,古交市|大同市,市辖区,城区,矿区,南郊区,新荣区,阳高县,天镇县,广灵县,灵丘县,浑源县,左云县,大同县|阳泉市,市辖区,城区,矿区,郊区,平定县,盂县|长治市,市辖区,城区,郊区,长治县,襄垣县,屯留县,平顺县,黎城县,壶关县,长子县,武乡县,沁县,沁源县,潞城市|晋城市,市辖区,城区,沁水县,阳城县,陵川县,泽州县,高平市|朔州市,市辖区,朔城区,平鲁区,山阴县,应县,右玉县,怀仁县|晋中市,市辖区,榆次区,榆社县,左权县,和顺县,昔阳县,寿阳县,太谷县,祁县,平遥县,灵石县,介休市|运城市,市辖区,盐湖区,临猗县,万荣县,闻喜县,稷山县,新绛县,绛县,垣曲县,夏县,平陆县,芮城县,永济市,河津市|忻州市,市辖区,忻府区,定襄县,五台县,代县,繁峙县,宁武县,静乐县,神池县,五寨县,岢岚县,河曲县,保德县,偏关县,原平市|临汾市,市辖区,尧都区,曲沃县,翼城县,襄汾县,洪洞县,古县,安泽县,浮山县,吉县,乡宁县,大宁县,隰县,永和县,蒲县,汾西县,侯马市,霍州市|吕梁市,市辖区,离石区,文水县,交城县,兴县,临县,柳林县,石楼县,岚县,方山县,中阳县,交口县,孝义市,汾阳市#内蒙古自治区$呼和浩特市,市辖区,新城区,回民区,玉泉区,赛罕区,土默特左旗,托克托县,和林格尔县,清水河县,武川县|包头市,市辖区,东河区,昆都仑区,青山区,石拐区,白云鄂博矿区,九原区,土默特右旗,固阳县,达尔罕茂明安联合旗|乌海市,市辖区,海勃湾区,海南区,乌达区|赤峰市,市辖区,红山区,元宝山区,松山区,阿鲁科尔沁旗,巴林左旗,巴林右旗,林西县,克什克腾旗,翁牛特旗,喀喇沁旗,宁城县,敖汉旗|通辽市,市辖区,科尔沁区,科尔沁左翼中旗,科尔沁左翼后旗,开鲁县,库伦旗,奈曼旗,扎鲁特旗,霍林郭勒市|鄂尔多斯市,市辖区,东胜区,达拉特旗,准格尔旗,鄂托克前旗,鄂托克旗,杭锦旗,乌审旗,伊金霍洛旗|呼伦贝尔市,市辖区,海拉尔区,阿荣旗,莫力达瓦达斡尔族自治旗,鄂伦春自治旗,鄂温克族自治旗,陈巴尔虎旗,新巴尔虎左旗,新巴尔虎右旗,满洲里市,牙克石市,扎兰屯市,额尔古纳市,根河市|巴彦淖尔市,市辖区,临河区,五原县,磴口县,乌拉特前旗,乌拉特中旗,乌拉特后旗,杭锦后旗|乌兰察布市,市辖区,集宁区,卓资县,化德县,商都县,兴和县,凉城县,察哈尔右翼前旗,察哈尔右翼中旗,察哈尔右翼后旗,四子王旗,丰镇市|兴安盟,乌兰浩特市,阿尔山市,科尔沁右翼前旗,科尔沁右翼中旗,扎赉特旗,突泉县|锡林郭勒盟,二连浩特市,锡林浩特市,阿巴嘎旗,苏尼特左旗,苏尼特右旗,东乌珠穆沁旗,西乌珠穆沁旗,太仆寺旗,镶黄旗,正镶白旗,正蓝旗,多伦县|阿拉善盟,阿拉善左旗,阿拉善右旗,额济纳旗#辽宁省$沈阳市,市辖区,和平区,沈河区,大东区,皇姑区,铁西区,苏家屯区,东陵区,沈北新区,于洪区,辽中县,康平县,法库县,新民市|大连市,市辖区,中山区,西岗区,沙河口区,甘井子区,旅顺口区,金州区,长海县,瓦房店市,普兰店市,庄河市|鞍山市,市辖区,铁东区,铁西区,立山区,千山区,台安县,岫岩满族自治县,海城市|抚顺市,市辖区,新抚区,东洲区,望花区,顺城区,抚顺县,新宾满族自治县,清原满族自治县|本溪市,市辖区,平山区,溪湖区,明山区,南芬区,本溪满族自治县,桓仁满族自治县|丹东市,市辖区,元宝区,振兴区,振安区,宽甸满族自治县,东港市,凤城市|锦州市,市辖区,古塔区,凌河区,太和区,黑山县,义县,凌海市,北镇市|营口市,市辖区,站前区,西市区,鲅鱼圈区,老边区,盖州市,大石桥市|阜新市,市辖区,海州区,新邱区,太平区,清河门区,细河区,阜新蒙古族自治县,彰武县|辽阳市,市辖区,白塔区,文圣区,宏伟区,弓长岭区,太子河区,辽阳县,灯塔市|盘锦市,市辖区,双台子区,兴隆台区,大洼县,盘山县|铁岭市,市辖区,银州区,清河区,铁岭县,西丰县,昌图县,调兵山市,开原市|朝阳市,市辖区,双塔区,龙城区,朝阳县,建平县,喀喇沁左翼蒙古族自治县,北票市,凌源市|葫芦岛市,市辖区,连山区,龙港区,南票区,绥中县,建昌县,兴城市#吉林省$长春市,市辖区,南关区,宽城区,朝阳区,二道区,绿园区,双阳区,农安县,九台市,榆树市,德惠市|吉林市,市辖区,昌邑区,龙潭区,船营区,丰满区,永吉县,蛟河市,桦甸市,舒兰市,磐石市|四平市,市辖区,铁西区,铁东区,梨树县,伊通满族自治县,公主岭市,双辽市|辽源市,市辖区,龙山区,西安区,东丰县,东辽县|通化市,市辖区,东昌区,二道江区,通化县,辉南县,柳河县,梅河口市,集安市|白山市,市辖区,八道江区,江源区,抚松县,靖宇县,长白朝鲜族自治县,临江市|松原市,市辖区,宁江区,前郭尔罗斯蒙古族自治县,长岭县,乾安县,扶余县|白城市,市辖区,洮北区,镇赉县,通榆县,洮南市,大安市|延边朝鲜族自治州,延吉市,图们市,敦化市,珲春市,龙井市,和龙市,汪清县,安图县#黑龙江省$哈尔滨市,市辖区,道里区,南岗区,道外区,平房区,松北区,香坊区,呼兰区,阿城区,依兰县,方正县,宾县,巴彦县,木兰县,通河县,延寿县,双城市,尚志市,五常市|齐齐哈尔市,市辖区,龙沙区,建华区,铁锋区,昂昂溪区,富拉尔基区,碾子山区,梅里斯达斡尔族区,龙江县,依安县,泰来县,甘南县,富裕县,克山县,克东县,拜泉县,讷河市|鸡西市,市辖区,鸡冠区,恒山区,滴道区,梨树区,城子河区,麻山区,鸡东县,虎林市,密山市|鹤岗市,市辖区,向阳区,工农区,南山区,兴安区,东山区,兴山区,萝北县,绥滨县|双鸭山市,市辖区,尖山区,岭东区,四方台区,宝山区,集贤县,友谊县,宝清县,饶河县|大庆市,市辖区,萨尔图区,龙凤区,让胡路区,红岗区,大同区,肇州县,肇源县,林甸县,杜尔伯特蒙古族自治县|伊春市,市辖区,伊春区,南岔区,友好区,西林区,翠峦区,新青区,美溪区,金山屯区,五营区,乌马河区,汤旺河区,带岭区,乌伊岭区,红星区,上甘岭区,嘉荫县,铁力市|佳木斯市,市辖区,向阳区,前进区,东风区,郊区,桦南县,桦川县,汤原县,抚远县,同江市,富锦市|七台河市,市辖区,新兴区,桃山区,茄子河区,勃利县|牡丹江市,市辖区,东安区,阳明区,爱民区,西安区,东宁县,林口县,绥芬河市,海林市,宁安市,穆棱市|黑河市,市辖区,爱辉区,嫩江县,逊克县,孙吴县,北安市,五大连池市|绥化市,市辖区,北林区,望奎县,兰西县,青冈县,庆安县,明水县,绥棱县,安达市,肇东市,海伦市|大兴安岭地区,呼玛县,塔河县,漠河县#上海市$市辖区,黄浦区,徐汇区,长宁区,静安区,普陀区,闸北区,虹口区,杨浦区,闵行区,宝山区,嘉定区,浦东新区,金山区,松江区,青浦区,奉贤区|市辖县,崇明县#江苏省$南京市,市辖区,玄武区,白下区,秦淮区,建邺区,鼓楼区,下关区,浦口区,栖霞区,雨花台区,江宁区,六合区,溧水县,高淳县|无锡市,市辖区,崇安区,南长区,北塘区,锡山区,惠山区,滨湖区,江阴市,宜兴市|徐州市,市辖区,鼓楼区,云龙区,贾汪区,泉山区,铜山区,丰县,沛县,睢宁县,新沂市,邳州市|常州市,市辖区,天宁区,钟楼区,戚墅堰区,新北区,武进区,溧阳市,金坛市|苏州市,市辖区,沧浪区,平江区,金阊区,虎丘区,吴中区,相城区,常熟市,张家港市,昆山市,吴江市,太仓市|南通市,市辖区,崇川区,港闸区,通州区,海安县,如东县,启东市,如皋市,海门市|连云港市,市辖区,连云区,新浦区,海州区,赣榆县,东海县,灌云县,灌南县|淮安市,市辖区,清河区,楚州区,淮阴区,清浦区,涟水县,洪泽县,盱眙县,金湖县|盐城市,市辖区,亭湖区,盐都区,响水县,滨海县,阜宁县,射阳县,建湖县,东台市,大丰市|扬州市,市辖区,广陵区,邗江区,江都区,宝应县,仪征市,高邮市|镇江市,市辖区,京口区,润州区,丹徒区,丹阳市,扬中市,句容市|泰州市,市辖区,海陵区,高港区,兴化市,靖江市,泰兴市,姜堰市|宿迁市,市辖区,宿城区,宿豫区,沭阳县,泗阳县,泗洪县#浙江省$杭州市,市辖区,上城区,下城区,江干区,拱墅区,西湖区,滨江区,萧山区,余杭区,桐庐县,淳安县,建德市,富阳市,临安市|宁波市,市辖区,海曙区,江东区,江北区,北仑区,镇海区,鄞州区,象山县,宁海县,余姚市,慈溪市,奉化市|温州市,市辖区,鹿城区,龙湾区,瓯海区,洞头县,永嘉县,平阳县,苍南县,文成县,泰顺县,瑞安市,乐清市|嘉兴市,市辖区,南湖区,秀洲区,嘉善县,海盐县,海宁市,平湖市,桐乡市|湖州市,市辖区,吴兴区,南浔区,德清县,长兴县,安吉县|绍兴市,市辖区,越城区,绍兴县,新昌县,诸暨市,上虞市,嵊州市|金华市,市辖区,婺城区,金东区,武义县,浦江县,磐安县,兰溪市,义乌市,东阳市,永康市|衢州市,市辖区,柯城区,衢江区,常山县,开化县,龙游县,江山市|舟山市,市辖区,定海区,普陀区,岱山县,嵊泗县|台州市,市辖区,椒江区,黄岩区,路桥区,玉环县,三门县,天台县,仙居县,温岭市,临海市|丽水市,市辖区,莲都区,青田县,缙云县,遂昌县,松阳县,云和县,庆元县,景宁畲族自治县,龙泉市#安徽省$合肥市,市辖区,瑶海区,庐阳区,蜀山区,包河区,长丰县,肥东县,肥西县,庐江县,巢湖市|芜湖市,市辖区,镜湖区,弋江区,鸠江区,三山区,芜湖县,繁昌县,南陵县,无为县|蚌埠市,市辖区,龙子湖区,蚌山区,禹会区,淮上区,怀远县,五河县,固镇县|淮南市,市辖区,大通区,田家庵区,谢家集区,八公山区,潘集区,凤台县|马鞍山市,市辖区,金家庄区,花山区,雨山区,当涂县,含山县,和县|淮北市,市辖区,杜集区,相山区,烈山区,濉溪县|铜陵市,市辖区,铜官山区,狮子山区,郊区,铜陵县|安庆市,市辖区,迎江区,大观区,宜秀区,怀宁县,枞阳县,潜山县,太湖县,宿松县,望江县,岳西县,桐城市|黄山市,市辖区,屯溪区,黄山区,徽州区,歙县,休宁县,黟县,祁门县|滁州市,市辖区,琅琊区,南谯区,来安县,全椒县,定远县,凤阳县,天长市,明光市|阜阳市,市辖区,颍州区,颍东区,颍泉区,临泉县,太和县,阜南县,颍上县,界首市|宿州市,市辖区,埇桥区,砀山县,萧县,灵璧县,泗县|六安市,市辖区,金安区,裕安区,寿县,霍邱县,舒城县,金寨县,霍山县|亳州市,市辖区,谯城区,涡阳县,蒙城县,利辛县|池州市,市辖区,贵池区,东至县,石台县,青阳县|宣城市,市辖区,宣州区,郎溪县,广德县,泾县,绩溪县,旌德县,宁国市#福建省$福州市,市辖区,鼓楼区,台江区,仓山区,马尾区,晋安区,闽侯县,连江县,罗源县,闽清县,永泰县,平潭县,福清市,长乐市|厦门市,市辖区,思明区,海沧区,湖里区,集美区,同安区,翔安区|莆田市,市辖区,城厢区,涵江区,荔城区,秀屿区,仙游县|三明市,市辖区,梅列区,三元区,明溪县,清流县,宁化县,大田县,尤溪县,沙县,将乐县,泰宁县,建宁县,永安市|泉州市,市辖区,鲤城区,丰泽区,洛江区,泉港区,惠安县,安溪县,永春县,德化县,金门县,石狮市,晋江市,南安市|漳州市,市辖区,芗城区,龙文区,云霄县,漳浦县,诏安县,长泰县,东山县,南靖县,平和县,华安县,龙海市|南平市,市辖区,延平区,顺昌县,浦城县,光泽县,松溪县,政和县,邵武市,武夷山市,建瓯市,建阳市|龙岩市,市辖区,新罗区,长汀县,永定县,上杭县,武平县,连城县,漳平市|宁德市,市辖区,蕉城区,霞浦县,古田县,屏南县,寿宁县,周宁县,柘荣县,福安市,福鼎市#江西省$南昌市,市辖区,东湖区,西湖区,青云谱区,湾里区,青山湖区,南昌县,新建县,安义县,进贤县|景德镇市,市辖区,昌江区,珠山区,浮梁县,乐平市|萍乡市,市辖区,安源区,湘东区,莲花县,上栗县,芦溪县|九江市,市辖区,庐山区,浔阳区,九江县,武宁县,修水县,永修县,德安县,星子县,都昌县,湖口县,彭泽县,瑞昌市,共青城市|新余市,市辖区,渝水区,分宜县|鹰潭市,市辖区,月湖区,余江县,贵溪市|赣州市,市辖区,章贡区,赣县,信丰县,大余县,上犹县,崇义县,安远县,龙南县,定南县,全南县,宁都县,于都县,兴国县,会昌县,寻乌县,石城县,瑞金市,南康市|吉安市,市辖区,吉州区,青原区,吉安县,吉水县,峡江县,新干县,永丰县,泰和县,遂川县,万安县,安福县,永新县,井冈山市|宜春市,市辖区,袁州区,奉新县,万载县,上高县,宜丰县,靖安县,铜鼓县,丰城市,樟树市,高安市|抚州市,市辖区,临川区,南城县,黎川县,南丰县,崇仁县,乐安县,宜黄县,金溪县,资溪县,东乡县,广昌县|上饶市,市辖区,信州区,上饶县,广丰县,玉山县,铅山县,横峰县,弋阳县,余干县,鄱阳县,万年县,婺源县,德兴市#山东省$济南市,市辖区,历下区,市中区,槐荫区,天桥区,历城区,长清区,平阴县,济阳县,商河县,章丘市|青岛市,市辖区,市南区,市北区,四方区,黄岛区,崂山区,李沧区,城阳区,胶州市,即墨市,平度市,胶南市,莱西市|淄博市,市辖区,淄川区,张店区,博山区,临淄区,周村区,桓台县,高青县,沂源县|枣庄市,市辖区,市中区,薛城区,峄城区,台儿庄区,山亭区,滕州市|东营市,市辖区,东营区,河口区,垦利县,利津县,广饶县|烟台市,市辖区,芝罘区,福山区,牟平区,莱山区,长岛县,龙口市,莱阳市,莱州市,蓬莱市,招远市,栖霞市,海阳市|潍坊市,市辖区,潍城区,寒亭区,坊子区,奎文区,临朐县,昌乐县,青州市,诸城市,寿光市,安丘市,高密市,昌邑市|济宁市,市辖区,市中区,任城区,微山县,鱼台县,金乡县,嘉祥县,汶上县,泗水县,梁山县,曲阜市,兖州市,邹城市|泰安市,市辖区,泰山区,岱岳区,宁阳县,东平县,新泰市,肥城市|威海市,市辖区,环翠区,文登市,荣成市,乳山市|日照市,市辖区,东港区,岚山区,五莲县,莒县|莱芜市,市辖区,莱城区,钢城区|临沂市,市辖区,兰山区,罗庄区,河东区,沂南县,郯城县,沂水县,苍山县,费县,平邑县,莒南县,蒙阴县,临沭县|德州市,市辖区,德城区,陵县,宁津县,庆云县,临邑县,齐河县,平原县,夏津县,武城县,乐陵市,禹城市|聊城市,市辖区,东昌府区,阳谷县,莘县,茌平县,东阿县,冠县,高唐县,临清市|滨州市,市辖区,滨城区,惠民县,阳信县,无棣县,沾化县,博兴县,邹平县|菏泽市,市辖区,牡丹区,曹县,单县,成武县,巨野县,郓城县,鄄城县,定陶县,东明县#河南省$郑州市,市辖区,中原区,二七区,管城回族区,金水区,上街区,惠济区,中牟县,巩义市,荥阳市,新密市,新郑市,登封市|开封市,市辖区,龙亭区,顺河回族区,鼓楼区,禹王台区,金明区,杞县,通许县,尉氏县,开封县,兰考县|洛阳市,市辖区,老城区,西工区,瀍河回族区,涧西区,吉利区,洛龙区,孟津县,新安县,栾川县,嵩县,汝阳县,宜阳县,洛宁县,伊川县,偃师市|平顶山市,市辖区,新华区,卫东区,石龙区,湛河区,宝丰县,叶县,鲁山县,郏县,舞钢市,汝州市|安阳市,市辖区,文峰区,北关区,殷都区,龙安区,安阳县,汤阴县,滑县,内黄县,林州市|鹤壁市,市辖区,鹤山区,山城区,淇滨区,浚县,淇县|新乡市,市辖区,红旗区,卫滨区,凤泉区,牧野区,新乡县,获嘉县,原阳县,延津县,封丘县,长垣县,卫辉市,辉县市|焦作市,市辖区,解放区,中站区,马村区,山阳区,修武县,博爱县,武陟县,温县,沁阳市,孟州市|濮阳市,市辖区,华龙区,清丰县,南乐县,范县,台前县,濮阳县|许昌市,市辖区,魏都区,许昌县,鄢陵县,襄城县,禹州市,长葛市|漯河市,市辖区,源汇区,郾城区,召陵区,舞阳县,临颍县|三门峡市,市辖区,湖滨区,渑池县,陕县,卢氏县,义马市,灵宝市|南阳市,市辖区,宛城区,卧龙区,南召县,方城县,西峡县,镇平县,内乡县,淅川县,社旗县,唐河县,新野县,桐柏县,邓州市|商丘市,市辖区,梁园区,睢阳区,民权县,睢县,宁陵县,柘城县,虞城县,夏邑县,永城市|信阳市,市辖区,浉河区,平桥区,罗山县,光山县,新县,商城县,固始县,潢川县,淮滨县,息县|周口市,市辖区,川汇区,扶沟县,西华县,商水县,沈丘县,郸城县,淮阳县,太康县,鹿邑县,项城市|驻马店市,市辖区,驿城区,西平县,上蔡县,平舆县,正阳县,确山县,泌阳县,汝南县,遂平县,新蔡县|省直辖县级行政区划,济源市#湖北省$武汉市,市辖区,江岸区,江汉区,硚口区,汉阳区,武昌区,青山区,洪山区,东西湖区,汉南区,蔡甸区,江夏区,黄陂区,新洲区|黄石市,市辖区,黄石港区,西塞山区,下陆区,铁山区,阳新县,大冶市|十堰市,市辖区,茅箭区,张湾区,郧县,郧西县,竹山县,竹溪县,房县,丹江口市|宜昌市,市辖区,西陵区,伍家岗区,点军区,猇亭区,夷陵区,远安县,兴山县,秭归县,长阳土家族自治县,五峰土家族自治县,宜都市,当阳市,枝江市|襄阳市,市辖区,襄城区,樊城区,襄州区,南漳县,谷城县,保康县,老河口市,枣阳市,宜城市|鄂州市,市辖区,梁子湖区,华容区,鄂城区|荆门市,市辖区,东宝区,掇刀区,京山县,沙洋县,钟祥市|孝感市,市辖区,孝南区,孝昌县,大悟县,云梦县,应城市,安陆市,汉川市|荆州市,市辖区,沙市区,荆州区,公安县,监利县,江陵县,石首市,洪湖市,松滋市|黄冈市,市辖区,黄州区,团风县,红安县,罗田县,英山县,浠水县,蕲春县,黄梅县,麻城市,武穴市|咸宁市,市辖区,咸安区,嘉鱼县,通城县,崇阳县,通山县,赤壁市|随州市,市辖区,曾都区,随县,广水市|恩施土家族苗族自治州,恩施市,利川市,建始县,巴东县,宣恩县,咸丰县,来凤县,鹤峰县|省直辖县级行政区划,仙桃市,潜江市,天门市,神农架林区#湖南省$长沙市,市辖区,芙蓉区,天心区,岳麓区,开福区,雨花区,望城区,长沙县,宁乡县,浏阳市|株洲市,市辖区,荷塘区,芦淞区,石峰区,天元区,株洲县,攸县,茶陵县,炎陵县,醴陵市|湘潭市,市辖区,雨湖区,岳塘区,湘潭县,湘乡市,韶山市|衡阳市,市辖区,珠晖区,雁峰区,石鼓区,蒸湘区,南岳区,衡阳县,衡南县,衡山县,衡东县,祁东县,耒阳市,常宁市|邵阳市,市辖区,双清区,大祥区,北塔区,邵东县,新邵县,邵阳县,隆回县,洞口县,绥宁县,新宁县,城步苗族自治县,武冈市|岳阳市,市辖区,岳阳楼区,云溪区,君山区,岳阳县,华容县,湘阴县,平江县,汨罗市,临湘市|常德市,市辖区,武陵区,鼎城区,安乡县,汉寿县,澧县,临澧县,桃源县,石门县,津市市|张家界市,市辖区,永定区,武陵源区,慈利县,桑植县|益阳市,市辖区,资阳区,赫山区,南县,桃江县,安化县,沅江市|郴州市,市辖区,北湖区,苏仙区,桂阳县,宜章县,永兴县,嘉禾县,临武县,汝城县,桂东县,安仁县,资兴市|永州市,市辖区,零陵区,冷水滩区,祁阳县,东安县,双牌县,道县,江永县,宁远县,蓝山县,新田县,江华瑶族自治县|怀化市,市辖区,鹤城区,中方县,沅陵县,辰溪县,溆浦县,会同县,麻阳苗族自治县,新晃侗族自治县,芷江侗族自治县,靖州苗族侗族自治县,通道侗族自治县,洪江市|娄底市,市辖区,娄星区,双峰县,新化县,冷水江市,涟源市|湘西土家族苗族自治州,吉首市,泸溪县,凤凰县,花垣县,保靖县,古丈县,永顺县,龙山县#广东省$广州市,市辖区,荔湾区,越秀区,海珠区,天河区,白云区,黄埔区,番禺区,花都区,南沙区,萝岗区,增城市,从化市|韶关市,市辖区,武江区,浈江区,曲江区,始兴县,仁化县,翁源县,乳源瑶族自治县,新丰县,乐昌市,南雄市|深圳市,市辖区,罗湖区,福田区,南山区,宝安区,龙岗区,盐田区|珠海市,市辖区,香洲区,斗门区,金湾区|汕头市,市辖区,龙湖区,金平区,濠江区,潮阳区,潮南区,澄海区,南澳县|佛山市,市辖区,禅城区,南海区,顺德区,三水区,高明区|江门市,市辖区,蓬江区,江海区,新会区,台山市,开平市,鹤山市,恩平市|湛江市,市辖区,赤坎区,霞山区,坡头区,麻章区,遂溪县,徐闻县,廉江市,雷州市,吴川市|茂名市,市辖区,茂南区,茂港区,电白县,高州市,化州市,信宜市|肇庆市,市辖区,端州区,鼎湖区,广宁县,怀集县,封开县,德庆县,高要市,四会市|惠州市,市辖区,惠城区,惠阳区,博罗县,惠东县,龙门县|梅州市,市辖区,梅江区,梅县,大埔县,丰顺县,五华县,平远县,蕉岭县,兴宁市|汕尾市,市辖区,城区,海丰县,陆河县,陆丰市|河源市,市辖区,源城区,紫金县,龙川县,连平县,和平县,东源县|阳江市,市辖区,江城区,阳西县,阳东县,阳春市|清远市,市辖区,清城区,佛冈县,阳山县,连山壮族瑶族自治县,连南瑶族自治县,清新县,英德市,连州市|东莞市|中山市|潮州市,市辖区,湘桥区,潮安县,饶平县|揭阳市,市辖区,榕城区,揭东县,揭西县,惠来县,普宁市|云浮市,市辖区,云城区,新兴县,郁南县,云安县,罗定市#广西壮族自治区$南宁市,市辖区,兴宁区,青秀区,江南区,西乡塘区,良庆区,邕宁区,武鸣县,隆安县,马山县,上林县,宾阳县,横县|柳州市,市辖区,城中区,鱼峰区,柳南区,柳北区,柳江县,柳城县,鹿寨县,融安县,融水苗族自治县,三江侗族自治县|桂林市,市辖区,秀峰区,叠彩区,象山区,七星区,雁山区,阳朔县,临桂县,灵川县,全州县,兴安县,永福县,灌阳县,龙胜各族自治县,资源县,平乐县,荔蒲县,恭城瑶族自治县|梧州市,市辖区,万秀区,蝶山区,长洲区,苍梧县,藤县,蒙山县,岑溪市|北海市,市辖区,海城区,银海区,铁山港区,合浦县|防城港市,市辖区,港口区,防城区,上思县,东兴市|钦州市,市辖区,钦南区,钦北区,灵山县,浦北县|贵港市,市辖区,港北区,港南区,覃塘区,平南县,桂平市|玉林市,市辖区,玉州区,容县,陆川县,博白县,兴业县,北流市|百色市,市辖区,右江区,田阳县,田东县,平果县,德保县,靖西县,那坡县,凌云县,乐业县,田林县,西林县,隆林各族自治县|贺州市,市辖区,八步区,昭平县,钟山县,富川瑶族自治县|河池市,市辖区,金城江区,南丹县,天峨县,凤山县,东兰县,罗城仫佬族自治县,环江毛南族自治县,巴马瑶族自治县,都安瑶族自治县,大化瑶族自治县,宜州市|来宾市,市辖区,兴宾区,忻城县,象州县,武宣县,金秀瑶族自治县,合山市|崇左市,市辖区,江洲区,扶绥县,宁明县,龙州县,大新县,天等县,凭祥市#海南省$海口市,市辖区,秀英区,龙华区,琼山区,美兰区|三亚市,市辖区|省直辖县级行政区划,五指山市,琼海市,儋州市,文昌市,万宁市,东方市,定安县,屯昌县,澄迈县,临高县,白沙黎族自治县,昌江黎族自治县,乐东黎族自治县,陵水黎族自治县,保亭黎族苗族自治县,琼中黎族苗族自治县,西沙群岛,南沙群岛,中沙群岛的岛礁及其海域#重庆市$市辖区,万州区,涪陵区,渝中区,大渡口区,江北区,沙坪坝区,九龙坡区,南岸区,北碚区,綦江区,大足区,渝北区,巴南区,黔江区,长寿区,江津区,合川区,永川区,南川区|市辖县,潼南县,铜梁县,荣昌县,璧山县,梁平县,城口县,丰都县,垫江县,武隆县,忠县,开县,云阳县,奉节县,巫山县,巫溪县,石柱土家族自治县,秀山土家族苗族自治县,酉阳土家族苗族自治县,彭水苗族土家族自治县#四川省$成都市,市辖区,锦江区,青羊区,金牛区,武侯区,成华区,龙泉驿区,青白江区,新都区,温江区,金堂县,双流县,郫县,大邑县,蒲江县,新津县,都江堰市,彭州市,邛崃市,崇州市|自贡市,市辖区,自流井区,贡井区,大安区,沿滩区,荣县,富顺县|攀枝花市,市辖区,东区,西区,仁和区,米易县,盐边县|泸州市,市辖区,江阳区,纳溪区,龙马潭区,泸县,合江县,叙永县,古蔺县|德阳市,市辖区,旌阳区,中江县,罗江县,广汉市,什邡市,绵竹市|绵阳市,市辖区,涪城区,游仙区,三台县,盐亭县,安县,梓潼县,北川羌族自治县,平武县,江油市|广元市,市辖区,利州区,元坝区,朝天区,旺苍县,青川县,剑阁县,苍溪县|遂宁市,市辖区,船山区,安居区,蓬溪县,射洪县,大英县|内江市,市辖区,市中区,东兴区,威远县,资中县,隆昌县|乐山市,市辖区,市中区,沙湾区,五通桥区,金口河区,犍为县,井研县,夹江县,沐川县,峨边彝族自治县,马边彝族自治县,峨眉山市|南充市,市辖区,顺庆区,高坪区,嘉陵区,南部县,营山县,蓬安县,仪陇县,西充县,阆中市|眉山市,市辖区,东坡区,仁寿县,彭山县,洪雅县,丹棱县,青神县|宜宾市,市辖区,翠屏区,南溪区,宜宾县,江安县,长宁县,高县,珙县,筠连县,兴文县,屏山县|广安市,市辖区,广安区,岳池县,武胜县,邻水县,华蓥市|达州市,市辖区,通川区,达县,宣汉县,开江县,大竹县,渠县,万源市|雅安市,市辖区,雨城区,名山县,荥经县,汉源县,石棉县,天全县,芦山县,宝兴县|巴中市,市辖区,巴州区,通江县,南江县,平昌县|资阳市,市辖区,雁江区,安岳县,乐至县,简阳市|阿坝藏族羌族自治州,汶川县,理县,茂县,松潘县,九寨沟县,金川县,小金县,黑水县,马尔康县,壤塘县,阿坝县,若尔盖县,红原县|甘孜藏族自治州,康定县,泸定县,丹巴县,九龙县,雅江县,道孚县,炉霍县,甘孜县,新龙县,德格县,白玉县,石渠县,色达县,理塘县,巴塘县,乡城县,稻城县,得荣县|凉山彝族自治州,西昌市,木里藏族自治县,盐源县,德昌县,会理县,会东县,宁南县,普格县,布拖县,金阳县,昭觉县,喜德县,冕宁县,越西县,甘洛县,美姑县,雷波县#贵州省$贵阳市,市辖区,南明区,云岩区,花溪区,乌当区,白云区,小河区,开阳县,息烽县,修文县,清镇市|六盘水市,钟山区,六枝特区,水城县,盘县|遵义市,市辖区,红花岗区,汇川区,遵义县,桐梓县,绥阳县,正安县,道真仡佬族苗族自治县,务川仡佬族苗族自治县,凤冈县,湄潭县,余庆县,习水县,赤水市,仁怀市|安顺市,市辖区,西秀区,平坝县,普定县,镇宁布依族苗族自治县,关岭布依族苗族自治县,紫云苗族布依族自治县|毕节市,市辖区,七星关区,大方县,黔西县,金沙县,织金县,纳雍县,威宁彝族回族苗族自治县,赫章县|铜仁市,市辖区,碧江区,万山区,江口县,玉屏侗族自治县,石阡县,思南县,印江土家族苗族自治县,德江县,沿河土家族自治县,松桃苗族自治县|黔西南布依族苗族自治州,兴义市,兴仁县,普安县,晴隆县,贞丰县,望谟县,册亨县,安龙县|黔东南苗族侗族自治州,凯里市,黄平县,施秉县,三穗县,镇远县,岑巩县,天柱县,锦屏县,剑河县,台江县,黎平县,榕江县,从江县,雷山县,麻江县,丹寨县|黔南布依族苗族自治州,都匀市,福泉市,荔波县,贵定县,瓮安县,独山县,平塘县,罗甸县,长顺县,龙里县,惠水县,三都水族自治县#云南省$昆明市,市辖区,五华区,盘龙区,官渡区,西山区,东川区,呈贡区,晋宁县,富民县,宜良县,石林彝族自治县,嵩明县,禄劝彝族苗族自治县,寻甸回族彝族自治县,安宁市|曲靖市,市辖区,麒麟区,马龙县,陆良县,师宗县,罗平县,富源县,会泽县,沾益县,宣威市|玉溪市,市辖区,红塔区,江川县,澄江县,通海县,华宁县,易门县,峨山彝族自治县,新平彝族傣族自治县,元江哈尼族彝族傣族自治县|保山市,市辖区,隆阳区,施甸县,腾冲县,龙陵县,昌宁县|昭通市,市辖区,昭阳区,鲁甸县,巧家县,盐津县,大关县,永善县,绥江县,镇雄县,彝良县,威信县,水富县|丽江市,市辖区,古城区,玉龙纳西族自治县,永胜县,华坪县,宁蒗彝族自治县|普洱市,市辖区,思茅区,宁洱哈尼族彝族自治县,墨江哈尼族自治县,景东彝族自治县,景谷傣族彝族自治县,镇沅彝族哈尼族拉祜族自治县,江城哈尼族彝族自治县,孟连傣族拉祜族佤族自治县,澜沧拉祜族自治县,西盟佤族自治县|临沧市,市辖区,临翔区,凤庆县,云县,永德县,镇康县,双江拉祜族佤族布朗族傣族自治县,耿马傣族佤族自治县,沧源佤族自治县|楚雄彝族自治州,楚雄市,双柏县,牟定县,南华县,姚安县,大姚县,永仁县,元谋县,武定县,禄丰县|红河哈尼族彝族自治州,个旧市,开远市,蒙自市,屏边苗族自治县,建水县,石屏县,弥勒县,泸西县,元阳县,红河县,金平苗族瑶族傣族自治县,绿春县,河口瑶族自治县|文山壮族苗族自治州,文山市,砚山县,西畴县,麻栗坡县,马关县,丘北县,广南县,富宁县|西双版纳傣族自治州,景洪市,勐海县,勐腊县|大理白族自治州,大理市,漾濞彝族自治县,祥云县,宾川县,弥渡县,南涧彝族自治县,巍山彝族回族自治县,永平县,云龙县,洱源县,剑川县,鹤庆县|德宏傣族景颇族自治州,瑞丽市,芒市,梁河县,盈江县,陇川县|怒江傈僳族自治州,泸水县,福贡县,贡山独龙族怒族自治县,兰坪白族普米族自治县|迪庆藏族自治州,香格里拉县,德钦县,维西傈僳族自治县#西藏自治区$拉萨市,市辖区,城关区,林周县,当雄县,尼木县,曲水县,堆龙德庆县,达孜县,墨竹工卡县|昌都地区,昌都县,江达县,贡觉县,类乌齐县,丁青县,察雅县,八宿县,左贡县,芒康县,洛隆县,边坝县|山南地区,乃东县,扎囊县,贡嘎县,桑日县,琼结县,曲松县,措美县,洛扎县,加查县,隆子县,错那县,浪卡子县|日喀则地区,日喀则市,南木林县,江孜县,定日县,萨迦县,拉孜县,昂仁县,谢通门县,白朗县,仁布县,康马县,定结县,仲巴县,亚东县,吉隆县,聂拉木县,萨嘎县,岗巴县|那曲地区,那曲县,嘉黎县,比如县,聂荣县,安多县,申扎县,索县,班戈县,巴青县,尼玛县|阿里地区,普兰县,札达县,噶尔县,日土县,革吉县,改则县,措勤县|林芝地区,林芝县,工布江达县,米林县,墨脱县,波密县,察隅县,朗县#陕西省$西安市,市辖区,新城区,碑林区,莲湖区,灞桥区,未央区,雁塔区,阎良区,临潼区,长安区,蓝田县,周至县,户县,高陵县|铜川市,市辖区,王益区,印台区,耀州区,宜君县|宝鸡市,市辖区,渭滨区,金台区,陈仓区,凤翔县,岐山县,扶风县,眉县,陇县,千阳县,麟游县,凤县,太白县|咸阳市,市辖区,秦都区,杨陵区,渭城区,三原县,泾阳县,乾县,礼泉县,永寿县,彬县,长武县,旬邑县,淳化县,武功县,兴平市|渭南市,市辖区,临渭区,华县,潼关县,大荔县,合阳县,澄城县,蒲城县,白水县,富平县,韩城市,华阴市|延安市,市辖区,宝塔区,延长县,延川县,子长县,安塞县,志丹县,吴起县,甘泉县,富县,洛川县,宜川县,黄龙县,黄陵县|汉中市,市辖区,汉台区,南郑县,城固县,洋县,西乡县,勉县,宁强县,略阳县,镇巴县,留坝县,佛坪县|榆林市,市辖区,榆阳区,神木县,府谷县,横山县,靖边县,定边县,绥德县,米脂县,佳县,吴堡县,清涧县,子洲县|安康市,市辖区,汉滨区,汉阴县,石泉县,宁陕县,紫阳县,岚皋县,平利县,镇坪县,旬阳县,白河县|商洛市,市辖区,商州区,洛南县,丹凤县,商南县,山阳县,镇安县,柞水县#甘肃省$兰州市,市辖区,城关区,七里河区,西固区,安宁区,红古区,永登县,皋兰县,榆中县|嘉峪关市,市辖区|金昌市,市辖区,金川区,永昌县|白银市,市辖区,白银区,平川区,靖远县,会宁县,景泰县|天水市,市辖区,秦州区,麦积区,清水县,秦安县,甘谷县,武山县,张家川回族自治县|武威市,市辖区,凉州区,民勤县,古浪县,天祝藏族自治县|张掖市,市辖区,甘州区,肃南裕固族自治县,民乐县,临泽县,高台县,山丹县|平凉市,市辖区,崆峒区,泾川县,灵台县,崇信县,华亭县,庄浪县,静宁县|酒泉市,市辖区,肃州区,金塔县,瓜州县,肃北蒙古族自治县,阿克塞哈萨克族自治县,玉门市,敦煌市|庆阳市,市辖区,西峰区,庆城县,环县,华池县,合水县,正宁县,宁县,镇原县|定西市,市辖区,安定区,通渭县,陇西县,渭源县,临洮县,漳县,岷县|陇南市,市辖区,武都区,成县,文县,宕昌县,康县,西和县,礼县,徽县,两当县|临夏回族自治州,临夏市,临夏县,康乐县,永靖县,广河县,和政县,东乡族自治县,积石山保安族东乡族撒拉族自治县|甘南藏族自治州,合作市,临潭县,卓尼县,舟曲县,迭部县,玛曲县,碌曲县,夏河县#青海省$西宁市,市辖区,城东区,城中区,城西区,城北区,大通回族土族自治县,湟中县,湟源县|海东地区,平安县,民和回族土族自治县,乐都县,互助土族自治县,化隆回族自治县,循化撒拉族自治县|海北藏族自治州,门源回族自治县,祁连县,海晏县,刚察县|黄南藏族自治州,同仁县,尖扎县,泽库县,河南蒙古族自治县|海南藏族自治州,共和县,同德县,贵德县,兴海县,贵南县|果洛藏族自治州,玛沁县,班玛县,甘德县,达日县,久治县,玛多县|玉树藏族自治州,玉树县,杂多县,称多县,治多县,囊谦县,曲麻莱县|海西蒙古族藏族自治州,格尔木市,德令哈市,乌兰县,都兰县,天峻县#宁夏回族自治区$银川市,市辖区,兴庆区,西夏区,金凤区,永宁县,贺兰县,灵武市|石嘴山市,市辖区,大武口区,惠农区,平罗县|吴忠市,市辖区,利通区,红寺堡区,盐池县,同心县,青铜峡市|固原市,市辖区,原州区,西吉县,隆德县,泾源县,彭阳县|中卫市,市辖区,沙坡头区,中宁县,海原县#新疆维吾尔自治区$乌鲁木齐市,市辖区,天山区,沙依巴克区,新市区,水磨沟区,头屯河区,达坂城区,米东区,乌鲁木齐县|克拉玛依市,市辖区,独山子区,克拉玛依区,白碱滩区,乌尔禾区|吐鲁番地区,吐鲁番市,鄯善县,托克逊县|哈密地区,哈密市,巴里坤哈萨克自治县,伊吾县|昌吉回族自治州,昌吉市,阜康市,呼图壁县,玛纳斯县,奇台县,吉木萨尔县,木垒哈萨克自治县|博尔塔拉蒙古自治州,博乐市,精河县,温泉县|巴音郭楞蒙古自治州,库尔勒市,轮台县,尉犁县,若羌县,且末县,焉耆回族自治县,和静县,和硕县,博湖县|阿克苏地区,阿克苏市,温宿县,库车县,沙雅县,新和县,拜城县,乌什县,阿瓦提县,柯坪县|克孜勒苏柯尔克孜自治州,阿图什市,阿克陶县,阿合奇县,乌恰县|喀什地区,喀什市,疏附县,疏勒县,英吉沙县,泽普县,莎车县,叶城县,麦盖提县,岳普湖县,伽师县,巴楚县,塔什库尔干塔吉克自治县|和田地区,和田市,和田县,墨玉县,皮山县,洛浦县,策勒县,于田县,民丰县|伊犁哈萨克自治州,伊宁市,奎屯市,伊宁县,察布查尔锡伯自治县,霍城县,巩留县,新源县,昭苏县,特克斯县,尼勒克县|塔城地区,塔城市,乌苏市,额敏县,沙湾县,托里县,裕民县,和布克赛尔蒙古自治县|阿勒泰地区,阿勒泰市,布尔津县,富蕴县,福海县,哈巴河县,青河县,吉木乃县|自治区直辖县级行政区划,石河子市,阿拉尔市,图木舒克市,五家渠市#香港特别行政区$香港,香港特别行政区#澳门特别行政区$澳门,澳门特别行政区#台湾省$台北市,中正区,大同区,中山区,松山区,大安区,万华区,信义区,士林区,北投区,内湖区,南港区,文山区|高雄市,新兴区,前金区,芩雅区,盐埕区,鼓山区,旗津区,前镇区,三民区,左营区,楠梓区,小港区|基隆市,仁爱区,信义区,中正区,中山区,安乐区,暖暖区,七堵区|台中市,中区,东区,南区,西区,北区,北屯区,西屯区,南屯区|台南市,中西区,东区,南区,北区,安平区,安南区|新竹市,东区,北区,香山区|嘉义市,东区,西区|县,台北县(板桥市),宜兰县(宜兰市),新竹县(竹北市),桃园县(桃园市),苗栗县(苗栗市),台中县(丰原市),彰化县(彰化市),南投县(南投市),嘉义县(太保市),云林县(斗六市),台南县(新营市),高雄县(凤山市),屏东县(屏东市),台东县(台东市),花莲县(花莲市),澎湖县(马公市)#其它$亚洲,阿富汗,巴林,孟加拉国,不丹,文莱,缅甸,塞浦路斯,印度,印度尼西亚,伊朗,伊拉克,日本,约旦,朝鲜,科威特,老挝,马尔代夫,黎巴嫩,马来西亚,以色列,蒙古,尼泊尔,阿曼,巴基斯坦,巴勒斯坦,菲律宾,沙特阿拉伯,新加坡,斯里兰卡,叙利亚,泰国,柬埔寨,土耳其,阿联酋,越南,也门,韩国,中国,中国香港,中国澳门,中国台湾|非洲,阿尔及利亚,安哥拉,厄里特里亚,法罗群鸟,加那利群岛(西)(拉斯帕尔马斯),贝宁,博茨瓦纳,布基纳法索,布隆迪,喀麦隆,加那利群岛(西)(圣克鲁斯),佛得角,中非,乍得,科摩罗,刚果,吉布提,埃及,埃塞俄比亚,赤道几内亚,加蓬,冈比亚,加纳,几内亚,南非,几内亚比绍,科特迪瓦,肯尼亚,莱索托,利比里亚,利比亚,马达加斯加,马拉维,马里,毛里塔尼亚,毛里求斯,摩洛哥,莫桑比克,尼日尔,尼日利亚,留尼旺岛,卢旺达,塞内加尔,塞舌尔,塞拉利昂,索马里,苏丹,斯威士兰,坦桑尼亚,圣赤勒拿,多哥,突尼斯,乌干达,扎伊尔,赞比亚,津巴布韦,纳米比亚,迪戈加西亚,桑给巴尔,马约特岛,圣多美和普林西比|欧洲,阿尔巴尼亚,安道尔,奥地利,比利时,保加利亚,捷克,丹麦,芬兰,法国,德国,直布罗陀(英),希腊,匈牙利,冰岛,爱尔兰,意大利,列支敦士登,斯洛伐克,卢森堡,马耳他,摩纳哥,荷兰,挪威,波兰,葡萄牙,马其顿,罗马尼亚,南斯拉夫,圣马力诺,西班牙,瑞典,瑞士,英国,科罗地亚,斯洛文尼亚,梵蒂冈,波斯尼亚和塞哥维那,俄罗斯联邦,亚美尼亚共和国,白俄罗斯共和国,格鲁吉亚共和国,哈萨克斯坦共和国,吉尔吉斯坦共和国,乌兹别克斯坦共和国,塔吉克斯坦共和国,土库曼斯坦共和国,乌克兰,立陶宛,拉脱维亚,爱沙尼亚,摩尔多瓦,阿塞拜疆|美洲,安圭拉岛,安提瓜和巴布达,阿根廷,阿鲁巴岛,阿森松,巴哈马,巴巴多斯,伯利兹,百慕大群岛,玻利维亚,巴西,加拿大,开曼群岛,智利,哥伦比亚,多米尼加联邦,哥斯达黎加,古巴,多米尼加共和国,厄瓜多尔,萨尔瓦多,法属圭亚那,格林纳达,危地马拉,圭亚那,海地,洪都拉斯,牙买加,马提尼克(法),墨西哥,蒙特塞拉特岛,荷属安的列斯群岛,尼加拉瓜,巴拿马,巴拉圭,秘鲁,波多黎哥,圣皮埃尔岛密克隆岛(法),圣克里斯托弗和尼维斯,圣卢西亚,福克兰群岛,维尔京群岛(英),圣文森特岛(英),维尔京群岛(美),苏里南,特立尼达和多巴哥,乌拉圭,美国,委内瑞拉,格陵兰岛,特克斯和凯科斯群岛,瓜多罗普|大洋洲,澳大利亚,科克群岛,斐济,法属波里尼西亚、塔希提,瓦努阿图,关岛,基里巴斯,马里亚纳群岛,中途岛,瑙鲁,新咯里多尼亚群岛,新西兰,巴布亚新几内亚,东萨摩亚,西萨摩亚,所罗门群岛,汤加,对诞岛,威克岛,科科斯岛,夏威夷,诺福克岛,帕劳,纽埃岛,图瓦卢,托克鲁,密克罗尼西亚,马绍尔群岛,瓦里斯加富士那群岛";(function(window,undefined){SPT='省份';SCT='城市';SAT='地区';ShowT=1;// 提示文字 0:不显示 1:显示
|
||
if(ShowT)PCAD1=SPT+"$"+SCT+","+SAT+"#"+PCAD;PCAArea=[];PCAP=[];PCAC=[];PCAA=[];PCAN=PCAD1.split("#");for(i=0;i<PCAN.length;i++){PCAA[i]=[];TArea=PCAN[i].split("$")[1].split("|");for(j=0;j<TArea.length;j++){PCAA[i][j]=TArea[j].split(",");if(PCAA[i][j].length==1)PCAA[i][j][1]=SAT;TArea[j]=TArea[j].split(",")[0];}PCAArea[i]=PCAN[i].split("$")[0]+","+TArea.join(",");PCAP[i]=PCAArea[i].split(",")[0];PCAC[i]=PCAArea[i].split(',');}function pcas(){this.SelP=document.getElementById(arguments[0]);this.SelC=document.getElementById(arguments[1]);this.SelA=document.getElementById(arguments[2]);this.DefP=this.SelA?arguments[3]:arguments[2];this.DefC=this.SelA?arguments[4]:arguments[3];this.DefA=this.SelA?arguments[5]:arguments[4];this.SelP.PCA=this;this.SelC.PCA=this;this.SelP.onchange=function(){pcas.SetC(this.PCA);};if(this.SelA){this.SelC.onchange=function(){pcas.SetA(this.PCA);};}pcas.SetP(this);};pcas.SetP=function(PCA){for(i=0;i<PCAP.length;i++){PCAPT=PCAPV=PCAP[i];if(PCAPT==SPT){PCAPV="";}PCA.SelP.options.add(new Option(PCAPT,PCAPV));if(PCA.DefP==PCAPV){PCA.SelP[i].selected=true;}}pcas.SetC(PCA);};pcas.SetC=function(PCA){PI=PCA.SelP.selectedIndex;PCA.SelC.length=0;for(i=1;i<PCAC[PI].length;i++){PCACT=PCACV=PCAC[PI][i];if(PCACT==SCT){PCACV="";}PCA.SelC.options.add(new Option(PCACT,PCACV));if(PCA.DefC==PCACV){PCA.SelC[i-1].selected=true;}}if(PCA.SelA){pcas.SetA(PCA);}};pcas.SetA=function(PCA){PI=PCA.SelP.selectedIndex;CI=PCA.SelC.selectedIndex;PCA.SelA.length=0;for(i=1;i<PCAA[PI][CI].length;i++){PCAAT=PCAAV=PCAA[PI][CI][i];if(PCAAT==SAT){PCAAV="";}PCA.SelA.options.add(new Option(PCAAT,PCAAV));if(PCA.DefA==PCAAV){PCA.SelA[i-1].selected=true;}}};window.pcas=pcas;})(window);/*! art-template@4.13.1 for browser | https://github.com/aui/art-template */!function(e,t){"object"==(typeof exports==="undefined"?"undefined":_typeof2(exports))&&"object"==(typeof module==="undefined"?"undefined":_typeof2(module))?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==(typeof exports==="undefined"?"undefined":_typeof2(exports))?exports.template=t():e.template=t();}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports;}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r});},t.n=function(e){var n=e&&e.__esModule?function(){return e["default"];}:function(){return e;};return t.d(n,"a",n),n;},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t);},t.p="",t(t.s=4);}([function(e,t,n){"use strict";var r=n(6),i=n(2),o=n(22),s=function s(e,t){t.onerror(e,t);var n=function n(){return"{Template Error}";};return n.mappings=[],n.sourcesContent=[],n;},a=function u(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};"string"!=typeof e?t=e:t.source=e,t=i.$extend(t),e=t.source,!0===t.debug&&(t.cache=!1,t.minimize=!1,t.compileDebug=!0),t.compileDebug&&(t.minimize=!1),t.filename&&(t.filename=t.resolveFilename(t.filename,t));var n=t.filename,a=t.cache,c=t.caches;if(a&&n){var l=c.get(n);if(l)return l;}if(!e)try{e=t.loader(n,t),t.source=e;}catch(m){var f=new o({name:"CompileError",path:n,message:"template not found: "+m.message,stack:m.stack});if(t.bail)throw f;return s(f,t);}var p=void 0,h=new r(t);try{p=h.build();}catch(f){if(f=new o(f),t.bail)throw f;return s(f,t);}var d=function d(e,n){try{return p(e,n);}catch(f){if(!t.compileDebug)return t.cache=!1,t.compileDebug=!0,u(t)(e,n);if(f=new o(f),t.bail)throw f;return s(f,t)();}};return d.mappings=p.mappings,d.sourcesContent=p.sourcesContent,d.toString=function(){return p.toString();},a&&n&&c.set(n,d),d;};a.Compiler=r,e.exports=a;},function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g,t.matchToToken=function(e){var t={type:"invalid",value:e[0]};return e[1]?(t.type="string",t.closed=!(!e[3]&&!e[4])):e[5]?t.type="comment":e[6]?(t.type="comment",t.closed=!!e[7]):e[8]?t.type="regex":e[9]?t.type="number":e[10]?t.type="name":e[11]?t.type="punctuator":e[12]&&(t.type="whitespace"),t;};},function(e,t,n){"use strict";function r(){this.$extend=function(e){return e=e||{},o(e,e instanceof r?e:this);};}var i=n(10),o=n(12),s=n(13),a=n(14),u=n(15),c=n(16),l=n(17),f=n(18),p=n(19),h=n(21),d="undefined"==typeof window,m={source:null,filename:null,rules:[f,l],escape:!0,debug:!!d&&"production"!==process.env.NODE_ENV,bail:!0,cache:!0,minimize:!0,compileDebug:!1,resolveFilename:h,include:s,htmlMinifier:p,htmlMinifierOptions:{collapseWhitespace:!0,minifyCSS:!0,minifyJS:!0,ignoreCustomFragments:[]},onerror:a,loader:c,caches:u,root:"/",extname:".art",ignore:[],imports:i};r.prototype=m,e.exports=new r();},function(e,t){},function(e,t,n){"use strict";var r=n(5),i=n(0),o=n(23),s=function s(e,t){return t instanceof Object?r({filename:e},t):i({filename:e,source:t});};s.render=r,s.compile=i,s.defaults=o,e.exports=s;},function(e,t,n){"use strict";var r=n(0),i=function i(e,t,n){return r(e,n)(t);};e.exports=i;},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e;}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++){n[t]=e[t];}return n;}return Array.from(e);}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function");}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r);}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t;};}(),a=n(7),u=n(9),c="$data",l="$imports",f="print",p="include",h="extend",d="block",m="$$out",v="$$line",g="$$blocks",y="$$slice",b="$$from",w="$$options",x=function x(e,t){return Object.hasOwnProperty.call(e,t);},k=JSON.stringify,E=function(){function e(t){var n,s,a=this;o(this,e);var x=t.source,k=t.minimize,E=t.htmlMinifier;if(this.options=t,this.stacks=[],this.context=[],this.scripts=[],this.CONTEXT_MAP={},this.ignore=[c,l,w].concat(i(t.ignore)),this.internal=(n={},r(n,m,"''"),r(n,v,"[0,0]"),r(n,g,"arguments[1]||{}"),r(n,b,"null"),r(n,f,"function(){var s=''.concat.apply('',arguments);"+m+"+=s;return s}"),r(n,p,"function(src,data){var s="+w+".include(src,data||"+c+",arguments[2]||"+g+","+w+");"+m+"+=s;return s}"),r(n,h,"function(from){"+b+"=from}"),r(n,y,"function(c,p,s){p="+m+";"+m+"='';c();s="+m+";"+m+"=p+s;return s}"),r(n,d,"function(){var a=arguments,s;if(typeof a[0]==='function'){return "+y+"(a[0])}else if("+b+"){if(!"+g+"[a[0]]){"+g+"[a[0]]="+y+"(a[1])}else{"+m+"+="+g+"[a[0]]}}else{s="+g+"[a[0]];if(typeof s==='string'){"+m+"+=s}else{s="+y+"(a[1])}return s}}"),n),this.dependencies=(s={},r(s,f,[m]),r(s,p,[m,w,c,g]),r(s,h,[b,p]),r(s,d,[y,b,m,g]),s),this.importContext(m),t.compileDebug&&this.importContext(v),k)try{x=E(x,t);}catch(T){}this.source=x,this.getTplTokens(x,t.rules,this).forEach(function(e){e.type===u.TYPE_STRING?a.parseString(e):a.parseExpression(e);});}return s(e,[{key:"getTplTokens",value:function value(){return u.apply(undefined,arguments);}},{key:"getEsTokens",value:function value(e){return a(e);}},{key:"getVariables",value:function value(e){var t=!1;return e.filter(function(e){return"whitespace"!==e.type&&"comment"!==e.type;}).filter(function(e){return"name"===e.type&&!t||(t="punctuator"===e.type&&"."===e.value,!1);}).map(function(e){return e.value;});}},{key:"importContext",value:function value(e){var t=this,n="",r=this.internal,i=this.dependencies,o=this.ignore,s=this.context,a=this.options,u=a.imports,f=this.CONTEXT_MAP;x(f,e)||-1!==o.indexOf(e)||(x(r,e)?(n=r[e],x(i,e)&&i[e].forEach(function(e){return t.importContext(e);})):n="$escape"===e||"$each"===e||x(u,e)?l+"."+e:c+"."+e,f[e]=n,s.push({name:e,value:n}));}},{key:"parseString",value:function value(e){var t=e.value;if(t){var n=m+"+="+k(t);this.scripts.push({source:t,tplToken:e,code:n});}}},{key:"parseExpression",value:function value(e){var t=this,n=e.value,r=e.script,i=r.output,o=this.options.escape,s=r.code;i&&(s=!1===o||i===u.TYPE_RAW?m+"+="+r.code:m+"+=$escape("+r.code+")");var a=this.getEsTokens(s);this.getVariables(a).forEach(function(e){return t.importContext(e);}),this.scripts.push({source:n,tplToken:e,code:s});}},{key:"checkExpression",value:function value(e){for(var t=[[/^\s*}[\w\W]*?{?[\s;]*$/,""],[/(^[\w\W]*?\([\w\W]*?(?:=>|\([\w\W]*?\))\s*{[\s;]*$)/,"$1})"],[/(^[\w\W]*?\([\w\W]*?\)\s*{[\s;]*$)/,"$1}"]],n=0;n<t.length;){if(t[n][0].test(e)){var r;e=(r=e).replace.apply(r,i(t[n]));break;}n++;}try{return new Function(e),!0;}catch(o){return!1;}}},{key:"build",value:function value(){var e=this.options,t=this.context,n=this.scripts,r=this.stacks,i=this.source,o=e.filename,s=e.imports,a=[],f=x(this.CONTEXT_MAP,h),d=0,y=function y(e,t){var n=t.line,i=t.start,o={generated:{line:r.length+d+1,column:1},original:{line:n+1,column:i+1}};return d+=e.split(/\n/).length-1,o;},E=function E(e){return e.replace(/^[\t ]+|[\t ]$/g,"");};r.push("function("+c+"){"),r.push("'use strict'"),r.push(c+"="+c+"||{}"),r.push("var "+t.map(function(e){return e.name+"="+e.value;}).join(",")),e.compileDebug?(r.push("try{"),n.forEach(function(e){e.tplToken.type===u.TYPE_EXPRESSION&&r.push(v+"=["+[e.tplToken.line,e.tplToken.start].join(",")+"]"),a.push(y(e.code,e.tplToken)),r.push(E(e.code));}),r.push("}catch(error){"),r.push("throw {"+["name:'RuntimeError'","path:"+k(o),"message:error.message","line:"+v+"[0]+1","column:"+v+"[1]+1","source:"+k(i),"stack:error.stack"].join(",")+"}"),r.push("}")):n.forEach(function(e){a.push(y(e.code,e.tplToken)),r.push(E(e.code));}),f&&(r.push(m+"=''"),r.push(p+"("+b+","+c+","+g+")")),r.push("return "+m),r.push("}");var T=r.join("\n");try{var O=new Function(l,w,"return "+T)(s,e);return O.mappings=a,O.sourcesContent=[i],O;}catch(P){for(var $=0,j=0,_=0,S=void 0;$<n.length;){var C=n[$];if(!this.checkExpression(C.code)){j=C.tplToken.line,_=C.tplToken.start,S=C.code;break;}$++;}throw{name:"CompileError",path:o,message:P.message,line:j+1,column:_+1,source:i,generated:S,stack:P.stack};}}}]),e;}();E.CONSTS={DATA:c,IMPORTS:l,PRINT:f,INCLUDE:p,EXTEND:h,BLOCK:d,OPTIONS:w,OUT:m,LINE:v,BLOCKS:g,SLICE:y,FROM:b,ESCAPE:"$escape",EACH:"$each"},e.exports=E;},function(e,t,n){"use strict";var r=n(8),i=n(1)["default"],o=n(1).matchToToken,s=function s(e){return e.match(i).map(function(e){return i.lastIndex=0,o(i.exec(e));}).map(function(e){return"name"===e.type&&r(e.value)&&(e.type="keyword"),e;});};e.exports=s;},function(e,t,n){"use strict";var r={"abstract":!0,"await":!0,"boolean":!0,"break":!0,"byte":!0,"case":!0,"catch":!0,"char":!0,"class":!0,"const":!0,"continue":!0,"debugger":!0,"default":!0,"delete":!0,"do":!0,"double":!0,"else":!0,"enum":!0,"export":!0,"extends":!0,"false":!0,"final":!0,"finally":!0,"float":!0,"for":!0,"function":!0,"goto":!0,"if":!0,"implements":!0,"import":!0,"in":!0,"instanceof":!0,"int":!0,"interface":!0,"let":!0,"long":!0,"native":!0,"new":!0,"null":!0,"package":!0,"private":!0,"protected":!0,"public":!0,"return":!0,"short":!0,"static":!0,"super":!0,"switch":!0,"synchronized":!0,"this":!0,"throw":!0,"transient":!0,"true":!0,"try":!0,"typeof":!0,"var":!0,"void":!0,"volatile":!0,"while":!0,"with":!0,"yield":!0};e.exports=function(e){return r.hasOwnProperty(e);};},function(e,t,n){"use strict";function r(e){var t=new String(e.value);return t.line=e.line,t.start=e.start,t.end=e.end,t;}function i(e,t,n){this.type=e,this.value=t,this.script=null,n?(this.line=n.line+n.value.split(/\n/).length-1,this.line===n.line?this.start=n.end:this.start=n.value.length-n.value.lastIndexOf("\n")-1):(this.line=0,this.start=0),this.end=this.start+this.value.length;}var o=function o(e,t){for(var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},o=[new i("string",e)],s=0;s<t.length;s++){for(var a=t[s],u=a.test.ignoreCase?"ig":"g",c=new RegExp(a.test.source,u),l=0;l<o.length;l++){var f=o[l],p=o[l-1];if("string"===f.type){for(var h=void 0,d=0,m=[],v=f.value;null!==(h=c.exec(v));){h.index>d&&(p=new i("string",v.slice(d,h.index),p),m.push(p)),p=new i("expression",h[0],p),h[0]=r(p),p.script=a.use.apply(n,h),m.push(p),d=h.index+h[0].length;}d<v.length&&(p=new i("string",v.slice(d),p),m.push(p)),o.splice.apply(o,[l,1].concat(m)),l+=m.length-1;}}}return o;};o.TYPE_STRING="string",o.TYPE_EXPRESSION="expression",o.TYPE_RAW="raw",o.TYPE_ESCAPE="escape",e.exports=o;},function(e,t,n){"use strict";(function(t){function n(e){return"string"!=typeof e&&(e=e===undefined||null===e?"":"function"==typeof e?n(e.call(e)):JSON.stringify(e)),e;}function r(e){var t=""+e,n=s.exec(t);if(!n)return e;var r="",i=void 0,o=void 0,a=void 0;for(i=n.index,o=0;i<t.length;i++){switch(t.charCodeAt(i)){case 34:a=""";break;case 38:a="&";break;case 39:a="'";break;case 60:a="<";break;case 62:a=">";break;default:continue;}o!==i&&(r+=t.substring(o,i)),o=i+1,r+=a;}return o!==i?r+t.substring(o,i):r;}/*! art-template@runtime | https://github.com/aui/art-template */var i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},o=Object.create(i),s=/["&'<>]/;o.$escape=function(e){return r(n(e));},o.$each=function(e,t){if(Array.isArray(e))for(var n=0,r=e.length;n<r;n++){t(e[n],n);}else for(var i in e){t(e[i],i);}},e.exports=o;}).call(t,n(11));},function(e,t){var n;n=function(){return this;}();try{n=n||Function("return this")()||(0,eval)("this");}catch(r){"object"==(typeof window==="undefined"?"undefined":_typeof2(window))&&(n=window);}e.exports=n;},function(e,t,n){"use strict";var r=Object.prototype.toString,i=function i(e){return null===e?"Null":r.call(e).slice(8,-1);},o=function s(e,t){var n=void 0,r=i(e);if("Object"===r?n=Object.create(t||{}):"Array"===r&&(n=[].concat(t||[])),n){for(var o in e){Object.hasOwnProperty.call(e,o)&&(n[o]=s(e[o],n[o]));}return n;}return e;};e.exports=o;},function(e,t,n){"use strict";var r=function r(e,t,_r,i){var o=n(0);return i=i.$extend({filename:i.resolveFilename(e,i),bail:!0,source:null}),o(i)(t,_r);};e.exports=r;},function(e,t,n){"use strict";var r=function r(e){console.error(e.name,e.message);};e.exports=r;},function(e,t,n){"use strict";var r={__data:Object.create(null),set:function set(e,t){this.__data[e]=t;},get:function get(e){return this.__data[e];},reset:function reset(){this.__data={};}};e.exports=r;},function(e,t,n){"use strict";var r="undefined"==typeof window,i=function i(e){if(r){return n(3).readFileSync(e,"utf8");}var t=document.getElementById(e);return t.value||t.innerHTML;};e.exports=i;},function(e,t,n){"use strict";var r={test:/{{([@#]?)[ \t]*(\/?)([\w\W]*?)[ \t]*}}/,use:function use(e,t,n,i){var o=this,s=o.options,a=o.getEsTokens(i),u=a.map(function(e){return e.value;}),c={},l=void 0,f=!!t&&"raw",p=n+u.shift(),h=function h(t,n){console.warn((s.filename||"anonymous")+":"+(e.line+1)+":"+(e.start+1)+"\nTemplate upgrade: {{"+t+"}} -> {{"+n+"}}");};switch("#"===t&&h("#value","@value"),p){case"set":i="var "+u.join("").trim();break;case"if":i="if("+u.join("").trim()+"){";break;case"else":var d=u.indexOf("if");~d?(u.splice(0,d+1),i="}else if("+u.join("").trim()+"){"):i="}else{";break;case"/if":i="}";break;case"each":l=r._split(a),l.shift(),"as"===l[1]&&(h("each object as value index","each object value index"),l.splice(1,1));i="$each("+(l[0]||"$data")+",function("+(l[1]||"$value")+","+(l[2]||"$index")+"){";break;case"/each":i="})";break;case"block":l=r._split(a),l.shift(),i="block("+l.join(",").trim()+",function(){";break;case"/block":i="})";break;case"echo":p="print",h("echo value","value");case"print":case"include":case"extend":if(0!==u.join("").trim().indexOf("(")){l=r._split(a),l.shift(),i=p+"("+l.join(",")+")";break;}default:if(~u.indexOf("|")){var m=a.reduce(function(e,t){var n=t.value,r=t.type;return"|"===n?e.push([]):"whitespace"!==r&&"comment"!==r&&(e.length||e.push([]),":"===n&&1===e[e.length-1].length?h("value | filter: argv","value | filter argv"):e[e.length-1].push(t)),e;},[]).map(function(e){return r._split(e);});i=m.reduce(function(e,t){var n=t.shift();return t.unshift(e),"$imports."+n+"("+t.join(",")+")";},m.shift().join(" ").trim());}f=f||"escape";}return c.code=i,c.output=f,c;},_split:function _split(e){e=e.filter(function(e){var t=e.type;return"whitespace"!==t&&"comment"!==t;});for(var t=0,n=e.shift(),r=/\]|\)/,i=[[n]];t<e.length;){var o=e[t];"punctuator"===o.type||"punctuator"===n.type&&!r.test(n.value)?i[i.length-1].push(o):i.push([o]),n=o,t++;}return i.map(function(e){return e.map(function(e){return e.value;}).join("");});}};e.exports=r;},function(e,t,n){"use strict";var r={test:/<%(#?)((?:==|=#|[=-])?)[ \t]*([\w\W]*?)[ \t]*(-?)%>/,use:function use(e,t,n,r){return n={"-":"raw","=":"escape","":!1,"==":"raw","=#":"raw"}[n],t&&(r="/*"+r+"*/",n=!1),{code:r,output:n};}};e.exports=r;},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++){n[t]=e[t];}return n;}return Array.from(e);}var i="undefined"==typeof window,o=function o(e,t){if(i){var o,s=n(20).minify,a=t.htmlMinifierOptions,u=t.rules.map(function(e){return e.test;});(o=a.ignoreCustomFragments).push.apply(o,r(u)),e=s(e,a);}return e;};e.exports=o;},function(e,t){!function(e){e.noop=function(){};}("object"==_typeof2(e)&&"object"==_typeof2(e.exports)?e.exports:window);},function(e,t,n){"use strict";var r="undefined"==typeof window,i=/^\.+\//,o=function o(e,t){if(r){var o=n(3),s=t.root,a=t.extname;if(i.test(e)){var u=t.filename,c=!u||e===u,l=c?s:o.dirname(u);e=o.resolve(l,e);}else e=o.resolve(s,e);o.extname(e)||(e+=a);}return e;};e.exports=o;},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function");}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=_typeof2(t)&&"function"!=typeof t?e:t;}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+_typeof2(t));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t);}function s(e){var t=e.name,n=e.source,r=e.path,i=e.line,o=e.column,s=e.generated,a=e.message;if(!n)return a;var u=n.split(/\n/),c=Math.max(i-3,0),l=Math.min(u.length,i+3),f=u.slice(c,l).map(function(e,t){var n=t+c+1;return(n===i?" >> ":" ")+n+"| "+e;}).join("\n");return(r||"anonymous")+":"+i+":"+o+"\n"+f+"\n\n"+t+": "+a+(s?"\n generated: "+s:"");}var a=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e.message));return n.name="TemplateError",n.message=s(e),Error.captureStackTrace&&Error.captureStackTrace(n,n.constructor),n;}return o(t,e),t;}(Error);e.exports=a;},function(e,t,n){"use strict";e.exports=n(2);}]);});(function($){var GdooEvent=function GdooEvent(args){var me=this;me.args=args;me.trigger=function(fun){if(typeof me.args[fun]=='function'){var args=[];for(var i=1;i<arguments.length;i++){args.push(arguments[i]);}return me.args[fun].apply(me,args);}};me.exist=function(fun){if(typeof me.args[fun]=='function'){return true;}return false;};};var gdoo={formKey:function formKey(params){if(params.form_id){var key=params.form_id+'.'+params.id;var id=params.form_id+'_'+params.id;var name=params.form_id+'_'+params.name;}else{var key=params.id;var id=params.id;var name=params.name;}return{id:id,key:key,name:name};},widgets:{},forms:{},dialogs:{},grids:{},event:{events:{},set:function set(tag,fun){this.events[tag]=new GdooEvent(fun);},get:function get(tag){return this.events[tag]||new GdooEvent({});}}};gdoo.grid=function(table){var root=this;this.table=table;this.grid=new agGridOptions();this.header=Vue.reactive({init:false,name:'',master_table:'',access:{},create_btn:false,trash_btn:false,simple_search_form:true,right_buttons:[],left_buttons:[],buttons:[],tabs:{items:[],active:''},search_form:{columns:[]},by_title:'全部',bys:{items:[]}});this.search={simple:{el:null,query:{}},advanced:{el:null,query:{}}};this.action=new gridAction();// 默认不自动计算栏目宽度
|
||
this.grid.autoColumnsToFit=false;// 默认点击行触发
|
||
this.grid.onRowDoubleClicked=function(params){if(params.node.rowPinned){return;}if(params.data==undefined){return;}if(params.data.master_id>0){if(root.action.rowDoubleClick){root.action.rowDoubleClick(params.data);}}};this.div=function(height){var gridDiv=document.querySelector("#"+this.table+"-grid");// 因为panel高度根据页面原素高度不一致,这里设置修正值
|
||
gridDiv.style.height=this.getPanelHeight(height);new agGrid.Grid(gridDiv,this.grid);// 绑定自定义事件
|
||
$(gridDiv).on('click','[data-toggle="event"]',function(){var data=$(this).data();if(data.master_id>0){root.action[data.action](data);}});return gridDiv;};/**
|
||
* 获取panel计算整体窗口高度
|
||
*/this.getPanelHeight=function(v){var list=$('.gdoo-list-grid').position();var position=list.top+v+'px';return'calc(100vh - '+position+')';};this.init=function(res){var me=this;if(me.header.init==false){var header=res.header;me.header.init=true;me.header.create_btn=header.create_btn;me.header.trash_btn=header.trash_btn;me.header.name=header.name;me.header.table=table;// 搜索
|
||
var search_form=header.search_form;search_form.simple_search=header.simple_search_form;me.header.search_form=search_form;me.search.forms=search_form.forms;// 操作
|
||
me.action.table=table;me.action.name=header.master_name;me.action.bill_url=header.bill_uri;// access
|
||
if(header.access){me.header.access=header.access;}// 按钮
|
||
if(header.right_buttons){me.header.right_buttons=header.right_buttons;}if(header.left_buttons){me.header.left_buttons=header.left_buttons;}if(header.buttons){me.header.center_buttons=header.buttons;}// bys
|
||
if(header.bys){me.header.bys=header.bys;}// tabs
|
||
if(header.tabs){me.header.tabs=header.tabs;me.header.tabs.active=search_form.params['tab']?search_form.params['tab']:header.tabs.items[0].value;}// 设置栏目
|
||
me.grid.api.setColumnDefs(header.columns);me.grid.columnDefs=header.columns;me.grid.remoteParams=search_form.query;// 渲染完成显示div
|
||
$('#'+table+'-page').show();setTimeout(function(){me.searchForm();},1);}};this.searchForm=function(){var me=this;me.search.advanced.el=$('#'+me.table+'-search-form-advanced').searchForm({data:me.search.forms,advanced:true});me.search.simple.el=$('#'+me.table+'-search-form').searchForm({data:me.search.forms});me.search.simple.el.find('#search-submit').on('click',function(){var query=me.search.simple.el.serializeArray();var params={};me.search.queryType='simple';$.map(query,function(row){params[row.name]=row.value;});params['page']=1;me.grid.remoteData(params);return false;});};this.setup={header:this.header,action:this.action,grid:this.grid};gdoo.grids[table]={grid:this.grid,search:this.search};};window.gdoo=gdoo;})(jQuery);var select2List={};(function($){$.fn.select2Field=function(options){$this=$(this);var key=$this.attr('key');var event=gdoo.event.get(key);var defaults={width:'100%',placeholder:' - ',allowClear:true,minimumInputLength:0,// 不需要每次都获取数据
|
||
resultCache:true,ajax:{type:'POST',url:'',dataType:'json',delay:250,cache:false,data:function data(params){var query=options.ajaxParams||{};query.q=params.term||'';query.page=params.page||1;query.resultCache=true;event.trigger('query',query);return query;},processResults:function processResults(res,params){return{results:res.data,pagination:{more:res.current_page<res.last_page}};}},escapeMarkup:function escapeMarkup(markup){return markup;},templateResult:function templateResult(m){return m.text;},// 函数用来渲染结果
|
||
templateSelection:function templateSelection(m){return m.text;},createTag:function createTag(params){var term=$.trim(params.term);if(term===''){return null;}return{id:'draft_'+term,text:term};},initSelection:function initSelection(element,callback){var data={id:element.val(),text:element.text()};callback(data);}};options=$.extend(true,{},defaults,options);event.trigger('init',options);var select2=$this.select2(options);select2.on('select2:select',function(e){event.trigger('onSelect',e.params.data);});select2.on('select2:opening',function(){});select2.on('select2:open',function(){//select2.select2();
|
||
/*
|
||
var data = $(this).data('select2');
|
||
$('.select2-link').remove();
|
||
data.$results.parents('.select2-results')
|
||
.append('<div class="select2-link"><a> <i class="fa fa-plus-square"></i> 更多</a></div>')
|
||
.on('click', function () {
|
||
data.trigger('close');
|
||
});
|
||
*/});return select2;};})(jQuery);(function($){'use strict';var grid=null;/**
|
||
* 默认的配置选项
|
||
* @type {Object}
|
||
*/var defaultOptions={query:{},item:{},data:[],delay:300,showBtn:true,clearable:false,keyLeft:37,keyUp:38,keyRight:39,keyDown:40,keyEnter:13};/**
|
||
* 显示下拉列表
|
||
*/function showSuggest($input,options){var $dropdownMenu=$('#gdoo-suggest');if(!$dropdownMenu.is(':visible')){$dropdownMenu.show();$input.trigger('onShowSuggest',[options?options.data:[]]);}}/**
|
||
* 隐藏下拉列表
|
||
*/function hideSuggest($input,options){var $dropdownMenu=$('#gdoo-suggest');if($dropdownMenu.is(':visible')){$dropdownMenu.hide();$input.trigger('onHideSuggest',[options?options.data:[]]);}}/**
|
||
* 刷新数据
|
||
* ajax请求携带q参数
|
||
*/function refreshData($input,options,params){showSuggest($input,options);var event=gdoo.event.get(params.form_id+'.'+params.id);event.trigger('open',params);event.trigger('query',params);params.suggest=true;params.q=$input.val();grid.rowSelection=params.multi==1?'multiple':'single';grid.remoteDataUrl=app.url(params.url);grid.remoteParams=params;// 读取数据
|
||
grid.remoteData();return $input;}/**
|
||
* 构建 Suggest的agGrid
|
||
* 作为 fnGetData 的 callback 函数调用
|
||
*/function buildSuggest($input,options,params){var $dropdownMenu=$('#gdoo-suggest');$dropdownMenu.html('<div style="height:180px;overflow:auto;width:auto;"><div id="suggest-aggrid" class="ag-theme-balham" style="width:100%;height:180px;border-left:1px solid #BDC3C7;border-right:1px solid #BDC3C7;"></div></div>');var gridDiv=document.querySelector("#suggest-aggrid");grid=new agGridOptions();grid.suppressRowClickSelection=true;grid.columnDefs=[//{suppressMenu: true, cellClass:'text-center', checkboxSelection: true, headerCheckboxSelection: multiple, suppressSizeToFit: true, sortable: false, width: 40},
|
||
//{suppressMenu: true, cellClass:'text-center', sortable: false, suppressSizeToFit: true, cellRenderer: 'htmlCellRenderer', field: 'images', headerName: '图片', width: 40},
|
||
{suppressMenu:true,cellClass:'text-center',sortable:true,field:'code',headerName:'存货编码',width:100},{suppressMenu:true,cellClass:'text-left',sortable:true,field:'name',headerName:'产品名称',minWidth:140},{suppressMenu:true,cellClass:'text-center',sortable:true,field:'spec',headerName:'规格型号',width:100},{suppressMenu:true,cellClass:'text-center',sortable:true,field:'barcode',headerName:'产品条码',width:120},{suppressMenu:true,cellClass:'text-center',sortable:true,field:'unit_id_name',headerName:'计量单位',width:80},{suppressMenu:true,cellClass:'text-right',field:'price',headerName:'价格',width:80}];grid.onRowClicked=function(row){var ret=grid.writeSelected([row.data]);if(ret){hideSuggest($input,options);}};/**
|
||
* 写入选中
|
||
*/grid.writeSelected=function(rows){var params=grid.remoteParams;var sid=params.prefix==1?'sid':'id';var id=[];var text=[];$.each(rows,function(index,row){id.push(row[sid]);text.push(row.name);});var input_id=params.form_id+'_'+params.id;$('#'+input_id).val(id.join(','));$('#'+input_id+'_text').val(text.join(','));var event=gdoo.event.get(params.form_id+'.'+params.id);if(event.exist('onSelect')){return event.trigger('onSelect',grid.rowSelection=='multiple'?rows:rows[0]);}return true;};new agGrid.Grid(gridDiv,grid);return $input;}$.fn.gdooDialogInput=function(options){var self=this;options=options||{};options=$.extend(true,{},defaultOptions,options);$('body').append('<div class="gdoo-gird-suggest" id="gdoo-suggest" style="position:absolute;display:none;box-shadow:0 2px 5px 0 rgb(0 0 0 / 26%);"></div>');return self.each(function(){var $input=$(this);var params=$input.data();var keyupTimer=null;var isMouseenter=0;var $dropdownMenu=$('#gdoo-suggest');buildSuggest($input,options,params);$input.off();// 开始事件处理
|
||
$input.on('keydown',function(event){// 当提示层显示时才对键盘事件处理
|
||
if(!$dropdownMenu.is(':visible')){return;}if(event.keyCode===options.keyEnter){hideSuggest($input,options);}}).on('keyup input paste',function(event){// 如果弹起的键是回车、向上或向下方向键则返回
|
||
if(~$.inArray(event.keyCode,[options.keyDown,options.keyUp,options.keyEnter])){$input.val($input.val());// 让鼠标输入跳到最后
|
||
return;}clearTimeout(keyupTimer);keyupTimer=setTimeout(function(){refreshData($input,options,params);},options.delay);}).on('focus',function(){$dropdownMenu.off();var w=$(window).width();var h=$(window).height();var width=$input.outerWidth();var height=$input.outerHeight();var offset=$input.offset();var dw=$dropdownMenu.outerWidth();var dh=$dropdownMenu.outerHeight();var css={top:offset.top+height-1};// 判断是否小于768
|
||
if(w<768){css.minWidth=360;css.left=14;css.right=14;}else{css.left=offset.left;// 右边超出
|
||
if(w<offset.left+dw+10){css.left=offset.left-dw+width;}// 下边超出
|
||
if(h<offset.top+dh+10){css.top=offset.top-dh+1;}}$dropdownMenu.css(css);// 列表中滑动时,输入框失去焦点
|
||
$dropdownMenu.on('mouseenter',function(){isMouseenter=1;$input.blur();}).on('mouseleave',function(){isMouseenter=0;$input.focus();}).on('click',function(){// 阻止冒泡
|
||
return false;});}).on('blur',function(){// 隐藏对话框
|
||
if(!isMouseenter){hideSuggest($input,options);}});});};})(jQuery);(function($){'use strict';$.fn.searchForm=function(options){var self=this;var element=[];var data=options.data;var advanced=options.advanced==1?1:data.advanced==1?1:0;var form_id=self.attr('id');var assign=false;var values={};var _field='search-field-';var _condition='search-condition-';var _value='search-value-';if(advanced){_field='advanced-'+_field;_condition='advanced-'+_condition;_value='advanced-'+_value;}function init(){if(advanced){$.each(data.field,function(i){var type=self.find('#'+_field+i).data('type');setValues(type,i,data.option[i]);});}else{var e=self.find('#'+_field+'0');e.val(data['field'][0]);var type=e.find('option:selected').data('type');setValues(type,0,data.option[0]);e.on('change',function(){assign=true;var index=this.selectedIndex-1;var type=$(this).find('option:selected').data('type');element[0].value.empty();setValues(type,0,data.option[index]);});}}function setValues(type,i,config){self.find('#'+_value+i);element[i]={condition:self.find('#'+_condition+i),value:self.find('#'+_value+i)};setCondition(i,type,data['condition'][i]||'');handle[type].call(self,i,config);}function setCondition(i,type,selected){var e=element[i].condition.empty();var condition={};if(assign==true){selected='';}condition.number=[{key:"eq",value:'等于'},{key:"neq",value:'不等于'},{key:"gt",value:'大于'},{key:"lt",value:'小于'}];condition.date=[{key:"eq",value:'等于'},{key:"neq",value:'不等于'},{key:"gt",value:'大于'},{key:"lt",value:'小于'}];condition.second=[{key:"eq",value:'等于'},{key:"neq",value:'不等于'},{key:"gt",value:'大于'},{key:"lt",value:'小于'}];condition.text=[{key:"like",value:'包含'},{key:"not_like",value:'不包含'},{key:"eq",value:'等于'},{key:"neq",value:'不等于'},{key:"gt",value:'大于'},{key:"lt",value:'小于'},{key:"empty",value:'为空'},{key:"not_empty",value:'不为空'}];if(type=='second'||type=='text'||type=='number'||type=='date'){var value=selected||condition[type][0].key;$.map(condition[type],function(row){e.append('<option value="'+row.key+'">'+row.value+'</option>');});e.parent('div').css("display","inline-block");}else if(type=='birthday'){e.append('<option value="birthday">birthday</option>');e.parent('div').hide();var value='birthday';}else if(type=='date2'){e.append('<option value="date2">date2</option>');e.parent('div').hide();var value='date2';}else if(type=='region'){e.append('<option value="region">region</option>');e.parent('div').hide();var value='region';}else if(type=='second2'){e.append('<option value="second2">second2</option>');e.parent('div').hide();var value='second2';}else if(type=='dialog'){e.append('<option value="dialog">dialog</option>');e.parent('div').hide();var value='dialog';}else{e.append('<option value="eq">eq</option>');e.parent('div').hide();var value='eq';}e.val(value);toggleValue(i,value);e.on('change',function(){toggleValue(i,$(this).val());});}function toggleValue(i,value){var e=element[i].value;if(value=='empty'||value=='not_empty'){e.hide();}else{e.show();}}function attr(i,id){var value=_value;var name='search';var res={};var id_0='';var id_1='';if(id!=undefined){id_0='-'+id;id_1='_'+id;}res.id=form_id+'_'+value+i+id_0;res.name=name+'_'+i+id_1;if(assign==false){if(id_0){var v1=data['search'][i][id];res.value=v1==undefined?'':v1;}else{var v1=data['search'][i];res.value=v1==undefined?'':v1;}}else{res.value='';}return res;}function _option(rows){var type=$.type(rows);var option=advanced==true?'<option value=""> - </option>':'';if(type=='array'||type=='object'){$.map(rows,function(row){option+='<option value="'+row.id+'">'+row.name+'</option>';});}else{option=option.concat(rows);}return option;}self._select=function(config,i,id,space){var a=attr(i,id);var d=_option(config);var e=$('<select name="'+a.name+'" id="'+a.id+'" class="form-control input-sm">'+d+'</select>');element[i].value.append(e);if(a.value!==''){e.val(a.value);}};self._text=function(i,id,space){var a=attr(i,id);var e=$('<input name="'+a.name+'" id="'+a.id+'" value="'+a.value+'" type="text" class="form-control input-sm">');element[i].value.append(e);};self._year=function(i,id,space){var a=attr(i,id);var e=$('<input name="'+a.name+'" id="'+a.id+'" value="'+a.value+'" type="text" autocomplete="off" data-toggle="date" data-format="yyyy" class="form-control input-sm">');element[i].value.append(e);};self._date=function(i,id,space){var a=attr(i,id);var e=$('<input name="'+a.name+'" id="'+a.id+'" value="'+a.value+'" type="text" autocomplete="off" data-toggle="date" class="form-control input-sm">');element[i].value.append(e);};self._date2=function(i,id,space){var a0=attr(i,0);var a1=attr(i,1);var e=$('<table class="table date-field"><tr><td><input name="'+a0.name+'" id="'+a0.id+'" value="'+a0.value+'" type="text" data-toggle="date" autocomplete="off" class="form-control input-sm"></td><td class="date-apart"> - </td><td><input name="'+a1.name+'" id="'+a1.id+'" value="'+a1.value+'" type="text" autocomplete="off" data-toggle="date" class="form-control input-sm"></td></tr></table>');element[i].value.append(e);};self._second2=function(i,id,space){var a0=attr(i,0);var a1=attr(i,1);var e=$('<table class="table date-field"><tr><td><input name="'+a0.name+'" id="'+a0.id+'" value="'+a0.value+'" type="text" autocomplete="off" data-toggle="date" class="form-control input-sm"></td><td class="date-apart"> - </td><td><input name="'+a1.name+'" id="'+a1.id+'" value="'+a1.value+'" type="text" autocomplete="off" data-toggle="date" class="form-control input-sm"></td></tr></table>');element[i].value.append(e);};self._birthday=function(i,id,space){var a0=attr(i,0);var a1=attr(i,1);var e=$('<input name="'+a0.name+'" id="'+a0.id+'" value="'+a0.value+'" type="text" data-toggle="date" autocomplete="off" data-format="MM-dd" class="form-control input-sm"> - <input name="'+a1.name+'" id="'+a1.id+'" value="'+a1.value+'" type="text" data-toggle="date" autocomplete="off" data-format="MM-dd" class="form-control input-sm">');element[i].value.append(e);};self._birthday2=function(i,id,space){var a0=attr(i,0);var a1=attr(i,1);var e=$('<input name="'+a0.name+'" id="'+a0.id+'" value="'+a0.value+'" type="text" data-toggle="date" autocomplete="off" data-format="MM-dd" class="form-control input-sm"> - <input name="'+a1.name+'" id="'+a1.id+'" value="'+a1.value+'" type="text" data-toggle="date" autocomplete="off" data-format="MM-dd" class="form-control input-sm">');element[i].value.append(e);};self._dialog=function(config,i,id,space){var a0=attr(i,id);var query=[];if(config.query){config.query['multi']=config.query['multi']=='undefined'?1:config.query['multi'];$.each(config.query,function(k,v){query.push('data-'+k+'="'+v+'"');});}if(advanced){var field=self.find('#'+_field+i);}else{var field=self.find('#'+_field+'0').find('option:selected');}var options=field.data();var e='<div class="select-group input-group">';e+='<input class="form-control input-sm" data-toggle="dialog-view" readonly="readonly" data-title="'+options.title+'" data-url="'+config.url+'" data-id="'+a0.id+'" '+query.join(' ')+' style="min-width:153px;cursor:pointer;" id="'+a0.id+'_text" />';e+='<input type="hidden" id="'+a0.id+'" name="'+a0.name+'" value="'+a0.value+'">';e+='<div class="input-group-btn">';e+='<a data-toggle="dialog-clear" data-id="'+a0.id+'" class="btn btn-sm btn-default"><i class="fa fa-times"></i></a>';e+='</div>';element[i].value.append($(e));};var handle={empty:function empty(i){element[i].value.empty();},text:function text(i){self._text(i);},select2:function select2(i){self._text(i);},select:function select(i,config){self._select(config,i);},number:function number(i){self._text(i);},year:function year(i){self._year(i);},date:function date(i){self._date(i);},date2:function date2(i){self._date2(i);},birthday:function birthday(i){self._birthday(i);},dialog:function dialog(i,config){self._dialog(config,i);},second:function second(i){self._date(i);},second2:function second2(i){self._second2(i);},option:function option(i,config){self._select(config,i);},address:function address(i){var province=attr(i,0);var city=attr(i,1);var e='<select name="'+province.name+'" id="'+province.id+'" class="form-control input-sm"></select> <select name="'+city.name+'" id="'+city.id+'" class="form-control input-sm"></select>';element[i].value.append(e);new pcas(province.id,city.id,province.value,city.value);},region:function region(i){var province=attr(i,0);var city=attr(i,1);var county=attr(i,2);var province_id=province.value;var city_id=city.value;var county_id=county.value;element[i].value.append('<select name="'+province.name+'" id="'+province.id+'" class="form-control input-sm"></select> <select name="'+city.name+'" id="'+city.id+'" class="form-control input-sm"></select> <select name="'+county.name+'" id="'+county.id+'" class="form-control input-sm"></select>');$.get(app.url('index/api/region',{layer:1}),function(res){var option='';$.map(res,function(row){option+='<option value="'+row.id+'">'+row.name+'</option>';});var e=$('#'+province.id).html(option);if(province_id){e.val(province_id);}_city(i);_county(i);self.on('change','#'+province.id,function(){province_id=this.value;city_id=0;county_id=0;_city(i);_county(i);});self.on('change','#'+city.id,function(){city_id=this.value;county_id=0;_county(i);});});function _city(i,space){$.get(app.url('index/api/region',{layer:2,parent_id:province_id}),function(res){var option='';$.map(res,function(row){option+='<option value="'+row.id+'">'+row.name+'</option>';});var e=$('#'+city.id).html(option);if(city_id){e.val(city_id);}});}function _county(i,space){$.get(app.url('index/api/region',{layer:3,parent_id:city_id}),function(res){var option='';$.map(res,function(row){option+='<option value="'+row.id+'">'+row.name+'</option>';});var e=$('#'+county.id).html(option);if(county_id){e.val(county_id);}});}},circle:function circle(i){var circle=self.attr(i,0);var customer=self.attr(i,1);var circle_id=circle.value;var customer_id=customer.value;element[i].value.append('<select name="'+circle.name+'" id="'+circle.id+'" class="form-control input-sm"></select> <select name="'+customer.name+'" id="'+customer.id+'" class="form-control input-sm"></select>');$.post(app.url('customer/circle/dialog'),function(res){var option='<option value=""> - </option>';$.map(res,function(row){option+='<option value="'+row.id+'">'+row.name+'</option>';});var e=$('#'+circle.id).html(option);if(circle_id){e.val(circle_id);}_customer(i);});self.on('change','#'+circle.id,function(){circle_id=this.value;customer_id=0;_customer(i);});function _customer(i){var option='<option value=""> - </option>';if(circle_id){$.post(app.url('customer/customer/dialog',{limit:500,circle_id:circle_id}),function(res){$.map(res.data,function(row){option+='<option value="'+row.id+'">'+row.text+'</option>';});var e=$('#'+customer.id).html(option);if(customer_id){e.val(customer_id);}});}else{$('#'+customer.id).html(option);}}}};self.attr=attr;self.element=element;self.options=options;if(typeof options.init=='function'){options.init.call(this,handle);}init();return this;};})(jQuery);(function($){var COUNT=0;$.fn.dialog=function(options){var self=this,$this=$(self),$body=$(document.body),$element=$this.closest('.dialog');this.options=options;var create=function create(){// fade
|
||
var element='<div class="dialog modal"><div class="modal-dialog"><div class="modal-content">';if(options.title){element+='<div class="modal-header"><button type="button" data-dismiss="dialog" class="close">×</button><h4 class="modal-title"></h4></div>';}element+='<div class="modal-body"></div>';if(options.buttons.length>0){element+='<div class="modal-footer"></div>';}element+='</div></div></div>';// 窗口创建一个以上遮罩只显示一层
|
||
// options.backdrop = COUNT > 0 ? '' : options.backdrop;
|
||
$element=$(element);$body.append($element);$element.find(".modal-body").append($this);$element.modal({backdrop:options.backdrop});//if(options.draggable === true) {
|
||
$('.modal-dialog').draggable({handle:".modal-header",iframeFix:true});//}
|
||
};var createButton=function createButton(_options){var buttons=(_options||options||{}).buttons||{},$btnrow=$element.find(".modal-footer");// clear old buttons
|
||
$btnrow.html('');for(var button in buttons){var btn=buttons[button],id='',text='',classed='btn-default',click='';classed=btn['class']||btn.classed||classed;$button=$('<button type="button" class="btn btn-sm '+classed+'">'+btn.text+'</button>');$button.data('click',btn.click);if(btn.id){$button.attr("id",btn.id);}$btnrow.append($button);}$btnrow.on('click',function(e){var click=$(e.target).data('click');if(typeof click==='function'){click.call(self,e);}});$btnrow.data('buttons',buttons);};var show=function show(){$element.modal('show');var showHandler=options.onShow||function(){};showHandler.call(self);};var close=function close(){$element.modal('hide');};var destroy=function destroy(){$element.remove();};if(options.constructor==Object){var defaults={show:true,backdrop:true,destroy:false};options=$.extend(defaults,options);if($element.size()==0){create();createButton();$element.find('.modal-title').html(options['title']);if(options['dialogClass']){$element.find('.modal-dialog').addClass(options['dialogClass']);}$element.on('click',"[data-dismiss='dialog']",function(){var closeHandler=options.onClose||close;closeHandler.call(self);});$element.one('show.bs.modal',function(){COUNT++;});$element.one('hidden.bs.modal',function(){COUNT--;if(COUNT>0){$element.modal('checkScrollbar');$body.addClass('modal-open');$element.modal('setScrollbar');}// 取消绑定的事件
|
||
// $element.off('click',"[data-dismiss='dialog']");
|
||
// 删除 $element
|
||
if(options.destroy==true){destroy();}});if(options.modalClass){$element.addClass(options.modalClass);}}if(options.show){show();}}if(options=="destroy"){options.destroy=true;close();}if(options=="close"){close();}if(options=="show"){show();}return self;};})(jQuery);(function($){var modal={ok:{text:"确定",classed:'btn-info'},cancel:{text:"取消",classed:'btn-default'}};$.messager={};$.messager.alert=function(title,message,callback){if(arguments.length<2){message=title||"";title=" ";}$("<div>"+message+"</div>").dialog({title:title,destroy:true,dialogClass:'modal-sm',buttons:[{text:modal.ok.text,classed:modal.ok.classed||"btn-success",click:function click(){if(typeof callback==='function'){callback();}$(this).dialog("destroy");}}]});};$.messager.confirm=function(title,message,callback){$("<div>"+message+"</div>").dialog({title:title,destroy:true,backdrop:'static',dialogClass:'modal-sm modal-confirm',buttons:[{text:modal.cancel.text,classed:modal.cancel.classed||"btn-danger",click:function click(){$(this).dialog("destroy");if(typeof callback==='function'){callback(false);}}},{text:modal.ok.text,classed:modal.ok.classed||"btn-success",click:function click(){$(this).dialog("destroy");if(typeof callback==='function'){callback(true);}}}]});};})(jQuery);(function($){var dialogIndex=0;$.dialog=function(options){var oldIndex=dialogIndex;var defaultOptions={title:'Dialog',modalClass:'no-padder',dialogClass:'modal-md',destroy:true,index:dialogIndex,onShow:function onShow(){var me=this;var url=options['url'];if(url){var url=url+(url.indexOf('?')<0?'?':'&')+'dialog_index='+oldIndex;$.get(url,function(data){me.html(data);});}if(options['html']){this.html(options['html']);}},buttons:[{text:"取消",click:function click(){$(this).dialog("close");}},{text:"确定",'class':"btn-primary",click:function click(){$(this).dialog("close");}}]};options=$.extend(defaultOptions,options);var id='gdoo-dialog-'+dialogIndex;var $target=$('#'+id);if($target.length==0){$target=$('<div/>',{id:id});dialogIndex++;}$target.dialog(options);return oldIndex;};})(jQuery);(function($){$.toastr=function(type,title,content){toastr.options={"closeButton":true,"debug":false,"progressBar":false,"positionClass":"toast-top-right",//"positionClass": "toast-top-center",
|
||
"onclick":null,"showDuration":"300","hideDuration":"1000","timeOut":"5000","extendedTimeOut":"1000","showEasing":"swing","hideEasing":"linear","showMethod":"fadeIn","hideMethod":"fadeOut"};toastr[type](title,content);};})(jQuery);(function(window){var calc={/**
|
||
* 人民币计算大写
|
||
* @param {type} currencyDigits
|
||
* @returns {String}
|
||
*/'rmb':function rmb(currencyDigits){// Constants:
|
||
var MAXIMUM_NUMBER=99999999999.99;// Predefine the radix characters and currency symbols for output:
|
||
var YUANCAPITAL={ZERO:"零",ONE:"壹",TWO:"贰",THREE:"叁",FOUR:"肆",FIVE:"伍",SIX:"陆",SEVEN:"柒",EIGHT:"捌",NINE:"玖",TEN:"拾",HUNDRED:"佰",THOUSAND:"仟",TEN_THOUSAND:"万",HUNDRED_MILLION:"亿",DOLLAR:"元",TEN_CENT:"角",CENT:"分",INTEGER:"整"};var CN_ZERO=YUANCAPITAL.ZERO;var CN_ONE=YUANCAPITAL.ONE;var CN_TWO=YUANCAPITAL.TWO;var CN_THREE=YUANCAPITAL.THREE;var CN_FOUR=YUANCAPITAL.FOUR;var CN_FIVE=YUANCAPITAL.FIVE;var CN_SIX=YUANCAPITAL.SIX;var CN_SEVEN=YUANCAPITAL.SEVEN;var CN_EIGHT=YUANCAPITAL.EIGHT;var CN_NINE=YUANCAPITAL.NINE;var CN_TEN=YUANCAPITAL.TEN;var CN_HUNDRED=YUANCAPITAL.HUNDRED;var CN_THOUSAND=YUANCAPITAL.THOUSAND;var CN_TEN_THOUSAND=YUANCAPITAL.TEN_THOUSAND;var CN_HUNDRED_MILLION=YUANCAPITAL.HUNDRED_MILLION;var CN_DOLLAR=YUANCAPITAL.DOLLAR;var CN_TEN_CENT=YUANCAPITAL.TEN_CENT;var CN_CENT=YUANCAPITAL.CENT;var CN_INTEGER=YUANCAPITAL.INTEGER;// Variables:
|
||
var integral;// Represent integral part of digit number.
|
||
var decimal;// Represent decimal part of digit number.
|
||
var outputCharacters;// The output result.
|
||
var parts;var digits,radices,bigRadices,decimals;var zeroCount;var i,p,d;var quotient,modulus;// Validate input string:
|
||
currencyDigits=currencyDigits.toString();if(currencyDigits==""){return"";}if(currencyDigits.match(/[^,.\d]/)!=null){return"";}if(currencyDigits.match(/^((\d{1,3}(,\d{3})*(.((\d{3},)*\d{1,3}))?)|(\d+(.\d+)?))$/)==null){return"";}// Normalize the format of input digits:
|
||
currencyDigits=currencyDigits.replace(/,/g,"");// Remove comma delimiters.
|
||
currencyDigits=currencyDigits.replace(/^0+/,"");// Trim zeros at the beginning.
|
||
// Assert the number is not greater than the maximum number.
|
||
if(Number(currencyDigits)>MAXIMUM_NUMBER){return"";}// Process the coversion from currency digits to characters:
|
||
// Separate integral and decimal parts before processing coversion:
|
||
parts=currencyDigits.split(".");if(parts.length>1){integral=parts[0];decimal=parts[1];// Cut down redundant decimal digits that are after the second.
|
||
decimal=decimal.substr(0,2);}else{integral=parts[0];decimal="";}// Prepare the characters corresponding to the digits:
|
||
digits=new Array(CN_ZERO,CN_ONE,CN_TWO,CN_THREE,CN_FOUR,CN_FIVE,CN_SIX,CN_SEVEN,CN_EIGHT,CN_NINE);radices=new Array("",CN_TEN,CN_HUNDRED,CN_THOUSAND);bigRadices=new Array("",CN_TEN_THOUSAND,CN_HUNDRED_MILLION);decimals=new Array(CN_TEN_CENT,CN_CENT);// Start processing:
|
||
outputCharacters="";// Process integral part if it is larger than 0:
|
||
if(Number(integral)>0){zeroCount=0;for(i=0;i<integral.length;i++){p=integral.length-i-1;d=integral.substr(i,1);quotient=p/4;modulus=p%4;if(d=="0"){zeroCount++;}else{if(zeroCount>0){outputCharacters+=digits[0];}zeroCount=0;outputCharacters+=digits[Number(d)]+radices[modulus];}if(modulus==0&&zeroCount<4){outputCharacters+=bigRadices[quotient];}}outputCharacters+=CN_DOLLAR;}// Process decimal part if there is:
|
||
if(decimal!=""){for(i=0;i<decimal.length;i++){d=decimal.substr(i,1);if(d!="0"){outputCharacters+=digits[Number(d)]+decimals[i];}}}// Confirm and return the final output string:
|
||
if(outputCharacters==""){outputCharacters=CN_ZERO+CN_DOLLAR;}if(decimal==""){outputCharacters+=CN_INTEGER;}//outputCharacters = CN_SYMBOL + outputCharacters;
|
||
return outputCharacters;},/**
|
||
* 最大值
|
||
* @returns {unresolved}
|
||
*/'max':function max(){if(arguments.length==0){return;}var maxNum=arguments[0];for(var i=0;i<arguments.length;i++){maxNum=Math.max(maxNum,arguments[i]);}return parseFloat(maxNum);},/**
|
||
* 最小值
|
||
* @returns {unresolved}
|
||
*/'min':function min(){if(arguments.length==0){return;}var minNum=arguments[0];for(var i=0;i<arguments.length;i++){minNum=Math.min(minNum,arguments[i]);}return parseFloat(minNum);},/**
|
||
* 平均值
|
||
* @returns {unresolved}
|
||
*/'avg':function avg(){var args=arguments,len=args.length,i=0,sum=0;for(;i<len&&(sum+=parseFloat(args[i]));i++){}return sum/len;},/**
|
||
* 取模运算
|
||
* @returns {String}
|
||
*/'mod':function mod(){if(arguments.length==0){return;}var firstNum=arguments[0];var secondNum=arguments[1];var result=firstNum%secondNum;result=isNaN(result)?"":parseFloat(result);return result;},/**
|
||
* 绝对值
|
||
* @param {type} val
|
||
* @returns {@exp;Math@call;abs}
|
||
*/'abs':function abs(val){return Math.abs(parseFloat(val));},/**
|
||
* 获取值
|
||
* @param {type} val
|
||
* @returns {@exp;Math@call;floor|Number}
|
||
*/'val':function val(_val,prec){return isNaN(_val)||_val===Infinity?0:_val.toFixed(prec);},/**
|
||
* 天数计算
|
||
* @param {type} val
|
||
* @returns {Number|@exp;Math@call;floor}
|
||
*/'day':function day(val){return val==0?0:Math.floor(val/86400);},/**
|
||
* 小时
|
||
* @param {type} val
|
||
* @returns {@exp;Math@call;floor|Number}
|
||
*/'hour':function hour(val){return val==0?0:Math.floor(val/3600);},/**
|
||
* 日期计算
|
||
* @param {type} val
|
||
* @returns {String}
|
||
*/'date':function date(val){var TIME={YEAR:"年",HALFYEAR:"半年",QUARTER:"季",MONTH:"月",WEEK:"周",DAY:"天",HOUR:"小时",MIN:"分",MINS:"分钟",SEC:"秒",SECS:"秒钟",INVALID_DATE:"日期格式无效",WEEKS:"星期",WEEKDAYS:"日一二三四五六"};return val>=0?Math.floor(val/86400)+TIME.DAY+Math.floor(val%86400/3600)+TIME.HOUR+Math.floor(val%3600/60)+TIME.MIN+Math.floor(val%60)+TIME.SEC:TIME.INVALID_DATE;//'日期格式无效'
|
||
},/**
|
||
* 列表控件计算
|
||
* @param {type} olist
|
||
* @param {type} col
|
||
* @returns {Number}
|
||
*/'list':function list(table_id,col){var output=0;var tbody=document.getElementById('body_'+table_id);for(var i=0;i<tbody.rows.length;i++){for(var j=0;j<tbody.rows[i].cells.length;j++){if(j==col){var child=tbody.rows[i].cells[j].firstChild;if(child&&child.tagName){var val=child.value||child.innerText;val=val==""||val.replace(/\s/g,'')==""?0:val;val=isNaN(val)?NaN:val;output+=parseFloat(val);}else{output+=parseFloat(child.data);}}}}return parseFloat(output);},/**
|
||
* 计算控件获取item的值
|
||
* @param {type} $item
|
||
* @returns {@exp;d@call;getTime|Number|@exp;document@call;getElementById}
|
||
*/'getVal':function getVal(id,type){var $item=$('#'+id);if($item.length==0){return 0;}// $item.data('flag')
|
||
if(type=='listview'){return document.getElementById('lv_'+id);}else if(type=='date'){var val=$('#'+id).val();//var val = $item.parent().data("datetimepicker").getDate();
|
||
var d=new Date(val);return d.getTime()/1000;}else{var val=$item.val();if(val==""){val=0;}return val;}},/**
|
||
数字合计
|
||
*/sum:function sum(){var args=[].slice.call(arguments,0),len,item,sum=0;for(len=args.length;len--;){item=parseFloat(args[len]);// if item=>NaN
|
||
sum+=item===item?item:0;}return sum;}};var listView={calc:calc,field:{},data:{},total:{},editor:function editor(key,i,j){var field=listView.field[key];var type=field.type[j];var size=field.size[j];var css=field.checks[j]=='SYS_NOT_NULL'?'input-required':'input-text';var readonly=field.writes[j]==true?false:true;var value='';if(listView.data[key][i]){value=listView.data[key][i][j]==undefined?'':listView.data[key][i][j];}var name=key+'['+i+']['+j+']';var id=key+'_'+i+'_'+j;switch(type){case"empty":var out='<span tyle="width:'+size+'px;" id="'+id+'"></span>';break;case"text":var out=readonly==0?'<input autocomplete="off" type="text" style="width:'+size+'px;" class="'+css+'" name="'+name+'" id="'+id+'" value="'+value+'">':'<span id="'+id+'">'+value+'</span>';break;case"textarea":var out=readonly==0?'<textarea style="width:'+size+'px;" class="'+css+'" name="'+name+'" id="'+id+'">'+value+'</textarea>':'<span id="'+id+'">'+value+'</span>';break;case"calc":var out=readonly==0?'<input type="text" style="width:'+size+'px;" class="readonly" name="'+name+'" id="'+id+'" value="'+value+'" readonly>':'<span id="'+id+'">'+value+'</span>';break;case"select":var option=field.value[j].split(',');var r=[];r.push('<select style=width:'+size+'px;" name="'+name+'" id="'+id+'">');for(var i=0;i<option.length;i++){var selected=value==option[i]?' selected':'';r.push('<option value="'+option[i]+'"'+selected+'>'+option[i]+'</option>');}r.push('</select>');out=readonly==0?r.join("\n"):'<span id="'+id+'">'+value+'</span>';break;case"radio":var option=field.value[j].split(',');var r=[];for(var i=0;i<option.length;i++){var checked=value==option[i]?' checked':'';r.push('<label class="checkbox"><input type="radio" name="'+name+'" id="'+id+'"'+checked+'>'+option[i]+'</label>');}out=readonly==0?r.join("\n"):'<span id="'+id+'">'+value+'</span>';break;case"checkbox":var option=field.value[j].split(',');var r=[];for(var i=0;i<option.length;i++){var checked=value==option[i]?' checked':'';r.push('<label class="checkbox"><input type="checkbox" name="'+name+'" id="'+id+'"'+checked+'>'+option[i]+'</label>');}out=readonly==0?r.join("\n"):'<span id="'+id+'">'+value+'</span>';break;case"datetime":out=readonly==0?'<input autocomplete="off" type="text" style=width:'+size+'px;" onfocus="datePicker({dateFmt:\'yyyy-MM-dd\'});" class="'+css+' popDate" value="'+value+'" name="'+name+'" id="'+id+'">':'<span id="'+id+'">'+value+'</span>';break;}return out;},rowUpdate:function rowUpdate(obj){var e=obj.target.id.split('_');if(e.length==4){var key=e[0]+'_'+e[1];listView.rowSum(key,e[2]);listView.footerSum(key);};},footerSum:function footerSum(key){var body=document.getElementById('body_'+key);var field=listView.field[key];var sum=field.sum;var readonly=field.readonly;for(var i=0;i<sum.length;i++){if(sum[i]==true){var row=0;for(var j=0;j<body.rows.length;j++){var td=body.rows[j].cells[i+1];var value=field.readonly==0?$(td).find('input,select').val():$(td).find('span').text();value=parseFloat(value);row+=isNaN(value)?0:Math.round(parseFloat(value)*10000)/10000;}row=row.toFixed(2);$('#total_'+key+'_'+i).html(row);}}},rowSum:function rowSum(key,j){var field=listView.field[key];var type=field.type;var value=field.value;var readonly=field.readonly;var calc=[];for(var i=0;i<type.length;i++){if(type[i]=='calc'){calc[i]=value[i];for(var k=0;k<type.length;k++){var n=k+1;var td=$('#'+key+'_'+j+'_'+k);var td_value=readonly==0?td.val():td.text();calc[i]=calc[i].replace('['+n+']',parseFloat(td_value));}row=isNaN(eval(calc[i]))?0:Math.round(parseFloat(eval(calc[i]))*10000)/10000;row=row.toFixed(2);var obj=$('#'+key+'_'+j+'_'+i);readonly==0?obj.val(row):obj.text(row);}}},rowAdd:function rowAdd(key){i=listView.total[key];var tr=[];tr.push('<tr><td align="center">'+(i+1)+'</td>');for(var j=0;j<listView.field[key].type.length;j++){tr.push('<td>'+listView.editor(key,i,j)+'</td>');}// 检查字段是否为只读
|
||
if(listView.field[key].readonly==0){var option=i>0?'<a class="option" href="javascript:;" onclick="listView.deleteRow(\''+key+'\',this);">删除</a>':'<a class="option" onclick="listView.rowAdd(\''+key+'\');" href="javascript:;">添加</a>';tr.push('<td align="center" style="white-space:nowrap;">'+option+'</td></tr>');}$('#body_'+key).append(tr.join("\n"));// 累加行
|
||
listView.total[key]++;},deleteRow:function deleteRow(key,obj){var tr=obj.parentNode.parentNode;tr.parentNode.removeChild(tr);// 总计列总数
|
||
listView.footerSum(key);},init:function init(key){// 初始化列表视图
|
||
listView.total[key]=0;// 新建的时候默认显示一行
|
||
var length=listView.data[key].length>0?listView.data[key].length:1;for(var i=0;i<length;i++){// 添加一行
|
||
listView.rowAdd(key);// 计算小计行
|
||
listView.rowSum(key,i);};// 总计列总数
|
||
listView.footerSum(key);}};window.listView=listView;})(window);(function(window){// 循环子表
|
||
function gridListData(table){var gets={};var tables=formGridList[table]||[];if(tables.length){for(var i=0;i<tables.length;i++){var t=tables[i];var store=t.api.memoryStore;var rows=[];t.api.stopEditing();t.api.forEachNode(function(rowNode){var data=rowNode.data;if(isNotEmpty(data[t.dataKey])){var id=''+data.id;var draft=id.indexOf('draft_');if(draft===0){data.id=0;}rows.push(data);}});var event=gdoo.event.get('grid.'+t.tableKey);if(event.exist('onSaveBefore')){var ret=event.trigger('onSaveBefore',rows);if(ret===false){return false;}}if(rows.length==0){toastrError(t.tableTitle+'不能为空。');return false;}else{gets[t.tableKey]={rows:rows,deleteds:store.deleted};}}}return gets;}// 刷新所有相关grid
|
||
function reloadGrid(table){var iframes=top.document.getElementsByTagName("iframe");for(var i=0;i<iframes.length;i++){var iframe=iframes[i];var igdoo=iframe.contentWindow.gdoo;if(iframe.id=='tab_iframe_dashboard'){// 刷新首页全部部件
|
||
var widgets=Object.values(igdoo.widgets);widgets.forEach(function(grid){grid.remoteData();});}else{// 刷新全部页面的相关grid
|
||
if(igdoo&&igdoo.grids){var grids=igdoo.grids;if(grids[table]){grids[table].grid.remoteData();}}}}}window.gridListData=gridListData;var model={bill_url:'',audit:function audit(table){var form=$('#'+table);var key=form.find('#master_key').val();var run_id=form.find('#master_run_id').val();var step_id=form.find('#master_step_id').val();var run_log_id=form.find('#master_run_log_id').val();var uri=$('#'+table).find('#master_uri').val();var url=app.url(uri+'/flowAudit',{key:key,run_id:run_id,step_id:step_id,run_log_id:run_log_id});$.dialog({title:'单据审批',url:url,buttons:[{text:'取消','class':'btn-default',click:function click(){$(this).dialog('close');}},{text:'提交','class':'btn-info',click:function click(){var query=$('#myturn,#'+table).serialize();// 循环子表
|
||
var gets=gridListData(table);if(gets===false){return;}var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*120});$.post(app.url(uri+'/flowAudit'),query+'&'+$.param(gets),function(res){if(res.status){reloadGrid(table);toastrSuccess(res.data);if(res.url){location.href=res.url;}}else{toastrError(res.data);}},'json').complete(function(){layer.close(loading);});}}]});},draft:function draft(table){var uri=$('#'+table).find('#master_uri').val();var query=$('#myturn,#'+table).serialize();// 循环子表
|
||
var gets=gridListData(table);if(gets===false){return;}var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*120});var event=gdoo.event.get('grid.'+table);$.post(app.url(uri+'/flowDraft'),query+'&'+$.param(gets),function(res){if(event.exist('onSaveAfter')){res=event.trigger('onSaveAfter',res);}if(res.status){reloadGrid(table);toastrSuccess(res.data);if(res.url){location.href=res.url;}}else{toastrError(res.data);}},'json').complete(function(){layer.close(loading);});},remove:function remove(url){$.messager.confirm('操作警告','确定要删除吗?',function(btn){if(btn==true){$.post(url,function(res){if(res.status){toastrSuccess(res.data);location.reload();}else{toastrError(res.data);}},'json');}});},store:function store(table){var uri=$('#'+table).find('#master_uri').val();var query=$('#'+table).serialize();// 循环子表
|
||
var gets=gridListData(table);if(gets===false){return;}var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*120});$.post(app.url(uri+'/store'),query+'&'+$.param(gets),function(res){if(res.status){reloadGrid(table);toastrSuccess(res.data);if(res.url){location.href=res.url;}}else{toastrError(res.data);}},'json').complete(function(){layer.close(loading);});},read:function read(table){var uri=$('#'+table).find('#master_uri').val();var query=$('#'+table).serialize();var loading=layer.msg('数据提交中...',{icon:16,shade:0.1});$.post(app.url(uri+'/flowRead'),query,function(res){if(res.status){reloadGrid(table);toastrSuccess(res.data);location.reload();}else{toastrError(res.data);}},'json').complete(function(){layer.close(loading);});},reset:function reset(table){$.messager.confirm('操作警告','确定要重置流程吗',function(btn){if(btn==true){var uri=$('#'+table).find('#master_uri').val();var query=$('#'+table).serialize();var loading=layer.msg('数据提交中...',{icon:16,shade:0.1});$.post(app.url(uri+'/flowReset'),query,function(res){if(res.status){location.reload();}else{toastrError(res.data);}},'json').complete(function(){layer.close(loading);});}});},auditLog:function auditLog(key){var url=app.url('index/workflow/flowLog',{key:key});$.dialog({title:'审批记录',dialogClass:'modal-lg',url:url,buttons:[{text:'取消','class':'btn-default',click:function click(){$(this).dialog('close');}}]});},revise:function revise(key){var url=app.url('index/workflow/flowRevise',{key:key});formDialog({title:'流程修正',url:url,dialogClass:'modal-md',id:'revise-form',success:function success(res){toastrSuccess(res.data);location.reload();$(this).dialog("close");},error:function error(res){toastrError(res.data);}});}};// 流程撤回
|
||
model.recall=function(table){var key=$('#'+table).find('#master_key').val();var uri=$('#'+table).find('#master_uri').val();var log_id=$('#'+table).find('#master_recall_log_id').val();var url=app.url(uri+'/recall',{key:key,log_id:log_id});$.dialog({title:'撤回单据',url:url,buttons:[{text:"取消",'class':"btn-default",click:function click(){$(this).dialog("close");}},{text:"提交",'class':"btn-info",click:function click(){var me=this;var query=$('#myrecall').serialize();var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*120});$.post(app.url(uri+'/recall'),query,function(res){if(res.status){reloadGrid(table);toastrSuccess(res.data);location.reload();}else{toastrError(res.data);}},'json').complete(function(){layer.close(loading);});}}]});};// 弃审单据
|
||
model.abort=function(table){var key=$('#'+table).find('#master_key').val();var uri=$('#'+table).find('#master_uri').val();var url=app.url(uri+'/abort',{key:key});$.dialog({title:'弃审单据',url:url,buttons:[{text:"取消",'class':"btn-default",click:function click(){$(this).dialog("close");}},{text:"提交",'class':"btn-info",click:function click(){var me=this;var query=$('#myabort').serialize();var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*120});$.post(app.url(uri+'/abort'),query,function(res){if(res.status){reloadGrid(table);toastrSuccess(res.data);location.reload();}else{toastrError(res.data);}},'json').complete(function(){layer.close(loading);});}}]});};// 普通审核弃审
|
||
model.audit2=function(table){var key=$('#'+table).find('#master_key').val();var uri=$('#'+table).find('#master_uri').val();$.messager.confirm('操作警告','确定要审核单据吗',function(btn){if(btn==true){var loading=layer.msg('数据提交中...',{icon:16,shade:0.1});$.post(app.url(uri+'/audit'),{key:key},function(res){if(res.status){reloadGrid(table);toastrSuccess(res.data);location.reload();}else{toastrError(res.data);}},'json').complete(function(){layer.close(loading);});}});};// 普通审核弃审
|
||
model.abort2=function(table){var key=$('#'+table).find('#master_key').val();var uri=$('#'+table).find('#master_uri').val();$.messager.confirm('操作警告','确定要弃审单据吗',function(btn){if(btn==true){var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*30});$.post(app.url(uri+'/abort'),{key:key},function(res){if(res.status){reloadGrid(table);top.$.toastr('success',res.data);location.reload();}else{top.$.toastr('error',res.data);}},'json').complete(function(){layer.close(loading);});}});};// 子表新增
|
||
model.createRow=function(table){var grid=gdoo.forms[table];var onCreateRow=window[table+'.onCreateRow'];if(typeof onCreateRow=='function'){var ret=onCreateRow.call(grid,table);if(ret===false){return false;}}grid.api.memoryStore.create({});};// 子表删除
|
||
model.deleteRow=function(table){var grid=gdoo.forms[table];var onDeleteRow=window[table+'.onDeleteRow'];if(typeof onDeleteRow=='function'){var ret=onDeleteRow.call(grid,table);if(ret===false){return false;}}var selectedNodes=grid.api.getSelectedNodes();if(selectedNodes&&selectedNodes.length===1){var selectedNode=selectedNodes[0];grid.api.deleteRow(selectedNode.data);grid.api.forEachNode(function(node){if(node.childIndex===selectedNode.childIndex){node.setSelected(true);return;}});}};// 快速搜索
|
||
model.quickFilter=function(table){var grid=gdoo.forms[table];var $div=$('#'+table+'_quick_filter_text');var $el=$div.dialog({title:'<i class="fa fa-filter"></i> 过滤'+grid.tableTitle,modalClass:'no-padder',dialogClass:'modal-sm',buttons:[{text:"确定",classed:'btn-info',click:function click(){grid.api.setQuickFilter($div.find('input').val());$el.dialog("close");}},{text:"取消",classed:'btn-default',click:function click(){$el.dialog("close");}}]}).on('keydown',function(e){if(e.keyCode==13){grid.api.setQuickFilter($div.find('input').val());$el.dialog("close");}});};// 子表关闭
|
||
model.closeRow=function(table){var me=this;var grid=gdoo.forms[table];var rows=grid.api.getSelectedRows();if(rows.length>0){var id=rows[0].id;top.$.messager.confirm('操作提醒','是否要关闭选中的行数据?',function(btn){if(btn==true){var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*120});$.post(app.url(me.bill_url+'/closeRow'),{table:table,id:id},function(res){if(res.status){toastrSuccess(res.data);grid.remoteData();}else{toastrError(res.data);}},'json').complete(function(){layer.close(loading);});}});}else{toastrError('最少选择一行记录。');}};// 子表关闭所有
|
||
model.closeAllRow=function(table){var me=this;var grid=gdoo.forms[table];var ids=[];grid.api.forEachNode(function(node){ids.push(node.data.id);});if(ids.length>0){top.$.messager.confirm('操作提醒','是否要关闭所有行数据?',function(btn){if(btn==true){var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*120});$.post(app.url(me.bill_url+'/closeAllRow'),{table:table,ids:ids},function(res){if(res.status){toastrSuccess(res.data);grid.remoteData();}else{toastrError(res.data);}},'json').complete(function(){layer.close(loading);});}});}else{toastrError('最少选择一行记录。');}};window.flow=model;})(window);(function($){function gridAction(table,name){this.name=name;this.table=table;this.dialogType='dialog';this.show=function(data,key,name){var me=this;if(data.flow_form_edit==1){me.audit(data);return;}var url=app.url(me.bill_url+'/show',{id:data.master_id});if(me.dialogType=='dialog'){viewDialog({title:me.name,dialogClass:'modal-lg',url:url,close:function close(){$(this).dialog("close");}});}else{if(isEmpty(key)){key=me.bill_url.replace(/\//g,'_')+'_show';}if(isEmpty(name)){name=me.name;}top.addTab(me.bill_url+'/show?id='+data.master_id,key,name);}};this["import"]=function(){var me=this;var grid=gdoo.grids[me.table].grid;formDialog({title:'数据导入',url:app.url(me.bill_url+'/import'),dialogClass:'modal-md',id:'import-dialog',onSubmit:function onSubmit(){var fd=new FormData();fd.append("file",$('#import_file')[0].files[0]);var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*120});$.ajax({url:app.url(me.bill_url+'/import'),type:"POST",data:fd,processData:false,contentType:false,complete:function complete(){layer.close(loading);},success:function success(res){if(res.status){$('#modal-import-dialog').dialog('close');grid.remoteData();toastrSuccess(res.data);}else{toastrError(res.data);}}});}});};this["delete"]=function(){var me=this;var grid=gdoo.grids[me.table].grid;var rows=grid.api.getSelectedRows();var ids=[];$.each(rows,function(index,row){ids.push(row.master_id);});if(ids.length>0){var content=ids.length+'个'+me.name+'将被删除?';top.$.messager.confirm('删除'+me.name,content,function(btn){if(btn==true){var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*120});$.post(app.url(me.bill_url+'/delete'),{id:ids},function(res){if(res.status){toastrSuccess(res.data);grid.remoteData();}else{toastrError(res.data);}},'json').complete(function(){layer.close(loading);});}});}else{toastrError('最少选择一行记录。');}};this.created_by=function(data){var me=this;var grid=gdoo.grids[me.table].grid;formDialog({title:'私信',url:app.url('user/message/create',{user_id:data.id}),storeUrl:app.url('model/form/store'),id:'user_message',dialogClass:'modal-md',success:function success(res){toastrSuccess(res.data);grid.remoteData();$(this).dialog("close");},error:function error(res){toastrError(res.data);}});};this.create=function(){var me=this;var grid=gdoo.grids[me.table].grid;if(me.dialogType=='dialog'){formDialog({title:'新建'+me.name,url:app.url(me.bill_url+'/create'),storeUrl:app.url(me.bill_url+'/store'),id:me.table,table:me.table,dialogClass:'modal-lg',success:function success(res){toastrSuccess(res.data);grid.remoteData();$(this).dialog("close");},error:function error(res){toastrError(res.data);}});}else{var key=me.bill_url.replace(/\//g,'_')+'_show';top.addTab(me.bill_url+'/create',key,me.name);}};this.edit=function(data){var me=this;var grid=gdoo.grids[me.table].grid;if(me.dialogType=='dialog'){formDialog({title:'编辑'+me.name,url:app.url(me.bill_url+'/edit',{id:data.master_id}),storeUrl:app.url(me.bill_url+'/store'),id:me.table,table:me.table,dialogClass:'modal-lg',success:function success(res){toastrSuccess(res.data);grid.remoteData();$(this).dialog("close");},error:function error(res){toastrError(res.data);}});}else{var key=me.bill_url.replace(/\//g,'_')+'_show';top.addTab(me.bill_url+'/edit?id='+data.master_id,key,me.name);}};this.audit=function(data){var me=this;var grid=gdoo.grids[me.table].grid;if(me.dialogType=='dialog'){formDialog({title:'审核'+me.name,url:app.url(me.bill_url+'/audit',{id:data.master_id}),storeUrl:app.url(me.bill_url+'/store'),id:me.table,table:me.table,dialogClass:'modal-lg',success:function success(res){toastrSuccess(res.data);grid.remoteData();$(this).dialog("close");},error:function error(res){toastrError(res.data);}});}else{var key=me.bill_url.replace(/\//g,'_')+'_show';top.addTab(me.bill_url+'/audit?id='+data.master_id,key,me.name);}};this.batchEdit=function(){var me=this;var grid=gdoo.grids[me.table].grid;var rows=grid.api.getSelectedRows();var ids=[];$.each(rows,function(index,row){ids.push(row.master_id);});if(ids.length>0){formDialog({title:'批量编辑',dialogClass:'modal-sm',id:'batch-edit-form',url:app.url(me.bill_url+'/batchEdit',{ids:ids.join(',')}),success:function success(res){toastrSuccess(res.data);grid.remoteData();$(this).dialog("close");},close:function close(){$(this).dialog("close");}});}else{toastrError('最少选择一行记录。');}};// 导出
|
||
this["export"]=function(){var me=this;var grid=gdoo.grids[me.table].grid;LocalExport(grid,me.name);};this.filter=function(){var me=this;var config=gdoo.grids[me.table];var grid=config.grid;var search=config.search;// 过滤数据
|
||
$(search.advanced.el).dialog({title:'高级搜索',modalClass:'no-padder',buttons:[{text:"取消",'class':"btn-default",click:function click(){$(this).dialog("close");}},{text:"确定",'class':"btn-info",click:function click(){var query=search.advanced.el.serializeArray();var params={};search.queryType='advanced';$.map(query,function(row){params[row.name]=row.value;});params['page']=1;grid.remoteData(params);$(this).dialog("close");return false;}}]});};}window.gridAction=gridAction;})(jQuery);var select2List={};$(function(){var $document=$(document);// 注册jQuery Ajax全局错误提示
|
||
$document.ajaxError(function(event,xhr){if(xhr.responseJSON){toastrError(xhr.responseJSON.message);}});var input_select2=$document.find('.input-select2');if(input_select2.length){input_select2.select2();}// 新提示
|
||
$document.tooltip({container:'body',placement:'auto',selector:'.hinted',delay:{show:200,hide:0}});// 批量操作
|
||
$('.select-all').on('click',function(){var tr=$('.select-row').closest('tr');if($(this).prop('checked')){tr.addClass('success');}else{tr.removeClass('success');}$(".select-row").prop('checked',$(this).prop('checked'));});// 从子窗口关闭tab
|
||
$document.on('click','[data-toggle="closetab"]',function(){// 获取框架的名称
|
||
if(window.name){var id=window.name.replace('iframe_','');}else{var id=$(this).data('id');}top.$.addtabs.close({id:'tab_'+id});});// 点击td选择行
|
||
$('.table tbody tr').on('click',function(e){var tr=$(this);var checkbox=tr.find('.select-row');var checked=checkbox.prop('checked');if(checkbox.length==0){return;}if(e.target.tagName=='INPUT'){setCheckbox(checked);}if(e.target.tagName=='DIV'){setCheckbox(!checked);}if(e.target.tagName=='TD'){setCheckbox(!checked);}function setCheckbox(checked){if(checked){tr.addClass('success');}else{tr.removeClass('success');}checkbox.prop('checked',checked);}});// 转到某些地址,单页面内类型切换
|
||
$document.on('change','[data-toggle="redirect"]',function(){// 从select的rel传递过来的地址
|
||
var url=$(this).data('url');var id=$(this).attr('id');var selected=$(this).find("option:selected").val();location.href=url.replace(new RegExp('('+id+'=)[^&]*','g'),'$1'+selected);});// 清除弹出层id
|
||
$document.on('click.dialog.search','[data-toggle="dialog-clear"]',function(){var params=$(this).data();$('#'+params.id).val('');$('#'+params.id+'_text').val('');var event=gdoo.event.get(params.id);event.trigger('clear',params);});// 弹出对话框表单
|
||
$document.on('click.dialog.view','[data-toggle="dialog-view"]',function(){var params=$(this).data();var query={};$.each(params,function(k,v){if(k=='url'||k=='title'||k=='toggle'){return true;}query[k]=v;});var iframe_name=window.name;if(iframe_name){query.iframe_id=iframe_name.replace('iframe_','');}var option=gdoo.formKey(params);var event=gdoo.event.get(option.key);event.trigger('open',params,query);var url=params['url'];var title=params['title'];var url=app.url(url,query);top.$.dialog({title:title,url:url,dialogClass:'modal-lg',buttons:[{text:"确定",'class':"btn-default",click:function click(){var me=this;var list=gdoo.dialogs[option.id]||{};if(typeof list.writeSelected=='function'){var ret=list.writeSelected();if(ret===true){$(this).dialog("close");}}else{$(this).dialog("close");}}}]});});var gdoo_dialog_input=$document.find('.gdoo-dialog-input');if(gdoo_dialog_input.length){gdoo_dialog_input.gdooDialogInput();}// 弹出对话框表单
|
||
$document.on('click.dialog.image','[data-toggle="dialog-image"]',function(){var params=$(this).data();$.dialog({title:params.title,html:'<img style="text-align:center;max-width:100%;" src="'+params.url+'" />',buttons:[{text:'确定','class':'btn-default',click:function click(){$(this).dialog("close");}}]});});// 弹出对话框表单
|
||
$document.on('click.dialog.form','[data-toggle="dialog-form"]',function(){var params=$(this).data();params.id=params.id||'myform';params.size=params.size||'md';$.dialog({title:params.title,url:params.url,dialogClass:'modal-'+params.size,buttons:[{text:'取消',"class":'btn-default',click:function click(){var me=this;if(typeof error==='function'){error.call(me,res);}else{$(me).dialog("close");}}},{text:'保存',"class":'btn-info',click:function click(){var me=this;var action=$('#'+params.id).attr('action');var formData=$('#'+params.id).serialize();$.post(action,formData,function(res){if(typeof success==='function'){success.call(me,res);}else{if(res.status){if(res.data=='reload'){window.location.reload();}else{toastrSuccess(res.data);$(me).dialog('close');}}else{toastrError(res.data);}}},'json');}}]});});// 日期选择
|
||
$document.on('click.date','[data-toggle="date"]',function(){var data=$(this).data();var ops={};ops['dateFmt']=data['format']||'yyyy-MM-dd';var onpicked=window[this.id+'.onpicked'];if(typeof onpicked=='function'){ops['onpicked']=onpicked;}if(data['dchanging']){ops['dchanging']=data['dchanging'];}datePicker(ops);});// 日期时间选项
|
||
$document.on('click.datetime','[data-toggle="datetime"]',function(){var data=$(this).data();var ops={};ops['dateFmt']=data['format']||'yyyy-MM-dd';if(data['dchanging']){ops['dchanging']=data['dchanging'];}datePicker(ops);});// 关闭layerFrame
|
||
$document.on('click.frame.close','[data-toggle="layer-frame-close"]',function(){layerFrameClose();});// 打开layerFrame
|
||
$document.on('click.frame.url','[data-toggle="layer-frame-url"]',function(){var url=$(this).data('url');var title=$(this).data('title')||false;var skin=$(this).data('skin')||'frame';var close=$(this).data('close')||false;var index=layer.open({skin:'layui-layer-'+skin,scrollbar:false,closeBtn:close,title:title,type:2,move:false,area:['100%','100%'],content:url});});// 打开tabFrame
|
||
$document.on('click.tab.frame','[data-toggle="tab-frame-url"]',function(){var url=$(this).data('url');var id=$(this).data('id');var name=$(this).data('name');top.addTab(url,id,name);});// 媒体管理删除
|
||
$document.on('click','[data-toggle="media-delete"]',function(){var me=this;var media=$(me).parent();var rows=$(me).closest('.media-controller').find('.media-item');if(rows.length>1){media.remove();}else{media.find('img').attr('src',app.url('assets/images/nopic.jpg'));media.find('input').val('');}});$('a.image-show').hover(function(e){var params=$(this).data();var img=$('<p id="image"><img src="'+params.url+'" alt="" /></p>');$("body").append(img);$(this).find('img').stop().fadeTo('slow',0.5);var $window=$(window);var $image=$(document).find('#image');var height=$image.height();var width=$image.width();var left=$window.scrollLeft()+($window.width()-width)/2+'px';var top=$window.scrollTop()+($window.height()-height)/2+'px';var offset=$(this).offset();$image.css({left:offset.left+100,top:top});$image.fadeIn('fast');},function(){$(this).find('img').stop().fadeTo('slow',1);$("#image").remove();});// 表格拖动排序
|
||
$('#table-sortable tbody').sortable({// opacity: 0.6,
|
||
delay:50,cursor:"move",axis:"y",items:"tr",handle:'td.move',// containmentType:"parent",
|
||
// placeholder: "ui-sortable-placeholder",
|
||
helper:function helper(event,ui){// 在拖动时,拖动行的cell(单元格)宽度会发生改变。
|
||
ui.children().each(function(){$(this).width($(this).width());});return ui;},stop:function stop(event,ui){},start:function start(event,ui){ui.placeholder.outerHeight(ui.item.outerHeight());},update:function update(){var url=$(this).parent().attr('url');var orders=$(this).sortable("toArray");$.post(url,{sort:orders},function(res){toastrSuccess(res.data);});}});//.disableSelection();
|
||
});var app={/**
|
||
* 确认窗口
|
||
*/confirm:function confirm(url,content,title){title=title||'操作警告';$.messager.confirm(title,content,function(btn){if(btn==true){location.href=url;}});},/**
|
||
* 警告窗口
|
||
*/alert:function alert(title,content){$.messager.alert(title,content);},/**
|
||
* 获取附带基本路径的URL
|
||
*/url:function url(uri,params){if(uri=='/'){return settings.public_url;}query=params==''||params===undefined?'':'?'+$.param(params);return settings.public_url+'/'+uri+query;},redirect:function redirect(uri,params){return window.location.href=app.url(uri,params);},/**
|
||
* 汉字转换为拼音
|
||
*/pinyin:function pinyin(read,write,type){type=type||'first';var field=$('#'+write).val();if(field==''){$.get(app.url('index/api/pinyin?type='+type+'&id='+Math.random()),{name:$('#'+read).val()},function(data){$('#'+write).val(data);});}}};var uploader={file:function file(fileId){var id=$('#'+fileId).find(".id").val();location.href=app.url('index/attachment/download',{id:id});},cancel:function cancel(fileId){var id=$('#'+fileId).find(".id").val();if(id>0){var name=$('#'+fileId).find(".file-name a").text();$.messager.confirm('删除文件','确定要删除 <strong>'+name+'</strong> 此文件吗',function(btn){if(btn==true){$.get(app.url('index/attachment/delete'),{id:id},function(res){if(res==1){$('#'+fileId).remove();}});}});}else{$('#'+fileId).remove();}},insert:function insert(fileId){var id=$('#'+fileId).find(".id").val();var name=$('#'+fileId).find(".file-name a").text();// 检查图片类型
|
||
if(/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(name)){var html='<img src="'+app.url('index/attachment/show',{id:id})+'" title="'+name+'">';}else{var html='<a href="'+app.url('index/attachment/download',{id:id})+'" title="'+name+'">'+name+'</a>';}UE.getEditor("content").execCommand('insertHtml',html);}};/**
|
||
* 媒体对话框
|
||
*/function mediaDialog(url,name,id,multi){var params={id:id,name:name,multi:multi};var url=app.url(url,params);$.dialog({title:'媒体管理',url:url,dialogClass:'modal-lg',buttons:[{text:'<i class="fa fa-remove"></i> 取消','class':"btn-default",click:function click(){$(this).dialog('close');}},{text:'<i class="fa fa-check"></i> 确定','class':"btn-info",click:function click(){if(window.saveMedia){window.saveMedia.call(this,params);$(this).dialog('close');}}}]});}/**
|
||
* 显示窗口
|
||
*/function viewBox(name,title,url,size){size=size||'md';$.dialog({title:title,url:url,dialogClass:'modal-'+size,buttons:[{text:"确定",'class':"btn-default",click:function click(){$(this).dialog("close");}}]});}var viewDialogIndex=0;/**
|
||
* 表单窗口
|
||
*/function viewDialog(options){if(options.id===undefined){options.id='view-dialog-'+viewDialogIndex;viewDialogIndex++;}var exist=$('#modal-'+options.id);if(exist.length>0){exist.dialog('show');}var defaults={title:name,url:url,buttons:[{text:'确定','class':'btn-default',click:function click(){$(this).dialog('close');}}]};var settings=$.extend({},defaults,options);$.dialog(settings);}var formDialogIndex=0;/**
|
||
* 表单窗口
|
||
*/function formDialog(options){if(options.id===undefined){options.id='form-dialog-'+formDialogIndex;formDialogIndex++;}var exist=$('#modal-'+options.id);if(exist.length>0){exist.dialog('show');}else{var defaults={title:'formDialog',backdrop:'static',buttons:[{text:'取消',"class":'btn-default',click:function click(){var me=this;if(typeof error==='function'){error.call(me);}else{$(me).dialog("close");}}},{text:'保存',"class":'btn-info',click:function click(){var me=this;var options=me.options;// 自定义提交函数
|
||
if(typeof options.onSubmit==='function'){options.onSubmit.call(me);}else{// 默认提交方法
|
||
if(me.options.storeUrl){var action=me.options.storeUrl;}else{var action=$('#'+options.id).attr('action');}var query=$('#'+options.id).serialize();// 循环子表
|
||
var gets=gridListData(options.table);if(gets===false){return;}var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*120});$.post(action,query+'&'+$.param(gets),function(res){if(res.status){if(typeof options.success==='function'){options.success.call(me,res);}}else{if(typeof options.error==='function'){options.error.call(me,res);}}},'json').complete(function(){layer.close(loading);});}}}]};var settings=$.extend({},defaults,options);$.dialog(settings);}}/**
|
||
* 转换时间,计算差值
|
||
*/function niceTime(timestamp){// 当前时间戳
|
||
var nowtime=new Date().getTime();// 计算时间戳差值
|
||
var secondNum=parseInt((nowtime-timestamp*1000)/1000);if(secondNum>=0&&secondNum<60){return secondNum+'秒前';}else if(secondNum>=60&&secondNum<3600){var nTime=parseInt(secondNum/60);return nTime+'分钟前';}else if(secondNum>=3600&&secondNum<3600*24){var nTime=parseInt(secondNum/3600);return nTime+'小时前';}else{var nTime=parseInt(secondNum/86400);return nTime+'天前';}}/**
|
||
* 首字母大写
|
||
*/function ucfirst(str){if(str){return str[0].toUpperCase()+str.substr(1);}else{return str;}}/**
|
||
* 数字金额大写转换(可以处理整数,小数,负数)
|
||
*/function digitUppercase(n){var fraction=['角','分'];var digit=['零','壹','贰','叁','肆','伍','陆','柒','捌','玖'];var unit=[['元','万','亿'],['','拾','佰','仟']];var head=n<0?'欠':'';n=Math.abs(n);var s='';for(var i=0;i<fraction.length;i++){s+=(digit[Math.floor(n*10*Math.pow(10,i))%10]+fraction[i]).replace(/零./,'');}s=s||'整';n=Math.floor(n);for(var i=0;i<unit[0].length&&n>0;i++){var p='';for(var j=0;j<unit[1].length&&n>0;j++){p=digit[n%10]+unit[1][j]+p;n=Math.floor(n/10);}s=p.replace(/(零.)*零$/,'').replace(/^$/,'零')+unit[0][i]+s;}return head+s.replace(/(零.)*零元/,'元').replace(/(零.)+/g,'零').replace(/^整$/,'零元整');};/**
|
||
* 数字格式化
|
||
*/function number_format(number,decimals,decPoint,thousandsSep){number=(number+'').replace(/[^0-9+\-Ee.]/g,'');var n=!isFinite(+number)?0:+number;var prec=!isFinite(+decimals)?0:Math.abs(decimals);var sep=typeof thousandsSep==='undefined'?',':thousandsSep;var dec=typeof decPoint==='undefined'?'.':decPoint;var s='';var toFixedFix=function toFixedFix(n,prec){if((''+n).indexOf('e')===-1){return+(Math.round(n+'e+'+prec)+'e-'+prec);}else{var arr=(''+n).split('e');var sig='';if(+arr[1]+prec>0){sig='+';}return(+(Math.round(+arr[0]+'e'+sig+(+arr[1]+prec))+'e-'+prec)).toFixed(prec);}};// @todo: for IE parseFloat(0.55).toFixed(0) = 0;
|
||
s=(prec?toFixedFix(n,prec).toString():''+Math.round(n)).split('.');if(s[0].length>3){s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,sep);}if((s[1]||'').length<prec){s[1]=s[1]||'';s[1]+=new Array(prec-s[1].length+1).join('0');}return s.join(dec);}/**
|
||
* 检查变量是否为空
|
||
*/function isEmpty(val){try{if(val==''||val==null||val==undefined){return true;}// 判断数字是否是NaN
|
||
if(typeof val==="number"){if(isNaN(val)){return true;}else{return false;}}// 判断参数是否是布尔、函数、日期、正则,是则返回false
|
||
if(typeof val==="boolean"||typeof val==="function"||val instanceof Date||val instanceof RegExp){return false;}//判断参数是否是字符串,去空,如果长度为0则返回true
|
||
if(typeof val==="string"){if(val.trim().length==0){return true;}else{return false;}}if(_typeof2(val)==='object'){// 判断参数是否是数组,数组为空则返回true
|
||
if(val instanceof Array){if(val.length==0){return true;}else{return false;}}//判断参数是否是对象,判断是否是空对象,是则返回true
|
||
if(val instanceof Object){//判断对象属性个数
|
||
if(Object.getOwnPropertyNames(val).length==0){return true;}else{return false;}}}}catch(e){return false;}}/**
|
||
* 检查变量是否不为空
|
||
*/function isNotEmpty(value){return!isEmpty(value);}/**
|
||
* 清除字符串两边的空格
|
||
*/String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');};/**
|
||
* 封装全部替换字符串
|
||
*/String.prototype.replaceAll=function(search,replace){return this.replace(new RegExp(search,"gm"),replace);};/**
|
||
* 正则去掉所有的html标记
|
||
* @param {*} str
|
||
*/function delHtmlTag(str){return str.replace(/<[^>]+>/g,"");}function isWeiXin(){var ua=window.navigator.userAgent.toLowerCase();if(ua.match(/MicroMessenger/i)=='micromessenger'){return true;}else{return false;}}function toastrSuccess(content){if(isWeiXin()){$.toastr('success',content);}else{top.$.toastr('success',content);}}function toastrError(content){if(isWeiXin()){$.toastr('error',content);}else{top.$.toastr('error',content);}}function url(uri,params){query=params==''||params===undefined?'':'?'+$.param(params);return settings.public_url+'/'+uri+query;}/**
|
||
* 时间戳格式化
|
||
*/function format_datetime(value){function add0(v){return v<10?'0'+v:v;}value=parseInt(value)*1000;var time=new Date(value);var y=time.getFullYear();var m=time.getMonth()+1;var d=time.getDate();var h=time.getHours();var mm=time.getMinutes();var s=time.getSeconds();return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm);}/**
|
||
* 时间戳格式化
|
||
*/function format_date(value){function add0(v){return v<10?'0'+v:v;}value=parseInt(value)*1000;var time=new Date(value);var y=time.getFullYear();var m=time.getMonth()+1;var d=time.getDate();var h=time.getHours();var mm=time.getMinutes();var s=time.getSeconds();return y+'-'+add0(m)+'-'+add0(d);}/**
|
||
* ajax 提交
|
||
* @param {*} table
|
||
* @param {*} callback
|
||
*/function ajaxSubmit(table,callback){// 监听提交事件
|
||
$('#'+table+'-form-submit').on('click',function(){var me=$('#'+table);var url=me.attr('action');var data=me.serialize();var rows={};var rows=gridListData(table);if(rows===false){return;}data=data+'&'+$.param(rows);var loading=layer.msg('数据提交中...',{icon:16,shade:0.1,time:1000*120});$.post(url,data,function(res){if(typeof callback==='function'){callback(res);}else{if(res.status){toastrSuccess(res.data);if(res.url){self.location.href=res.url;}}else{toastrError(res.data);}}},'json').complete(function(){layer.close(loading);});return false;});}function layerFrameClose(){var index=parent.layer.getFrameIndex(window.name);parent.layer.close(index);}/**
|
||
* 格式化文件大小
|
||
* @param {*} fileSize
|
||
*/function fileFormatSize(fileSize){if(fileSize<1024){return fileSize+'B';}else if(fileSize<1024*1024){var temp=fileSize/1024;temp=temp.toFixed(2);return temp+'KB';}else if(fileSize<1024*1024*1024){var temp=fileSize/(1024*1024);temp=temp.toFixed(2);return temp+'MB';}else{var temp=fileSize/(1024*1024*1024);temp=temp.toFixed(2);return temp+'GB';}}/**
|
||
* 扫码上传功能
|
||
*/function FindFile(inputId,key){$.post(app.url('index/attachment/draft'),{key:key},function(data){var qrArray=[];var fileDraft="#fileDraft_"+inputId;var items=$(fileDraft).find(".id");$.each(items,function(i,row){qrArray.push($(this).val());});$.each(data,function(i,row){if(qrArray.indexOf(row.id+"")==-1){row.size=fileFormatSize(row.size);var html=template("uploader-item-tpl",row);$(fileDraft).append(html);}});});}/**
|
||
* 格式为数值
|
||
* @param {*} value
|
||
*/function toNumber(value){value=parseFloat(value);return isNaN(value)?0:isFinite(value)?value:0;}/**
|
||
* 实现StringBuilder
|
||
*/function StringBuilder(){this._stringArray=new Array();}StringBuilder.prototype.append=function(str){this._stringArray.push(str);};StringBuilder.prototype.appendLine=function(str){this._stringArray.push(str+"\n");};StringBuilder.prototype.toString=function(joinGap){return this._stringArray.join(joinGap);};/**
|
||
* 本地导出excel
|
||
* @param {*} grid
|
||
* @param {*} name
|
||
*/function LocalExport(grid,name){if(grid.api.getDisplayedRowCount()==0){toastrError("表格无数据,无法导出.");return;}function getColumnsTable(columns){var table=[];getColumnsRows(columns,0,table);return table;}function getColumnsRows(columns,level,table){var row=null;if(table.length>level){row=table[level];}else{row=[];table.push(row);}$.each(columns,function(name,column){var children=column['children'];if(children!=null){column['colspan']=children.length;getColumnsRows(children,level+1,table);}column['rowspan']=1;row.push(column);});}function getColumnsBottom(columns){var columnsBottom=[];$.each(columns,function(i,column){if(column['children']!=null){var children=column['children'];$.each(getColumnsBottom(children),function(j,v){columnsBottom.push(v);});}else{columnsBottom.push(column);}});return columnsBottom;}var columns=[];$.each(grid.columnDefs,function(i,column){if(column['checkboxSelection']==true){return;}if(column['cellRenderer']=='"actionCellRenderer"'){return;}columns.push(column);});var columnsBottom=getColumnsBottom(columns);var columnsTable=getColumnsTable(columns);console.log("开始导出任务:"+name);var sb=new StringBuilder();// 写出列名
|
||
var columnsCount=columnsTable.length-1;$.each(columnsTable,function(i,rows){var columnsRow=rows;sb.appendLine('<tr style="font-weight:bold;white-space:nowrap;">');$.each(columnsRow,function(j,column){var rowspan=toNumber(column['rowspan']);var colspan=toNumber(column['colspan']);if(columnsCount>i){if(column['children']==null){rowspan=rowspan+(i+1);}}var s='<td colspan="'+colspan+'" rowspan="'+rowspan+'"';var style=['text-align:center'];if(column['headerName']=='序号'){style.push('mso-number-format:\'@\'');}s=s+' style="'+style.join(';')+'"';s=s+'>'+column['headerName']+'</td>';sb.appendLine(s);});sb.appendLine('</tr>');});// 写出数据
|
||
var count=0;grid.api.forEachNode(function(rowNode,index){var row=rowNode.data;sb.append("<tr>");count++;$.each(columnsBottom,function(n,column){var value;if(column['field']==null){value='';}else{value=row[column['field']]||'';}if(column['cellRenderer']=='htmlCellRenderer'){value=delHtmlTag(value);}if(column['headerName']=='序号'){value=count;}var style=[];if(column.type=="number"){var options=column.numberOptions||{};var places=options.places==undefined?2:options.places;value=parseFloat(value);value=isNaN(value)?0:value.toFixed(places);}else if(column.form_type=='date'){}else{style.push('mso-number-format:\'@\'');}sb.appendLine('<td style="'+style.join(';')+'">'+value+'</td>');});sb.appendLine("</tr>");});console.log("结束导出任务:"+name);var worksheet='Sheet1';var excel=sb.toString(" ");// 下载的表格模板数据
|
||
var template='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+'xmlns:x="urn:schemas-microsoft-com:office:excel" '+'xmlns="http://www.w3.org/TR/REC-html40">'+'<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>'+'<x:Name>'+worksheet+'</x:Name>'+'<x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>'+'</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->'+'</head><body><table>'+excel+'</table></body></html>';// 保存文件到本地
|
||
function saveShareContent(content,fileName){var downLink=document.createElement('a');downLink.download=fileName;// 字符内容转换为blod地址
|
||
var blob=new Blob([content]);downLink.href=URL.createObjectURL(blob);// 链接插入到页面
|
||
document.body.appendChild(downLink);downLink.click();// 移除下载链接
|
||
document.body.removeChild(downLink);}var d=new Date();var date=[d.getFullYear(),d.getMonth()+1,d.getDate()].join('-');saveShareContent(template,name+"-"+date+".xls");}/**
|
||
* 导出普通table成xls
|
||
* @param {*} id
|
||
* @param {*} name
|
||
*/function LocalTableExport(id,name){var table=$('#'+id);var preserveColors=table.hasClass('table2excel_with_colors')?true:false;var d=new Date();var date=[d.getFullYear(),d.getMonth()+1,d.getDate()].join('-');table.table2excel({exclude:".noExl",name:name,filename:name+date+".xls",fileext:".xls",exclude_img:true,exclude_links:true,exclude_inputs:true,preserveColors:preserveColors});}/**
|
||
* 选择行政区域
|
||
*/function regionSelect(){var params=arguments;var a={'a1':'省','a2':'市','a3':'县'};function getRegion(id,layer,parent_id,value){$.get(app.url('index/api/region',{layer:layer,parent_id:parent_id}),function(res){var option='';$.map(res,function(row){option+='<option value="'+row.id+'">'+row.name+'</option>';});var e=$('#'+id).html(option);if(value>0){e.val(value);}});}$('#'+params[0]).on('change',function(){getRegion(params[1],2,this.value,0);$('#'+params[1]).html('<option value="">'+a['a'+2]+'</option>');$('#'+params[2]).html('<option value="">'+a['a'+3]+'</option>');});$('#'+params[1]).on('change',function(){getRegion(params[2],3,this.value,0);$('#'+params[2]).html('<option value="">'+a['a'+3]+'</option>');});getRegion(params[0],1,0,params[3]);if(params[3]){getRegion(params[1],2,params[3],params[4]);if(params[4]){getRegion(params[2],3,params[4],params[5]);}}};
|