Skip to content

Commit 634ce58

Browse files
cope with outdated option values
1 parent e2dfcf5 commit 634ce58

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

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.2",
3+
"version": "0.0.3",
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ const TST = tstApi({
2929
name: manifest.name,
3030
icons: manifest.icons,
3131
style: [ 'miss', 'child', 'hit', 'active', 'custom', ].map(
32-
name => options.result.children[name].children.styles.children.map(style => {
32+
name => options.result.children[name].children.styles.children.map(style => { try {
3333
const values = Array.isArray(style.value) ? style.value : [ style.value, ];
3434
return typeof style.model.extra.get === 'function' ? style.model.extra.get(...values) : values[0] ? style.model.extra.value : '';
35-
}).join('\n')
35+
} catch (error) { console.error(error); return ''; } }).join('\n')
3636
).join('\n')
3737
+'\n'+ options.advanced.children.hideHeader.value
3838
+'\n'+ String.raw`.tab.tst-search\:searching:not(.pinned)::after { content: attr(data-tab-id); padding: 0 0 0 .5em; }`,

src/common/options.esm.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const isBeta = manifest.applications.gecko.id.endsWith('-dev');
6868
[ 'bold', true, 'Bold Text', String.raw`
6969
.tab:not(.pinned).tst-search\:matching .label { font-weight: bold; }
7070
`, ],
71-
[ 'fgColor', [ false, '#ff4300', ], [ { type: 'boolean', }, { prefix: 'Text Color', type: 'color', }, ], (active, color) => active ? String.raw`
71+
[ 'fgColor', [ false, '#ff4300', ], [ { type: 'boolean', }, { prefix: 'Text Color', type: 'color', }, ], (active, color = '#ff4300') => active ? String.raw`
7272
.tab:not(.pinned).tst-search\:matching .label { color: ${globalThis.CSS.escape(color).replace('\\#', '#')}; }
7373
` : '', ],
7474
]),
@@ -79,7 +79,7 @@ const isBeta = manifest.applications.gecko.id.endsWith('-dev');
7979
description: `The active search result, which can be scrolled through with <code>Enter</code> and <code>Shift</code>+<code>Enter</code>.`,
8080
default: true, children: {
8181
styles: styles([
82-
[ 'fgColor', [ true, '#0085ff', ], [ { type: 'boolean', }, { prefix: 'Text Color', type: 'color', }, ], (active, color) => active ? String.raw`
82+
[ 'fgColor', [ true, '#0085ff', ], [ { type: 'boolean', }, { prefix: 'Text Color', type: 'color', }, ], (active, color = '#0085ff') => active ? String.raw`
8383
.tab:not(.pinned).tst-search\:active .label { color: ${globalThis.CSS.escape(color).replace('\\#', '#')}; }
8484
` : '', ],
8585
[ 'bold', false, 'Bold Text', String.raw`
@@ -93,7 +93,7 @@ const isBeta = manifest.applications.gecko.id.endsWith('-dev');
9393
description: `Any tabs with children that match the search.`,
9494
default: true, children: {
9595
styles: styles([
96-
[ 'fgColor', [ false, '#0aff00', ], [ { type: 'boolean', }, { prefix: 'Text Color', type: 'color', }, ], (active, color) => active ? String.raw`
96+
[ 'fgColor', [ false, '#0aff00', ], [ { type: 'boolean', }, { prefix: 'Text Color', type: 'color', }, ], (active, color = '#0aff00') => active ? String.raw`
9797
.tab:not(.pinned).tst-search\:child-matching .label { color: ${globalThis.CSS.escape(color).replace('\\#', '#')}; }
9898
` : '', ],
9999
[ 'hide', false, 'Hide Completely', String.raw`
@@ -107,7 +107,7 @@ const isBeta = manifest.applications.gecko.id.endsWith('-dev');
107107
description: `Any tab that neither matches not has matching children.`,
108108
default: true, children: {
109109
styles: styles([
110-
[ 'shrink', [ true, 50, ], [ { type: 'boolean', }, { prefix: 'Shrink Height to', type: 'integer', suffix: '%', }, ], (active, shrink) => active ? String.raw`
110+
[ 'shrink', [ true, 50, ], [ { type: 'boolean', }, { prefix: 'Shrink Height to', type: 'integer', suffix: '%', }, ], (active, shrink = 50) => active ? String.raw`
111111
.tab:not(.pinned).collapsed:where(.tst-search\:matching, .tst-search\:child-matches, .tst-search\:not-matching) {
112112
margin-top: 0; display: none;
113113
}
@@ -117,7 +117,7 @@ const isBeta = manifest.applications.gecko.id.endsWith('-dev');
117117
transform: scaleY(${shrink.toFixed(6)}%); transform-origin: top;
118118
}
119119
` : '', [ { }, { from: 25, to: 80, }, ], ],
120-
[ 'opacity', [ false, 60, ], [ { type: 'boolean', }, { prefix: 'Reduce Opacity to', type: 'integer', suffix: '%', }, ], (active, opacity) => active ? String.raw`
120+
[ 'opacity', [ false, 60, ], [ { type: 'boolean', }, { prefix: 'Reduce Opacity to', type: 'integer', suffix: '%', }, ], (active, opacity = 60) => active ? String.raw`
121121
.tab:not(.pinned).tst-search\:not-matching { opacity: ${(opacity/100).toFixed(6)}; }
122122
` : '', [ { }, { from: 0, to: 100, }, ], ],
123123
[ 'hide', false, 'Hide Completely', String.raw`

src/views/options.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'module!node_modules/web-ext-utils/browser/': { manifest, },
33
'node_modules/web-ext-utils/options/editor/inline': Inline,
44
'module!node_modules/web-ext-utils/utils/notify': notify,
5-
'module!../background/': { register, },
5+
'module!../background/': { TST, },
66
}) => async (/**@type{Window}*/window, location) => { const { document, } = window;
77

88
document.head.insertAdjacentHTML('beforeend', String.raw`<style>
@@ -20,7 +20,7 @@ document.head.insertAdjacentHTML('beforeend', String.raw`<style>
2020

2121
async function onCommand({ name, }, _buttonId) { try { switch (name) {
2222
case 'register': { try {
23-
(await register()); notify.info('Registered', `${manifest.name} should now work!`);
23+
(await TST.register()); notify.info('Registered', `${manifest.name} should now work!`);
2424
} catch (error) {
2525
notify.error('TST Registration Failed', `Are you sure Tree Style Tabs is installed and enabled?\nThis extension won't do anything without that.`);
2626
} } break;

0 commit comments

Comments
 (0)