(function(){
const includeJs=function(str){
document.open();
document.write("<scr"+"ipt src='"+str+"'></scr"+"ipt>");
document.close();
}
const _includeJsPath="";
const _defaultIncludedJs=new Array(
"js/root.var.js",
"https://cdn.bootcss.com/popper.js/1.12.9/umd/popper.min.js",
"js/plugins/bootstrap-util/util.js",
);
$.each(_defaultIncludedJs,function(){
includeJs(this)
})
}())
const includeJsonload=function({templetLink='',callback='',css=''}){
const addCSS=function(cssCallBack){
let css=eval(cssCallBack+"();");//cssCallBack();
$('head').append(`<style type='text/css' cssId='${css.name}' >${css.css}</style>`)
}
//let scrps=document.scripts;
let js=document.createElement("script");
js.setAttribute('type', 'text/javascript');
js.setAttribute('src', templetLink);
let scrps = document.getElementsByTagName('head')[0];
scrps.appendChild(js);
if (document.all) { //如果是IE
js.onreadystatechange = function () {
if (js.readyState == 'loaded' || js.readyState == 'complete') {
if(callback!='') callback();
if(css!='') addCSS(css);
}
}
}else {
js.onload = function () {
if(callback!='') callback();
if(css!='') addCSS(css);
}
};
}
网友评论