1// æ¬¢è¿æç¤ºå¤ç 2 3// æµè§å¨çæ¬æ£æµä¼å 4const BROWSER_VERSION_LIMITS = { 5 Edge: 90, 6 Firefox: 90, 7 OPR: 80, 8 Chrome: 90, 9 Safari: null // Safari æä¸å¤ç 10} 11 12const getBrowserInfo = () => { 13 const ua = navigator.userAgent 14 for (const [browser] of Object.entries(BROWSER_VERSION_LIMITS)) { 15 if (ua.includes(browser)) { 16 const match = ua.match(new RegExp(`${browser}\\/([\\d]+)`)) 17 return { browser, version: match ? parseInt(match[1]) : 0 } 18 } 19 } 20 return null 21} 22 23const browserVersion = () => { 24 const browserInfo = getBrowserInfo() 25 if (!browserInfo) return 26 27 const minVersion = BROWSER_VERSION_LIMITS[browserInfo.browser] 28 if (minVersion && browserInfo.version < minVersion) { 29 Snackbar.show({ 30 text: "æµè§å¨çæ¬è¾ä½ï¼ç½ç«æ ·å¼å¯è½éä¹±", 31 actionText: "å ³é", 32 duration: "6000", 33 pos: "bottom-right" 34 }) 35 } 36} 37 38// Cookie ç¸å ³å½æ°ä¼å 39const setCookies = (obj, limitTime) => { 40 const expires = new Date(Date.now() + limitTime * 24 * 60 * 60 * 1000).toGMTString() 41 Object.entries(obj).forEach(([key, value]) => { 42 document.cookie = `${key}=${value};expires=${expires}` 43 }) 44} 45 46const getCookie = (name) => { 47 const match = document.cookie.match(new RegExp(`(^| )${name}=([^;]*)(;|$)`)) 48 return match ? decodeURIComponent(match[2]) : null 49} 50
51/* 52if (sessionStorage.getItem('popCookieWindow') != '0') { 53 setTimeout(function () { 54 Snackbar.show({ 55 text: 'æ¬ç«ä½¿ç¨Cookie忬å°/ä¼è¯åå¨ä¿è¯æµè§ä½éªåç½ç«ç»è®¡', 56 pos: 'bottom-right', 57 actionText: 'æ¥çå客声æ', 58 onActionClick: function (element) { 59 window.open('/license') 60 } 61 }) 62 }, 3000) 63} 64sessionStorage.setItem('popCookieWindow', '0') 65*/ 66 67if (getCookie("browsertc") != 1) { 68 setCookies( 69 { 70 browsertc: 1 71 }, 72 1 73 ) 74 browserVersion() 75}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.