Add setting to hide AI summary below YouTube player (#2901) #2902
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


π Pull Request Description
This PR implements the feature requested in #2901 β to allow users to hide the new AI-generated summary that appears below the YouTube video player, between the description and the comments.
βοΈ Summary of Changes
Settings Toggle:
-->Added a new user-facing option Hide AI summary below player to the General section of the extension settings.
-->The setting is labeled hide_ai_summary and is fully localized (_locales/en/messages.json).
Hiding Logic via CSS and JavaScript:
--> A CSS rule was added in both styles.css and general.css targeting the AI summary container ([target-id*="description"]).
-->This rule hides the section when the root element has the attribute it-hide-ai-summary="true".
--.A feature handler (extension.features.hideAISummary) was created to read the setting and toggle this attribute accordingly.
Initialization and Messaging:
-->init.js calls hideAISummary() on every YouTube page load to apply the setting instantly.
-->The background script listens for changes to the setting and messages all active YouTube tabs.
-->The content script responds by re-running the feature logic, applying the change dynamically without a page reload.
Future-Proofing & Performance:
-->Used a flexible CSS selector ([target-id*="description"]) to handle potential changes in YouTubeβs DOM structure.
-->Messaging is limited to YouTube tabs only for efficiency.
-->Basic error handling added to ensure stable message passing.
π― Why This Solves the Issue
The changes directly implement the request in #2901 by:
-->Providing a clear toggle option for users
-->Hiding the AI summary panel only when enabled
This gives users the exact control they asked for β to remove the AI summary section if they donβt want to see it.
closes issue #2901