Search Cobb
Search Cobb is an extension for Chrome to perform in-page searches and has the following features:
- Can search using regular expression. In this case,
- Can search a range across multiple elements
- Accurately identifies grapheme clusters
- Can search using migemo
- Unifies a wide range of characters: with and without diacritical marks, combining characters, enclosing characters, characters constructed in squares, old and new forms of Kanji characters, etc.
- Can edit search string with key bindings similar to emacs. So you don't have to break your home position.
Screenshots
Comparison with extensions that don't allow searches across multiple elements
In the example of the image below, "バームクーヘン" (Baumkuchen) is in em element. Extensions that claim to be able to perform in-page searches with regular expressions can be classified into those that can search all elements together without distinguishing between inside and outside elements, and those that cannot.
Search Cobb belongs to the extensions on the side that can do that.
migemo search
migemo is a way to search Japanese by its romanized representation. Using this method, you can search for Japanese words without going through the input method. jsmigemo is used as a migemo library.
Search the alphabet with diacritical marks by base character
You can search for both combining character sequence and precomposed characters without distinction.
You can unify rare combining characters other than accented characters as well.
Search for kanji characters
In kanji used in the Japanese-speaking countries, the kanji characters included in the Joyo Kanji Hyo (kanji table for regular use) and the Jinmeiyo Kanji Hyo (kanji table for personal names) are considered to be identical to their old forms.
How to install
From Chrome Web Store
You can install from Chrome Web Store.
From Github repository
Clone the Search Cobb repository and load the src
directory in developer mode at chrome://extensions
. There is no difference in functionality from the extension available on the Chrome Web Store, while the repository may reflect progress in the source code more quickly.
Declare the shortcut keys
To enable Search Cobb to be operated using only the keyboard, you must first explicitly declare the shortcuts to be used.
Set a shortcut to Search Cobb in the shortcut key settings pane at chrome://extensions
. At least, a shortcut to open the search panel and Ctrl+N
(shortcut to advance the history) are required.
Now, Ctrl+N
, Ctrl+T
, and Ctrl+Shift+N
are a bit special. These key strokes are basically reserved by Chrome and cannot be received by the web page. However, the extension can be received as shown in the image above. Rather than using this reserved key stroke received directly, Search Cobb intersperses a redistribution mechanism that dispatches it to the active web page via emulated keyboard events. This effectively liberates the reserved key strokes to the web page. This means that the web page and other extensions will receive this reserved key strokes as if these were normal strokes.
This “redistribution mechanism” is an independent feature from Search Cobb, and is enabled even when the search panel is not displayed. Maybe something to note: The isTrusted
property of the event object generated by each key stroke is false because it is not an event generated by Chrome itself. Redistribution may not work well on web pages or extensions that behave isTrusted
when processing key strokes.
How to use
Activate the search panel
Press the declared shortcut or click the icon to open the search panel. Then, the process of creating indices for searching is executed and the progress is displayed as a bar at the top of the panel. Please wait until the progress bar reaches the right edge of the panel and turns green.
Switching search mode
Normally, the text you enter is treated as a javascript's regular expression, but you can control the search mode by including the following special meta string in the text. \L
and \M
are exclusive, and if more than one exists, the one closest to the end of the text takes precedence.
\L
Sets the search mode to literal mode. All meta characters in the regular expression are disabled\M
Sets the search mode to migemo mode\C
Disables character unifying. Searches only for exact matches to the text entered
These meta strings can be entered directly or toggled by pressing Alt+L
, Alt+M
, or Alt+C
.
Key bindings
You can use the following key bindings when you enter search string.
Key | Function |
---|---|
Ctrl+A | Move the caret to the beginning of the text |
Ctrl+E | Move the caret to the end of the text |
Ctrl+B | Move the caret back one grapheme cluster |
Ctrl+C | Copy the contents of the currently active highlighted search result to the clipboard |
Ctrl+F | Advance the caret by one grapheme cluster |
Ctrl+O | Click on the highlighted search result if the currently active one is a hyperlink |
Ctrl+P | Move back one item in the history |
Ctrl+N | Advance one item in the history. To enable this key binding, you must declare a shortcut for Search Cobb in chrome://extensions |
Ctrl+H | Delete one grapheme cluster before the caret |
Ctrl+W | Delete one word before the caret |
Ctrl+U | Delete text from the beginning of the text to before the caret |
Ctrl+K | Delete from the caret to the end of the text |
Ctrl+/ | Select all text |
Ctrl+M | Equivalent to Enter |
Ctrl+[ | Equivalent to Escape |
Alt+B | Move the caret back one word |
Alt+F | Advance the caret by one word |
Alt+L | Enter \L : switch the search mode to literal |
Alt+M | Enter \M : switch the search mode to migemo |
Alt+C | Enter \C : disable character unifying |
Enter | Commit the search string or to advance the active search result |
Shift+Enter | Commit the search string or to back the active search result |
Escape | Close the search panel |
Limitations
- If the search result is a single grapheme cluster and is contiguous, it will be combined into a single chunk until it reaches 200 grapheme clusters
- If the search result is too long, it will be split into 200 grapheme cluster chunks.
- Search results are limited to a maximum of 1000 results.
License
Among the source files that make up Search Cobb, src/dict/migemo-compact-dict
is released under GPL v2 because it is generated from SKK-JISYO.L.
All other files are released under Apache License, Version 2.0.