cleanup: dedupe setPageTitle fallback in renderer-settings
4.6.77 inlined the setPageTitle global-window resolution + fallback twice — once in each branch of the "vods+streamer vs other tab" conditional. Reading two near-identical 4-line if/else stanzas back to back was harder than necessary. Collapsed the branch to a single ternary that picks the title text first, then a single setPageTitle resolve + apply block at the end. Same behavior, one resolution of the optional global. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7c99193e25
commit
e705beabf3
@ -193,16 +193,12 @@ function changeLanguage(lang: string): void {
|
||||
|
||||
const activeTabId = document.querySelector('.tab-content.active')?.id || 'vodsTab';
|
||||
const activeTab = activeTabId.replace('Tab', '');
|
||||
if (activeTab === 'vods' && currentStreamer) {
|
||||
const setTitle = (window as unknown as { setPageTitle?: (text: string) => void }).setPageTitle;
|
||||
if (typeof setTitle === 'function') setTitle(currentStreamer);
|
||||
else byId('pageTitle').textContent = currentStreamer;
|
||||
} else {
|
||||
const setTitle = (window as unknown as { setPageTitle?: (text: string) => void }).setPageTitle;
|
||||
const text = (UI_TEXT.tabs as Record<string, string>)[activeTab] || UI_TEXT.appName;
|
||||
if (typeof setTitle === 'function') setTitle(text);
|
||||
else byId('pageTitle').textContent = text;
|
||||
}
|
||||
const titleText = (activeTab === 'vods' && currentStreamer)
|
||||
? currentStreamer
|
||||
: ((UI_TEXT.tabs as Record<string, string>)[activeTab] || UI_TEXT.appName);
|
||||
const setTitle = (window as unknown as { setPageTitle?: (text: string) => void }).setPageTitle;
|
||||
if (typeof setTitle === 'function') setTitle(titleText);
|
||||
else byId('pageTitle').textContent = titleText;
|
||||
|
||||
void refreshRuntimeMetrics();
|
||||
void refreshAutomationStatusLine();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user