Some fixes for keyboard shortcuts.
This commit is contained in:
parent
e3de746bb6
commit
3610975bc1
|
@ -1522,8 +1522,7 @@ OC.Contacts={
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
next:function(reverse) {
|
next:function(reverse) {
|
||||||
// TODO: Check if we're last-child/first-child and jump to next/prev address book.
|
var curlistitem = this.getContact(OC.Contacts.Card.id);
|
||||||
var curlistitem = $('#contacts li[data-id="'+OC.Contacts.Card.id+'"]');
|
|
||||||
var newlistitem = reverse ? curlistitem.prev('li') : curlistitem.next('li');
|
var newlistitem = reverse ? curlistitem.prev('li') : curlistitem.next('li');
|
||||||
if(newlistitem) {
|
if(newlistitem) {
|
||||||
curlistitem.removeClass('active');
|
curlistitem.removeClass('active');
|
||||||
|
@ -1536,6 +1535,30 @@ OC.Contacts={
|
||||||
previous:function() {
|
previous:function() {
|
||||||
this.next(true);
|
this.next(true);
|
||||||
},
|
},
|
||||||
|
nextAddressbook:function(reverse) {
|
||||||
|
console.log('nextAddressbook', reverse);
|
||||||
|
var curlistitem = this.getContact(OC.Contacts.Card.id);
|
||||||
|
var parent = curlistitem.parent('ul');
|
||||||
|
var newparent = reverse
|
||||||
|
? parent.prevAll('ul').first()
|
||||||
|
: parent.nextAll('ul').first();
|
||||||
|
if(newparent) {
|
||||||
|
newlistitem = newparent.find('li:first-child');
|
||||||
|
if(newlistitem) {
|
||||||
|
parent.slideUp().prev('h3').removeClass('active');
|
||||||
|
newparent.slideDown().prev('h3').addClass('active');
|
||||||
|
curlistitem.removeClass('active');
|
||||||
|
OC.Contacts.Card.update({
|
||||||
|
cid:newlistitem.data('id'),
|
||||||
|
aid:newlistitem.data('bookid')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
previousAddressbook:function() {
|
||||||
|
console.log('previousAddressbook');
|
||||||
|
this.nextAddressbook(true);
|
||||||
|
},
|
||||||
// Reload the contacts list.
|
// Reload the contacts list.
|
||||||
update:function(params){
|
update:function(params){
|
||||||
if(!params) { params = {}; }
|
if(!params) { params = {}; }
|
||||||
|
@ -1677,10 +1700,10 @@ $(document).ready(function(){
|
||||||
|| !OC.Contacts.Card.id) {
|
|| !OC.Contacts.Card.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(event.which + ' ' + event.target.nodeName);
|
//console.log(event.which + ' ' + event.target.nodeName);
|
||||||
/**
|
/**
|
||||||
* To add:
|
* To add:
|
||||||
* (Shift)n/p: next/prev addressbook
|
* Shift-a: add addressbook
|
||||||
* u (85): hide/show leftcontent
|
* u (85): hide/show leftcontent
|
||||||
* f (70): add field
|
* f (70): add field
|
||||||
*/
|
*/
|
||||||
|
@ -1688,18 +1711,13 @@ $(document).ready(function(){
|
||||||
case 27: // Esc
|
case 27: // Esc
|
||||||
ninjahelp.hide();
|
ninjahelp.hide();
|
||||||
break;
|
break;
|
||||||
case 46:
|
case 46: // Delete
|
||||||
if(event.shiftKey) {
|
if(event.shiftKey) {
|
||||||
OC.Contacts.Card.delayedDelete();
|
OC.Contacts.Card.delayedDelete();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 32: // space
|
|
||||||
if(event.shiftKey) {
|
|
||||||
OC.Contacts.Contacts.previous();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 40: // down
|
case 40: // down
|
||||||
case 75: // k
|
case 74: // j
|
||||||
OC.Contacts.Contacts.next();
|
OC.Contacts.Contacts.next();
|
||||||
break;
|
break;
|
||||||
case 65: // a
|
case 65: // a
|
||||||
|
@ -1711,23 +1729,24 @@ $(document).ready(function(){
|
||||||
OC.Contacts.Card.editNew();
|
OC.Contacts.Card.editNew();
|
||||||
break;
|
break;
|
||||||
case 38: // up
|
case 38: // up
|
||||||
case 74: // j
|
case 75: // k
|
||||||
OC.Contacts.Contacts.previous();
|
OC.Contacts.Contacts.previous();
|
||||||
break;
|
break;
|
||||||
|
case 34: // PageDown
|
||||||
case 78: // n
|
case 78: // n
|
||||||
// next addressbook
|
// next addressbook
|
||||||
OC.Contacts.notImplemented();
|
OC.Contacts.Contacts.nextAddressbook();
|
||||||
break;
|
break;
|
||||||
case 13: // Enter
|
|
||||||
case 79: // o
|
case 79: // o
|
||||||
var aid = $('#contacts h3.active').first().data('id');
|
var aid = $('#contacts h3.active').first().data('id');
|
||||||
if(aid) {
|
if(aid) {
|
||||||
$('#contacts ul[data-id="'+aid+'"]').slideToggle(300);
|
$('#contacts ul[data-id="'+aid+'"]').slideToggle(300);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 33: // PageUp
|
||||||
case 80: // p
|
case 80: // p
|
||||||
// prev addressbook
|
// prev addressbook
|
||||||
OC.Contacts.notImplemented();
|
OC.Contacts.Contacts.previousAddressbook();
|
||||||
break;
|
break;
|
||||||
case 82: // r
|
case 82: // r
|
||||||
OC.Contacts.Contacts.update({cid:OC.Contacts.Card.id});
|
OC.Contacts.Contacts.update({cid:OC.Contacts.Card.id});
|
||||||
|
|
|
@ -38,14 +38,16 @@
|
||||||
<div class="help-section">
|
<div class="help-section">
|
||||||
<h3><?php echo $l->t('Navigation'); ?></h3>
|
<h3><?php echo $l->t('Navigation'); ?></h3>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>j/Down/Space</dt>
|
<dt>j/Down</dt>
|
||||||
<dd><?php echo $l->t('Next contact in list'); ?></dd>
|
<dd><?php echo $l->t('Next contact in list'); ?></dd>
|
||||||
<dt>k/Up/Shift-Space</dt>
|
<dt>k/Up</dt>
|
||||||
<dd><?php echo $l->t('Previous contact in list'); ?></dd>
|
<dd><?php echo $l->t('Previous contact in list'); ?></dd>
|
||||||
<dt>o/Enter</dt>
|
<dt>o</dt>
|
||||||
<dd><?php echo $l->t('Expand/collapse current addressbook'); ?></dd>
|
<dd><?php echo $l->t('Expand/collapse current addressbook'); ?></dd>
|
||||||
<dt>n/p</dt>
|
<dt>n/PageDown</dt>
|
||||||
<dd><?php echo $l->t('Next/previous addressbook'); ?></dd>
|
<dd><?php echo $l->t('Next addressbook'); ?></dd>
|
||||||
|
<dt>p/PageUp</dt>
|
||||||
|
<dd><?php echo $l->t('Previous addressbook'); ?></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div class="help-section">
|
<div class="help-section">
|
||||||
|
@ -55,8 +57,8 @@
|
||||||
<dd><?php echo $l->t('Refresh contacts list'); ?></dd>
|
<dd><?php echo $l->t('Refresh contacts list'); ?></dd>
|
||||||
<dt>a</dt>
|
<dt>a</dt>
|
||||||
<dd><?php echo $l->t('Add new contact'); ?></dd>
|
<dd><?php echo $l->t('Add new contact'); ?></dd>
|
||||||
<dt>Shift-a</dt>
|
<!-- dt>Shift-a</dt>
|
||||||
<dd><?php echo $l->t('Add new addressbook'); ?></dd>
|
<dd><?php echo $l->t('Add new addressbook'); ?></dd -->
|
||||||
<dt>Shift-Delete</dt>
|
<dt>Shift-Delete</dt>
|
||||||
<dd><?php echo $l->t('Delete current contact'); ?></dd>
|
<dd><?php echo $l->t('Delete current contact'); ?></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
Loading…
Reference in New Issue