1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- * 动态加载初始资源
- */
- ;(function() {
- var resList = {
- icon: window.SITE_CONFIG.cdnUrl + '/static/img/favicon.ico',
- css: [
- window.SITE_CONFIG.cdnUrl + '/static/css/app.css',
- ],
- js: [
-
- window.SITE_CONFIG.cdnUrl + '/static/plugins/echarts-3.8.5/echarts.common.min.js',
-
- window.SITE_CONFIG.cdnUrl + '/static/js/manifest.js',
- window.SITE_CONFIG.cdnUrl + '/static/js/vendor.js',
- window.SITE_CONFIG.cdnUrl + '/static/js/app.js'
- ]
- };
-
- (function () {
- var _icon = document.createElement('link');
- _icon.setAttribute('rel', 'shortcut icon');
- _icon.setAttribute('type', 'image/x-icon');
- _icon.setAttribute('href', resList.icon);
- document.getElementsByTagName('head')[0].appendChild(_icon);
- })();
-
- (function () {
- document.getElementsByTagName('html')[0].style.opacity = 0;
- var i = 0;
- var _style = null;
- var createStyles = function () {
- if (i >= resList.css.length) {
- document.getElementsByTagName('html')[0].style.opacity = 1;
- return;
- }
- _style = document.createElement('link');
- _style.href = resList.css[i];
- _style.setAttribute('rel', 'stylesheet');
- _style.onload = function () {
- i++;
- createStyles();
- }
- document.getElementsByTagName('head')[0].appendChild(_style);
- }
- createStyles();
- })();
-
- document.onreadystatechange = function () {
- if (document.readyState === 'interactive') {
- var i = 0;
- var _script = null;
- var createScripts = function () {
- if (i >= resList.js.length) {
- return;
- }
- _script = document.createElement('script');
- _script.src = resList.js[i];
- _script.onload = function () {
- i++;
- createScripts();
- }
- document.getElementsByTagName('body')[0].appendChild(_script);
- }
- createScripts();
- }
- };
- })();
|