export default function browserType ( ) { const ua = navigator . userAgent . toLowerCase ( ) ; const testUa = ( regexp ) => regexp . test ( ua ) ; const testVs = ( regexp ) => ( ua . match ( regexp ) || [ ] ) . toString ( ) . replace ( /[^0-9|_.]/g , '' ) . replace ( /_/g , '.' ) ; let system = 'unknow' ; if ( testUa ( /windows|win32|win64|wow32|wow64/g ) ) { system = 'windows' ; } else if ( testUa ( /macintosh|macintel/g ) ) { system = 'macos' ; } else if ( testUa ( /x11/g ) ) { system = 'linux' ; } else if ( testUa ( /android|adr/g ) ) { system = 'android' ; } else if ( testUa ( /ios|iphone|ipad|ipod|iwatch/g ) ) { system = 'ios' ; } let systemVs = 'unknow' ; if ( system === 'windows' ) { if ( testUa ( /windows nt 5.0|windows 2000/g ) ) { systemVs = '2000' ; } else if ( testUa ( /windows nt 5.1|windows xp/g ) ) { systemVs = 'xp' ; } else if ( testUa ( /windows nt 5.2|windows 2003/g ) ) { systemVs = '2003' ; } else if ( testUa ( /windows nt 6.0|windows vista/g ) ) { systemVs = 'vista' ; } else if ( testUa ( /windows nt 6.1|windows 7/g ) ) { systemVs = '7' ; } else if ( testUa ( /windows nt 6.2|windows 8/g ) ) { systemVs = '8' ; } else if ( testUa ( /windows nt 6.3|windows 8.1/g ) ) { systemVs = '8.1' ; } else if ( testUa ( /windows nt 10.0|windows 10/g ) ) { systemVs = '10' ; } } else if ( system === 'macos' ) { systemVs = testVs ( /os x [\d._]+/g ) ; } else if ( system === 'android' ) { systemVs = testVs ( /android [\d._]+/g ) ; } else if ( system === 'ios' ) { systemVs = testVs ( /os [\d._]+/g ) ; } let platform = 'unknow' ; if ( system === 'windows' || system === 'macos' || system === 'linux' ) { platform = 'desktop' ; } else if ( system === 'android' || system === 'ios' || testUa ( /mobile/g ) ) { platform = 'mobile' ; } let engine = 'unknow' ; let supporter = 'unknow' ; if ( testUa ( /applewebkit/g ) ) { engine = 'webkit' ; if ( testUa ( /edge/g ) ) { supporter = 'edge' ; } else if ( testUa ( /opr/g ) ) { supporter = 'opera' ; } else if ( testUa ( /chrome/g ) ) { supporter = 'chrome' ; } else if ( testUa ( /safari/g ) ) { supporter = 'safari' ; } } else if ( testUa ( /gecko/g ) && testUa ( /firefox/g ) ) { engine = 'gecko' ; supporter = 'firefox' ; } else if ( testUa ( /presto/g ) ) { engine = 'presto' ; supporter = 'opera' ; } else if ( testUa ( /trident|compatible|msie/g ) ) { engine = 'trident' ; supporter = 'iexplore' ; } let engineVs = 'unknow' ; if ( engine === 'webkit' ) { engineVs = testVs ( /applewebkit\/[\d._]+/g ) ; } else if ( engine === 'gecko' ) { engineVs = testVs ( /gecko\/[\d._]+/g ) ; } else if ( engine === 'presto' ) { engineVs = testVs ( /presto\/[\d._]+/g ) ; } else if ( engine === 'trident' ) { engineVs = testVs ( /trident\/[\d._]+/g ) ; } let supporterVs = 'unknow' ; if ( supporter === 'chrome' ) { supporterVs = testVs ( /chrome\/[\d._]+/g ) ; } else if ( supporter === 'safari' ) { supporterVs = testVs ( /version\/[\d._]+/g ) ; } else if ( supporter === 'firefox' ) { supporterVs = testVs ( /firefox\/[\d._]+/g ) ; } else if ( supporter === 'opera' ) { supporterVs = testVs ( /opr\/[\d._]+/g ) ; } else if ( supporter === 'iexplore' ) { supporterVs = testVs ( /(msie [\d._]+)|(rv:[\d._]+)/g ) ; } else if ( supporter === 'edge' ) { supporterVs = testVs ( /edge\/[\d._]+/g ) ; } let shell = 'none' ; let shellVs = 'unknow' ; if ( testUa ( /micromessenger/g ) ) { shell = 'wechat' ; shellVs = testVs ( /micromessenger\/[\d._]+/g ) ; } else if ( testUa ( /qqbrowser/g ) ) { shell = 'qq' ; shellVs = testVs ( /qqbrowser\/[\d._]+/g ) ; } else if ( testUa ( /ucbrowser/g ) ) { shell = 'uc' ; shellVs = testVs ( /ucbrowser\/[\d._]+/g ) ; } else if ( testUa ( /qihu 360se/g ) ) { shell = '360' ; } else if ( testUa ( /2345explorer/g ) ) { shell = '2345' ; shellVs = testVs ( /2345explorer\/[\d._]+/g ) ; } else if ( testUa ( /metasr/g ) ) { shell = 'sougou' ; } else if ( testUa ( /lbbrowser/g ) ) { shell = 'liebao' ; } else if ( testUa ( /maxthon/g ) ) { shell = 'maxthon' ; shellVs = testVs ( /maxthon\/[\d._]+/g ) ; } const result = Object . assign ( { engine , engineVs , platform , supporter , supporterVs , system , systemVs , } , shell === 'none' ? { } : { shell , shellVs , } ) ; console . log ( "%c\n .d88b.  d888888b d8b   db  d888b  db       .d88b.  d8b   db  d888b  \n.8P  Y8.   `88'   888o  88 88' Y8b 88      .8P  Y8. 888o  88 88' Y8b \n88    88    88    88V8o 88 88      88      88    88 88V8o 88 88      \n88    88    88    88 V8o88 88  ooo 88      88    88 88 V8o88 88  ooo \n`8P  d8'   .88.   88  V888 88. ~8~ 88booo. `8b  d8' 88  V888 88. ~8~ \n `Y88'Y8 Y888888P VP   V8P  Y888P  Y88888P  `Y88P'  VP   V8P  Y888P  \n                                                                     \n                                                                     \n" , 'color: blue;font-size: 14px;' ) ; console . log ( '%c忘形雨笠烟蓑，知心牧唱樵歌。明月清风共我，闲人三个，从他今古消磨。\n' , 'color: yellow;font-size: 18px;' ) ; console . log ( `%c青龙运行环境:\n\n系统：${ result . system }/${ result . systemVs }\n浏览器：${ result . supporter }/${ result . supporterVs }\n内核：${ result . engine }/${ result . engineVs }` , 'color: green;font-size: 14px;font-weight: bold;' ) ; return result ; } param { * } extraHeight param { * } id export function getTableScroll ( { extraHeight , id , } = { } ) { if ( typeof extraHeight == 'undefined' ) { extraHeight = 121 ; } let tHeader = null ; if ( id ) { tHeader = document . getElementById ( id ) ? document . getElementById ( id ) ! . getElementsByClassName ( 'ant-table-thead' ) [ 0 ] : null ; } else { tHeader = document . querySelector ( '.ant-table-wrapper' ) ; } let mainTop = 0 ; if ( tHeader ) { mainTop = tHeader . getBoundingClientRect ( ) . top ; } let height = document . body . clientHeight - mainTop - extraHeight ; return height ; }