var device = ( function ( ) { class Device { devices : any ; show : any ; constructor ( ) { this . devices = { 1 : 'unknow' , 2 : 'windows' , 3 : 'mac' , 4 : 'ipad' , 5 : 'iphone' , 6 : 'android' , 7 : 'ios-app' , 8 : 'android-app' } ; this . show = { 1 : '' , 2 : '' , 3 : '' , 4 : '' , 5 : '来自 iPhone' , 6 : '来自 Android' , 7 : `来自 <a href="https://www.xiaoduyu.com/app/xiaoduyu/" target="_blank" class="text-muted" >iPhone客户端</a>` , 8 : `来自 <a href="https://www.xiaoduyu.com/app/xiaoduyu/" target="_blank" class="text-muted" >Android客户端</a>` } ; } getCurrentDeviceId ( ) { if ( typeof window == 'undefined' || typeof document == 'undefined' ) { return 1 ; } var dvicename = 'unknow' ; var p = navigator . platform ; var sUserAgent = navigator . userAgent . toLowerCase ( ) ; var system = { windows : p . indexOf ( "Win" ) == 0 , mac : p . indexOf ( "Mac" ) == 0 , ipad : sUserAgent . match ( /ipad/i ) == "ipad" , iphone : sUserAgent . match ( /iphone os/i ) == "iphone os" , android : sUserAgent . match ( /android/i ) == "android" } ; for ( var i in system ) { if ( system [ i ] ) { dvicename = i ; } } for ( var i in this . devices ) { if ( this . devices [ i ] == dvicename ) { return parseInt ( i ) ; } } return 1 ; } getNameByDeviceId ( id ) { return this . show [ id ] ; } isMobileDevice ( ) { var id = this . getCurrentDeviceId ( ) ; if ( id == 5 || id == 6 ) { return true ; } return false ; } } return new Device ( ) ; } ( ) ) ; export default device ;