browser detection

This commit is contained in:
j 2011-03-01 12:06:37 +01:00
parent 62e6c0d84c
commit eacecd83fb
2 changed files with 20 additions and 9 deletions

View file

@ -44,9 +44,14 @@ $(function() {
userAgent = name; userAgent = name;
return false; return false;
} }
if (!userAgent && navigator.userAgent.indexOf('Gecko') > -1) }
userAgent = 'Firefox';
}); });
if (!userAgent && $.browser.mozilla) {
userAgent = 'Firefox';
}
if (!userAgent && $.browser.webkit) {
userAgent = 'Chrome';
}
return userAgent; return userAgent;
} }

View file

@ -98,9 +98,9 @@ requires
_$elements = $elements; _$elements = $elements;
$(function() { $(function() {
$window = $(window), $window = $(window);
$document = $(document), $document = $(document);
$body = $('body'), $body = $('body');
Ox.theme(oxui.defaultTheme); Ox.theme(oxui.defaultTheme);
}); });
@ -153,6 +153,12 @@ requires
return false; return false;
} }
}); });
if (!userAgent && $.browser.mozilla) {
userAgent = 'Firefox';
}
if (!userAgent && $.browser.webkit) {
userAgent = 'Chrome';
}
return userAgent; return userAgent;
} }
@ -248,7 +254,7 @@ requires
}; };
}); });
that.api.init(getUserData(), function(result) { that.api.init(getUserData(), function(result) {
config = result.data.config, config = result.data.config;
user = result.data.user; user = result.data.user;
document.title = config.site.name; document.title = config.site.name;
launchCallback(); launchCallback();
@ -524,7 +530,7 @@ requires
keys.push(keyNames[event.keyCode]); keys.push(keyNames[event.keyCode]);
} }
key = keys.join('_'); key = keys.join('_');
if (key.match(/^[\w\d-]$|SPACE/)) { if (key.match(/^[\w\d\-]$|SPACE/)) {
time = Ox.getTime(); time = Ox.getTime();
if (time - bufferTime > bufferTimeout) { if (time - bufferTime > bufferTimeout) {
buffer = ''; buffer = '';
@ -586,10 +592,10 @@ requires
if (arguments[0](req)) { if (arguments[0](req)) {
delete requests[id]; delete requests[id];
} }
}) });
} else { } else {
// cancel by id // cancel by id
delete requests[arguments[0]] delete requests[arguments[0]];
} }
}, },