Ver Fonte

feat: fix hdr issues feature done

Sv443 há 11 meses atrás
pai
commit
39d15c2058

+ 5 - 0
assets/style/fixHDR.css

@@ -0,0 +1,5 @@
+#side-panel ytmusic-player-queue-item[play-button-state="loading"],
+#side-panel ytmusic-player-queue-item[play-button-state="playing"],
+#side-panel ytmusic-player-queue-item[play-button-state="paused"] {
+  background-color: #1D1D1D !important;
+}

+ 7 - 7
assets/translations/README.md

@@ -56,7 +56,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `copy_to_clipboard_error` | `Couldn't copy the text to the clipboard. Please copy it from here manually:\n%1` |
 | `clear_list` | `Clear the list` |
 | `clear_list_confirm` | `Do you really want to clear the list and leave only the currently playing song?` |
-| `feature_desc_fixHdrIssues` | `Fix rendering issues when using an HDR-compatible GPU and monitor` |
+| `feature_desc_fixHdrIssues` | `Prevent some rendering issues when using an HDR-compatible GPU and monitor` |
 | `feature_desc_scrollToActiveSongBtn` | `Add a button above the queue to scroll to the currently playing song` |
 | `feature_desc_clearQueueBtn` | `Add a button above the currently playing queue or playlist to quickly clear it` |
 
@@ -69,7 +69,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `copy_to_clipboard_error` | `Couldn't copy the text to the clipboard. Please copy it from here manually:\n%1` |
 | `clear_list` | `Clear the list` |
 | `clear_list_confirm` | `Do you really want to clear the list and leave only the currently playing song?` |
-| `feature_desc_fixHdrIssues` | `Fix rendering issues when using an HDR-compatible GPU and monitor` |
+| `feature_desc_fixHdrIssues` | `Prevent some rendering issues when using an HDR-compatible GPU and monitor` |
 | `feature_desc_scrollToActiveSongBtn` | `Add a button above the queue to scroll to the currently playing song` |
 | `feature_desc_clearQueueBtn` | `Add a button above the currently playing queue or playlist to quickly clear it` |
 
@@ -82,7 +82,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `copy_to_clipboard_error` | `Couldn't copy the text to the clipboard. Please copy it from here manually:\n%1` |
 | `clear_list` | `Clear the list` |
 | `clear_list_confirm` | `Do you really want to clear the list and leave only the currently playing song?` |
-| `feature_desc_fixHdrIssues` | `Fix rendering issues when using an HDR-compatible GPU and monitor` |
+| `feature_desc_fixHdrIssues` | `Prevent some rendering issues when using an HDR-compatible GPU and monitor` |
 | `feature_desc_scrollToActiveSongBtn` | `Add a button above the queue to scroll to the currently playing song` |
 | `feature_desc_clearQueueBtn` | `Add a button above the currently playing queue or playlist to quickly clear it` |
 
@@ -95,7 +95,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `copy_to_clipboard_error` | `Couldn't copy the text to the clipboard. Please copy it from here manually:\n%1` |
 | `clear_list` | `Clear the list` |
 | `clear_list_confirm` | `Do you really want to clear the list and leave only the currently playing song?` |
-| `feature_desc_fixHdrIssues` | `Fix rendering issues when using an HDR-compatible GPU and monitor` |
+| `feature_desc_fixHdrIssues` | `Prevent some rendering issues when using an HDR-compatible GPU and monitor` |
 | `feature_desc_scrollToActiveSongBtn` | `Add a button above the queue to scroll to the currently playing song` |
 | `feature_desc_clearQueueBtn` | `Add a button above the currently playing queue or playlist to quickly clear it` |
 
@@ -108,7 +108,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `copy_to_clipboard_error` | `Couldn't copy the text to the clipboard. Please copy it from here manually:\n%1` |
 | `clear_list` | `Clear the list` |
 | `clear_list_confirm` | `Do you really want to clear the list and leave only the currently playing song?` |
-| `feature_desc_fixHdrIssues` | `Fix rendering issues when using an HDR-compatible GPU and monitor` |
+| `feature_desc_fixHdrIssues` | `Prevent some rendering issues when using an HDR-compatible GPU and monitor` |
 | `feature_desc_scrollToActiveSongBtn` | `Add a button above the queue to scroll to the currently playing song` |
 | `feature_desc_clearQueueBtn` | `Add a button above the currently playing queue or playlist to quickly clear it` |
 
@@ -121,7 +121,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `copy_to_clipboard_error` | `Couldn't copy the text to the clipboard. Please copy it from here manually:\n%1` |
 | `clear_list` | `Clear the list` |
 | `clear_list_confirm` | `Do you really want to clear the list and leave only the currently playing song?` |
-| `feature_desc_fixHdrIssues` | `Fix rendering issues when using an HDR-compatible GPU and monitor` |
+| `feature_desc_fixHdrIssues` | `Prevent some rendering issues when using an HDR-compatible GPU and monitor` |
 | `feature_desc_scrollToActiveSongBtn` | `Add a button above the queue to scroll to the currently playing song` |
 | `feature_desc_clearQueueBtn` | `Add a button above the currently playing queue or playlist to quickly clear it` |
 
@@ -134,7 +134,7 @@ This means to figure out which keys are untranslated, you will need to manually
 | `copy_to_clipboard_error` | `Couldn't copy the text to the clipboard. Please copy it from here manually:\n%1` |
 | `clear_list` | `Clear the list` |
 | `clear_list_confirm` | `Do you really want to clear the list and leave only the currently playing song?` |
-| `feature_desc_fixHdrIssues` | `Fix rendering issues when using an HDR-compatible GPU and monitor` |
+| `feature_desc_fixHdrIssues` | `Prevent some rendering issues when using an HDR-compatible GPU and monitor` |
 | `feature_desc_scrollToActiveSongBtn` | `Add a button above the queue to scroll to the currently playing song` |
 | `feature_desc_clearQueueBtn` | `Add a button above the currently playing queue or playlist to quickly clear it` |
 

+ 1 - 1
assets/translations/en_US.json

@@ -169,7 +169,7 @@
     "feature_desc_thumbnailOverlayImageFit": "How to fit the thumbnail image over the video element",
     "feature_desc_hideCursorOnIdle": "Hide the cursor after a few seconds of inactivity over the video",
     "feature_desc_hideCursorOnIdleDelay": "How many seconds of inactivity before the cursor should be hidden?",
-    "feature_desc_fixHdrIssues": "Fix rendering issues when using an HDR-compatible GPU and monitor",
+    "feature_desc_fixHdrIssues": "Prevent some rendering issues when using an HDR-compatible GPU and monitor",
 
     "feature_desc_lyricsQueueButton": "Add a button to each song in a queue to quickly open its lyrics page",
     "feature_desc_deleteFromQueueButton": "Add a button to each song in a queue to quickly remove it",

+ 2 - 4
src/features/layout.ts

@@ -2,7 +2,7 @@ import { addParent, autoPlural, debounce, fetchAdvanced, insertAfter, pauseFor }
 import { getFeatures } from "../config";
 import { siteEvents } from "../siteEvents";
 import { addSelectorListener } from "../observers";
-import { error, getResourceUrl, log, warn, t, onInteraction, openInTab, getBestThumbnailUrl, getDomain, addStyle, currentMediaType, domLoaded, waitVideoElementReady, hdrEnabled, getVideoTime, insertBefore, fetchCss, addStyleFromResource } from "../utils";
+import { error, getResourceUrl, log, warn, t, onInteraction, openInTab, getBestThumbnailUrl, getDomain, addStyle, currentMediaType, domLoaded, waitVideoElementReady, getVideoTime, insertBefore, fetchCss, addStyleFromResource } from "../utils";
 import { scriptInfo } from "../constants";
 import { openCfgMenu } from "../menu/menu_old";
 import { createCircularBtn } from "../components";
@@ -705,10 +705,8 @@ export async function initHideCursorOnIdle() {
 
 //#region fix HDR
 
-/** Fixes visual issues when HDR is enabled */
+/** Prevents visual issues when using HDR */
 export async function fixHdrIssues() {
-  if(!hdrEnabled())
-    return log("HDR is not enabled, skipping HDR fixes");
   if(!await addStyleFromResource("css-fix_hdr"))
     error("Couldn't fix HDR issues");
   else

+ 0 - 5
src/utils/misc.ts

@@ -119,11 +119,6 @@ export function openInTab(href: string, background = false) {
   }
 }
 
-/** Returns whether the monitor has HDR enabled */
-export function hdrEnabled() {
-  return window.matchMedia("(dynamic-range: high)").matches;
-}
-
 //#region resources
 
 /**