//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); }; //extend underscore _.mixin({ mapObject: function (array, keySelector) { var obj = {}; _.each(array, function (e) { obj[keySelector(e)] = e; }); return obj; } }); 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);