upgrade to requirejs - warning the copy in demo is only a partial upgrade to fix the immediate text loading issue
This commit is contained in:
parent
b91f4d0941
commit
57f1c2bf95
2 changed files with 56 additions and 40 deletions
|
|
@ -13,16 +13,20 @@ setInterval: false, importScripts: false, jQuery: false */
|
||||||
var require, define;
|
var require, define;
|
||||||
(function () {
|
(function () {
|
||||||
//Change this version number for each release.
|
//Change this version number for each release.
|
||||||
var version = "0.14.5",
|
var version = "0.14.5+",
|
||||||
empty = {}, s,
|
empty = {}, s,
|
||||||
i, defContextName = "_", contextLoads = [],
|
i, defContextName = "_", contextLoads = [],
|
||||||
scripts, script, rePkg, src, m, dataMain, cfg = {}, setReadyState,
|
scripts, script, rePkg, src, m, dataMain, cfg = {}, setReadyState,
|
||||||
readyRegExp = /^(complete|loaded)$/,
|
|
||||||
commentRegExp = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
|
commentRegExp = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
|
||||||
cjsRequireRegExp = /require\(["']([\w-_\.\/]+)["']\)/g,
|
cjsRequireRegExp = /require\(["']([\w\!\-_\.\/]+)["']\)/g,
|
||||||
main,
|
main,
|
||||||
isBrowser = !!(typeof window !== "undefined" && navigator && document),
|
isBrowser = !!(typeof window !== "undefined" && navigator && document),
|
||||||
isWebWorker = !isBrowser && typeof importScripts !== "undefined",
|
isWebWorker = !isBrowser && typeof importScripts !== "undefined",
|
||||||
|
//PS3 indicates loaded and complete, but need to wait for complete
|
||||||
|
//specifically. Sequence is "loading", "loaded", execution,
|
||||||
|
// then "complete". The UA check is unfortunate, but not sure how
|
||||||
|
//to feature test w/o causing perf issues.
|
||||||
|
readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ? /^complete$/ : /^(complete|loaded)$/,
|
||||||
ostring = Object.prototype.toString,
|
ostring = Object.prototype.toString,
|
||||||
ap = Array.prototype,
|
ap = Array.prototype,
|
||||||
aps = ap.slice, scrollIntervalId, req, baseElement,
|
aps = ap.slice, scrollIntervalId, req, baseElement,
|
||||||
|
|
@ -882,12 +886,12 @@ var require, define;
|
||||||
}
|
}
|
||||||
contextName = contextName || s.ctxName;
|
contextName = contextName || s.ctxName;
|
||||||
|
|
||||||
var ret, context = s.contexts[contextName];
|
var ret, context = s.contexts[contextName], nameProps;
|
||||||
|
|
||||||
//Normalize module name, if it contains . or ..
|
//Normalize module name, if it contains . or ..
|
||||||
moduleName = req.normalizeName(moduleName, relModuleName, context);
|
nameProps = req.splitPrefix(moduleName, relModuleName, context);
|
||||||
|
|
||||||
ret = context.defined[moduleName];
|
ret = context.defined[nameProps.name];
|
||||||
if (ret === undefined) {
|
if (ret === undefined) {
|
||||||
req.onError(new Error("require: module name '" +
|
req.onError(new Error("require: module name '" +
|
||||||
moduleName +
|
moduleName +
|
||||||
|
|
@ -940,7 +944,7 @@ var require, define;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
req.jsExtRegExp = /\.js$/;
|
req.jsExtRegExp = /^\/|:|\?|\.js$/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a relative module name, like ./something, normalize it to
|
* Given a relative module name, like ./something, normalize it to
|
||||||
|
|
@ -955,12 +959,10 @@ var require, define;
|
||||||
//Adjust any relative paths.
|
//Adjust any relative paths.
|
||||||
var part;
|
var part;
|
||||||
if (name.charAt(0) === ".") {
|
if (name.charAt(0) === ".") {
|
||||||
if (!baseName) {
|
//If have a base name, try to normalize against it,
|
||||||
req.onError(new Error("Cannot normalize module name: " +
|
//otherwise, assume it is a top-level require that will
|
||||||
name +
|
//be relative to baseUrl in the end.
|
||||||
", no relative module name available."));
|
if (baseName) {
|
||||||
}
|
|
||||||
|
|
||||||
if (context.config.packages[baseName]) {
|
if (context.config.packages[baseName]) {
|
||||||
//If the baseName is a package name, then just treat it as one
|
//If the baseName is a package name, then just treat it as one
|
||||||
//name to concat the name with.
|
//name to concat the name with.
|
||||||
|
|
@ -981,12 +983,21 @@ var require, define;
|
||||||
name.splice(i, 1);
|
name.splice(i, 1);
|
||||||
i -= 1;
|
i -= 1;
|
||||||
} else if (part === "..") {
|
} else if (part === "..") {
|
||||||
|
if (i === 1) {
|
||||||
|
//End of the line. Keep at least one non-dot
|
||||||
|
//path segment at the front so it can be mapped
|
||||||
|
//correctly to disk. Otherwise, there is likely
|
||||||
|
//no path mapping for '..'.
|
||||||
|
break;
|
||||||
|
} else if (i > 1) {
|
||||||
name.splice(i - 1, 2);
|
name.splice(i - 1, 2);
|
||||||
i -= 2;
|
i -= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
name = name.join("/");
|
name = name.join("/");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return name;
|
return name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1035,7 +1046,7 @@ var require, define;
|
||||||
//If a colon is in the URL, it indicates a protocol is used and it is just
|
//If a colon is in the URL, it indicates a protocol is used and it is just
|
||||||
//an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
|
//an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
|
||||||
//The slash is important for protocol-less URLs as well as full paths.
|
//The slash is important for protocol-less URLs as well as full paths.
|
||||||
if (moduleName.indexOf(":") !== -1 || moduleName.charAt(0) === '/' || req.jsExtRegExp.test(moduleName)) {
|
if (req.jsExtRegExp.test(moduleName)) {
|
||||||
//Just a plain path, not module name lookup, so just return it.
|
//Just a plain path, not module name lookup, so just return it.
|
||||||
//Add extension if it is included. This is a bit wonky, only non-.js things pass
|
//Add extension if it is included. This is a bit wonky, only non-.js things pass
|
||||||
//an extension, this method probably needs to be reworked.
|
//an extension, this method probably needs to be reworked.
|
||||||
|
|
@ -1078,6 +1089,11 @@ var require, define;
|
||||||
config.urlArgs) : url;
|
config.urlArgs) : url;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//In async environments, checkLoaded can get called a few times in the same
|
||||||
|
//call stack. Allow only one to do the finishing work. Set to false
|
||||||
|
//for sync environments.
|
||||||
|
req.blockCheckLoaded = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if all modules for a context are loaded, and if so, evaluates the
|
* Checks if all modules for a context are loaded, and if so, evaluates the
|
||||||
* new ones in right dependency order.
|
* new ones in right dependency order.
|
||||||
|
|
@ -1119,7 +1135,7 @@ var require, define;
|
||||||
//by calling a waiting callback that then calls require and then this function
|
//by calling a waiting callback that then calls require and then this function
|
||||||
//should not proceed. At the end of this function, if there are still things
|
//should not proceed. At the end of this function, if there are still things
|
||||||
//waiting, then checkLoaded will be called again.
|
//waiting, then checkLoaded will be called again.
|
||||||
context.isCheckLoaded = true;
|
context.isCheckLoaded = req.blockCheckLoaded;
|
||||||
|
|
||||||
//Grab waiting and loaded lists here, since it could have changed since
|
//Grab waiting and loaded lists here, since it could have changed since
|
||||||
//this function was first called.
|
//this function was first called.
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 819c4e7b9b1e6e5f99696b5c9f2805891a9e7cfd
|
Subproject commit 0095dc028d0e6f3d40587071fa67622930aa880e
|
||||||
Loading…
Add table
Add a link
Reference in a new issue