From d2d7d970afc3896ef9331603af9a741040f2240f Mon Sep 17 00:00:00 2001 From: NikkelM <57323886+NikkelM@users.noreply.github.com> Date: Wed, 29 Nov 2023 21:42:48 +0000 Subject: [PATCH] Renamed function --- src/content.js | 10 +++++----- src/shuffleVideo.js | 8 ++++---- src/utils.js | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/content.js b/src/content.js index 0c2a42ef..fbfc2209 100644 --- a/src/content.js +++ b/src/content.js @@ -1,5 +1,5 @@ // Content script that is injected into YouTube pages -import { setDOMTextWithDelay, updateSmallButtonStyle, getPageTypeFromURL, RandomYoutubeVideoError, delay } from "./utils.js"; +import { setDOMTextWithDelay, updateSmallButtonStyleForText, getPageTypeFromURL, RandomYoutubeVideoError, delay } from "./utils.js"; import { configSync, setSyncStorageValue } from "./chromeStorage.js"; import { buildShuffleButton, shuffleButton, shuffleButtonTextElement, tryRenameUntitledList } from "./domManipulation.js"; import { chooseRandomVideo } from "./shuffleVideo.js"; @@ -124,7 +124,7 @@ function resetShuffleButtonText() { if (shuffleButtonTextElement.id.includes("large-shuffle-button")) { shuffleButtonTextElement.innerText = "\xa0Shuffle"; } else if (shuffleButtonTextElement.innerText !== "autorenew") { - updateSmallButtonStyle(shuffleButtonTextElement, false); + updateSmallButtonStyleForText(shuffleButtonTextElement, false); shuffleButtonTextElement.innerText = "shuffle"; } } @@ -178,7 +178,7 @@ async function shuffleVideos() { return; } - updateSmallButtonStyle(shuffleButtonTextElementCopy, false); + updateSmallButtonStyleForText(shuffleButtonTextElementCopy, false); shuffleButtonTextElementCopy.innerText = "autorenew"; let rotation = 0; @@ -203,7 +203,7 @@ async function shuffleVideos() { if (shuffleButtonTextElement.id.includes("large-shuffle-button")) { shuffleButtonTextElement.innerText = "\xa0Shuffle"; } else { - updateSmallButtonStyle(shuffleButtonTextElementCopy, false); + updateSmallButtonStyleForText(shuffleButtonTextElementCopy, false); shuffleButtonTextElementCopy.innerText = "shuffle"; } } catch (error) { @@ -211,7 +211,7 @@ async function shuffleVideos() { hasBeenShuffled = true; if (shuffleButton.id.includes("small-shuffle-button")) { - updateSmallButtonStyle(shuffleButtonTextElementCopy, true); + updateSmallButtonStyleForText(shuffleButtonTextElementCopy, true); } let displayText = ""; diff --git a/src/shuffleVideo.js b/src/shuffleVideo.js index 37cedb4c..981505b2 100644 --- a/src/shuffleVideo.js +++ b/src/shuffleVideo.js @@ -5,7 +5,7 @@ import { getLength, RandomYoutubeVideoError, YoutubeAPIError, - updateSmallButtonStyle, + updateSmallButtonStyleForText, getPageTypeFromURL } from "./utils.js"; import { configSync, setSyncStorageValue, getUserQuotaRemainingToday } from "./chromeStorage.js"; @@ -1015,7 +1015,7 @@ async function playVideo(chosenVideos, firedFromPopup) { if (player && player.classList.contains('playing-mode') && !player.classList.contains('unstarted-mode')) { player.children[0].click(); } - } else if(pageType === "channel") { + } else if (pageType === "channel") { // Channel page: Pause the featured video if it exists and is playing const featuredPlayer = document.querySelector('ytd-player#player')?.children[0]?.children[0]; if (featuredPlayer && featuredPlayer.classList.contains('playing-mode') && !featuredPlayer.classList.contains('unstarted-mode')) { @@ -1104,9 +1104,9 @@ function updateProgressTextElement(progressTextElement, largeButtonText, smallBu } else { // Make it the icon style if an icon is set, otherwise the text style if (!["shuffle", "close"].includes(smallButtonText)) { - updateSmallButtonStyle(progressTextElement, true); + updateSmallButtonStyleForText(progressTextElement, true); } else { - updateSmallButtonStyle(progressTextElement, false); + updateSmallButtonStyleForText(progressTextElement, false); } progressTextElement.innerText = smallButtonText; } diff --git a/src/utils.js b/src/utils.js index 619e2480..7d48fec7 100644 --- a/src/utils.js +++ b/src/utils.js @@ -47,7 +47,7 @@ export function setDOMTextWithDelay(textElement, newText, delayMS, predicate = ( }); } -export function updateSmallButtonStyle(textElement, isTextStyle) { +export function updateSmallButtonStyleForTextForText(textElement, isTextStyle) { textElement.style.fontSize = isTextStyle ? "12px" : ""; textElement.style.position = isTextStyle ? "absolute" : ""; textElement.style.top = isTextStyle ? "50%" : ""; @@ -58,9 +58,9 @@ export function updateSmallButtonStyle(textElement, isTextStyle) { textElement.style.display = isTextStyle ? "flex" : ""; if (isTextStyle) { - textElement.classList.remove("material-symbols-outlined"); + textElement.classList.remove("material-symbols-outlined"); } else { - textElement.classList.add("material-symbols-outlined"); + textElement.classList.add("material-symbols-outlined"); } }