Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}());
}
}
//回调
function onCallback(){
exports.push(layui[item]);
apps.length > 1 ?
that.use(apps.slice(1), callback, exports)
: ( typeof callback === 'function' && callback.apply(layui, exports) );
}
//如果使用了 layui.all.js
if(apps.length === 0
|| (layui['layui.all'] && modules[item])
|| (!layui['layui.all'] && layui['layui.mobile'] && modules[item])
){
return onCallback(), that;
}
//首次加载模块
if(!config.modules[item]){
var node = doc.createElement('script')
//如果是内置模块,则按照 dir 参数拼接模块路径
//如果是扩展模块,则判断模块路径值是否为 {!} 开头,
// 如果路径值是 {/} 开头,则模块路径即为后面紧跟的字符。
// 否则,则按照 base 参数拼接模块路径
,url = ( modules[item] ? (dir + 'lay/')
: (/^\{\/\}/.test(that.modules[item]) ? '' : (config.base || ''))
) + (that.modules[item] || item) + '.js';
}());
}
}
// 回调
function onCallback() {
exports.push(layui[item]);
apps.length > 1 ?
that.use(apps.slice(1), callback, exports) :
(typeof callback === 'function' && callback.apply(layui, exports));
}
// 如果使用了 layui.all.js
if(apps.length === 0 ||
(layui['layui.all'] && modules[item]) ||
(!layui['layui.all'] && layui['layui.mobile'] && modules[item])
) {
return onCallback(), that;
}
// 首次加载模块
if(!config.modules[item]) {
var node = doc.createElement('script'),
// 如果是内置模块,则按照 dir 参数拼接模块路径
// 如果是扩展模块,则判断模块路径值是否为 {/} 开头,
// 如果路径值是 {/} 开头,则模块路径即为后面紧跟的字符。
// 否则,则按照 base 参数拼接模块路径
url = (modules[item] ? (dir + 'lay/') :
(/^\{\/\}/.test(that.modules[item]) ? '' : (config.base || ''))
) + (that.modules[item] || item) + '.js';
url = url.replace(/^\{\/\}/, '');
//判断URL拼接可访问路径
if(item === 'jquery'){
apps.splice(index, 1);
}
});
layui.jquery = jQuery;
}
var item = apps[0], timeout = 0;
exports = exports || [];
//静态资源host
config.host = config.host || (dir.match(/\/\/([\s\S]+?)\//)||['//'+ location.host +'/'])[0];
if(apps.length === 0
|| (layui['layui.all'] && modules[item])
|| (!layui['layui.all'] && layui['layui.mobile'] && modules[item])
){
return onCallback(), that;
}
//加载完毕
function onScriptLoad(e, url){
var readyRegExp = navigator.platform === 'PLaySTATION 3' ? /^complete$/ : /^(complete|loaded)$/
if (e.type === 'load' || (readyRegExp.test((e.currentTarget || e.srcElement).readyState))) {
config.modules[item] = url;
head.removeChild(node);
(function poll() {
if(++timeout > config.timeout * 1000 / 4){
return error(item + ' is not a valid module');
};
config.status[item] ? onCallback() : setTimeout(poll, 4);
}());
}());
}
}
//回调
function onCallback(){
exports.push(layui[item]);
apps.length > 1 ?
that.use(apps.slice(1), callback, exports)
: ( typeof callback === 'function' && callback.apply(layui, exports) );
}
//如果使用了 layui.all.js
if(apps.length === 0
|| (layui['layui.all'] && modules[item])
|| (!layui['layui.all'] && layui['layui.mobile'] && modules[item])
){
return onCallback(), that;
}
//首次加载模块
if(!config.modules[item]){
var node = doc.createElement('script')
//如果是内置模块,则按照 dir 参数拼接模块路径
//如果是扩展模块,则判断模块路径值是否为 {/} 开头,
//如果路径值是 {/} 开头,则模块路径即为后面紧跟的字符。
//否则,则按照 base 参数拼接模块路径
,url = ( modules[item] ? (dir + 'lay/')
: (/^\{\/\}/.test(that.modules[item]) ? '' : (config.base || ''))
) + (that.modules[item] || item) + '.js';
n.prototype.cache = o, n.prototype.define = function (e, t) {
var n = this, r = "function" == typeof e, i = function () {
var e = function (e, t) {
layui[e] = t, o.status[e] = !0
};
return "function" == typeof t && t(function (n, r) {
e(n, r), o.callback[n] = function () {
t(e)
}
}), this
};
return r && (t = e, e = []), layui["layui.all"] || !layui["layui.all"] && layui["layui.mobile"] ? i.call(n) : (n.use(e, i), n)
}, n.prototype.use = function (e, n, l) {
function s(e, t) {
};
typeof factory === 'function' && factory(function(app, exports){
setApp(app, exports);
config.callback[app] = function(){
factory(setApp);
}
});
return this;
};
type && (
factory = deps,
deps = []
);
if(layui['layui.all'] || (!layui['layui.all'] && layui['layui.mobile'])){
return callback.call(that);
}
that.use(deps, callback);
return that;
};
};
typeof factory === 'function' && factory(function(app, exports){
setApp(app, exports);
config.callback[app] = function(){
factory(setApp);
}
});
return this;
};
type && (
factory = deps,
deps = []
);
if(layui['layui.all'] || (!layui['layui.all'] && layui['layui.mobile'])){
return callback.call(that);
}
that.use(deps, callback);
return that;
};
var that = this
,type = typeof deps === 'function'
,mods = function(){
typeof callback === 'function' && callback(function(app, exports){
layui[app] = exports;
config.status[app] = true;
});
return this;
};
type && (
callback = deps,
deps = []
);
if(layui['layui.all'] || (!layui['layui.all'] && layui['layui.mobile'])){
return mods.call(that);
}
that.use(deps, mods);
return that;
};
var that = this
,type = typeof deps === 'function'
,mods = function(){
typeof callback === 'function' && callback(function(app, exports){
layui[app] = exports;
config.status[app] = true;
});
return this;
};
type && (
callback = deps,
deps = []
);
if(layui['layui.all'] || (!layui['layui.all'] && layui['layui.mobile'])){
return mods.call(that);
}
that.use(deps, mods);
return that;
};