Skip to content

Commit

Permalink
Merge pull request #383 from m-edlund/feat/changeNameOfTab
Browse files Browse the repository at this point in the history
feature: option to change name of tab
  • Loading branch information
killergerbah authored Mar 19, 2024
2 parents 696c5b8 + 49eb104 commit 903f927
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/app/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,10 @@ function App({ origin, logoUrl, settings, extension, fetcher, onSettingsChanged
);
}, [keyBinder, handleOpenCopyHistory, ankiDialogOpen]);

useEffect(() => {
document.title = settings.tabName;
}, [settings.tabName]);

const { initialized: i18nInitialized } = useI18n({ language: settings.language });

if (!i18nInitialized) {
Expand Down
2 changes: 2 additions & 0 deletions common/app/services/video-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ export default class VideoChannel {
clickToMineDefaultAction,
language,
lastSubtitleOffset,
tabName,
} = settings;
const message: MiscSettingsToVideoMessage = {
command: 'miscSettings',
Expand All @@ -550,6 +551,7 @@ export default class VideoChannel {
clickToMineDefaultAction,
language,
lastSubtitleOffset,
tabName,
},
};
this.protocol.postMessage(message);
Expand Down
8 changes: 8 additions & 0 deletions common/components/SettingsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ export default function SettingsForm({
rememberSubtitleOffset,
autoCopyCurrentSubtitle,
alwaysPlayOnSubtitleRepeat,
tabName,
subtitleRegexFilter,
subtitleRegexFilterTextReplacement,
language,
Expand Down Expand Up @@ -1826,6 +1827,13 @@ export default function SettingsForm({
step: 1,
}}
/>
<TextField
label={t('settings.tabName')}
fullWidth
value={tabName}
color="secondary"
onChange={(event) => handleSettingChanged('tabName', event.target.value)}
/>
<TextField
label={t('settings.subtitleRegexFilter')}
fullWidth
Expand Down
1 change: 1 addition & 0 deletions common/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
"subtitleAlignment": "Untertitel-Position",
"subtitleAlignmentBottom": "Unten",
"subtitleAlignmentTop": "Oben",
"tabName": "Reiterbezeichnung",
"subtitleRegexFilter": "Untertitelfilter (Regulärer Ausdruck)",
"subtitleRegexFilterTextReplacement": "Untertitelfilter Ersetzung",
"subtitleSize": "Untertitelgröße",
Expand Down
1 change: 1 addition & 0 deletions common/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
"subtitleAlignment": "Subtitle Alignment",
"subtitleAlignmentBottom": "Bottom",
"subtitleAlignmentTop": "Top",
"tabName": "Name of the tab",
"subtitleRegexFilter": "Subtitle regex filter",
"subtitleRegexFilterTextReplacement": "Subtitle regex filter text replacement",
"subtitleSize": "Subtitle Size",
Expand Down
1 change: 1 addition & 0 deletions common/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
"subtitleAlignment": "Alineación de Subtítulos",
"subtitleAlignmentBottom": "Inferior",
"subtitleAlignmentTop": "Superior",
"tabName": "Nombre de la pestaña",
"subtitleRegexFilter": "Filtro regex para subtítulos",
"subtitleRegexFilterTextReplacement": "Texto de reemplazo para el filtro regex",
"subtitleSize": "Tamaño de los subtítulos",
Expand Down
1 change: 1 addition & 0 deletions common/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
"subtitleAlignment": "字幕の表示位置",
"subtitleAlignmentBottom": "下部",
"subtitleAlignmentTop": "上部",
"tabName": "タブ名",
"subtitleRegexFilter": "字幕の正規表現フィルタ",
"subtitleRegexFilterTextReplacement": "字幕の正規表現フィルタの置き換えテキスト",
"subtitleSize": "字幕のサイズ",
Expand Down
1 change: 1 addition & 0 deletions common/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
"subtitleAlignment": "Wyrównanie napisów",
"subtitleAlignmentBottom": "Dół",
"subtitleAlignmentTop": "Góra",
"tabName": "Nazwa karty",
"subtitleRegexFilter": "Filtr Regex napisów",
"subtitleRegexFilterTextReplacement": "Zamiana tekstu z filtru Regex napisów",
"subtitleSize": "Wielkość napisów",
Expand Down
1 change: 1 addition & 0 deletions common/locales/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
"subtitleAlignment": "Alinhamento da legenda",
"subtitleAlignmentBottom": "Inferior",
"subtitleAlignmentTop": "Superior",
"tabName": "Nome da guia",
"subtitleRegexFilter": "Filtro regex da legenda",
"subtitleRegexFilterTextReplacement": "Substituição de texto do filtro regex da legenda",
"subtitleSize": "Tamanho da legenda",
Expand Down
1 change: 1 addition & 0 deletions common/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
"subtitleAlignment": "Выравнивание субтитров",
"subtitleAlignmentBottom": "По нижнему краю",
"subtitleAlignmentTop": "По верхнему краю",
"tabName": "название вкладки",
"subtitleRegexFilter": "Пропускать субтитры через фильтр с регулярным выражением",
"subtitleRegexFilterTextReplacement": "Замена текста для фильтра регулярных выражений для субтитров",
"subtitleSize": "Размер субтитров",
Expand Down
1 change: 1 addition & 0 deletions common/locales/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
"subtitleAlignment": "字幕对齐方式",
"subtitleAlignmentBottom": "底部",
"subtitleAlignmentTop": "顶部",
"tabName": "选项卡名称",
"subtitleRegexFilter": "字幕正则筛选器",
"subtitleRegexFilterTextReplacement": "字幕正则筛选器文本替换",
"subtitleSize": "字幕大小",
Expand Down
1 change: 1 addition & 0 deletions common/settings/settings-import-export.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ it('validates exported settings', () => {
updateLastCard: { keys: '⇧+⌃+U' },
},
preferMp3: true,
tabName: 'asbplayer',
miningHistoryStorageLimit: 25,
preCacheSubtitleDom: true,
clickToMineDefaultAction: 1,
Expand Down
3 changes: 3 additions & 0 deletions common/settings/settings-import-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ const settingsSchema = {
preferMp3: {
type: 'boolean',
},
tabName: {
type: 'string',
},
miningHistoryStorageLimit: {
type: 'number',
},
Expand Down
1 change: 1 addition & 0 deletions common/settings/settings-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const defaultSettings: AsbplayerSettings = {
toggleRepeat: { keys: isMacOs ? '⇧+R' : 'shift+R' },
},
preferMp3: true,
tabName: 'asbplayer',
miningHistoryStorageLimit: 25,
preCacheSubtitleDom: true,
clickToMineDefaultAction: PostMineAction.showAnkiDialog,
Expand Down
1 change: 1 addition & 0 deletions common/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface MiscSettings {
readonly language: string;
readonly clickToMineDefaultAction: PostMineAction;
readonly lastSubtitleOffset: number;
readonly tabName: string;
}

export interface AnkiSettings {
Expand Down

0 comments on commit 903f927

Please sign in to comment.