Skip to content

Commit b0643e3

Browse files
add screenshots to README, fix sync search result
1 parent ffd8c91 commit b0643e3

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

README.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ This is an extension for the browser extension <a href="https://github.com/piroo
1616
<li> search by any tab property </li>
1717
</ul>
1818

19-
<img alt="Tab searches with different settings " src="./resources/screenshot-merged.png" width="600px"> <!-- remove this for AMO -->
19+
<img alt="Tab searches with different settings" src="./resources/screenshot-merged.png" width="600px"> <!-- remove this for AMO -->
20+
<!-- Left to right: global search hotkey, customized filters, and search by tab ID. -->
2021

2122
There are quite a lot of things that can, but don't need to, be changed in the extensions options. The descriptions of the options also explain how some of the more advanced search features work.
2223
Should the search bar not show up after installing this extension, then have a look at the top of the options page as well.
@@ -34,6 +35,27 @@ This extension doesn't collect any data, nor does it directly or indirectly cont
3435
This extension only momentarily changes how tabs are displayed in the sidebar, but does no persistent changes to them, and should thus also not be able to cause any (tab) data loss.
3536

3637

38+
## Screenshots
39+
40+
![](./resources/screenshot-default.png)
41+
Default view of search results in Firefox 89 (other screenshots have customized options).
42+
43+
![](./resources/screenshot-visuals.png)
44+
Highlighting search results in bold orange, the currently selected result in bold blue, and parents of search results in green.
45+
All other tabs are shrunk and dimmed.
46+
Pressing Ctrl+Enter will switch to the blue tab.
47+
48+
![](./resources/screenshot-global.png)
49+
The global hotkey allows searching (and then switching to) tabs without moving the cursor. For technical reasons, the search panel has to open in the little popup at the top.
50+
51+
![](./resources/screenshot-by-id.png)
52+
There is an option to display the tab IDs while the search panel is focused, to the quickly switch to tabs by id.
53+
54+
![](./resources/screenshot-modes.png)
55+
Additional search modes: case sensitive, as whole word, or by regular expression.
56+
By default tab titles and URLs are searched, but there is an option to search all other (tree style) tab properties as well.
57+
58+
3759
## Additional Features
3860

3961
I am happy to receive feedback or contributions on this. This is the list of stuff that should be addressed:

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tst-search",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"title": "TST Tab Search",
55
"description": "Filter Tree Style Tab's sidebar by search terms.",
66
"author": "Niklas Gollenstede",

src/background/index.esm.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ async function doSearch({
161161
} term += '';
162162

163163
// pick tab properties to search
164-
const fields = fieldsDefault; if (fieldsPrefix) {
165-
if (options.search.children.searchByTabIds.value[0] && (/^\s*\d+\s*$/).test(term)) { fields.splice(0, Infinity, 'id'); }
164+
const fields = fieldsDefault;
165+
if (options.search.children.searchByTabIds.value[0] && (/^\s*\d+\s*$/).test(term)) { fields.splice(0, Infinity, 'id'); }
166+
else if (fieldsPrefix) {
166167
const match = (/^(\w+(?:[|]\w+)*): ?(.*)/).exec(term);
167168
if (match) { fields.splice(0, Infinity, ...match[1].split('|')); term = match[2]; }
168169
}

src/content/embed.esm.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ const port = new Port(Browser.Runtime.connect(), web_ext_Port);
1616
(async () => {
1717
const windowId = +(new globalThis.URL(globalThis.location.href).searchParams.get('windowId') ?? -1);
1818

19-
const initialTerm = windowId === -1 ? '' : (await RPC.onSearched({ windowId, }, result => setResult(result))).term;
19+
const initialTerm = windowId === -1 ? '' : (await RPC.onSearched({ windowId, }, result => { !inputs.term.matches(':focus') && setResult(result); })).term;
2020

21-
const { setResult, applyOptions, } = (await render(window, { RPC, destructive: true, windowId, initialTerm, }));
21+
const { inputs, setResult, applyOptions, } = (await render(window, { RPC, destructive: true, windowId, initialTerm, }));
2222

2323
applyOptions((await RPC.onOptions(applyOptions)));
2424

src/content/form.esm.js

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default async function render(/**@type{Window}*/window, {
3030
setResult((await RPC.doSearch(form)));
3131
}
3232
function setResult(/**@type{import('../background/index.esm.js').SearchResult}*/result) {
33+
!inputs.term.matches(':focus') && (inputs.term.value = result.term);
3334
matchIndex.textContent = result.failed ? '??' : result.cleared ? '' : result.index >= 0 ? ((result.index + 1) +' / '+ result.matches) : (result.matches || 'none') +'';
3435
document.documentElement.style.setProperty('--count-width', matchIndex.clientWidth +'px');
3536
}

0 commit comments

Comments
 (0)