function fontSize() {
let doc = document.documentElement,
resizeEvt = "orientationchange" in window ? "orientationchange" : "resize",
recalc = function () {
let winW = doc.clientWidth,
size;
if (!winW) return;
if(winW <= 480){
size = Math.round(winW / 7.5);
}else if (winW <= 768) {
size = Math.round(winW / 10.5);
if (size > 65) {
size = 65;
}
} else if(winW <= 1200){
size = Math.round(winW / 13);
} else if (winW <= 1800) {
size = Math.round(winW / 16);
} else {
size = 100;
};
doc.style.fontSize = size + 'px';
};
if (!document.addEventListener) return;
window.addEventListener(resizeEvt, recalc, false);
document.addEventListener("DOMContentLoaded", recalc, false);
};
fontSize();
const userBrowser = (function () {
const ua = navigator.userAgent;
const testUa = function (regexp) {
return regexp.test(ua.toLowerCase())
};
let userBrowserClient = function () {
let client = '';
if (/(iPhone|iPad|iPod|iOS)/i.test(ua)) {
client = 'iOS';
} else if (/(Android)/i.test(ua)) {
client = 'Android';
} else {
client = 'PC';
}
return client;
};
let userBrowserType = function () {
let shell = "none";
let shellVs = "unknow";
if (testUa(/micromessenger/g)) {
shell = "wechat"; // 微信浏览器
} else if (testUa(/qqbrowser/g)) {
shell = "qq"; // QQ浏览器
} else if (testUa(/ubrowser/g)) {
shell = "uc"; // UC浏览器
} else if (testUa(/qihu 360se/g)) {
shell = "360"; // 360浏览器
} else if (testUa(/2345explorer/g)) {
shell = "2345"; // 2345浏览器
} else if (testUa(/metasr/g)) {
shell = "sougou"; // 搜狗浏览器
} else if (testUa(/lbbrowser/g)) {
shell = "liebao"; // 猎豹浏览器
} else if (testUa(/maxthon/g)) {
shell = "maxthon"; // 遨游浏览器
}
return shell
};
return {
userBrowserClient: userBrowserClient,
userBrowserType: userBrowserType
}
})();
function dynamicLoadJs(url, callback) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
script.defer = 'defer';
if (typeof (callback) === 'function') {
script.onload = script.onreadystatechange = function () {
if (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete') {
callback();
script.onload = script.onreadystatechange = null;
}
}
}
head.appendChild(script);
}
if (userBrowser.userBrowserClient() == 'PC') {
try {
eval('()=>{}');
} catch (eo) {
dynamicLoadJs("js/polyfill/polyfill.min.js");
};
};