Commit a1ee0b7a authored by antoor's avatar antoor

Rebuild code

重构代码
parent 13cfdc55
/** /**
* 中国蚁剑::前端加载模块 * 中国蚁剑::前端加载模块
* 开写: 2016/04/23 * 开写: 2016/04/23
* 更新: 2016/04/28 * 更新: 2016/05/10
* 作者: 蚁逅 <https://github.com/antoor> * 作者: 蚁逅 <https://github.com/antoor>
*/ */
'use strict'; 'use strict';
// 加载jQuery // 添加源码目录到全局模块加载变量,以提供后边加载
window.$ = window.jQuery = require('../static/libs/jquery/jquery.js');
const path = require('path'); const path = require('path');
const Module = require('module').Module;
Module.globalPaths.push(path.join(process.env.AS_WORKDIR, 'source'));
// 开始加载时间 // 开始加载时间
let APP_START_TIME = +new Date; let APP_START_TIME = +new Date;
$(document).ready(() => { window.addEventListener('load', () => {
/** /**
* 时间格式化函数 * 时间格式化函数
* @param {String} format 格式化字符串,如yyyy/mm/dd hh:ii:ss * @param {String} format 格式化字符串,如yyyy/mm/dd hh:ii:ss
...@@ -72,79 +73,57 @@ $(document).ready(() => { ...@@ -72,79 +73,57 @@ $(document).ready(() => {
} }
// 开始加载css // 开始加载css
loadCSS( loadCSS('ant-static://libs/bmenu/bmenu.css')
'../static/libs/bmenu/bmenu.css' .then(() => loadCSS('ant-static://libs/toastr/toastr.min.css'))
).then(() => { .then(() => loadCSS('ant-static://libs/layer/src/skin/layer.css'))
return loadCSS('../static/libs/toastr/toastr.min.css'); .then(() => loadCSS('ant-static://libs/layer/src/skin/layer.ext.css'))
}).then(() => { .then(() => loadCSS('ant-static://libs/laydate/need/laydate.css'))
return loadCSS('../static/libs/layer/src/skin/layer.css'); .then(() => loadCSS('ant-static://libs/laydate/skins/default/laydate.css'))
}).then(() => { .then(() => loadCSS('ant-static://libs/terminal/css/jquery.terminal.css'))
return loadCSS('../static/libs/layer/src/skin/layer.ext.css'); .then(() => loadCSS('ant-static://libs/font-awesome/css/font-awesome.min.css'))
}).then(() => { .then(() => loadCSS('ant-static://libs/dhtmlx/codebase/dhtmlx.css'))
return loadCSS('../static/libs/laydate/need/laydate.css'); .then(() => loadCSS('ant-static://libs/dhtmlx/skins/mytheme/dhtmlx.css'))
}).then(() => { .then(() => loadCSS('ant-static://css/index.css'));
return loadCSS('../static/libs/laydate/skins/default/laydate.css');
}).then(() => {
return loadCSS('../static/libs/terminal/css/jquery.terminal.css');
}).then(() => {
return loadCSS('../static/libs/font-awesome/css/font-awesome.min.css');
}).then(() => {
return loadCSS('../static/libs/dhtmlx/codebase/dhtmlx.css');
}).then(() => {
return loadCSS('../static/libs/dhtmlx/skins/mytheme/dhtmlx.css');
}).then(() => {
return loadCSS('../static/css/index.css');
});
// 加载js资源 // 加载js资源
loadJS( loadJS('ant-static://libs/jquery/jquery.js')
'../static/libs/ace/ace.js' .then(() => loadJS('ant-static://libs/ace/ace.js'))
).then(() => { .then(() => loadJS('ant-static://libs/ace/ext-language_tools.js'))
return loadJS('../static/libs/ace/ext-language_tools.js'); .then(() => loadJS('ant-static://libs/bmenu/bmenu.js'))
}).then(() => { .then(() => loadJS('ant-static://libs/toastr/toastr.js'))
return loadJS('../static/libs/bmenu/bmenu.js'); .then(() => loadJS('ant-static://libs/layer/src/layer.js'))
}).then(() => { .then(() => loadJS('ant-static://libs/laydate/laydate.js'))
return loadJS('../static/libs/toastr/toastr.js'); .then(() => loadJS('ant-static://libs/terminal/js/jquery.terminal-min.js'))
}).then(() => { .then(() => loadJS('ant-static://libs/dhtmlx/codebase/dhtmlx.js'))
return loadJS('../static/libs/layer/src/layer.js'); .then(() => {
}).then(() => { /**
return loadJS('../static/libs/laydate/laydate.js'); * 配置layer弹出层
}).then(() => { * @param {[type]} {extend: 'extend/layer.ext.js'} [description]
return loadJS('../static/libs/terminal/js/jquery.terminal-min.js'); * @return {[type]} [description]
}).then(() => { */
return loadJS('../static/libs/dhtmlx/codebase/dhtmlx.js'); layer.config({extend: 'extend/layer.ext.js'});
}).then(() => { // 加载程序入口
/** require('app.entry');
* 配置layer弹出层 // LOGO
* @param {[type]} {extend: 'extend/layer.ext.js'} [description] console.group('LOGO');
* @return {[type]} [description] console.log(
*/ `%c
layer.config({extend: 'extend/layer.ext.js'}); _____ _ _____ _
// 加载babel引擎 | _ |___| |_| __|_ _ _ ___ ___ _| |
// require('babel/register')(); | | | _|__ | | | | . | _| . |
// 添加require路径 |__|__|_|_|_| |_____|_____|___|_| |___|%c
require.main.paths.unshift(
path.join(process.env.AS_WORKDIR, 'source')
);
// 加载程序入口
require('./app.entry');
// LOGO
console.log(
`%c
_____ _ _____ _
| _ |___| |_| __|_ _ _ ___ ___ _| |
| | | _|__ | | | | . | _| . |
|__|__|_|_|_| |_____|_____|___|_| |___|%c
->| Ver: %c${antSword.package.version}%c ->| Ver: %c${antSword.package.version}%c
-+=>| Git: %c${antSword.package.repository['url']}%c -+=>| Git: %c${antSword.package.repository['url']}%c
-*| End: %c${+new Date - APP_START_TIME}%c/ms -*| End: %c${+new Date - APP_START_TIME}%c/ms
`, `,
'color: #F44336;', 'color: #9E9E9E;', 'color: #F44336;', 'color: #9E9E9E;',
'color: #4CAF50;', 'color: #9E9E9E;', 'color: #4CAF50;', 'color: #9E9E9E;',
'color: #2196F3;', 'color: #9E9E9E;', 'color: #2196F3;', 'color: #9E9E9E;',
'color: #FF9800;', 'color: #9E9E9E;' 'color: #FF9800;', 'color: #9E9E9E;'
); );
}); APP_START_TIME = null;
console.groupEnd();
});
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment