diff --git a/CHANGELOG.md b/CHANGELOG.md index d4ffc0f4..e135a555 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,16 @@ # Changelog -## v2.2.3 +## v2.2.4 +- Fixed an alignment issue of the shuffle button on channel pages that was introduced with the latest update to the YouTube UI. +- Fixed some issues with the display of the shuffle button if the shuffle icon is not loaded in time. + + +## v2.2.3 + - Error messages now include the current channel ID to help with reporting an issue. - Some changes in how data that is sent to the database is handled, to prepare for a future security update. - ## v2.2.2 diff --git a/package.json b/package.json index d69694ca..613e8f34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "random-youtube-video", - "version": "2.2.3", + "version": "2.2.4", "description": "Play a random video uploaded on the current YouTube channel.", "scripts": { "dev": "concurrently \"npm run dev:chromium\" \"npm run dev:firefox\"", diff --git a/src/buildShuffleButton.js b/src/buildShuffleButton.js index 45706a5f..f838f177 100644 --- a/src/buildShuffleButton.js +++ b/src/buildShuffleButton.js @@ -8,7 +8,7 @@ export function buildShuffleButton(pageType, channelId, clickHandler) { let buttonDivID = "youtube-random-video-shuffle-button"; let buttonDivExtraStyle = ""; let buttonDivOwner = null; - let buttonDivPrepend = true; + let buttonDivAppend = true; // Depending on the type of page we're on, we might need to change certain parts of the button switch (pageType) { @@ -20,7 +20,6 @@ export function buildShuffleButton(pageType, channelId, clickHandler) { buttonDivID = "youtube-random-video-shuffle-button-video"; buttonDivExtraStyle = "margin-left: 8px;"; buttonDivOwner = document.getElementById("above-the-fold").children.namedItem("top-row").children.namedItem("owner"); - buttonDivPrepend = false; break; default: console.warn(`Cannot build button: Unknown page type: ${pageType}`); @@ -69,11 +68,11 @@ export function buildShuffleButton(pageType, channelId, clickHandler) { `; buttonDiv = new DOMParser().parseFromString(buttonDiv, "text/html").body.firstChild; - // Depending on the page we're on, we wat to prepend or append the button to the owner - if (buttonDivPrepend) { - buttonDivOwner.prepend(buttonDiv); - } else { + // Depending on the page we're on, we may want to prepend or append the button to the parent + if (buttonDivAppend) { buttonDivOwner.appendChild(buttonDiv); + } else { + buttonDivOwner.prepend(buttonDiv); } // Wait for the button renderer to get the child elements defined by the element type @@ -117,7 +116,7 @@ function finalizeButton(pageType, channelId, clickHandler) {