aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-03-06 21:37:12 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-03-06 21:56:54 +0900
commit93bd0bc54fd5ce7a2803f2ebc7c834b1b815afda (patch)
tree18c0bd58d1f3ce268f36e96ead9239182e79ddd7 /src
parent72bf3cc2bdcc63864e064a64f7459aba004f4538 (diff)
show message on find
Diffstat (limited to 'src')
-rw-r--r--src/content/actions/find.js12
-rw-r--r--src/content/actions/operation.js5
-rw-r--r--src/content/components/top-content/find.js8
-rw-r--r--src/content/console-frames.js9
4 files changed, 28 insertions, 6 deletions
diff --git a/src/content/actions/find.js b/src/content/actions/find.js
index 80d6210..b266216 100644
--- a/src/content/actions/find.js
+++ b/src/content/actions/find.js
@@ -14,6 +14,13 @@ const postPatternNotFound = (pattern) => {
'Pattern not found: ' + pattern);
};
+const postPatternFound = (pattern) => {
+ return consoleFrames.postInfo(
+ window.document,
+ 'Pattern found: ' + pattern,
+ );
+};
+
const find = (string, backwards) => {
let caseSensitive = false;
let wrapScan = true;
@@ -34,9 +41,12 @@ const findNext = (keyword, reset, backwards) => {
window.getSelection().removeAllRanges();
found = find(keyword, backwards);
}
- if (!found) {
+ if (found) {
+ postPatternFound(keyword);
+ } else {
postPatternNotFound(keyword);
}
+
return {
type: actions.FIND_SET_KEYWORD,
keyword,
diff --git a/src/content/actions/operation.js b/src/content/actions/operation.js
index 5fd0f48..71b2470 100644
--- a/src/content/actions/operation.js
+++ b/src/content/actions/operation.js
@@ -62,10 +62,7 @@ const exec = (operation, repeat, settings) => {
return focuses.focusInput();
case operations.URLS_YANK:
urls.yank(window);
- return consoleFrames.postMessage(window.document, {
- type: messages.CONSOLE_SHOW_INFO,
- text: 'Current url yanked',
- });
+ return consoleFrames.postInfo(window.document, 'Current url yanked');
case operations.URLS_PASTE:
return urls.paste(window, operation.newTab ? operation.newTab : false);
default:
diff --git a/src/content/components/top-content/find.js b/src/content/components/top-content/find.js
index bccf040..9967d36 100644
--- a/src/content/components/top-content/find.js
+++ b/src/content/components/top-content/find.js
@@ -38,6 +38,10 @@ export default class FindComponent {
window.document,
'Pattern not found: ' + state.keyword);
}
+ consoleFrames.postInfo(
+ window.document,
+ 'Pattern found: ' + state.keyword,
+ );
return this.store.dispatch(findActions.next(state.keyword, false));
}
@@ -49,6 +53,10 @@ export default class FindComponent {
window.document,
'Pattern not found: ' + state.keyword);
}
+ consoleFrames.postInfo(
+ window.document,
+ 'Pattern found: ' + state.keyword,
+ );
return this.store.dispatch(findActions.prev(state.keyword, false));
}
}
diff --git a/src/content/console-frames.js b/src/content/console-frames.js
index 515ae09..0c0ec02 100644
--- a/src/content/console-frames.js
+++ b/src/content/console-frames.js
@@ -28,4 +28,11 @@ const postError = (doc, message) => {
});
};
-export { initialize, blur, postMessage, postError };
+const postInfo = (doc, message) => {
+ return postMessage(doc, {
+ type: messages.CONSOLE_SHOW_INFO,
+ text: message,
+ });
+};
+
+export { initialize, blur, postError, postInfo };