杭州・百腾教育

' + deprecationMsgCN + '' + '

' + deprecationMsgEN + '' + '' var style = document.createElement('style') style.innerHTML = '#unsupported-browser p {' + 'text-align: center;' + '}' function isIE() { var myNav = navigator.userAgent.toLowerCase() if ('ActiveXObject' in window) { return true } if (typeof window.Proxy === 'undefined') { return true } // https://stackoverflow.com/questions/65259661/detecting-edge-legacy-browser-not-edge-chromium if (myNav.indexOf('edge') > 0) { return true } return (myNav.indexOf('msie') > 0) ? parseInt(myNav.split('msie')[1], 10) : false } const CHROME_LIMIT_VERSION = 66 const FIREFOX_LIMIT_VERSION = 69 function isBrowserVersionLow() { const { userAgent = '' } = navigator const getBrowserVersion = (browser) => { try { return Number(userAgent.match(new RegExp(browser + '/([\\d.]+)'))[1].split('.')[0]) } catch (e) { return Number.MAX_SAFE_INTEGER } } if (userAgent.indexOf('Chrome') > -1) { return getBrowserVersion('Chrome') < CHROME_LIMIT_VERSION } if (userAgent.indexOf('Firefox') > -1) { return getBrowserVersion('Firefox') < FIREFOX_LIMIT_VERSION } return false } function isOmsClient() { return navigator.userAgent.indexOf('OMSClient') !== -1 } if (!isOmsClient() && (isIE() || isBrowserVersionLow())) { document.head.appendChild(style) const ele = document.createElement('div') ele.innerHTML = ieDeprecationHTML document.body.insertBefore(ele, document.body.firstChild) } else { // eslint-disable-next-line func-names window.PRELOAD_GLOBAL_ERROR_HANDLER = function (msg) { if (msg.toString() === 'NS_ERROR_STORAGE_CONSTRAINT') { alert('您的浏览器缓存已满,请清理缓存后再试。') } else if (msg.toString() !== 'Script error.') { alert(msg + '\n\n' + deprecationMsgCN + '\n' + deprecationMsgEN + '\n\n' + navigator.userAgent) } if (window.services && window.services.assert) { window.services.assert.assert(Date.now() - startTime < 10000, 'PRELOAD_GLOBAL_ERROR_HANDLER', window.CLEAR_DEPRECATION_ERROR_HANDLER + msg + navigator.userAgent) } } window.onerror = window.PRELOAD_GLOBAL_ERROR_HANDLER } const PUBLIC_PATH_CACHE_KEY = 'PUBLIC_PATH_CACHE' const PUBLIC_PATH_CACHE_TTL_KEY = 'PUBLIC_PATH_CACHE_TTL' try { const queryStrings = location.search.slice(1).split('&') if (!queryStrings.find(qs => qs === 'proxyCDN=1')) { const url = localStorage.getItem(PUBLIC_PATH_CACHE_KEY) const time = localStorage.getItem(PUBLIC_PATH_CACHE_TTL_KEY) if (url && time) { const lastUpdate = parseInt(time, 10) const now = Date.now() if (now - lastUpdate < 24 * 60 * 60 * 1000 ) { // 1 day in ms const urlObj = new URL(location.href) urlObj.searchParams.set('proxyCDN', '1') location.href = urlObj.toString() } } } } catch (e) { console.error(e) } setTimeout(function () { document.querySelectorAll('#splash [aria-hidden="true"]').forEach(function (ele) { ele.ariaHidden = 'false' }) }, 5000)