Skip to content

Commit

Permalink
Merge pull request #1023 from matheod/openLinkText
Browse files Browse the repository at this point in the history
Support Numpad in link post shortcut + correct link number 10
  • Loading branch information
jewel-andraia committed May 10, 2014
2 parents e85e5d2 + cb8266e commit f865fa1
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions lib/modules/keyboardNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,66 @@ modules['keyboardNav'] = {
value: [48, false, false, false], // 0
description: 'Open link #10 within comment.',
noconfig: true
},
link1NumPad: {
type: 'keycode',
value: [97, false, false, false], // 1
description: 'Open first link within comment.',
noconfig: true
},
link2NumPad: {
type: 'keycode',
value: [98, false, false, false], // 2
description: 'Open link #2 within comment.',
noconfig: true
},
link3NumPad: {
type: 'keycode',
value: [99, false, false, false], // 3
description: 'Open link #3 within comment.',
noconfig: true
},
link4NumPad: {
type: 'keycode',
value: [100, false, false, false], // 4
description: 'Open link #4 within comment.',
noconfig: true
},
link5NumPad: {
type: 'keycode',
value: [101, false, false, false], // 5
description: 'Open link #5 within comment.',
noconfig: true
},
link6NumPad: {
type: 'keycode',
value: [102, false, false, false], // 6
description: 'Open link #6 within comment.',
noconfig: true
},
link7NumPad: {
type: 'keycode',
value: [103, false, false, false], // 7
description: 'Open link #7 within comment.',
noconfig: true
},
link8NumPad: {
type: 'keycode',
value: [104, false, false, false], // 8
description: 'Open link #8 within comment.',
noconfig: true
},
link9NumPad: {
type: 'keycode',
value: [105, false, false, false], // 9
description: 'Open link #9 within comment.',
noconfig: true
},
link10NumPad: {
type: 'keycode',
value: [96, false, false, false], // 0
description: 'Open link #10 within comment.',
noconfig: true
}
},
description: 'Keyboard navigation for reddit!',
Expand Down Expand Up @@ -709,6 +769,10 @@ modules['keyboardNav'] = {
{
annotation.title = 'press ' + annotationCount + ' to open link';
}
else if(annotationCount === 10)
{
annotation.title = 'press 0 to open link';
}
else
{
annotation.title = 'press ' + this.getNiceKeyCode('toggleCmdLine') + ' then ' +annotationCount + ' and Enter to open link';
Expand Down Expand Up @@ -1084,33 +1148,43 @@ modules['keyboardNav'] = {
this.prevPage();
return true;
case RESUtils.checkKeysForEvent(e, this.options.link1.value):
case RESUtils.checkKeysForEvent(e, this.options.link1NumPad.value):
this.commentLink(0);
return true;
case RESUtils.checkKeysForEvent(e, this.options.link2.value):
case RESUtils.checkKeysForEvent(e, this.options.link2NumPad.value):
this.commentLink(1);
return true;
case RESUtils.checkKeysForEvent(e, this.options.link3.value):
case RESUtils.checkKeysForEvent(e, this.options.link3NumPad.value):
this.commentLink(2);
return true;
case RESUtils.checkKeysForEvent(e, this.options.link4.value):
case RESUtils.checkKeysForEvent(e, this.options.link4NumPad.value):
this.commentLink(3);
return true;
case RESUtils.checkKeysForEvent(e, this.options.link5.value):
case RESUtils.checkKeysForEvent(e, this.options.link5NumPad.value):
this.commentLink(4);
return true;
case RESUtils.checkKeysForEvent(e, this.options.link6.value):
case RESUtils.checkKeysForEvent(e, this.options.link6NumPad.value):
this.commentLink(5);
return true;
case RESUtils.checkKeysForEvent(e, this.options.link7.value):
case RESUtils.checkKeysForEvent(e, this.options.link7NumPad.value):
this.commentLink(6);
return true;
case RESUtils.checkKeysForEvent(e, this.options.link8.value):
case RESUtils.checkKeysForEvent(e, this.options.link8NumPad.value):
this.commentLink(7);
return true;
case RESUtils.checkKeysForEvent(e, this.options.link9.value):
case RESUtils.checkKeysForEvent(e, this.options.link9NumPad.value):
this.commentLink(8);
return true;
case RESUtils.checkKeysForEvent(e, this.options.link10.value):
case RESUtils.checkKeysForEvent(e, this.options.link10NumPad.value):
this.commentLink(9);
return true;
default:
Expand Down

0 comments on commit f865fa1

Please sign in to comment.