From d4b083509162f68001edc8af667370116639fa4c Mon Sep 17 00:00:00 2001 From: mschae23 Date: Mon, 13 Apr 2026 08:20:22 +0200 Subject: [PATCH] Use crowdsourced title even if formatter is disabled --- src/titles/titleRenderer.ts | 17 +++++------------ src/videoBranding/videoBranding.ts | 8 ++------ 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/titles/titleRenderer.ts b/src/titles/titleRenderer.ts index bbcf2695..7d72369c 100644 --- a/src/titles/titleRenderer.ts +++ b/src/titles/titleRenderer.ts @@ -1,12 +1,12 @@ import { VideoID, getVideoID } from "../../maze-utils/src/video"; -import Config, { TitleFormatting } from "../config/config"; +import Config from "../config/config"; import { getVideoTitleIncludingUnsubmitted } from "../dataFetching"; import { logError } from "../utils/logger"; import { MobileFix, addNodeToListenFor, getOrCreateTitleButtonContainer } from "../utils/titleBar"; import { BrandingLocation, ShowCustomBrandingInfo, extractVideoIDFromElement, getActualShowCustomBranding, hasCustomTitle, setShowCustomBasedOnDefault, shouldShowCasual, showThreeShowOriginalStages, toggleShowCustom } from "../videoBranding/videoBranding"; -import { cleanEmojis, formatTitle } from "./titleFormatter"; +import { formatTitle } from "./titleFormatter"; import { setCurrentVideoTitle } from "./pageTitleHandler"; -import { getTitleFormatting, shouldCleanEmojis, shouldDefaultToCustom, shouldReplaceTitles, shouldReplaceTitlesFastCheck, shouldUseCrowdsourcedTitles } from "../config/channelOverrides"; +import { shouldDefaultToCustom, shouldReplaceTitles, shouldReplaceTitlesFastCheck, shouldUseCrowdsourcedTitles } from "../config/channelOverrides"; import { countTitleReplacement } from "../config/stats"; import { isOnV3Extension, onMobile } from "../../maze-utils/src/pageInfo"; import { isFirefoxOrSafari, waitFor } from "../../maze-utils/src"; @@ -74,14 +74,7 @@ export async function replaceTitle(element: HTMLElement, videoID: VideoID, showC if (!await isOnCorrectVideo(element, brandingLocation, videoID)) return false; const title = titleData?.title; - const originalTitle = getOriginalTitleText(originalTitleElement, brandingLocation).trim(); - if (title && await shouldUseCrowdsourcedTitles(videoID) - // If there are just formatting changes, and the user doesn't want those, don't replace - && (await getTitleFormatting(videoID) !== TitleFormatting.Disable || originalTitle.toLowerCase() !== title.toLowerCase()) - && (await getTitleFormatting(videoID) !== TitleFormatting.Disable - || await shouldCleanEmojis(videoID) || cleanEmojis(originalTitle.toLowerCase()) !== cleanEmojis(title.toLowerCase())) - && (!await shouldShowCasual(videoID, element, showCustomBranding, brandingLocation) - || (originalTitle.toLowerCase() === title.toLowerCase() && await getTitleFormatting(videoID) !== TitleFormatting.Disable))) { + if (title && await shouldUseCrowdsourcedTitles(videoID)) { const formattedTitle = await formatTitle(title, true, videoID); if (!await isOnCorrectVideo(element, brandingLocation, videoID)) return false; @@ -825,4 +818,4 @@ function getOriginalTitleText(originalTitleElement: HTMLElement, brandingLocatio default: return originalTitleElement?.textContent ?? ""; } -} \ No newline at end of file +} diff --git a/src/videoBranding/videoBranding.ts b/src/videoBranding/videoBranding.ts index 7320d78b..0ff8e81c 100644 --- a/src/videoBranding/videoBranding.ts +++ b/src/videoBranding/videoBranding.ts @@ -10,7 +10,6 @@ import Config, { ThumbnailCacheOption, TitleFormatting } from "../config/config" import { logError } from "../utils/logger"; import { getVideoCasualInfo, getVideoTitleIncludingUnsubmitted } from "../dataFetching"; import { handleOnboarding } from "./onboarding"; -import { cleanEmojis, cleanResultingTitle } from "../titles/titleFormatter"; import { getTitleFormatting, shouldDefaultToCustom, shouldDefaultToCustomFastCheck, shouldUseCrowdsourcedTitles } from "../config/channelOverrides"; import { isOnV3Extension, onMobile } from "../../maze-utils/src/pageInfo"; import { addMaxTitleLinesCssToPage } from "../utils/cssInjector"; @@ -558,10 +557,7 @@ export function setupOptionChangeListener(): void { async function hasCustomTitleWithOriginalTitle(videoID: VideoID, originalTitleElement: HTMLElement, brandingLocation: BrandingLocation): Promise { const title = await getVideoTitleIncludingUnsubmitted(videoID, brandingLocation); - const originalTitle = originalTitleElement?.textContent; - const customTitle = title && !title.original - && (!originalTitle || (cleanResultingTitle(cleanEmojis(title.title))).toLowerCase() !== (cleanResultingTitle(cleanEmojis(originalTitle))).toLowerCase()) - && await shouldUseCrowdsourcedTitles(videoID); + const customTitle = title && await shouldUseCrowdsourcedTitles(videoID); return !!customTitle; } @@ -609,4 +605,4 @@ export async function showThreeShowOriginalStages(videoID: VideoID, originalTitl return await shouldShowCasualOnVideoWithOriginalTitleElement(videoID, originalTitleElement, brandingLocation) && await hasCustomTitleWithOriginalTitle(videoID, originalTitleElement, brandingLocation) && await shouldDefaultToCustom(videoID); -} \ No newline at end of file +}