//���û������ַ������ű����������������桢ƽ̨��windows����ϵͳ���ƶ��豸����ϸϵͳ��
var client = function(){
//��������
var engine = {
ie:0,
gecko:0,
webkit:0,
khtml:0,
opera:0,
//�����i汾��
ver:null
};
//�����
var browser = {
//��ҫ�����
ie:0,
firefox:0,
safari:0,
konq:0,
opera:0,
chrome:0,
//����i汾��
ver:null
};
//ƽ̨���豸�ͳ���ϵͳ
var system = {
win:false,
mac:false,
x11:false,
//�ƶ��豸
iphone:false,
ipod:false,
ipad:false,
ios:false,
android:false,
nokian:false,
winmobile:false,
//��ϸϵͳ
wii:false,
ps:false
};
//����������������
var ua = navigator.useragent;
if(window.opera){
engine.ver = browser.ver = window.opera.version();
engine.opera = browser.opera = parsefloat(engine.ver);
}
else if(/applewebkit\/(\s+)/.test(ua)){
engine.ver = regexp["$1"];
engine.webkit = parsefloat(engine.ver);
//ȷ����chrome����safari
if(/chrome\/(\s+)/.test(ua)){
browser.ver = regexp["$1"];
browser.chrome = parsefloat(browser.ver);
}
else if(/version\/(\s+)/.test(ua)){
browser.ver = regexp["$1"];
browser.safari = parsefloat(browser.ver);
}
else{
//���ƶ�ȷ���汾��
var safariversion = 1;
if(engine.webkit<100){
safariversion = 1;
} else if(engine.webkit<312){
safariversion = 1.2;
} else if(engine.webkit<412){
safariversion = 1.3;
} else{
safariversion = 1;
}
browser.safari = browser.ver = safariversion;
}
}
else if(/khtml\/(\s+)/.test(ua)||/kongqueror\/([^;]+)/.test(ua)){
engine.ver = browser.ver = regexp["$1"];
engine.khtml = browser.konq = parsefloat(engine.ver);
}
else if(/rv:([^\)]+)\) gecko\/\d{8}/.test(ua)){
engine.ver = regexp["$1"];
engine.gecko = parsefloat(engine.ver)
//ȷ���dz���firefox
if(/firefox\/(\s+)/.test(ua)){
browser.ver = regexp["$1"];
browser.firefox = parsefloat(browser.ver);
}
}
else if(/msie ([^;]+)/.test(ua)){
engine.ver = browser.ver = regexp["$1"];
engine.ie = browser.ie = parsefloat(engine.ver);
}
//��������
browser.ie = engine.ie;
browser.opera = engine.opera;
//���ƽ̨
var p = navigator.platform;
system.win = p.indexof("win")==0;
system.mac = p.indexof("mac")==0;
system.x11 = (p = "x11")||(p.indexof("linux")==0);
//���windows����ϵͳ
if(system.win){
if(/win(?:dows )?([^do]{2})\s?(\d+\.\d+)?/.test(ua)){
if(regexp["$1"]=="nt"){
switch(regexp["$2"]){
case "5.0":
system.win = "2000";
break;
case "5.1":
system.win = "xp";
break;
case "6.0":
system.win = "visita";
break;
case "6.1":
system.win = "7";
break;
default:
system.win = "nt";
break;
}
}
else if(regexp["$1"]=="9x"){
system.win = "me";
}
else {
system.win = regexp["$1"];
}
}
}
//�ƶ��豸
system.iphone = ua.indexof("iphone")>-1;
system.ipod = ua.indexof("ipod")>-1;
system.ipad = ua.indexof("ipad")>-1;
system.nokian = ua.indexof("nokian")>-1;
//windows moblie
if(system.win=="ce"){
system.winmobile = system.win;
} else if(system.win == "ph"){
if(/windows phone os (\d+.\d+)/.test(ua)){
system.win = "phone";
system.winmobile = parsefloat(regexp["$1"]);
}
}
//���ios�汾
if(system.mac&&ua.indexof("mobile")>-1){
if(/cpu (?:iphone)?os (\d+_\d+)/.test(ua)){
system.ios = parsefloat(regexp.$1.replace("_","."));
} else{
system.ios = 2;//��������������������ֻ�ܲ²�
}
}
//���android�汾
if(/android (\d+\.\d+)/.test(ua)){
system.android = parsefloat(regexp.$1);
}
//��ϸϵͳ
system.wii = ua.indexof("wii")>-1;
system.ps = /playstation/i.test(ua);
//������щ����
return {
engine:engine,
browser:browser,
system:system
};
}();
/*
for(p in client.engine){
document.write("client.engine."+p+":"+client.engine[p]+"
");
}
document.write("