Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #207 from neilmacintyre/master
Browse files Browse the repository at this point in the history
Add next page and previous page commands. As well as prepare for 1.25.4 release.
  • Loading branch information
neilmacintyre authored Sep 1, 2018
2 parents afd6b2d + 991b50e commit c495452
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 43 deletions.
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"editor.formatOnSave": true,
"editor.formatOnSave": false,
"javascript.format.enable": false,
"prettier.eslintIntegration": true
"prettier.eslintIntegration": true,
"files.autoSave": "onFocusChange"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Sufyan Dawoodjee
Copyright (c) 2018 Sufyan Dawoodjee, Neil Macintyre

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
**Saka Key needs a maintainer. Interested? See https://github.com/lusakasa/saka-key/issues/171**

# Saka Key

Saka Key is a Chrome and Firefox extension for keyboard-only web browsing. It differs from existing extensions because
Expand Down Expand Up @@ -45,7 +43,7 @@ npm run build:firefox:prod

## Credits

MIT Licensed, Copyright (c) 2017 Sufyan Dawoodjee
MIT Licensed, Copyright (c) 2018 Sufyan Dawoodjee, Neil Macintyre

Saka Key is inspired by and derives from

Expand Down
3 changes: 3 additions & 0 deletions book/tutorial/navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ For example, if the current URL is `key.saka.io/tutorial/zooming.html`, you can
Or you can jump directly to `key.saka.io`.

* **Go To Root** - <kbd>u</kbd><kbd>shift-u</kbd>

* **Next page** - <kbd>g</kbd><kbd>h</kbd>
* **Previous page** - <kbd>g</kbd><kbd>f</kbd>
4 changes: 2 additions & 2 deletions manifest/common.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Saka Key",
"version": "1.25.2",
"author": "Sufyan Dawoodjee",
"version": "1.25.4",
"author": "Sufyan Dawoodjee, Neil Macintyre",
"description": "A keyboard interface to the web",
"manifest_version": 2,
"content_security_policy": "script-src 'self'; object-src 'self'",
Expand Down
24 changes: 22 additions & 2 deletions src/modes/command/client/commands/navigation.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isURL } from '../../../../lib/url'

export function goBack () {
window.history.go(-1)
}
Expand All @@ -8,11 +10,29 @@ export function goForward () {

/* Goes to the next page (as in 2nd page of a google search) */
export function nextPage () {
console.log('>> Next page')
const nextPageURL = document.querySelector('[rel="next"]').href

if (isURL(nextPageURL)) {
window.location.href = document.querySelector('[rel="next"]').href
} else if (SAKA_DEBUG) {
console.log(
'Element with next link does not have a valid URL. Element found: ',
document.querySelector('[rel="next"]')
)
}
}

export function previousPage () {
console.log('<< Previous page')
const previousPageURL = document.querySelector('[rel="next"]').href

if (isURL(previousPageURL)) {
window.location.href = document.querySelector('[rel="next"]').href
} else if (SAKA_DEBUG) {
console.log(
'Element with next link does not have a valid URL. Element found: ',
document.querySelector('[rel="next"]')
)
}
}

/* Goes up URL hierarchy (from /cookie_recipes/3 to /cookie_recipes) */
Expand Down
2 changes: 0 additions & 2 deletions src/options/Keybindings/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,12 @@
"type": "keybinding",
"label": "Next Page",
"key": "nextPage",
"visible": false,
"default": []
},
{
"type": "keybinding",
"label": "Previous Page",
"key": "previousPage",
"visible": false,
"default": []
},
{
Expand Down
94 changes: 63 additions & 31 deletions src/options/Keybindings/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@
"goForward": [
[{ "code": "KeyV", "key": "v" }, { "code": "KeyV", "key": "v" }]
],
"nextPage": [],
"previousPage": [],
"nextPage": [
[{ "code": "KeyG", "key": "g" }, { "code": "KeyH", "key": "h" }]
],
"previousPage": [
[{ "code": "KeyG", "key": "g" }, { "code": "KeyF", "key": "f" }]
],
"goUp": [
[{ "code": "KeyU", "key": "u" }, { "code": "KeyU", "key": "u" }]
],
Expand Down Expand Up @@ -674,29 +678,39 @@
"openLinkInBackgroundTab": [
[{ "code": "KeyF", "key": "F", "shiftKey": true }]
],
"openLinkInForegroundTab": [[{ "code": "KeyE", "key": "e"}, { "code": "KeyT", "key": "t"}]],
"openLinkInNewWindow": [[{ "code": "KeyE", "key": "e"}, { "code": "KeyW", "key": "w"}]],
"openLinkInIncognitoWindow": [[{ "code": "KeyE", "key": "e"},{ "code": "KeyP", "key": "p"}]],
"openLinkInForegroundTab": [
[{ "code": "KeyE", "key": "e" }, { "code": "KeyT", "key": "t" }]
],
"openLinkInNewWindow": [
[{ "code": "KeyE", "key": "e" }, { "code": "KeyW", "key": "w" }]
],
"openLinkInIncognitoWindow": [
[{ "code": "KeyE", "key": "e" }, { "code": "KeyP", "key": "p" }]
],
"downloadLink": [],
"focusLink": [[{ "code": "KeyE", "key": "e" }, { "code": "KeyF", "key": "f" }]],
"focusLink": [
[{ "code": "KeyE", "key": "e" }, { "code": "KeyF", "key": "f" }]
],
"focusInput": [],
"hintChars": "fjdkslaghrueiwoncmv",
"scrollDown": [
[{ "code": "KeyJ", "key": "j" }]
],
"scrollUp": [
[{ "code": "KeyK", "key": "k" }]
],
"scrollDown": [[{ "code": "KeyJ", "key": "j" }]],
"scrollUp": [[{ "code": "KeyK", "key": "k" }]],
"scrollLeft": [[{ "code": "KeyH", "key": "h" }]],
"scrollRight": [[{ "code": "KeyL", "key": "l" }]],
"scrollPageDown": [[{ "code": "Space", "key": "Space" }]],
"scrollPageUp": [[{ "code": "Space", "key": "Space", "shiftKey": true }]],
"scrollPageUp": [
[{ "code": "Space", "key": "Space", "shiftKey": true }]
],
"scrollHalfPageDown": [[{ "code": "KeyD", "key": "d" }]],
"scrollHalfPageUp": [[{ "code": "KeyU", "key": "u" }]],
"scrollToBottom": [[{ "code": "KeyG", "key": "G", "shiftKey": true }]],
"scrollToTop": [[{ "code": "KeyG", "key": "g" }, { "code": "KeyG", "key": "g" }]
"scrollToTop": [
[{ "code": "KeyG", "key": "g" }, { "code": "KeyG", "key": "g" }]
],
"scrollToLeft": [
[{ "code": "Digit0", "key": "0" }],
[{ "code": "Digit6", "key": "^", "shiftKey": true }]
],
"scrollToLeft": [[{ "code": "Digit0", "key": "0" }],[{ "code": "Digit6", "key": "^", "shiftKey": true }]],
"scrollToRight": [[{ "code": "Digit4", "key": "$", "shiftKey": true }]],
"goBack": [[{ "code": "KeyH", "key": "H", "shiftKey": true }]],
"goForward": [[{ "code": "KeyL", "key": "L", "shiftKey": true }]],
Expand All @@ -711,12 +725,8 @@
{ "code": "KeyU", "key": "U", "shiftKey": true }
]
],
"previousTab": [
[{ "code": "KeyJ", "key": "J", "shiftKey": true }]
],
"nextTab": [
[{ "code": "KeyK", "key": "K", "shiftKey": true }]
],
"previousTab": [[{ "code": "KeyJ", "key": "J", "shiftKey": true }]],
"nextTab": [[{ "code": "KeyK", "key": "K", "shiftKey": true }]],
"firstTab": [
[{ "code": "KeyG", "key": "g" }, { "code": "Digit0", "key": "0" }]
],
Expand All @@ -728,23 +738,41 @@
],
"moveTabLeft": [
[
{ "code": "KeyG", "key": "g"},
{ "code": "KeyG", "key": "g" },
{ "code": "KeyJ", "key": "J", "shiftKey": true }
]
],
"moveTabRight": [
[
{ "code": "KeyG", "key": "g"},
{ "code": "KeyG", "key": "g" },
{ "code": "KeyK", "key": "K", "shiftKey": true }
]
],
"moveTabFirst": [],
"moveTabLast": [],
"moveTabNewWindow": [],
"closeTab": [[{ "code": "KeyX", "key": "x" }]],
"closeOtherTabs": [[{ "code": "KeyG", "key": "g" }, {"code": "KeyX", "key": "x"}, {"code": "KeyA", "key": "a"} ]],
"closeRightTabs": [[{ "code": "KeyG", "key": "g" }, {"code": "KeyX", "key": "x"}, {"code": "Digit4", "key": "$", "shiftKey": true } ]],
"closeLeftTabs": [[{ "code": "KeyG", "key": "g" }, {"code": "KeyX", "key": "x"}, {"code": "Digit0", "key": "0" } ]],
"closeOtherTabs": [
[
{ "code": "KeyG", "key": "g" },
{ "code": "KeyX", "key": "x" },
{ "code": "KeyA", "key": "a" }
]
],
"closeRightTabs": [
[
{ "code": "KeyG", "key": "g" },
{ "code": "KeyX", "key": "x" },
{ "code": "Digit4", "key": "$", "shiftKey": true }
]
],
"closeLeftTabs": [
[
{ "code": "KeyG", "key": "g" },
{ "code": "KeyX", "key": "x" },
{ "code": "Digit0", "key": "0" }
]
],
"newTab": [[{ "code": "KeyT", "key": "t" }]],
"restoreTab": [[{ "code": "KeyX", "key": "X", "shiftKey": true }]],
"duplicateTab": [
Expand All @@ -759,14 +787,18 @@
"zoomOut": [],
"zoomReset": [],
"refreshTab": [[{ "code": "KeyR", "key": "r" }]],
"refreshAllTabs": [[{ "code": "KeyA", "key": "a" }, { "code": "KeyR", "key": "r" } ]],
"refreshAllTabs": [
[{ "code": "KeyA", "key": "a" }, { "code": "KeyR", "key": "r" }]
],
"hardRefreshTab": [[{ "code": "KeyR", "key": "R", "shiftKey": true }]],
"toggleMuteTab": [],
"toggleMuteAllTabs": [],
"togglePinTab": [[{ "code": "KeyG", "key": "g" },{ "code": "KeyP", "key": "p"}]],
"passOneKey": [[{ "code": "KeyI", "key":"I", "shiftKey": true }]],
"passAllKeys": [[{ "code": "KeyI", "key":"i"}]],
"exitPassMode": [[{ "code": "Escape", "key":"Esc"}]],
"togglePinTab": [
[{ "code": "KeyG", "key": "g" }, { "code": "KeyP", "key": "p" }]
],
"passOneKey": [[{ "code": "KeyI", "key": "I", "shiftKey": true }]],
"passAllKeys": [[{ "code": "KeyI", "key": "i" }]],
"exitPassMode": [[{ "code": "Escape", "key": "Esc" }]],
"copyURL": [
[{ "code": "KeyY", "key": "y" }, { "code": "KeyY", "key": "y" }]
],
Expand Down

0 comments on commit c495452

Please sign in to comment.