Skip to content

Commit

Permalink
Ctrl+Shift+Enter opens link in a new background tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
BVK Chaitanya committed Feb 26, 2012
1 parent beb6f92 commit 7da9636
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ superscript -- after every link. When users type that number and press enter
key, this extension opens the corresponding link. Some salient feaures are:

- Ctrl+Enter opens the link in a new tab
- Ctrl+Shift+Enter opens the link in a new background tab
- Zero+Enter works like Back button
- Link is highlighted as you type the link number

* Known Issues

- This doesn't seem to work on webpages with flash content.
- It seems AJAX content that is loaded later doesn't get the navigation
numbers.
- Link numbers seem to get messed up when you returned to a webpage using the
back button.
- AJAX content that is loaded later doesn't get the navigation numbers.
- Link numbers seem to get messed up when returned to a webpage using the back
button.

* TODO

Expand Down
9 changes: 6 additions & 3 deletions mouseless.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
var keyZero = 48
var keyNine = 57
var keyReturn = 13
var keyShift = 16
var keyControl = 17
var highlightColor = '#49A8FF' // Color that Matches with default Chrome theme.

Expand Down Expand Up @@ -105,6 +106,8 @@ function captureKey(event) {
if (event.ctrlKey) {
log("Opening link " + linkSelected.href + " in a new window")
window.open(linkSelected.href)
if (event.shiftKey)
self.focus()
reset()
return
}
Expand All @@ -113,9 +116,9 @@ function captureKey(event) {
} else if (event.keyCode >= keyZero && event.keyCode <= keyNine) {
log("Received event with number, " + (event.keyCode - keyZero))
keysCaptured += (event.keyCode - keyZero)
} else if (event.keyCode == keyControl) {
// Control+Enter should open the link in new tab, so don't reset the
// keyboard state on control.
} else if (event.keyCode == keyControl || event.keyCode == keyShift) {
// Control+Enter or Control+Shift+Enter should open the link in new
// tab, so don't reset the keyboard state on control.
} else {
reset()
}
Expand Down

0 comments on commit 7da9636

Please sign in to comment.