mirror of https://github.com/Radarr/Radarr
updated js libraries,
require, jquery, backbone shortcuts backbone modelbinder
This commit is contained in:
parent
33aad6e8ef
commit
98df1be981
|
@ -1,4 +1,4 @@
|
||||||
// Backbone.ModelBinder v1.0.1
|
// Backbone.ModelBinder v1.0.2
|
||||||
// (c) 2013 Bart Wood
|
// (c) 2013 Bart Wood
|
||||||
// Distributed Under MIT License
|
// Distributed Under MIT License
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
// Current version of the library.
|
// Current version of the library.
|
||||||
Backbone.ModelBinder.VERSION = '1.0.1';
|
Backbone.ModelBinder.VERSION = '1.0.2';
|
||||||
Backbone.ModelBinder.Constants = {};
|
Backbone.ModelBinder.Constants = {};
|
||||||
Backbone.ModelBinder.Constants.ModelToView = 'ModelToView';
|
Backbone.ModelBinder.Constants.ModelToView = 'ModelToView';
|
||||||
Backbone.ModelBinder.Constants.ViewToModel = 'ViewToModel';
|
Backbone.ModelBinder.Constants.ViewToModel = 'ViewToModel';
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
this._options['modelSetOptions'].changeSource = 'ModelBinder';
|
this._options['modelSetOptions'].changeSource = 'ModelBinder';
|
||||||
|
|
||||||
if(!this._options['changeTriggers']){
|
if(!this._options['changeTriggers']){
|
||||||
this._options['changeTriggers'] = {'': 'change', '[contenteditable]': 'blur'};
|
this._options['changeTriggers'] = {'*': 'change', '[contenteditable]': 'blur'};
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this._options['initialCopyDirection']){
|
if(!this._options['initialCopyDirection']){
|
||||||
|
@ -240,16 +240,10 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
_unbindViewToModel: function () {
|
_unbindViewToModel: function () {
|
||||||
if (this._rootEl) {
|
if(this._options && this._options['changeTriggers']){
|
||||||
if (this._triggers) {
|
_.each(this._options['changeTriggers'], function (event, selector) {
|
||||||
_.each(this._triggers, function (event, selector) {
|
$(this._rootEl).undelegate(selector, event, this._onElChanged);
|
||||||
$(this._rootEl).undelegate(selector, event, this._onElChanged);
|
}, this);
|
||||||
}, this);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$(this._rootEl).undelegate('', 'change', this._onElChanged);
|
|
||||||
$(this._rootEl).undelegate('[contenteditable]', 'blur', this._onElChanged);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -389,7 +383,9 @@
|
||||||
break;
|
break;
|
||||||
case 'class':
|
case 'class':
|
||||||
var previousValue = this._model.previous(elementBinding.attributeBinding.attributeName);
|
var previousValue = this._model.previous(elementBinding.attributeBinding.attributeName);
|
||||||
if(!_.isUndefined(previousValue)){
|
var currentValue = this._model.get(elementBinding.attributeBinding.attributeName);
|
||||||
|
// is current value is now defined then remove the class the may have been set for the undefined value
|
||||||
|
if(!_.isUndefined(previousValue) || !_.isUndefined(currentValue)){
|
||||||
previousValue = this._getConvertedValue(Backbone.ModelBinder.Constants.ModelToView, elementBinding, previousValue);
|
previousValue = this._getConvertedValue(Backbone.ModelBinder.Constants.ModelToView, elementBinding, previousValue);
|
||||||
el.removeClass(previousValue);
|
el.removeClass(previousValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,13 @@
|
||||||
_results = [];
|
_results = [];
|
||||||
for (shortcut in _ref) {
|
for (shortcut in _ref) {
|
||||||
callback = _ref[shortcut];
|
callback = _ref[shortcut];
|
||||||
if (!_.isFunction(callback)) method = this[callback];
|
if (!_.isFunction(callback)){
|
||||||
if (!method) throw new Error("Method " + callback + " does not exist");
|
method = this[callback];
|
||||||
|
if (!method) throw new Error("Method " + callback + " does not exist");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
method = callback;
|
||||||
|
}
|
||||||
match = shortcut.match(/^(\S+)\s*(.*)$/);
|
match = shortcut.match(/^(\S+)\s*(.*)$/);
|
||||||
shortcutKey = match[1];
|
shortcutKey = match[1];
|
||||||
scope = match[2] === "" ? "all" : match[2];
|
scope = match[2] === "" ? "all" : match[2];
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
||||||
/** vim: et:ts=4:sw=4:sts=4
|
/** vim: et:ts=4:sw=4:sts=4
|
||||||
* @license RequireJS 2.1.4 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
* @license RequireJS 2.1.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
|
||||||
* Available via the MIT or new BSD license.
|
* Available via the MIT or new BSD license.
|
||||||
* see: http://github.com/jrburke/requirejs for details
|
* see: http://github.com/jrburke/requirejs for details
|
||||||
*/
|
*/
|
||||||
|
@ -12,7 +12,7 @@ var requirejs, require, define;
|
||||||
(function (global) {
|
(function (global) {
|
||||||
var req, s, head, baseElement, dataMain, src,
|
var req, s, head, baseElement, dataMain, src,
|
||||||
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
interactiveScript, currentlyAddingScript, mainScript, subPath,
|
||||||
version = '2.1.4',
|
version = '2.1.5',
|
||||||
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
|
||||||
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
|
||||||
jsSuffixRegExp = /\.js$/,
|
jsSuffixRegExp = /\.js$/,
|
||||||
|
@ -24,14 +24,14 @@ var requirejs, require, define;
|
||||||
apsp = ap.splice,
|
apsp = ap.splice,
|
||||||
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
|
//PS3 indicates loaded and complete, but need to wait for complete
|
||||||
//specifically. Sequence is 'loading', 'loaded', execution,
|
//specifically. Sequence is 'loading', 'loaded', execution,
|
||||||
// then 'complete'. The UA check is unfortunate, but not sure how
|
// then 'complete'. The UA check is unfortunate, but not sure how
|
||||||
//to feature test w/o causing perf issues.
|
//to feature test w/o causing perf issues.
|
||||||
readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
|
readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
|
||||||
/^complete$/ : /^(complete|loaded)$/,
|
/^complete$/ : /^(complete|loaded)$/,
|
||||||
defContextName = '_',
|
defContextName = '_',
|
||||||
//Oh the tragedy, detecting opera. See the usage of isOpera for reason.
|
//Oh the tragedy, detecting opera. See the usage of isOpera for reason.
|
||||||
isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
|
isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
|
||||||
contexts = {},
|
contexts = {},
|
||||||
cfg = {},
|
cfg = {},
|
||||||
|
@ -191,15 +191,21 @@ var requirejs, require, define;
|
||||||
var inCheckLoaded, Module, context, handlers,
|
var inCheckLoaded, Module, context, handlers,
|
||||||
checkLoadedTimeoutId,
|
checkLoadedTimeoutId,
|
||||||
config = {
|
config = {
|
||||||
|
//Defaults. Do not set a default for map
|
||||||
|
//config to speed up normalize(), which
|
||||||
|
//will run faster if there is no default.
|
||||||
waitSeconds: 7,
|
waitSeconds: 7,
|
||||||
baseUrl: './',
|
baseUrl: './',
|
||||||
paths: {},
|
paths: {},
|
||||||
pkgs: {},
|
pkgs: {},
|
||||||
shim: {},
|
shim: {},
|
||||||
map: {},
|
|
||||||
config: {}
|
config: {}
|
||||||
},
|
},
|
||||||
registry = {},
|
registry = {},
|
||||||
|
//registry of just enabled modules, to speed
|
||||||
|
//cycle breaking code when lots of modules
|
||||||
|
//are registered, but not activated.
|
||||||
|
enabledRegistry = {},
|
||||||
undefEvents = {},
|
undefEvents = {},
|
||||||
defQueue = [],
|
defQueue = [],
|
||||||
defined = {},
|
defined = {},
|
||||||
|
@ -295,7 +301,7 @@ var requirejs, require, define;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Apply map config if available.
|
//Apply map config if available.
|
||||||
if (applyMap && (baseParts || starMap) && map) {
|
if (applyMap && map && (baseParts || starMap)) {
|
||||||
nameParts = name.split('/');
|
nameParts = name.split('/');
|
||||||
|
|
||||||
for (i = nameParts.length; i > 0; i -= 1) {
|
for (i = nameParts.length; i > 0; i -= 1) {
|
||||||
|
@ -352,7 +358,7 @@ var requirejs, require, define;
|
||||||
if (isBrowser) {
|
if (isBrowser) {
|
||||||
each(scripts(), function (scriptNode) {
|
each(scripts(), function (scriptNode) {
|
||||||
if (scriptNode.getAttribute('data-requiremodule') === name &&
|
if (scriptNode.getAttribute('data-requiremodule') === name &&
|
||||||
scriptNode.getAttribute('data-requirecontext') === context.contextName) {
|
scriptNode.getAttribute('data-requirecontext') === context.contextName) {
|
||||||
scriptNode.parentNode.removeChild(scriptNode);
|
scriptNode.parentNode.removeChild(scriptNode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -456,8 +462,8 @@ var requirejs, require, define;
|
||||||
//normalization, stamp it with a unique ID so two matching relative
|
//normalization, stamp it with a unique ID so two matching relative
|
||||||
//ids that may conflict can be separate.
|
//ids that may conflict can be separate.
|
||||||
suffix = prefix && !pluginModule && !isNormalized ?
|
suffix = prefix && !pluginModule && !isNormalized ?
|
||||||
'_unnormalized' + (unnormalizedCounter += 1) :
|
'_unnormalized' + (unnormalizedCounter += 1) :
|
||||||
'';
|
'';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
|
@ -468,8 +474,8 @@ var requirejs, require, define;
|
||||||
originalName: originalName,
|
originalName: originalName,
|
||||||
isDefine: isDefine,
|
isDefine: isDefine,
|
||||||
id: (prefix ?
|
id: (prefix ?
|
||||||
prefix + '!' + normalizedName :
|
prefix + '!' + normalizedName :
|
||||||
normalizedName) + suffix
|
normalizedName) + suffix
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,7 +495,7 @@ var requirejs, require, define;
|
||||||
mod = getOwn(registry, id);
|
mod = getOwn(registry, id);
|
||||||
|
|
||||||
if (hasProp(defined, id) &&
|
if (hasProp(defined, id) &&
|
||||||
(!mod || mod.defineEmitComplete)) {
|
(!mod || mod.defineEmitComplete)) {
|
||||||
if (name === 'defined') {
|
if (name === 'defined') {
|
||||||
fn(defined[id]);
|
fn(defined[id]);
|
||||||
}
|
}
|
||||||
|
@ -534,7 +540,7 @@ var requirejs, require, define;
|
||||||
//local var ref to defQueue, so cannot just reassign the one
|
//local var ref to defQueue, so cannot just reassign the one
|
||||||
//on context.
|
//on context.
|
||||||
apsp.apply(defQueue,
|
apsp.apply(defQueue,
|
||||||
[defQueue.length - 1, 0].concat(globalDefQueue));
|
[defQueue.length - 1, 0].concat(globalDefQueue));
|
||||||
globalDefQueue = [];
|
globalDefQueue = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -576,6 +582,7 @@ var requirejs, require, define;
|
||||||
function cleanRegistry(id) {
|
function cleanRegistry(id) {
|
||||||
//Clean up machinery used for waiting modules.
|
//Clean up machinery used for waiting modules.
|
||||||
delete registry[id];
|
delete registry[id];
|
||||||
|
delete enabledRegistry[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
function breakCycle(mod, traced, processed) {
|
function breakCycle(mod, traced, processed) {
|
||||||
|
@ -609,7 +616,7 @@ var requirejs, require, define;
|
||||||
function checkLoaded() {
|
function checkLoaded() {
|
||||||
var map, modId, err, usingPathFallback,
|
var map, modId, err, usingPathFallback,
|
||||||
waitInterval = config.waitSeconds * 1000,
|
waitInterval = config.waitSeconds * 1000,
|
||||||
//It is possible to disable the wait interval by using waitSeconds of 0.
|
//It is possible to disable the wait interval by using waitSeconds of 0.
|
||||||
expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
|
expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
|
||||||
noLoads = [],
|
noLoads = [],
|
||||||
reqCalls = [],
|
reqCalls = [],
|
||||||
|
@ -624,7 +631,7 @@ var requirejs, require, define;
|
||||||
inCheckLoaded = true;
|
inCheckLoaded = true;
|
||||||
|
|
||||||
//Figure out the state of all the modules.
|
//Figure out the state of all the modules.
|
||||||
eachProp(registry, function (mod) {
|
eachProp(enabledRegistry, function (mod) {
|
||||||
map = mod.map;
|
map = mod.map;
|
||||||
modId = map.id;
|
modId = map.id;
|
||||||
|
|
||||||
|
@ -704,9 +711,9 @@ var requirejs, require, define;
|
||||||
this.depCount = 0;
|
this.depCount = 0;
|
||||||
|
|
||||||
/* this.exports this.factory
|
/* this.exports this.factory
|
||||||
this.depMaps = [],
|
this.depMaps = [],
|
||||||
this.enabled, this.fetched
|
this.enabled, this.fetched
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
Module.prototype = {
|
Module.prototype = {
|
||||||
|
@ -805,7 +812,7 @@ var requirejs, require, define;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks is the module is ready to define itself, and if so,
|
* Checks if the module is ready to define itself, and if so,
|
||||||
* define it.
|
* define it.
|
||||||
*/
|
*/
|
||||||
check: function () {
|
check: function () {
|
||||||
|
@ -850,9 +857,9 @@ var requirejs, require, define;
|
||||||
//favor a non-undefined return value over exports use.
|
//favor a non-undefined return value over exports use.
|
||||||
cjsModule = this.module;
|
cjsModule = this.module;
|
||||||
if (cjsModule &&
|
if (cjsModule &&
|
||||||
cjsModule.exports !== undefined &&
|
cjsModule.exports !== undefined &&
|
||||||
//Make sure it is not already the exports value
|
//Make sure it is not already the exports value
|
||||||
cjsModule.exports !== this.exports) {
|
cjsModule.exports !== this.exports) {
|
||||||
exports = cjsModule.exports;
|
exports = cjsModule.exports;
|
||||||
} else if (exports === undefined && this.usingExports) {
|
} else if (exports === undefined && this.usingExports) {
|
||||||
//exports already set the defined value.
|
//exports already set the defined value.
|
||||||
|
@ -883,7 +890,7 @@ var requirejs, require, define;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Clean up
|
//Clean up
|
||||||
delete registry[id];
|
cleanRegistry(id);
|
||||||
|
|
||||||
this.defined = true;
|
this.defined = true;
|
||||||
}
|
}
|
||||||
|
@ -905,7 +912,7 @@ var requirejs, require, define;
|
||||||
callPlugin: function () {
|
callPlugin: function () {
|
||||||
var map = this.map,
|
var map = this.map,
|
||||||
id = map.id,
|
id = map.id,
|
||||||
//Map already normalized the prefix.
|
//Map already normalized the prefix.
|
||||||
pluginMap = makeModuleMap(map.prefix);
|
pluginMap = makeModuleMap(map.prefix);
|
||||||
|
|
||||||
//Mark this as a dependency for this plugin, so it
|
//Mark this as a dependency for this plugin, so it
|
||||||
|
@ -933,7 +940,7 @@ var requirejs, require, define;
|
||||||
//prefix and name should already be normalized, no need
|
//prefix and name should already be normalized, no need
|
||||||
//for applying map config again either.
|
//for applying map config again either.
|
||||||
normalizedMap = makeModuleMap(map.prefix + '!' + name,
|
normalizedMap = makeModuleMap(map.prefix + '!' + name,
|
||||||
this.map.parentMap);
|
this.map.parentMap);
|
||||||
on(normalizedMap,
|
on(normalizedMap,
|
||||||
'defined', bind(this, function (value) {
|
'defined', bind(this, function (value) {
|
||||||
this.init([], function () { return value; }, null, {
|
this.init([], function () { return value; }, null, {
|
||||||
|
@ -1016,10 +1023,10 @@ var requirejs, require, define;
|
||||||
req.exec(text);
|
req.exec(text);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return onError(makeError('fromtexteval',
|
return onError(makeError('fromtexteval',
|
||||||
'fromText eval for ' + id +
|
'fromText eval for ' + id +
|
||||||
' failed: ' + e,
|
' failed: ' + e,
|
||||||
e,
|
e,
|
||||||
[id]));
|
[id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasInteractive) {
|
if (hasInteractive) {
|
||||||
|
@ -1049,6 +1056,7 @@ var requirejs, require, define;
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function () {
|
enable: function () {
|
||||||
|
enabledRegistry[this.map.id] = this;
|
||||||
this.enabled = true;
|
this.enabled = true;
|
||||||
|
|
||||||
//Set flag mentioning that the module is enabling,
|
//Set flag mentioning that the module is enabling,
|
||||||
|
@ -1065,9 +1073,9 @@ var requirejs, require, define;
|
||||||
//Dependency needs to be converted to a depMap
|
//Dependency needs to be converted to a depMap
|
||||||
//and wired up to this module.
|
//and wired up to this module.
|
||||||
depMap = makeModuleMap(depMap,
|
depMap = makeModuleMap(depMap,
|
||||||
(this.map.isDefine ? this.map : this.map.parentMap),
|
(this.map.isDefine ? this.map : this.map.parentMap),
|
||||||
false,
|
false,
|
||||||
!this.skipMap);
|
!this.skipMap);
|
||||||
this.depMaps[i] = depMap;
|
this.depMaps[i] = depMap;
|
||||||
|
|
||||||
handler = getOwn(handlers, depMap.id);
|
handler = getOwn(handlers, depMap.id);
|
||||||
|
@ -1208,6 +1216,7 @@ var requirejs, require, define;
|
||||||
Module: Module,
|
Module: Module,
|
||||||
makeModuleMap: makeModuleMap,
|
makeModuleMap: makeModuleMap,
|
||||||
nextTick: req.nextTick,
|
nextTick: req.nextTick,
|
||||||
|
onError: onError,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a configuration for the context.
|
* Set a configuration for the context.
|
||||||
|
@ -1234,6 +1243,9 @@ var requirejs, require, define;
|
||||||
eachProp(cfg, function (value, prop) {
|
eachProp(cfg, function (value, prop) {
|
||||||
if (objs[prop]) {
|
if (objs[prop]) {
|
||||||
if (prop === 'map') {
|
if (prop === 'map') {
|
||||||
|
if (!config.map) {
|
||||||
|
config.map = {};
|
||||||
|
}
|
||||||
mixin(config[prop], value, true, true);
|
mixin(config[prop], value, true, true);
|
||||||
} else {
|
} else {
|
||||||
mixin(config[prop], value, true);
|
mixin(config[prop], value, true);
|
||||||
|
@ -1279,8 +1291,8 @@ var requirejs, require, define;
|
||||||
//envs have different conventions: some use a module name,
|
//envs have different conventions: some use a module name,
|
||||||
//some use a file name.
|
//some use a file name.
|
||||||
main: (pkgObj.main || 'main')
|
main: (pkgObj.main || 'main')
|
||||||
.replace(currDirRegExp, '')
|
.replace(currDirRegExp, '')
|
||||||
.replace(jsSuffixRegExp, '')
|
.replace(jsSuffixRegExp, '')
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1345,7 +1357,7 @@ var requirejs, require, define;
|
||||||
//Synchronous access to one module. If require.get is
|
//Synchronous access to one module. If require.get is
|
||||||
//available (as in the Node adapter), prefer that.
|
//available (as in the Node adapter), prefer that.
|
||||||
if (req.get) {
|
if (req.get) {
|
||||||
return req.get(context, deps, relMap);
|
return req.get(context, deps, relMap, localRequire);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Normalize module name, if it contains . or ..
|
//Normalize module name, if it contains . or ..
|
||||||
|
@ -1354,10 +1366,10 @@ var requirejs, require, define;
|
||||||
|
|
||||||
if (!hasProp(defined, id)) {
|
if (!hasProp(defined, id)) {
|
||||||
return onError(makeError('notloaded', 'Module name "' +
|
return onError(makeError('notloaded', 'Module name "' +
|
||||||
id +
|
id +
|
||||||
'" has not been loaded yet for context: ' +
|
'" has not been loaded yet for context: ' +
|
||||||
contextName +
|
contextName +
|
||||||
(relMap ? '' : '. Use require([])')));
|
(relMap ? '' : '. Use require([])')));
|
||||||
}
|
}
|
||||||
return defined[id];
|
return defined[id];
|
||||||
}
|
}
|
||||||
|
@ -1396,7 +1408,7 @@ var requirejs, require, define;
|
||||||
* plain URLs like nameToUrl.
|
* plain URLs like nameToUrl.
|
||||||
*/
|
*/
|
||||||
toUrl: function (moduleNamePlusExt) {
|
toUrl: function (moduleNamePlusExt) {
|
||||||
var ext, url,
|
var ext,
|
||||||
index = moduleNamePlusExt.lastIndexOf('.'),
|
index = moduleNamePlusExt.lastIndexOf('.'),
|
||||||
segment = moduleNamePlusExt.split('/')[0],
|
segment = moduleNamePlusExt.split('/')[0],
|
||||||
isRelative = segment === '.' || segment === '..';
|
isRelative = segment === '.' || segment === '..';
|
||||||
|
@ -1408,9 +1420,8 @@ var requirejs, require, define;
|
||||||
moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
|
moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
url = context.nameToUrl(normalize(moduleNamePlusExt,
|
return context.nameToUrl(normalize(moduleNamePlusExt,
|
||||||
relMap && relMap.id, true), ext || '.fake');
|
relMap && relMap.id, true), ext, true);
|
||||||
return ext ? url : url.substring(0, url.length - 5);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
defined: function (id) {
|
defined: function (id) {
|
||||||
|
@ -1508,9 +1519,9 @@ var requirejs, require, define;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
return onError(makeError('nodefine',
|
return onError(makeError('nodefine',
|
||||||
'No define call for ' + moduleName,
|
'No define call for ' + moduleName,
|
||||||
null,
|
null,
|
||||||
[moduleName]));
|
[moduleName]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//A script that does not call define(), so just simulate
|
//A script that does not call define(), so just simulate
|
||||||
|
@ -1529,7 +1540,7 @@ var requirejs, require, define;
|
||||||
* it is assumed to have already been normalized. This is an
|
* it is assumed to have already been normalized. This is an
|
||||||
* internal API, not a public one. Use toUrl for the public API.
|
* internal API, not a public one. Use toUrl for the public API.
|
||||||
*/
|
*/
|
||||||
nameToUrl: function (moduleName, ext) {
|
nameToUrl: function (moduleName, ext, skipExt) {
|
||||||
var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
|
var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
|
||||||
parentPath;
|
parentPath;
|
||||||
|
|
||||||
|
@ -1578,13 +1589,13 @@ var requirejs, require, define;
|
||||||
|
|
||||||
//Join the path parts together, then figure out if baseUrl is needed.
|
//Join the path parts together, then figure out if baseUrl is needed.
|
||||||
url = syms.join('/');
|
url = syms.join('/');
|
||||||
url += (ext || (/\?/.test(url) ? '' : '.js'));
|
url += (ext || (/\?/.test(url) || skipExt ? '' : '.js'));
|
||||||
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
|
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
|
||||||
}
|
}
|
||||||
|
|
||||||
return config.urlArgs ? url +
|
return config.urlArgs ? url +
|
||||||
((url.indexOf('?') === -1 ? '?' : '&') +
|
((url.indexOf('?') === -1 ? '?' : '&') +
|
||||||
config.urlArgs) : url;
|
config.urlArgs) : url;
|
||||||
},
|
},
|
||||||
|
|
||||||
//Delegates to req.load. Broken out as a separate function to
|
//Delegates to req.load. Broken out as a separate function to
|
||||||
|
@ -1615,7 +1626,7 @@ var requirejs, require, define;
|
||||||
//all old browsers will be supported, but this one was easy enough
|
//all old browsers will be supported, but this one was easy enough
|
||||||
//to support and still makes sense.
|
//to support and still makes sense.
|
||||||
if (evt.type === 'load' ||
|
if (evt.type === 'load' ||
|
||||||
(readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
|
(readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
|
||||||
//Reset interactive script so a script node is not held onto for
|
//Reset interactive script so a script node is not held onto for
|
||||||
//to long.
|
//to long.
|
||||||
interactiveScript = null;
|
interactiveScript = null;
|
||||||
|
@ -1780,8 +1791,8 @@ var requirejs, require, define;
|
||||||
if (isBrowser) {
|
if (isBrowser) {
|
||||||
//In the browser so use a script tag
|
//In the browser so use a script tag
|
||||||
node = config.xhtml ?
|
node = config.xhtml ?
|
||||||
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
|
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
|
||||||
document.createElement('script');
|
document.createElement('script');
|
||||||
node.type = config.scriptType || 'text/javascript';
|
node.type = config.scriptType || 'text/javascript';
|
||||||
node.charset = 'utf-8';
|
node.charset = 'utf-8';
|
||||||
node.async = true;
|
node.async = true;
|
||||||
|
@ -1798,15 +1809,15 @@ var requirejs, require, define;
|
||||||
//UNFORTUNATELY Opera implements attachEvent but does not follow the script
|
//UNFORTUNATELY Opera implements attachEvent but does not follow the script
|
||||||
//script execution mode.
|
//script execution mode.
|
||||||
if (node.attachEvent &&
|
if (node.attachEvent &&
|
||||||
//Check if node.attachEvent is artificially added by custom script or
|
//Check if node.attachEvent is artificially added by custom script or
|
||||||
//natively supported by browser
|
//natively supported by browser
|
||||||
//read https://github.com/jrburke/requirejs/issues/187
|
//read https://github.com/jrburke/requirejs/issues/187
|
||||||
//if we can NOT find [native code] then it must NOT natively supported.
|
//if we can NOT find [native code] then it must NOT natively supported.
|
||||||
//in IE8, node.attachEvent does not have toString()
|
//in IE8, node.attachEvent does not have toString()
|
||||||
//Note the test for "[native code" with no closing brace, see:
|
//Note the test for "[native code" with no closing brace, see:
|
||||||
//https://github.com/jrburke/requirejs/issues/273
|
//https://github.com/jrburke/requirejs/issues/273
|
||||||
!(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
|
!(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
|
||||||
!isOpera) {
|
!isOpera) {
|
||||||
//Probably IE. IE (at least 6-8) do not fire
|
//Probably IE. IE (at least 6-8) do not fire
|
||||||
//script onload right after executing the script, so
|
//script onload right after executing the script, so
|
||||||
//we cannot tie the anonymous define call to a name.
|
//we cannot tie the anonymous define call to a name.
|
||||||
|
@ -1817,7 +1828,7 @@ var requirejs, require, define;
|
||||||
node.attachEvent('onreadystatechange', context.onScriptLoad);
|
node.attachEvent('onreadystatechange', context.onScriptLoad);
|
||||||
//It would be great to add an error handler here to catch
|
//It would be great to add an error handler here to catch
|
||||||
//404s in IE9+. However, onreadystatechange will fire before
|
//404s in IE9+. However, onreadystatechange will fire before
|
||||||
//the error handler, so that does not help. If addEvenListener
|
//the error handler, so that does not help. If addEventListener
|
||||||
//is used, then IE will fire error before load, but we cannot
|
//is used, then IE will fire error before load, but we cannot
|
||||||
//use that pathway given the connect.microsoft.com issue
|
//use that pathway given the connect.microsoft.com issue
|
||||||
//mentioned above about not doing the 'script execute,
|
//mentioned above about not doing the 'script execute,
|
||||||
|
@ -1846,16 +1857,24 @@ var requirejs, require, define;
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
} else if (isWebWorker) {
|
} else if (isWebWorker) {
|
||||||
//In a web worker, use importScripts. This is not a very
|
try {
|
||||||
//efficient use of importScripts, importScripts will block until
|
//In a web worker, use importScripts. This is not a very
|
||||||
//its script is downloaded and evaluated. However, if web workers
|
//efficient use of importScripts, importScripts will block until
|
||||||
//are in play, the expectation that a build has been done so that
|
//its script is downloaded and evaluated. However, if web workers
|
||||||
//only one script needs to be loaded anyway. This may need to be
|
//are in play, the expectation that a build has been done so that
|
||||||
//reevaluated if other use cases become common.
|
//only one script needs to be loaded anyway. This may need to be
|
||||||
importScripts(url);
|
//reevaluated if other use cases become common.
|
||||||
|
importScripts(url);
|
||||||
|
|
||||||
//Account for anonymous modules
|
//Account for anonymous modules
|
||||||
context.completeLoad(moduleName);
|
context.completeLoad(moduleName);
|
||||||
|
} catch (e) {
|
||||||
|
context.onError(makeError('importscripts',
|
||||||
|
'importScripts failed for ' +
|
||||||
|
moduleName + ' at ' + url,
|
||||||
|
e,
|
||||||
|
[moduleName]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1932,12 +1951,13 @@ var requirejs, require, define;
|
||||||
//This module may not have dependencies
|
//This module may not have dependencies
|
||||||
if (!isArray(deps)) {
|
if (!isArray(deps)) {
|
||||||
callback = deps;
|
callback = deps;
|
||||||
deps = [];
|
deps = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If no name, and callback is a function, then figure out if it a
|
//If no name, and callback is a function, then figure out if it a
|
||||||
//CommonJS thing with dependencies.
|
//CommonJS thing with dependencies.
|
||||||
if (!deps.length && isFunction(callback)) {
|
if (!deps && isFunction(callback)) {
|
||||||
|
deps = [];
|
||||||
//Remove comments from the callback string,
|
//Remove comments from the callback string,
|
||||||
//look for require calls, and pull them into the dependencies,
|
//look for require calls, and pull them into the dependencies,
|
||||||
//but only if there are function args.
|
//but only if there are function args.
|
||||||
|
@ -1997,4 +2017,4 @@ var requirejs, require, define;
|
||||||
|
|
||||||
//Set up with config info.
|
//Set up with config info.
|
||||||
req(cfg);
|
req(cfg);
|
||||||
}(this));
|
}(this));
|
||||||
|
|
Loading…
Reference in New Issue