/** * Sea.js 3.0.0 | seajs.org/LICENSE.md */ (function(global, undefined) { // Avoid conflicting when `sea.js` is loaded multiple times if (global.seajs) { return } var seajs = global.seajs = { // The current version of Sea.js being used version: "3.0.0" } var data = seajs.data = {} /** * util-lang.js - The minimal language enhancement */ function isType(type) { return function(obj) { return {}.toString.call(obj) == "[object " + type + "]" } } var isObject = isType("Object") var isString = isType("String") var isArray = Array.isArray || isType("Array") var isFunction = isType("Function") var _cid = 0 function cid() { return _cid++ } /** * util-events.js - The minimal events support */ var events = data.events = {} // Bind event seajs.on = function(name, callback) { var list = events[name] || (events[name] = []) list.push(callback) return seajs } // Remove event. If `callback` is undefined, remove all callbacks for the // event. If `event` and `callback` are both undefined, remove all callbacks // for all events seajs.off = function(name, callback) { // Remove *all* events if (!(name || callback)) { events = data.events = {} return seajs } var list = events[name] if (list) { if (callback) { for (var i = list.length - 1; i >= 0; i--) { if (list[i] === callback) { list.splice(i, 1) } } } else { delete events[name] } } return seajs } // Emit event, firing all bound callbacks. Callbacks receive the same // arguments as `emit` does, apart from the event name var emit = seajs.emit = function(name, data) { var list = events[name] if (list) { // Copy callback lists to prevent modification list = list.slice() // Execute event callbacks, use index because it's the faster. for(var i = 0, len = list.length; i < len; i++) { list[i](data) } } return seajs } /** * util-path.js - The utilities for operating path such as id, uri */ var DIRNAME_RE = /[^?#]*\// var DOT_RE = /\/\.\//g var DOUBLE_DOT_RE = /\/[^/]+\/\.\.\// var MULTI_SLASH_RE = /([^:/])\/+\//g // Extract the directory portion of a path // dirname("a/b/c.js?t=123#xx/zz") ==> "a/b/" // ref: http://jsperf.com/regex-vs-split/2 function dirname(path) { return path.match(DIRNAME_RE)[0] } // Canonicalize a path // realpath("http://test.com/a//./b/../c") ==> "http://test.com/a/c" function realpath(path) { // /a/b/./c/./d ==> /a/b/c/d path = path.replace(DOT_RE, "/") /* @author wh1100717 a//b/c ==> a/b/c a///b/////c ==> a/b/c DOUBLE_DOT_RE matches a/b/c//../d path correctly only if replace // with / first */ path = path.replace(MULTI_SLASH_RE, "$1/") // a/b/c/../../d ==> a/b/../d ==> a/d while (path.match(DOUBLE_DOT_RE)) { path = path.replace(DOUBLE_DOT_RE, "/") } return path } // Normalize an id // normalize("path/to/a") ==> "path/to/a.js" // NOTICE: substring is faster than negative slice and RegExp function normalize(path) { var last = path.length - 1 var lastC = path.charCodeAt(last) // If the uri ends with `#`, just return it without '#' if (lastC === 35 /* "#" */) { return path.substring(0, last) } return (path.substring(last - 2) === ".js" || path.indexOf("?") > 0 || lastC === 47 /* "/" */) ? path : path + ".js" } var PATHS_RE = /^([^/:]+)(\/.+)$/ var VARS_RE = /{([^{]+)}/g function parseAlias(id) { var alias = data.alias return alias && isString(alias[id]) ? alias[id] : id } function parsePaths(id) { var paths = data.paths var m if (paths && (m = id.match(PATHS_RE)) && isString(paths[m[1]])) { id = paths[m[1]] + m[2] } return id } function parseVars(id) { var vars = data.vars if (vars && id.indexOf("{") > -1) { id = id.replace(VARS_RE, function(m, key) { return isString(vars[key]) ? vars[key] : m }) } return id } function parseMap(uri) { var map = data.map var ret = uri if (map) { for (var i = 0, len = map.length; i < len; i++) { var rule = map[i] ret = isFunction(rule) ? (rule(uri) || uri) : uri.replace(rule[0], rule[1]) // Only apply the first matched rule if (ret !== uri) break } } return ret } var ABSOLUTE_RE = /^\/\/.|:\// var ROOT_DIR_RE = /^.*?\/\/.*?\// function addBase(id, refUri) { var ret var first = id.charCodeAt(0) // Absolute if (ABSOLUTE_RE.test(id)) { ret = id } // Relative else if (first === 46 /* "." */) { ret = (refUri ? dirname(refUri) : data.cwd) + id } // Root else if (first === 47 /* "/" */) { var m = data.cwd.match(ROOT_DIR_RE) ret = m ? m[0] + id.substring(1) : id } // Top-level else { ret = data.base + id } // Add default protocol when uri begins with "//" if (ret.indexOf("//") === 0) { ret = location.protocol + ret } return realpath(ret) } function id2Uri(id, refUri) { if (!id) return "" id = parseAlias(id) id = parsePaths(id) id = parseAlias(id) id = parseVars(id) id = parseAlias(id) id = normalize(id) id = parseAlias(id) var uri = addBase(id, refUri) uri = parseAlias(uri) uri = parseMap(uri) return uri } // For Developers seajs.resolve = id2Uri; // Check environment var isWebWorker = typeof window === 'undefined' && typeof importScripts !== 'undefined' && isFunction(importScripts); // Ignore about:xxx and blob:xxx var IGNORE_LOCATION_RE = /^(about|blob):/; var loaderDir; // Sea.js's full path var loaderPath; // Location is read-only from web worker, should be ok though var cwd = (!location.href || IGNORE_LOCATION_RE.test(location.href)) ? '' : dirname(location.href); if (isWebWorker) { // Web worker doesn't create DOM object when loading scripts // Get sea.js's path by stack trace. var stack; try { var up = new Error(); throw up; } catch (e) { // IE won't set Error.stack until thrown stack = e.stack.split('\n'); } // First line is 'Error' stack.shift(); var m; // Try match `url:row:col` from stack trace line. Known formats: // Chrome: ' at http://localhost:8000/script/sea-worker-debug.js:294:25' // FireFox: '@http://localhost:8000/script/sea-worker-debug.js:1082:1' // IE11: ' at Anonymous function (http://localhost:8000/script/sea-worker-debug.js:295:5)' // Don't care about older browsers since web worker is an HTML5 feature var TRACE_RE = /.*?((?:http|https|file)(?::\/{2}[\w]+)(?:[\/|\.]?)(?:[^\s"]*)).*?/i // Try match `url` (Note: in IE there will be a tailing ')') var URL_RE = /(.*?):\d+:\d+\)?$/; // Find url of from stack trace. // Cannot simply read the first one because sometimes we will get: // Error // at Error (native) <- Here's your problem // at http://localhost:8000/_site/dist/sea.js:2:4334 <- What we want // at http://localhost:8000/_site/dist/sea.js:2:8386 // at http://localhost:8000/_site/tests/specs/web-worker/worker.js:3:1 while (stack.length > 0) { var top = stack.shift(); m = TRACE_RE.exec(top); if (m != null) { break; } } var url; if (m != null) { // Remove line number and column number // No need to check, can't be wrong at this point var url = URL_RE.exec(m[1])[1]; } // Set loaderPath = url // Set loaderDir loaderDir = dirname(url || cwd); // This happens with inline worker. // When entrance script's location.href is a blob url, // cwd will not be available. // Fall back to loaderDir. if (cwd === '') { cwd = loaderDir; } } else { var doc = document var scripts = doc.scripts // Recommend to add `seajsnode` id for the `sea.js` script element var loaderScript = doc.getElementById("seajsnode") || scripts[scripts.length - 1] function getScriptAbsoluteSrc(node) { return node.hasAttribute ? // non-IE6/7 node.src : // see http://msdn.microsoft.com/en-us/library/ms536429(VS.85).aspx node.getAttribute("src", 4) } loaderPath = getScriptAbsoluteSrc(loaderScript) // When `sea.js` is inline, set loaderDir to current working directory loaderDir = dirname(loaderPath || cwd) } /** * util-request.js - The utilities for requesting script and style files * ref: tests/research/load-js-css/test.html */ if (isWebWorker) { function requestFromWebWorker(url, callback, charset) { // Load with importScripts var error; try { importScripts(url); } catch (e) { error = e; } callback(error); } // For Developers seajs.request = requestFromWebWorker; } else { var doc = document var head = doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement var baseElement = head.getElementsByTagName("base")[0] var currentlyAddingScript function request(url, callback, charset) { var node = doc.createElement("script") if (charset) { var cs = isFunction(charset) ? charset(url) : charset if (cs) { node.charset = cs } } addOnload(node, callback, url) node.async = true node.src = url // For some cache cases in IE 6-8, the script executes IMMEDIATELY after // the end of the insert execution, so use `currentlyAddingScript` to // hold current node, for deriving url in `define` call currentlyAddingScript = node // ref: #185 & http://dev.jquery.com/ticket/2709 baseElement ? head.insertBefore(node, baseElement) : head.appendChild(node) currentlyAddingScript = null } function addOnload(node, callback, url) { var supportOnload = "onload" in node if (supportOnload) { node.onload = onload node.onerror = function() { emit("error", { uri: url, node: node }) onload(true) } } else { node.onreadystatechange = function() { if (/loaded|complete/.test(node.readyState)) { onload() } } } function onload(error) { // Ensure only run once and handle memory leak in IE node.onload = node.onerror = node.onreadystatechange = null // Remove the script to reduce memory leak if (!data.debug) { head.removeChild(node) } // Dereference the node node = null callback(error) } } // For Developers seajs.request = request } var interactiveScript function getCurrentScript() { if (currentlyAddingScript) { return currentlyAddingScript } // For IE6-9 browsers, the script onload event may not fire right // after the script is evaluated. Kris Zyp found that it // could query the script nodes and the one that is in "interactive" // mode indicates the current script // ref: http://goo.gl/JHfFW if (interactiveScript && interactiveScript.readyState === "interactive") { return interactiveScript } var scripts = head.getElementsByTagName("script") for (var i = scripts.length - 1; i >= 0; i--) { var script = scripts[i] if (script.readyState === "interactive") { interactiveScript = script return interactiveScript } } } /** * util-deps.js - The parser for dependencies * ref: tests/research/parse-dependencies/test.html * ref: https://github.com/seajs/searequire */ function parseDependencies(s) { if(s.indexOf('require') == -1) { return [] } var index = 0, peek, length = s.length, isReg = 1, modName = 0, parentheseState = 0, parentheseStack = [], res = [] while(index < length) { readch() if(isBlank()) { } else if(isQuote()) { dealQuote() isReg = 1 } else if(peek == '/') { readch() if(peek == '/') { index = s.indexOf('\n', index) if(index == -1) { index = s.length } } else if(peek == '*') { index = s.indexOf('*/', index) if(index == -1) { index = length } else { index += 2 } } else if(isReg) { dealReg() isReg = 0 } else { index-- isReg = 1 } } else if(isWord()) { dealWord() } else if(isNumber()) { dealNumber() } else if(peek == '(') { parentheseStack.push(parentheseState) isReg = 1 } else if(peek == ')') { isReg = parentheseStack.pop() } else { isReg = peek != ']' modName = 0 } } return res function readch() { peek = s.charAt(index++) } function isBlank() { return /\s/.test(peek) } function isQuote() { return peek == '"' || peek == "'" } function dealQuote() { var start = index var c = peek var end = s.indexOf(c, start) if(end == -1) { index = length } else if(s.charAt(end - 1) != '\\') { index = end + 1 } else { while(index < length) { readch() if(peek == '\\') { index++ } else if(peek == c) { break } } } if(modName) { res.push(s.slice(start, index - 1)) modName = 0 } } function dealReg() { index-- while(index < length) { readch() if(peek == '\\') { index++ } else if(peek == '/') { break } else if(peek == '[') { while(index < length) { readch() if(peek == '\\') { index++ } else if(peek == ']') { break } } } } } function isWord() { return /[a-z_$]/i.test(peek) } function dealWord() { var s2 = s.slice(index - 1) var r = /^[\w$]+/.exec(s2)[0] parentheseState = { 'if': 1, 'for': 1, 'while': 1, 'with': 1 }[r] isReg = { 'break': 1, 'case': 1, 'continue': 1, 'debugger': 1, 'delete': 1, 'do': 1, 'else': 1, 'false': 1, 'if': 1, 'in': 1, 'instanceof': 1, 'return': 1, 'typeof': 1, 'void': 1 }[r] modName = /^require\s*\(\s*(['"]).+?\1\s*\)/.test(s2) if(modName) { r = /^require\s*\(\s*['"]/.exec(s2)[0] index += r.length - 2 } else { index += /^[\w$]+(?:\s*\.\s*[\w$]+)*/.exec(s2)[0].length - 1 } } function isNumber() { return /\d/.test(peek) || peek == '.' && /\d/.test(s.charAt(index)) } function dealNumber() { var s2 = s.slice(index - 1) var r if(peek == '.') { r = /^\.\d+(?:E[+-]?\d*)?\s*/i.exec(s2)[0] } else if(/^0x[\da-f]*/i.test(s2)) { r = /^0x[\da-f]*\s*/i.exec(s2)[0] } else { r = /^\d+\.?\d*(?:E[+-]?\d*)?\s*/i.exec(s2)[0] } index += r.length - 1 isReg = 0 } } /** * module.js - The core of module loader */ var cachedMods = seajs.cache = {} var anonymousMeta var fetchingList = {} var fetchedList = {} var callbackList = {} var STATUS = Module.STATUS = { // 1 - The `module.uri` is being fetched FETCHING: 1, // 2 - The meta data has been saved to cachedMods SAVED: 2, // 3 - The `module.dependencies` are being loaded LOADING: 3, // 4 - The module are ready to execute LOADED: 4, // 5 - The module is being executed EXECUTING: 5, // 6 - The `module.exports` is available EXECUTED: 6, // 7 - 404 ERROR: 7 } function Module(uri, deps) { this.uri = uri this.dependencies = deps || [] this.deps = {} // Ref the dependence modules this.status = 0 this._entry = [] } // Resolve module.dependencies Module.prototype.resolve = function() { var mod = this var ids = mod.dependencies var uris = [] for (var i = 0, len = ids.length; i < len; i++) { uris[i] = Module.resolve(ids[i], mod.uri) } return uris } Module.prototype.pass = function() { var mod = this var len = mod.dependencies.length for (var i = 0; i < mod._entry.length; i++) { var entry = mod._entry[i] var count = 0 for (var j = 0; j < len; j++) { var m = mod.deps[mod.dependencies[j]] // If the module is unload and unused in the entry, pass entry to it if (m.status < STATUS.LOADED && !entry.history.hasOwnProperty(m.uri)) { entry.history[m.uri] = true count++ m._entry.push(entry) if(m.status === STATUS.LOADING) { m.pass() } } } // If has passed the entry to it's dependencies, modify the entry's count and del it in the module if (count > 0) { entry.remain += count - 1 mod._entry.shift() i-- } } } // Load module.dependencies and fire onload when all done Module.prototype.load = function() { var mod = this // If the module is being loaded, just wait it onload call if (mod.status >= STATUS.LOADING) { return } mod.status = STATUS.LOADING // Emit `load` event for plugins such as combo plugin var uris = mod.resolve() emit("load", uris) for (var i = 0, len = uris.length; i < len; i++) { mod.deps[mod.dependencies[i]] = Module.get(uris[i]) } // Pass entry to it's dependencies mod.pass() // If module has entries not be passed, call onload if (mod._entry.length) { mod.onload() return } // Begin parallel loading var requestCache = {} var m for (i = 0; i < len; i++) { m = cachedMods[uris[i]] if (m.status < STATUS.FETCHING) { m.fetch(requestCache) } else if (m.status === STATUS.SAVED) { m.load() } } // Send all requests at last to avoid cache bug in IE6-9. Issues#808 for (var requestUri in requestCache) { if (requestCache.hasOwnProperty(requestUri)) { requestCache[requestUri]() } } } // Call this method when module is loaded Module.prototype.onload = function() { var mod = this mod.status = STATUS.LOADED // When sometimes cached in IE, exec will occur before onload, make sure len is an number for (var i = 0, len = (mod._entry || []).length; i < len; i++) { var entry = mod._entry[i] if (--entry.remain === 0) { entry.callback() } } delete mod._entry } // Call this method when module is 404 Module.prototype.error = function() { var mod = this mod.onload() mod.status = STATUS.ERROR } // Execute a module Module.prototype.exec = function () { var mod = this // When module is executed, DO NOT execute it again. When module // is being executed, just return `module.exports` too, for avoiding // circularly calling if (mod.status >= STATUS.EXECUTING) { return mod.exports } mod.status = STATUS.EXECUTING if (mod._entry && !mod._entry.length) { delete mod._entry } //non-cmd module has no property factory and exports if (!mod.hasOwnProperty('factory')) { mod.non = true return } // Create require var uri = mod.uri function require(id) { var m = mod.deps[id] || Module.get(require.resolve(id)) if (m.status == STATUS.ERROR) { throw new Error('module was broken: ' + m.uri); } return m.exec() } require.resolve = function(id) { return Module.resolve(id, uri) } require.async = function(ids, callback) { Module.use(ids, callback, uri + "_async_" + cid()) return require } // Exec factory var factory = mod.factory var exports = isFunction(factory) ? factory(require, mod.exports = {}, mod) : factory if (exports === undefined) { exports = mod.exports } // Reduce memory leak delete mod.factory mod.exports = exports mod.status = STATUS.EXECUTED // Emit `exec` event emit("exec", mod) return mod.exports } // Fetch a module Module.prototype.fetch = function(requestCache) { var mod = this var uri = mod.uri mod.status = STATUS.FETCHING // Emit `fetch` event for plugins such as combo plugin var emitData = { uri: uri } emit("fetch", emitData) var requestUri = emitData.requestUri || uri // Empty uri or a non-CMD module if (!requestUri || fetchedList.hasOwnProperty(requestUri)) { mod.load() return } if (fetchingList.hasOwnProperty(requestUri)) { callbackList[requestUri].push(mod) return } fetchingList[requestUri] = true callbackList[requestUri] = [mod] // Emit `request` event for plugins such as text plugin emit("request", emitData = { uri: uri, requestUri: requestUri, onRequest: onRequest, charset: isFunction(data.charset) ? data.charset(requestUri) || 'utf-8' : data.charset }) if (!emitData.requested) { requestCache ? requestCache[emitData.requestUri] = sendRequest : sendRequest() } function sendRequest() { seajs.request(emitData.requestUri, emitData.onRequest, emitData.charset) } function onRequest(error) { delete fetchingList[requestUri] fetchedList[requestUri] = true // Save meta data of anonymous module if (anonymousMeta) { Module.save(uri, anonymousMeta) anonymousMeta = null } // Call callbacks var m, mods = callbackList[requestUri] delete callbackList[requestUri] while ((m = mods.shift())) { // When 404 occurs, the params error will be true if(error === true) { m.error() } else { m.load() } } } } // Resolve id to uri Module.resolve = function(id, refUri) { // Emit `resolve` event for plugins such as text plugin var emitData = { id: id, refUri: refUri } emit("resolve", emitData) return emitData.uri || seajs.resolve(emitData.id, refUri) } // Define a module Module.define = function (id, deps, factory) { var argsLen = arguments.length // define(factory) if (argsLen === 1) { factory = id id = undefined } else if (argsLen === 2) { factory = deps // define(deps, factory) if (isArray(id)) { deps = id id = undefined } // define(id, factory) else { deps = undefined } } // Parse dependencies according to the module factory code if (!isArray(deps) && isFunction(factory)) { deps = typeof parseDependencies === "undefined" ? [] : parseDependencies(factory.toString()) } var meta = { id: id, uri: Module.resolve(id), deps: deps, factory: factory } // Try to derive uri in IE6-9 for anonymous modules if (!isWebWorker && !meta.uri && doc.attachEvent && typeof getCurrentScript !== "undefined") { var script = getCurrentScript() if (script) { meta.uri = script.src } // NOTE: If the id-deriving methods above is failed, then falls back // to use onload event to get the uri } // Emit `define` event, used in nocache plugin, seajs node version etc emit("define", meta) meta.uri ? Module.save(meta.uri, meta) : // Save information for "saving" work in the script onload event anonymousMeta = meta } // Save meta data to cachedMods Module.save = function(uri, meta) { var mod = Module.get(uri) // Do NOT override already saved modules if (mod.status < STATUS.SAVED) { mod.id = meta.id || uri mod.dependencies = meta.deps || [] mod.factory = meta.factory mod.status = STATUS.SAVED emit("save", mod) } } // Get an existed module or create a new one Module.get = function(uri, deps) { return cachedMods[uri] || (cachedMods[uri] = new Module(uri, deps)) } // Use function is equal to load a anonymous module Module.use = function (ids, callback, uri) { var mod = Module.get(uri, isArray(ids) ? ids : [ids]) mod._entry.push(mod) mod.history = {} mod.remain = 1 mod.callback = function() { var exports = [] var uris = mod.resolve() for (var i = 0, len = uris.length; i < len; i++) { exports[i] = cachedMods[uris[i]].exec() } if (callback) { callback.apply(global, exports) } delete mod.callback delete mod.history delete mod.remain delete mod._entry } mod.load() } // Public API seajs.use = function(ids, callback) { Module.use(ids, callback, data.cwd + "_use_" + cid()) return seajs } Module.define.cmd = {} global.define = Module.define // For Developers seajs.Module = Module data.fetchedList = fetchedList data.cid = cid seajs.require = function(id) { var mod = Module.get(Module.resolve(id)) if (mod.status < STATUS.EXECUTING) { mod.onload() mod.exec() } return mod.exports } /** * config.js - The configuration for the loader */ // The root path to use for id2uri parsing data.base = loaderDir // The loader directory data.dir = loaderDir // The loader's full path data.loader = loaderPath // The current working directory data.cwd = cwd // The charset for requesting files data.charset = "utf-8" // data.alias - An object containing shorthands of module id // data.paths - An object containing path shorthands in module id // data.vars - The {xxx} variables in module id // data.map - An array containing rules to map module uri // data.debug - Debug mode. The default value is false seajs.config = function(configData) { for (var key in configData) { var curr = configData[key] var prev = data[key] // Merge object config such as alias, vars if (prev && isObject(prev)) { for (var k in curr) { prev[k] = curr[k] } } else { // Concat array config such as map if (isArray(prev)) { curr = prev.concat(curr) } // Make sure that `data.base` is an absolute path else if (key === "base") { // Make sure end with "/" if (curr.slice(-1) !== "/") { curr += "/" } curr = addBase(curr) } // Set config data[key] = curr } } emit("config", configData) return seajs } })(this);(function(){ /** * seajs-combo * The Sea.js plugin for concatenating HTTP requests */ var Module = seajs.Module var FETCHING = Module.STATUS.FETCHING var data = seajs.data var comboHash = data.comboHash = {} var comboSyntax = ["??", ","] var comboMaxLength = 2000 var comboExcludes var comboSuffix seajs.on("load", setComboHash) seajs.on("fetch", setRequestUri) function setComboHash(uris) { var len = uris.length if (len < 2) { return } data.comboSyntax && (comboSyntax = data.comboSyntax) data.comboMaxLength && (comboMaxLength = data.comboMaxLength) data.comboSuffix && (comboSuffix = data.comboSuffix) comboExcludes = data.comboExcludes var needComboUris = [] for (var i = 0; i < len; i++) { var uri = uris[i] if (comboHash[uri]) { continue } var mod = Module.get(uri) // Remove fetching and fetched uris, excluded uris, combo uris if (mod.status < FETCHING && !isExcluded(uri) && !isComboUri(uri)) { needComboUris.push(uri) } } if (needComboUris.length > 1) { paths2hash(uris2paths(needComboUris)) } } function setRequestUri(data) { data.requestUri = comboHash[data.uri] || data.uri } // Helpers function uris2paths(uris) { return meta2paths(uris2meta(uris)) } // [ // "http://example.com/p/a.js", // "https://example2.com/b.js", // "http://example.com/p/c/d.js", // "http://example.com/p/c/e.js" // ] // ==> // { // "http__example.com": { // "p": { // "a.js": { __KEYS: [] }, // "c": { // "d.js": { __KEYS: [] }, // "e.js": { __KEYS: [] }, // __KEYS: ["d.js", "e.js"] // }, // __KEYS: ["a.js", "c"] // }, // __KEYS: ["p"] // }, // "https__example2.com": { // "b.js": { __KEYS: [] }, // _KEYS: ["b.js"] // }, // __KEYS: ["http__example.com", "https__example2.com"] // } function uris2meta(uris) { var meta = { __KEYS: [] } for (var i = 0, len = uris.length; i < len; i++) { var parts = uris[i].replace("://", "__").split("/") var m = meta for (var j = 0, l = parts.length; j < l; j++) { var part = parts[j] if (!m[part]) { m[part] = { __KEYS: [] } m.__KEYS.push(part) } m = m[part] } } return meta } // { // "http__example.com": { // "p": { // "a.js": { __KEYS: [] }, // "c": { // "d.js": { __KEYS: [] }, // "e.js": { __KEYS: [] }, // __KEYS: ["d.js", "e.js"] // }, // __KEYS: ["a.js", "c"] // }, // __KEYS: ["p"] // }, // "https__example2.com": { // "b.js": { __KEYS: [] }, // _KEYS: ["b.js"] // }, // __KEYS: ["http__example.com", "https__example2.com"] // } // ==> // [ // ["http://example.com/p", ["a.js", "c/d.js", "c/e.js"]] // ] function meta2paths(meta) { var paths = [] var __KEYS = meta.__KEYS for (var i = 0, len = __KEYS.length; i < len; i++) { var part = __KEYS[i] var root = part var m = meta[part] var KEYS = m.__KEYS while (KEYS.length === 1) { root += "/" + KEYS[0] m = m[KEYS[0]] KEYS = m.__KEYS } if (KEYS.length) { paths.push([root.replace("__", "://"), meta2arr(m)]) } } return paths } // { // "a.js": { __KEYS: [] }, // "c": { // "d.js": { __KEYS: [] }, // "e.js": { __KEYS: [] }, // __KEYS: ["d.js", "e.js"] // }, // __KEYS: ["a.js", "c"] // } // ==> // [ // "a.js", "c/d.js", "c/e.js" // ] function meta2arr(meta) { var arr = [] var __KEYS = meta.__KEYS for (var i = 0, len = __KEYS.length; i < len; i++) { var key = __KEYS[i] var r = meta2arr(meta[key]) // key = "c" // r = ["d.js", "e.js"] var m = r.length if (m) { for (var j = 0; j < m; j++) { arr.push(key + "/" + r[j]) } } else { arr.push(key) } } return arr } // [ // [ "http://example.com/p", ["a.js", "c/d.js", "c/e.js", "a.css", "b.css"] ] // ] // ==> // // a hash cache // // "http://example.com/p/a.js" ==> "http://example.com/p/??a.js,c/d.js,c/e.js" // "http://example.com/p/c/d.js" ==> "http://example.com/p/??a.js,c/d.js,c/e.js" // "http://example.com/p/c/e.js" ==> "http://example.com/p/??a.js,c/d.js,c/e.js" // "http://example.com/p/a.css" ==> "http://example.com/p/??a.css,b.css" // "http://example.com/p/b.css" ==> "http://example.com/p/??a.css,b.css" // function paths2hash(paths) { for (var i = 0, len = paths.length; i < len; i++) { var path = paths[i] var root = path[0] + "/" var group = files2group(path[1]) for (var j = 0, m = group.length; j < m; j++) { setHash(root, group[j]) } } return comboHash } function setHash(root, files) { var copy = [] for (var i = 0, len = files.length; i < len; i++) { copy[i] = files[i].replace(/\?.*$/, '') } var comboPath = root + comboSyntax[0] + copy.join(comboSyntax[1]) if(comboSuffix) { comboPath += comboSuffix } var exceedMax = comboPath.length > comboMaxLength // http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url if (files.length > 1 && exceedMax) { var parts = splitFiles(files, comboMaxLength - (root + comboSyntax[0]).length) setHash(root, parts[0]) setHash(root, parts[1]) } else { if (exceedMax) { throw new Error("The combo url is too long: " + comboPath) } for (var i = 0, len = files.length; i < len; i++) { comboHash[root + files[i]] = comboPath } } } function splitFiles(files, filesMaxLength) { var sep = comboSyntax[1] var s = files[0] for (var i = 1, len = files.length; i < len; i++) { s += sep + files[i] if (s.length > filesMaxLength) { return [files.splice(0, i), files] } } } // // ["a.js", "c/d.js", "c/e.js", "a.css", "b.css", "z"] // ==> // [ ["a.js", "c/d.js", "c/e.js"], ["a.css", "b.css"] ] // function files2group(files) { var group = [] var hash = {} for (var i = 0, len = files.length; i < len; i++) { var file = files[i] var ext = getExt(file) if (ext) { (hash[ext] || (hash[ext] = [])).push(file) } } for (var k in hash) { if (hash.hasOwnProperty(k)) { group.push(hash[k]) } } return group } function getExt(file) { var p = file.lastIndexOf(".") return p >= 0 ? file.substring(p) : "" } function isExcluded(uri) { if (comboExcludes) { return comboExcludes.test ? comboExcludes.test(uri) : comboExcludes(uri) } } function isComboUri(uri) { var comboSyntax = data.comboSyntax || ["??", ","] var s1 = comboSyntax[0] var s2 = comboSyntax[1] return s1 && uri.indexOf(s1) > 0 || s2 && uri.indexOf(s2) > 0 } // For test if (data.test) { var test = seajs.test || (seajs.test = {}) test.uris2paths = uris2paths test.paths2hash = paths2hash } define("seajs/seajs-combo", [], {}); })();/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license //@ sourceMappingURL=jquery.min.map */(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
t |