Light12306/Web12306/js/boot.js

33 lines
854 B
JavaScript
Raw Normal View History

2014-03-13 15:06:01 +08:00
//12306入口引导脚本
(function (window, document) {
2014-03-14 18:39:06 +08:00
var basePath = window.location.protocol + "//" + window.location.host + "/js/";
var pagename = /\/(\w+?)\.html/.exec(location.pathname) && RegExp.$1 || "index";
2014-03-13 15:06:01 +08:00
var loadScript = function (path, callback) {
var script = document.createElement("script");
2014-03-14 18:39:06 +08:00
script.src = basePath + path;
script.onload = function () {
callback();
2014-03-13 15:06:01 +08:00
document.head.removeChild(script);
};
document.head.appendChild(script);
};
2014-03-14 18:39:06 +08:00
loadScript("modules/seajs/sea.js", function () {
seajs.config({
base: basePath,
alias: {
"jquery": "modules/jquery/jquery.js",
"underscore": "modules/underscore/underscore.js"
},
vars: {
'locale': 'zh-cn'
},
charset: "utf-8",
debug: true
});
seajs.use("ui/" + pagename);
2014-03-13 15:06:01 +08:00
});
})(window, document);