Fix keys quirks for different browsers
This commit is contained in:
parent
5838824732
commit
2ee29923c1
|
@ -18,7 +18,7 @@
|
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
</head>
|
||||
<body ng-controller="WeechatCtrl" ng-keypress="handleKeyPress($event)">
|
||||
<body ng-controller="WeechatCtrl" ng-keydown="handleKeyPress($event)">
|
||||
<div ng-hide="connected" class="container">
|
||||
<h2>
|
||||
<img src="img/favicon.png">
|
||||
|
|
|
@ -497,11 +497,9 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
// Find next buffer with activity and switch to it
|
||||
angular.forEach($scope.buffers, function(buffer) {
|
||||
if(buffer.notification) {
|
||||
console.log('a', buffer.id);
|
||||
$scope.setActiveBuffer(buffer.id);
|
||||
return false;
|
||||
}else if((parseInt(buffer.unread) || 0) > 0) {
|
||||
console.log('b',buffer.id);
|
||||
$scope.setActiveBuffer(buffer.id);
|
||||
return false;
|
||||
}
|
||||
|
@ -510,15 +508,19 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
}
|
||||
|
||||
$scope.handleKeyPress = function($event) {
|
||||
// Support different browser quirks
|
||||
var code = $event.keyCode ? $event.keyCode : $event.charCode;
|
||||
|
||||
//console.log('keypress', $event.charCode, $event.altKey);
|
||||
|
||||
// Handle alt-a
|
||||
if($event.altKey && $event.charCode == '97') {
|
||||
if($event.altKey && (code == 97 || code == 65)) {
|
||||
$event.preventDefault();
|
||||
$rootScope.switchToActivityBuffer();
|
||||
return true;
|
||||
}
|
||||
// Handle ctrl-g
|
||||
if($event.ctrlKey && $event.charCode == '103') {
|
||||
if($event.ctrlKey && (code == 103 || code == 71)) {
|
||||
document.querySelector('#bufferFilter').focus();
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue