consolidate user agent sniffing from util.js and

core.js into a new module useragent.js
This commit is contained in:
Fabian Jakobs 2010-12-16 18:50:26 +01:00
commit ad19a8f98e
6 changed files with 54 additions and 95 deletions

View file

@ -37,7 +37,7 @@
define(function(require, exports, module) {
var core = require("pilot/core");
var useragent = require("pilot/useragent");
var event = require("pilot/event");
var default_mac = require("ace/conf/keybindings/default_mac").bindings;
var default_win = require("ace/conf/keybindings/default_win").bindings;
@ -50,7 +50,7 @@ var KeyBinding = function(element, editor, config) {
var _self = this;
event.addKeyListener(element, function(e) {
// opera on mac swaps ctrl and meta keys
if (core.isOpera && core.isMac)
if (useragent.isOpera && useragent.isMac)
var hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
| (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
else
@ -145,7 +145,7 @@ var KeyBinding = function(element, editor, config) {
}
this.setConfig = function(config) {
this.config = config || (core.isMac
this.config = config || (useragent.isMac
? default_mac
: default_win);
if (typeof this.config.reverse == "undefined")