diff --git a/README.md b/README.md index 948f1ae6..facaaf06 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ You may also test the extension with Firefox by running `npm run dev:firefox`, w ### Versioning The `manifest.json` contains two version numbers: `version` and `version_name`. -Packages that are released/uploaded to webstores will have both of these version numbers set to the same value. +Packages that are released/uploaded to web stores will have both of these version numbers set to the same value. During development, smaller changes may get pushed to the `main` branch. These packages will have the same `version` number as the latest release, but a newer `version_name` number, often including a `-beta` suffix, to distinguish them from the latest release. diff --git a/src/background.js b/src/background.js index da2af9fd..9ebb9d4b 100644 --- a/src/background.js +++ b/src/background.js @@ -1,7 +1,7 @@ // Background service worker for the extension, which is run ("started") on extension initialization // Handles communication between the extension and the content script as well as Firebase interactions import { configSync, setSyncStorageValue } from "./chromeStorage.js"; -// We need to import utils.js to get the console rerouting function +// We need to import utils.js to get the console re-routing function import { } from "./utils.js"; // ---------- Initialization/Chrome event listeners ---------- @@ -163,7 +163,7 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { case "overwritePlaylistInfoInDB": updatePlaylistInfoInDB('uploadsPlaylists/' + request.data.key, request.data.val, true).then(sendResponse); break; - // Before v1.0.0 the videos were stored in an array without upload times, so they need to all be refetched + // Before v1.0.0 the videos were stored in an array without upload times, so they need to all be re-fetched case 'updateDBPlaylistToV1.0.0': updateDBPlaylistToV1_0_0('uploadsPlaylists/' + request.data.key).then(sendResponse); break; diff --git a/src/config.js b/src/config.js index d203ea14..a5ebc9ea 100644 --- a/src/config.js +++ b/src/config.js @@ -56,7 +56,7 @@ export const shufflingHints = [ "The 'Shuffle' button will display a progress percentage if the extension has to fetch data from the YouTube API!", // Errors - "Whenever an error is encountered, an alert will open with more detailed information on what caused it, and how you may resolve it. If you still need assistence, please open an issue on GitHub and include the channel ID!", + "Whenever an error is encountered, an alert will open with more detailed information on what caused it, and how you may resolve it. If you still need assistance, please open an issue on GitHub and include the channel ID!", // General options "Use the 'Open in new tab' option to open each shuffled video in its own tab!", diff --git a/src/html/popup/popup.js b/src/html/popup/popup.js index 8a52fb31..39d99cb5 100644 --- a/src/html/popup/popup.js +++ b/src/html/popup/popup.js @@ -28,7 +28,7 @@ if (isPopup) { const isFirefox = typeof browser !== "undefined"; const domElements = getPopupDomElements(); await setPopupDomElementValuesFromConfig(domElements); -await setPopupDomElemenEventListeners(domElements); +await setPopupDomElementEventListeners(domElements); await determineOverlayVisibility(domElements); // Restart the background script if it was stopped to make sure the shuffle button immediately works @@ -199,7 +199,7 @@ async function setPopupDomElementValuesFromConfig(domElements) { } // Set event listeners for DOM elements -async function setPopupDomElemenEventListeners(domElements) { +async function setPopupDomElementEventListeners(domElements) { // Shuffling: Open in new tab option toggle domElements.shuffleOpenInNewTabOptionToggle.addEventListener("change", async function () { await setSyncStorageValue("shuffleOpenInNewTabOption", this.checked); diff --git a/src/html/shufflingPage.js b/src/html/shufflingPage.js index a4cfdaef..d4c56af8 100644 --- a/src/html/shufflingPage.js +++ b/src/html/shufflingPage.js @@ -20,7 +20,7 @@ try { const port = chrome.runtime.connect({ name: "shufflingPage" }); const domElements = getDomElements(); -await setDomElemenEventListeners(domElements); +await setDomElementEventListeners(domElements); // If this page is open, it means the user has clicked the shuffle button shuffleButtonClicked(); @@ -59,7 +59,7 @@ function getDomElements() { } // Set event listeners for DOM elements -async function setDomElemenEventListeners(domElements) { +async function setDomElementEventListeners(domElements) { // View changelog button domElements.viewChangelogButton.addEventListener("click", async function () { await setSyncStorageValue("lastViewedChangelogVersion", chrome.runtime.getManifest().version); diff --git a/src/html/welcome.js b/src/html/welcome.js index 5c63bbf9..6366856a 100644 --- a/src/html/welcome.js +++ b/src/html/welcome.js @@ -26,7 +26,7 @@ const currentVersion = chrome.runtime.getManifest().version_name ?? chrome.runti domElements.updateHeading.innerText = `Random YouTube Video - v${currentVersion}`; await buildShufflingHints(domElements); -await setPopupDomElemenEventListeners(domElements); +await setPopupDomElementEventListeners(domElements); // ---------- DOM ---------- // Get all relevant DOM elements @@ -64,7 +64,7 @@ function getDomElements() { } // Set event listeners for DOM elements -async function setPopupDomElemenEventListeners(domElements) { +async function setPopupDomElementEventListeners(domElements) { // Firefox permissions button if (isFirefox && !await browser.permissions.contains({ permissions: ["tabs"], origins: ["*://*.youtube.com/*"] })) { domElements.firefoxPermissionsDiv.classList.remove("hidden"); diff --git a/src/shuffleVideo.js b/src/shuffleVideo.js index c7317f51..80183577 100644 --- a/src/shuffleVideo.js +++ b/src/shuffleVideo.js @@ -232,7 +232,7 @@ async function handlePlaylistDatabaseUpload(playlistInfo, uploadsPlaylistId, sho playlistInfo["lastUpdatedDBAt"] = new Date().toISOString(); let videosToDatabase = {}; - // If any videos need to be deleted, this should be the union of videos, newvideos, minus the videos to delete + // If any videos need to be deleted, this should be the union of videos, new videos, minus the videos to delete if (encounteredDeletedVideos) { console.log("Some videos need to be deleted from the database. All current videos will be uploaded to the database..."); videosToDatabase = getAllVideosFromLocalPlaylist(playlistInfo); @@ -798,7 +798,7 @@ async function chooseRandomVideosFromPlaylist(playlistInfo, channelId, shouldUpd randomVideo = videosToShuffle[Math.floor(Math.random() * videosToShuffle.length)]; numVideosProcessed++; - console.log(`The chosen video does not exist anymore, so it will be removed from the database. A new random video has been chosen: ${randomVideo}`); + console.log(`The chosen video does not exist any more, so it will be removed from the database. A new random video has been chosen: ${randomVideo}`); if (randomVideo === undefined) { // If we haven't chosen any videos yet, the channel does not contain any videos @@ -832,7 +832,7 @@ async function chooseRandomVideosFromPlaylist(playlistInfo, channelId, shouldUpd // What follows is dependent on if the video is a short or not, and the user's settings // Case 1: !isShort && ignoreShorts => Success if (!videoIsShort && configSync.shuffleIgnoreShortsOption == "2") { - // Move the video to the knownVideos subdictionary + // Move the video to the knownVideos sub-dictionary playlistInfo["videos"]["knownVideos"][randomVideo] = playlistInfo["videos"]["unknownType"][randomVideo]; delete playlistInfo["videos"]["unknownType"][randomVideo]; @@ -844,7 +844,7 @@ async function chooseRandomVideosFromPlaylist(playlistInfo, channelId, shouldUpd } else if (videoIsShort && configSync.shuffleIgnoreShortsOption == "2") { console.log('A chosen video was a short, but shorts are ignored. Choosing a new random video.'); - // Move the video to the knownShorts subdictionary + // Move the video to the knownShorts sub-dictionary playlistInfo["videos"]["knownShorts"][randomVideo] = playlistInfo["videos"]["unknownType"][randomVideo]; delete playlistInfo["videos"]["unknownType"][randomVideo]; @@ -857,7 +857,7 @@ async function chooseRandomVideosFromPlaylist(playlistInfo, channelId, shouldUpd // Case 3: isShort && onlyShorts => Success } else if (videoIsShort && configSync.shuffleIgnoreShortsOption == "0") { - // Move the video to the knownShorts subdictionary + // Move the video to the knownShorts sub-dictionary playlistInfo["videos"]["knownShorts"][randomVideo] = playlistInfo["videos"]["unknownType"][randomVideo]; delete playlistInfo["videos"]["unknownType"][randomVideo]; @@ -869,7 +869,7 @@ async function chooseRandomVideosFromPlaylist(playlistInfo, channelId, shouldUpd } else if (!videoIsShort && configSync.shuffleIgnoreShortsOption == "0") { console.log('A chosen video was not a short, but only shorts should be shuffled. Choosing a new random video.'); - // Move the video to the knownVideos subdictionary + // Move the video to the knownVideos sub-dictionary playlistInfo["videos"]["knownVideos"][randomVideo] = playlistInfo["videos"]["unknownType"][randomVideo]; delete playlistInfo["videos"]["unknownType"][randomVideo]; @@ -1047,7 +1047,7 @@ async function playVideo(chosenVideos, firedFromPopup) { // Open the video in a new tab, the reusable tab or the current tab // If the shuffle button from the popup was used, we always open the video in the 'same tab' (==the shuffling page) - // If the user wants to reuse tabs, we only open in a new tab if the reusable tab is not open anymore + // If the user wants to reuse tabs, we only open in a new tab if the reusable tab is not open any more if (configSync.shuffleOpenInNewTabOption && !firedFromPopup) { const pageType = getPageTypeFromURL(window.location.href); // Video page: Pause the current video if it is playing @@ -1062,7 +1062,7 @@ async function playVideo(chosenVideos, firedFromPopup) { if (featuredPlayer && featuredPlayer.classList.contains('playing-mode') && !featuredPlayer.classList.contains('unstarted-mode')) { featuredPlayer.children[0].click(); } - // Any page: Pause the miniplayer if it exists and is playing + // Any page: Pause the mini-player if it exists and is playing const miniPlayer = document.querySelector('ytd-player#ytd-player')?.children[0]?.children[0]; if (miniPlayer && miniPlayer.classList.contains('playing-mode') && !miniPlayer.classList.contains('unstarted-mode')) { miniPlayer.children[0].click(); diff --git a/src/utils.js b/src/utils.js index 4561b921..59457fb9 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,7 +1,7 @@ // Global utilities -/* c8 ignore start - The console reroutings cannot be tested correctly */ -// ---------- Console rerouting ---------- +/* c8 ignore start - The console re-routings cannot be tested correctly */ +// ---------- Console re-routing ---------- const oldLog = console.log; console.log = function () { // The last argument to console.log is a boolean that determines if the message should be shown in production diff --git a/static/html/changelog.html b/static/html/changelog.html index 665695a7..577c9ba2 100644 --- a/static/html/changelog.html +++ b/static/html/changelog.html @@ -4,7 +4,7 @@