Light12306/Web12306/js/boot.js
2014-03-14 18:39:06 +08:00

33 lines
854 B
JavaScript

//12306入口引导脚本
(function (window, document) {
var basePath = window.location.protocol + "//" + window.location.host + "/js/";
var pagename = /\/(\w+?)\.html/.exec(location.pathname) && RegExp.$1 || "index";
var loadScript = function (path, callback) {
var script = document.createElement("script");
script.src = basePath + path;
script.onload = function () {
callback();
document.head.removeChild(script);
};
document.head.appendChild(script);
};
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);
});
})(window, document);