aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-rw-r--r--src/content/actions/mark.js20
-rw-r--r--src/content/components/common/mark.js15
2 files changed, 33 insertions, 2 deletions
diff --git a/src/content/actions/mark.js b/src/content/actions/mark.js
index 1f5174e..712a811 100644
--- a/src/content/actions/mark.js
+++ b/src/content/actions/mark.js
@@ -1,4 +1,5 @@
import actions from 'content/actions';
+import messages from 'shared/messages';
const startSet = () => {
return { type: actions.MARK_START_SET };
@@ -21,6 +22,25 @@ const setLocal = (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/components/common/mark.js b/src/content/components/common/mark.js
index 06b2657..ce35afa 100644
--- a/src/content/components/common/mark.js
+++ b/src/content/components/common/mark.js
@@ -30,8 +30,10 @@ export default class MarkComponent {
if (key.ctrlKey || key.metaKey || key.altKey) {
consoleFrames.postError(window.document, 'Unknown mark');
- } else if (key.shiftKey) {
- consoleFrames.postError(window.document, 'Globa marks not supported');
+ } else if (key.shiftKey && markStage.setMode) {
+ this.doSetGlobal(key);
+ } else if (key.shiftKey && markStage.jumpMode) {
+ this.doJumpGlobal(key);
} else if (markStage.setMode) {
this.doSet(key);
} else if (markStage.jumpMode) {
@@ -56,4 +58,13 @@ export default class MarkComponent {
let { x, y } = marks[key.key];
scrolls.scrollTo(x, y, smoothscroll);
}
+
+ doSetGlobal(key) {
+ let { x, y } = scrolls.getScroll();
+ this.store.dispatch(markActions.setGlobal(key.key, x, y));
+ }
+
+ doJumpGlobal(key) {
+ this.store.dispatch(markActions.jumpGlobal(key.key));
+ }
}