aboutsummaryrefslogtreecommitdiff
path: root/src/content/actions
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/actions')
-rw-r--r--src/content/actions/index.js6
-rw-r--r--src/content/actions/mark.js46
-rw-r--r--src/content/actions/operation.js13
3 files changed, 61 insertions, 4 deletions
diff --git a/src/content/actions/index.js b/src/content/actions/index.js
index 6976df7..0a16fdf 100644
--- a/src/content/actions/index.js
+++ b/src/content/actions/index.js
@@ -22,4 +22,10 @@ export default {
// Find
FIND_SET_KEYWORD: 'find.set.keyword',
+
+ // Mark
+ MARK_START_SET: 'mark.start.set',
+ MARK_START_JUMP: 'mark.start.jump',
+ MARK_CANCEL: 'mark.cancel',
+ MARK_SET_LOCAL: 'mark.set.local',
};
diff --git a/src/content/actions/mark.js b/src/content/actions/mark.js
new file mode 100644
index 0000000..712a811
--- /dev/null
+++ b/src/content/actions/mark.js
@@ -0,0 +1,46 @@
+import actions from 'content/actions';
+import messages from 'shared/messages';
+
+const startSet = () => {
+ return { type: actions.MARK_START_SET };
+};
+
+const startJump = () => {
+ return { type: actions.MARK_START_JUMP };
+};
+
+const cancel = () => {
+ return { type: actions.MARK_CANCEL };
+};
+
+const setLocal = (key, x, y) => {
+ return {
+ type: actions.MARK_SET_LOCAL,
+ key,
+ x,
+ y,
+ };
+};
+
+const setGlobal = (key, x, y) => {
+ browser.runtime.sendMessage({
+ type: messages.MARK_SET_GLOBAL,
+ key,
+ x,
+ y,
+ });
+ return { type: '' };
+};
+
+const jumpGlobal = (key) => {
+ browser.runtime.sendMessage({
+ type: messages.MARK_JUMP_GLOBAL,
+ key,
+ });
+ return { type: '' };
+};
+
+export {
+ startSet, startJump, cancel, setLocal,
+ setGlobal, jumpGlobal,
+};
diff --git a/src/content/actions/operation.js b/src/content/actions/operation.js
index 89d7fec..1aeb8be 100644
--- a/src/content/actions/operation.js
+++ b/src/content/actions/operation.js
@@ -6,6 +6,7 @@ import * as focuses from 'content/focuses';
import * as urls from 'content/urls';
import * as consoleFrames from 'content/console-frames';
import * as addonActions from './addon';
+import * as markActions from './mark';
import * as properties from 'shared/settings/properties';
// eslint-disable-next-line complexity, max-lines-per-function
@@ -39,16 +40,16 @@ const exec = (operation, repeat, settings, addonEnabled) => {
scrolls.scrollPages(operation.count, smoothscroll, repeat);
break;
case operations.SCROLL_TOP:
- scrolls.scrollTop(smoothscroll, repeat);
+ scrolls.scrollToTop(smoothscroll);
break;
case operations.SCROLL_BOTTOM:
- scrolls.scrollBottom(smoothscroll, repeat);
+ scrolls.scrollToBottom(smoothscroll);
break;
case operations.SCROLL_HOME:
- scrolls.scrollHome(smoothscroll, repeat);
+ scrolls.scrollToHome(smoothscroll);
break;
case operations.SCROLL_END:
- scrolls.scrollEnd(smoothscroll, repeat);
+ scrolls.scrollToEnd(smoothscroll);
break;
case operations.FOLLOW_START:
window.top.postMessage(JSON.stringify({
@@ -57,6 +58,10 @@ const exec = (operation, repeat, settings, addonEnabled) => {
background: operation.background,
}), '*');
break;
+ case operations.MARK_SET_PREFIX:
+ return markActions.startSet();
+ case operations.MARK_JUMP_PREFIX:
+ return markActions.startJump();
case operations.NAVIGATE_HISTORY_PREV:
navigates.historyPrev(window);
break;