Source: js/library.browser.js

/** @class
	@readonly
	@desc     Instantiates a hash of properties derived from environment.
	
	@property {Number}  #Platform
	@property {Number}  #Architecture
	@property {Boolean} #IsOrion
	@property {String}  #Version
	@property {Boolean} #IsZoomed
	@property {Number}  #Zoom
	
	@example  // Example user agent strings:
"Orion/1.5.0 (mac; x86_64; zoom 100)"
"Orion/2.0.0 (mac; x86_64; zoom 100)"
    @todo     Convert to constants.
*/
var Browser =
{
    __init: function (userAgent)
    {
        this.Platform = BrowserPlatform.Unknown;
        this.Architecture = BrowserArchitecture.Unknown;
    
        var agent = userAgent ? userAgent : navigator.userAgent;
        
        // if other browser
        if (agent.indexOf('Orion') == -1)
        {
            this.IsOrion = false;
            this.Version = '';
            this.IsZoomed = false;
            this.Zoom = 1;
        }
        else
        {
            this.IsOrion = true;
            
            // version
            this.Version = agent.substring(0, agent.indexOf(' ')).replace('Orion/', '');
            
            // platform
            if (agent.indexOf('mac') >= 0)
                this.Platform = BrowserPlatform.Mac;
            else if (agent.indexOf('windows') >= 0)
                this.Platform = BrowserPlatform.Windows;
            else if (agent.indexOf('linux') >= 0)
                this.Platform = BrowserPlatform.Linux;
            
            // zoom factor
            if (agent.indexOf('zoom 100') >= 0)
            {
                // normal zoom
                this.IsZoomed = false;
                this.Zoom = 1;
            }
            else
            {
                // is zoomed
                this.IsZoomed = true;
                this.Zoom = parseFloat(agent.substring(agent.indexOf('zoom ') + 5)) / 100;
            }
            
            // architecture
            if (agent.indexOf('x86_64') >= 0)
                this.Architecture = BrowserArchitecture.x86_64;
            else if (agent.indexOf('x86') >= 0)
                this.Architecture = BrowserArchitecture.x86;
        }
        
        return this;
    }
}.__init();