UNPKG

aurelia-bootstrap

Version:
1,484 lines (1,483 loc) 229 kB
/* */ "format cjs"; (function(process) { (function(window, undefined) { var readyList, rootjQuery, core_strundefined = typeof undefined, document = window.document, location = window.location, _jQuery = window.jQuery, _$ = window.$, class2type = {}, core_deletedIds = [], core_version = "1.9.1", core_concat = core_deletedIds.concat, core_push = core_deletedIds.push, core_slice = core_deletedIds.slice, core_indexOf = core_deletedIds.indexOf, core_toString = class2type.toString, core_hasOwn = class2type.hasOwnProperty, core_trim = core_version.trim, jQuery = function(selector, context) { return new jQuery.fn.init(selector, context, rootjQuery); }, core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, core_rnotwhite = /\S+/g, rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, rvalidchars = /^[\],:{}\s]*$/, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, fcamelCase = function(all, letter) { return letter.toUpperCase(); }, completed = function(event) { if (document.addEventListener || event.type === "load" || document.readyState === "complete") { detach(); jQuery.ready(); } }, detach = function() { if (document.addEventListener) { document.removeEventListener("DOMContentLoaded", completed, false); window.removeEventListener("load", completed, false); } else { document.detachEvent("onreadystatechange", completed); window.detachEvent("onload", completed); } }; jQuery.fn = jQuery.prototype = { jquery: core_version, constructor: jQuery, init: function(selector, context, rootjQuery) { var match, elem; if (!selector) { return this; } if (typeof selector === "string") { if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) { match = [null, selector, null]; } else { match = rquickExpr.exec(selector); } if (match && (match[1] || !context)) { if (match[1]) { context = context instanceof jQuery ? context[0] : context; jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true)); if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) { for (match in context) { if (jQuery.isFunction(this[match])) { this[match](context[match]); } else { this.attr(match, context[match]); } } } return this; } else { elem = document.getElementById(match[2]); if (elem && elem.parentNode) { if (elem.id !== match[2]) { return rootjQuery.find(selector); } this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } } else if (!context || context.jquery) { return (context || rootjQuery).find(selector); } else { return this.constructor(context).find(selector); } } else if (selector.nodeType) { this.context = this[0] = selector; this.length = 1; return this; } else if (jQuery.isFunction(selector)) { return rootjQuery.ready(selector); } if (selector.selector !== undefined) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray(selector, this); }, selector: "", length: 0, size: function() { return this.length; }, toArray: function() { return core_slice.call(this); }, get: function(num) { return num == null ? this.toArray() : (num < 0 ? this[this.length + num] : this[num]); }, pushStack: function(elems) { var ret = jQuery.merge(this.constructor(), elems); ret.prevObject = this; ret.context = this.context; return ret; }, each: function(callback, args) { return jQuery.each(this, callback, args); }, ready: function(fn) { jQuery.ready.promise().done(fn); return this; }, slice: function() { return this.pushStack(core_slice.apply(this, arguments)); }, first: function() { return this.eq(0); }, last: function() { return this.eq(-1); }, eq: function(i) { var len = this.length, j = +i + (i < 0 ? len : 0); return this.pushStack(j >= 0 && j < len ? [this[j]] : []); }, map: function(callback) { return this.pushStack(jQuery.map(this, function(elem, i) { return callback.call(elem, i, elem); })); }, end: function() { return this.prevObject || this.constructor(null); }, push: core_push, sort: [].sort, splice: [].splice }; jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { var src, copyIsArray, copy, name, options, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; if (typeof target === "boolean") { deep = target; target = arguments[1] || {}; i = 2; } if (typeof target !== "object" && !jQuery.isFunction(target)) { target = {}; } if (length === i) { target = this; --i; } for (; i < length; i++) { if ((options = arguments[i]) != null) { for (name in options) { src = target[name]; copy = options[name]; if (target === copy) { continue; } if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) { if (copyIsArray) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } target[name] = jQuery.extend(deep, clone, copy); } else if (copy !== undefined) { target[name] = copy; } } } } return target; }; jQuery.extend({ noConflict: function(deep) { if (window.$ === jQuery) { window.$ = _$; } if (deep && window.jQuery === jQuery) { window.jQuery = _jQuery; } return jQuery; }, isReady: false, readyWait: 1, holdReady: function(hold) { if (hold) { jQuery.readyWait++; } else { jQuery.ready(true); } }, ready: function(wait) { if (wait === true ? --jQuery.readyWait : jQuery.isReady) { return; } if (!document.body) { return setTimeout(jQuery.ready); } jQuery.isReady = true; if (wait !== true && --jQuery.readyWait > 0) { return; } readyList.resolveWith(document, [jQuery]); if (jQuery.fn.trigger) { jQuery(document).trigger("ready").off("ready"); } }, isFunction: function(obj) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function(obj) { return jQuery.type(obj) === "array"; }, isWindow: function(obj) { return obj != null && obj == obj.window; }, isNumeric: function(obj) { return !isNaN(parseFloat(obj)) && isFinite(obj); }, type: function(obj) { if (obj == null) { return String(obj); } return typeof obj === "object" || typeof obj === "function" ? class2type[core_toString.call(obj)] || "object" : typeof obj; }, isPlainObject: function(obj) { if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) { return false; } try { if (obj.constructor && !core_hasOwn.call(obj, "constructor") && !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) { return false; } } catch (e) { return false; } var key; for (key in obj) {} return key === undefined || core_hasOwn.call(obj, key); }, isEmptyObject: function(obj) { var name; for (name in obj) { return false; } return true; }, error: function(msg) { throw new Error(msg); }, 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 && []; if (parsed) { return [context.createElement(parsed[1])]; } parsed = jQuery.buildFragment([data], context, scripts); if (scripts) { jQuery(scripts).remove(); } return jQuery.merge([], parsed.childNodes); }, parseJSON: function(data) { if (window.JSON && window.JSON.parse) { return window.JSON.parse(data); } if (data === null) { return data; } if (typeof data === "string") { data = jQuery.trim(data); if (data) { if (rvalidchars.test(data.replace(rvalidescape, "@").replace(rvalidtokens, "]").replace(rvalidbraces, ""))) { return (new Function("return " + data))(); } } } jQuery.error("Invalid JSON: " + data); }, parseXML: function(data) { var xml, tmp; if (!data || typeof data !== "string") { return null; } try { if (window.DOMParser) { tmp = new DOMParser(); xml = tmp.parseFromString(data, "text/xml"); } else { 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; }, noop: function() {}, globalEval: function(data) { if (data && jQuery.trim(data)) { (window.execScript || function(data) { window["eval"].call(window, data); })(data); } }, camelCase: function(string) { return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); }, nodeName: function(elem, name) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, each: function(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; } } } } 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; }, trim: core_trim && !core_trim.call("\uFEFF\xA0") ? function(text) { return text == null ? "" : core_trim.call(text); } : function(text) { return text == null ? "" : (text + "").replace(rtrim, ""); }, makeArray: function(arr, results) { var ret = results || []; if (arr != null) { if (isArraylike(Object(arr))) { jQuery.merge(ret, typeof arr === "string" ? [arr] : arr); } else { core_push.call(ret, arr); } } return ret; }, inArray: function(elem, arr, i) { var len; if (arr) { if (core_indexOf) { return core_indexOf.call(arr, elem, i); } len = arr.length; i = i ? i < 0 ? Math.max(0, len + i) : i : 0; for (; i < len; i++) { if (i in arr && arr[i] === elem) { return i; } } } return -1; }, merge: function(first, second) { var l = second.length, i = first.length, j = 0; if (typeof l === "number") { for (; j < l; j++) { first[i++] = second[j]; } } else { while (second[j] !== undefined) { first[i++] = second[j++]; } } first.length = i; return first; }, grep: function(elems, callback, inv) { var retVal, ret = [], i = 0, length = elems.length; inv = !!inv; for (; i < length; i++) { retVal = !!callback(elems[i], i); if (inv !== retVal) { ret.push(elems[i]); } } return ret; }, map: function(elems, callback, arg) { var value, i = 0, length = elems.length, isArray = isArraylike(elems), ret = []; if (isArray) { for (; i < length; i++) { value = callback(elems[i], i, arg); if (value != null) { ret[ret.length] = value; } } } else { for (i in elems) { value = callback(elems[i], i, arg); if (value != null) { ret[ret.length] = value; } } } return core_concat.apply([], ret); }, guid: 1, proxy: function(fn, context) { var args, proxy, tmp; if (typeof context === "string") { tmp = fn[context]; context = fn; fn = tmp; } if (!jQuery.isFunction(fn)) { return undefined; } args = core_slice.call(arguments, 2); proxy = function() { return fn.apply(context || this, args.concat(core_slice.call(arguments))); }; proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, access: function(elems, fn, key, value, chainable, emptyGet, raw) { var i = 0, length = elems.length, bulk = key == null; if (jQuery.type(key) === "object") { chainable = true; for (i in key) { jQuery.access(elems, fn, i, key[i], true, emptyGet, raw); } } else if (value !== undefined) { chainable = true; if (!jQuery.isFunction(value)) { raw = true; } if (bulk) { if (raw) { fn.call(elems, value); fn = null; } else { bulk = fn; fn = function(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 : bulk ? fn.call(elems) : length ? fn(elems[0], key) : emptyGet; }, now: function() { return (new Date()).getTime(); } }); jQuery.ready.promise = function(obj) { if (!readyList) { readyList = jQuery.Deferred(); if (document.readyState === "complete") { setTimeout(jQuery.ready); } else if (document.addEventListener) { document.addEventListener("DOMContentLoaded", completed, false); window.addEventListener("load", completed, false); } else { document.attachEvent("onreadystatechange", completed); window.attachEvent("onload", completed); var top = false; try { top = window.frameElement == null && document.documentElement; } catch (e) {} if (top && top.doScroll) { (function doScrollCheck() { if (!jQuery.isReady) { try { top.doScroll("left"); } catch (e) { return setTimeout(doScrollCheck, 50); } detach(); jQuery.ready(); } })(); } } } return readyList.promise(obj); }; jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { class2type["[object " + name + "]"] = name.toLowerCase(); }); function isArraylike(obj) { var length = obj.length, type = jQuery.type(obj); if (jQuery.isWindow(obj)) { return false; } if (obj.nodeType === 1 && length) { return true; } return type === "array" || type !== "function" && (length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj); } rootjQuery = jQuery(document); var optionsCache = {}; function createOptions(options) { var object = optionsCache[options] = {}; jQuery.each(options.match(core_rnotwhite) || [], function(_, flag) { object[flag] = true; }); return object; } jQuery.Callbacks = function(options) { options = typeof options === "string" ? (optionsCache[options] || createOptions(options)) : jQuery.extend({}, options); var firing, memory, fired, firingLength, firingIndex, firingStart, list = [], stack = !options.once && [], fire = function(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; break; } } firing = false; if (list) { if (stack) { if (stack.length) { fire(stack.shift()); } } else if (memory) { list = []; } else { self.disable(); } } }, self = { add: function() { if (list) { 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") { add(arg); } }); })(arguments); if (firing) { firingLength = list.length; } else if (memory) { firingStart = start; fire(memory); } } return this; }, remove: function() { if (list) { jQuery.each(arguments, function(_, arg) { var index; while ((index = jQuery.inArray(arg, list, index)) > -1) { list.splice(index, 1); if (firing) { if (index <= firingLength) { firingLength--; } if (index <= firingIndex) { firingIndex--; } } } }); } return this; }, has: function(fn) { return fn ? jQuery.inArray(fn, list) > -1 : !!(list && list.length); }, empty: function() { list = []; return this; }, disable: function() { list = stack = memory = undefined; return this; }, disabled: function() { return !list; }, lock: function() { stack = undefined; if (!memory) { self.disable(); } return this; }, locked: function() { return !stack; }, fireWith: function(context, args) { args = args || []; args = [context, args.slice ? args.slice() : args]; if (list && (!fired || stack)) { if (firing) { stack.push(args); } else { fire(args); } } return this; }, fire: function() { self.fireWith(this, arguments); return this; }, fired: function() { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function(func) { var tuples = [["resolve", "done", jQuery.Callbacks("once memory"), "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), "rejected"], ["notify", "progress", jQuery.Callbacks("memory")]], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done(arguments).fail(arguments); return this; }, then: function() { var fns = arguments; return jQuery.Deferred(function(newDefer) { jQuery.each(tuples, function(i, tuple) { var action = tuple[0], fn = jQuery.isFunction(fns[i]) && fns[i]; 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[action + "With"](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments); } }); }); fns = null; }).promise(); }, promise: function(obj) { return obj != null ? jQuery.extend(obj, promise) : promise; } }, deferred = {}; promise.pipe = promise.then; jQuery.each(tuples, function(i, tuple) { var list = tuple[2], stateString = tuple[3]; promise[tuple[1]] = list.add; if (stateString) { list.add(function() { state = stateString; }, tuples[i ^ 1][2].disable, tuples[2][2].lock); } deferred[tuple[0]] = function() { deferred[tuple[0] + "With"](this === deferred ? promise : this, arguments); return this; }; deferred[tuple[0] + "With"] = list.fireWith; }); promise.promise(deferred); if (func) { func.call(deferred, deferred); } return deferred; }, when: function(subordinate) { var i = 0, resolveValues = core_slice.call(arguments), length = resolveValues.length, remaining = length !== 1 || (subordinate && jQuery.isFunction(subordinate.promise)) ? length : 0, deferred = remaining === 1 ? subordinate : jQuery.Deferred(), updateFunc = function(i, contexts, values) { return function(value) { contexts[i] = this; values[i] = arguments.length > 1 ? core_slice.call(arguments) : value; if (values === progressValues) { deferred.notifyWith(contexts, values); } else if (!(--remaining)) { deferred.resolveWith(contexts, values); } }; }, progressValues, progressContexts, resolveContexts; 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 (!remaining) { deferred.resolveWith(resolveContexts, resolveValues); } return deferred.promise(); } }); jQuery.support = (function() { var support, all, a, input, select, fragment, opt, eventName, isSupported, i, div = document.createElement("div"); div.setAttribute("className", "t"); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; all = div.getElementsByTagName("*"); a = div.getElementsByTagName("a")[0]; if (!all || !a || !all.length) { return {}; } select = document.createElement("select"); opt = select.appendChild(document.createElement("option")); input = div.getElementsByTagName("input")[0]; a.style.cssText = "top:1px;float:left;opacity:.5"; support = { getSetAttribute: div.className !== "t", leadingWhitespace: div.firstChild.nodeType === 3, tbody: !div.getElementsByTagName("tbody").length, htmlSerialize: !!div.getElementsByTagName("link").length, style: /top/.test(a.getAttribute("style")), hrefNormalized: a.getAttribute("href") === "/a", opacity: /^0.5/.test(a.style.opacity), cssFloat: !!a.style.cssFloat, checkOn: !!input.value, optSelected: opt.selected, enctype: !!document.createElement("form").enctype, html5Clone: document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>", boxModel: document.compatMode === "CSS1Compat", deleteExpando: true, noCloneEvent: true, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, reliableMarginRight: true, boxSizingReliable: true, pixelPosition: false }; input.checked = true; support.noCloneChecked = input.cloneNode(true).checked; select.disabled = true; support.optDisabled = !opt.disabled; try { delete div.test; } catch (e) { support.deleteExpando = false; } input = document.createElement("input"); input.setAttribute("value", ""); support.input = input.getAttribute("value") === ""; input.value = "t"; input.setAttribute("type", "radio"); support.radioValue = input.value === "t"; input.setAttribute("checked", "t"); input.setAttribute("name", "t"); fragment = document.createDocumentFragment(); fragment.appendChild(input); support.appendChecked = input.checked; support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; if (div.attachEvent) { div.attachEvent("onclick", function() { support.noCloneEvent = false; }); div.cloneNode(true).click(); } for (i in { submit: true, change: true, focusin: true }) { div.setAttribute(eventName = "on" + i, "t"); support[i + "Bubbles"] = eventName in window || div.attributes[eventName].expando === false; } div.style.backgroundClip = "content-box"; div.cloneNode(true).style.backgroundClip = ""; support.clearCloneStyle = div.style.backgroundClip === "content-box"; jQuery(function() { var container, marginDiv, tds, divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", body = document.getElementsByTagName("body")[0]; if (!body) { return; } container = document.createElement("div"); container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; body.appendChild(container).appendChild(div); div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; tds = div.getElementsByTagName("td"); tds[0].style.cssText = "padding:0;margin:0;border:0;display:none"; isSupported = (tds[0].offsetHeight === 0); tds[0].style.display = ""; tds[1].style.display = "none"; support.reliableHiddenOffsets = isSupported && (tds[0].offsetHeight === 0); div.innerHTML = ""; div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; support.boxSizing = (div.offsetWidth === 4); support.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== 1); if (window.getComputedStyle) { support.pixelPosition = (window.getComputedStyle(div, null) || {}).top !== "1%"; support.boxSizingReliable = (window.getComputedStyle(div, null) || {width: "4px"}).width === "4px"; marginDiv = div.appendChild(document.createElement("div")); marginDiv.style.cssText = div.style.cssText = divReset; marginDiv.style.marginRight = marginDiv.style.width = "0"; div.style.width = "1px"; support.reliableMarginRight = !parseFloat((window.getComputedStyle(marginDiv, null) || {}).marginRight); } if (typeof div.style.zoom !== core_strundefined) { div.innerHTML = ""; div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; support.inlineBlockNeedsLayout = (div.offsetWidth === 3); div.style.display = "block"; div.innerHTML = "<div></div>"; div.firstChild.style.width = "5px"; support.shrinkWrapBlocks = (div.offsetWidth !== 3); if (support.inlineBlockNeedsLayout) { body.style.zoom = 1; } } body.removeChild(container); container = div = tds = marginDiv = null; }); all = select = fragment = opt = a = input = null; return support; })(); var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, rmultiDash = /([A-Z])/g; function internalData(elem, name, data, pvt) { if (!jQuery.acceptData(elem)) { return; } var thisCache, ret, internalKey = jQuery.expando, getByName = typeof name === "string", isNode = elem.nodeType, cache = isNode ? jQuery.cache : elem, id = isNode ? elem[internalKey] : elem[internalKey] && internalKey; if ((!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined) { return; } if (!id) { if (isNode) { elem[internalKey] = id = core_deletedIds.pop() || jQuery.guid++; } else { id = internalKey; } } if (!cache[id]) { cache[id] = {}; if (!isNode) { cache[id].toJSON = jQuery.noop; } } if (typeof 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]; if (!pvt) { if (!thisCache.data) { thisCache.data = {}; } thisCache = thisCache.data; } if (data !== undefined) { thisCache[jQuery.camelCase(name)] = data; } if (getByName) { ret = thisCache[name]; if (ret == null) { ret = thisCache[jQuery.camelCase(name)]; } } else { ret = thisCache; } return ret; } function internalRemoveData(elem, name, pvt) { if (!jQuery.acceptData(elem)) { return; } var i, l, thisCache, isNode = elem.nodeType, cache = isNode ? jQuery.cache : elem, id = isNode ? elem[jQuery.expando] : jQuery.expando; if (!cache[id]) { return; } if (name) { thisCache = pvt ? cache[id] : cache[id].data; if (thisCache) { if (!jQuery.isArray(name)) { if (name in thisCache) { name = [name]; } else { name = jQuery.camelCase(name); if (name in thisCache) { name = [name]; } else { name = name.split(" "); } } } else { name = name.concat(jQuery.map(name, jQuery.camelCase)); } for (i = 0, l = name.length; i < l; i++) { delete thisCache[name[i]]; } if (!(pvt ? isEmptyDataObject : jQuery.isEmptyObject)(thisCache)) { return; } } } if (!pvt) { delete cache[id].data; if (!isEmptyDataObject(cache[id])) { return; } } if (isNode) { jQuery.cleanData([elem], true); } else if (jQuery.support.deleteExpando || cache != cache.window) { delete cache[id]; } else { cache[id] = null; } } jQuery.extend({ cache: {}, expando: "jQuery" + (core_version + Math.random()).replace(/\D/g, ""), noData: { "embed": true, "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", "applet": true }, hasData: function(elem) { elem = elem.nodeType ? jQuery.cache[elem[jQuery.expando]] : elem[jQuery.expando]; return !!elem && !isEmptyDataObject(elem); }, data: function(elem, name, data) { return internalData(elem, name, data); }, removeData: function(elem, name) { return internalRemoveData(elem, name); }, _data: function(elem, name, data) { return internalData(elem, name, data, true); }, _removeData: function(elem, name) { return internalRemoveData(elem, name, true); }, acceptData: function(elem) { if (elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9) { return false; } var noData = elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]; return !noData || noData !== true && elem.getAttribute("classid") === noData; } }); jQuery.fn.extend({ data: function(key, value) { var attrs, name, elem = this[0], i = 0, data = null; if (key === undefined) { if (this.length) { data = jQuery.data(elem); if (elem.nodeType === 1 && !jQuery._data(elem, "parsedAttrs")) { attrs = elem.attributes; for (; i < attrs.length; i++) { name = attrs[i].name; if (!name.indexOf("data-")) { name = jQuery.camelCase(name.slice(5)); dataAttr(elem, name, data[name]); } } jQuery._data(elem, "parsedAttrs", true); } } return data; } if (typeof key === "object") { return this.each(function() { jQuery.data(this, key); }); } return jQuery.access(this, function(value) { if (value === undefined) { return elem ? dataAttr(elem, key, jQuery.data(elem, key)) : null; } this.each(function() { jQuery.data(this, key, value); }); }, null, value, arguments.length > 1, null, true); }, removeData: function(key) { return this.each(function() { jQuery.removeData(this, key); }); } }); function dataAttr(elem, key, data) { 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 : +data + "" === data ? +data : rbrace.test(data) ? jQuery.parseJSON(data) : data; } catch (e) {} jQuery.data(elem, key, data); } else { data = undefined; } } return data; } function isEmptyDataObject(obj) { var name; for (name in obj) { if (name === "data" && jQuery.isEmptyObject(obj[name])) { continue; } if (name !== "toJSON") { return false; } } return true; } jQuery.extend({ queue: function(elem, type, data) { var queue; if (elem) { type = (type || "fx") + "queue"; queue = jQuery._data(elem, type); if (data) { if (!queue || jQuery.isArray(data)) { queue = jQuery._data(elem, type, jQuery.makeArray(data)); } else { queue.push(data); } } return queue || []; } }, dequeue: function(elem, type) { type = type || "fx"; var queue = jQuery.queue(elem, type), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks(elem, type), next = function() { jQuery.dequeue(elem, type); }; if (fn === "inprogress") { fn = queue.shift(); startLength--; } hooks.cur = fn; if (fn) { if (type === "fx") { queue.unshift("inprogress"); } delete hooks.stop; fn.call(elem, next, hooks); } if (!startLength && hooks) { hooks.empty.fire(); } }, _queueHooks: function(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(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); jQuery._queueHooks(this, type); if (type === "fx" && queue[0] !== "inprogress") { jQuery.dequeue(this, type); } }); }, dequeue: function(type) { return this.each(function() { jQuery.dequeue(this, type); }); }, 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); }; }); }, clearQueue: function(type) { return this.queue(type || "fx", []); }, promise: function(type, obj) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { 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 nodeHook, boolHook, rclass = /[\t\r\n]/g, rreturn = /\r/g, rfocusable = /^(?:input|select|textarea|button|object)$/i, rclickable = /^(?:a|area)$/i, rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, ruseDefault = /^(?:checked|selected)$/i, getSetAttribute = jQuery.support.getSetAttribute, getSetInput = jQuery.support.input; jQuery.fn.extend({ attr: function(name, value) { return jQuery.access(this, jQuery.attr, name, value, arguments.length > 1); }, removeAttr: function(name) { return this.each(function() { jQuery.removeAttr(this, name); }); }, prop: function(name, value) { return jQuery.access(this, jQuery.prop, name, value, arguments.length > 1); }, removeProp: function(name) { name = jQuery.propFix[name] || name; return this.each(function() { try { this[name] = undefined; delete this[name]; } catch (e) {} }); }, addClass: function(value) { var classes, elem, cur, clazz, j, 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) { classes = (value || "").match(core_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 + " "; } } elem.className = jQuery.trim(cur); } } } return this; }, removeClass: function(value) { var classes, elem, cur, clazz, j, 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(core_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++])) { while (cur.indexOf(" " + clazz + " ") >= 0) { cur = cur.replace(" " + clazz + " ", " "); } } elem.className = value ? jQuery.trim(cur) : ""; } } } return this; }, toggleClass: function(value, stateVal) { var type = typeof value, isBool = typeof stateVal === "boolean"; 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") { var className, i = 0, self = jQuery(this), state = stateVal, classNames = value.match(core_rnotwhite) || []; while ((className = classNames[i++])) { state = isBool ? state : !self.hasClass(className); self[state ? "addClass" : "removeClass"](className); } } else if (type === core_strundefined || type === "boolean") { if (this.className) { jQuery._data(this, "__className__", this.className); } this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || ""; } }); }, hasClass: function(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; }, val: function(value) { var ret, hooks, 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" ? ret.replace(rreturn, "") : ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction(value); return this.each(function(i) { var val, self = jQuery(this); if (this.nodeType !== 1) { return; } if (isFunction) { val = value.call(this, i, self.val()); } else { val = value; } 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 (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: {get: function(elem) { var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; }}, select: { get: function(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; for (; i < max; i++) { option = options[i]; if ((option.selected || i === index) && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) { value = jQuery(option).val(); if (one) { return value; } values.push(value); } } return values; },