VaR OS = This. OS ={}, browser = This. browser = {},
WebKit = UA. Match (/WebKit \/([\ D.] + )/),
Android = UA. Match (/(Android) \ s + ([\ D.] + )/),
IPad = UA. Match (/(IPAD). * OS \ s ([\ D _] + )/),
IPhone =! IPad & UA. Match (/(iPhone \ SOS) \ s ([\ D _] + )/),
WebOS = UA. Match (/(WebOS | hpwos) [\ s \/] ([\ D.] + )/),
Touchpad = WebOS & UA. Match (/touchpad /),
Kindle = UA. Match (/Kindle \/([\ D.] + )/),
Silk = UA. Match (/silk \/([\ D. _] + )/),
Blackberry = UA. Match (/(Blackberry). * version \/([\ D.] + )/)
// Todo clean this up with a better OS/Browser
// Separation. We need to discern between multiple
// Browsers on Android, and decide if Kindle Fire in
// Silk mode is Android or not
If (browser. WebKit = !! WebKit) browser. Version = WebKit [1]
If (Android) OS. Android = true, OS. Version = Android [2]
If (iPhone) OS. iOS = OS. iPhone = true, OS. Version = iPhone [2]. Replace (/_/g ,'.')
If (IPAD) OS. iOS = OS. iPad = true, OS. Version = iPad [2]. Replace (/_/g ,'.')
If (WebOS) OS. WebOS = true, OS. Version = WebOS [2]
If (touchpad) OS. touchpad = true
If (Blackberry) OS. Blackberry = true, OS. Version = BlackBerry [2]
If (Kindle) OS. Kindle = true, OS. Version = Kindle [1]
If (silk) browser. Silk = true, browser. Version = silk [1]
If (! Silk & OS. Android & UA. Match (/Kindle Fire/) browser. Silk = true
}