Skip to content

Commit

Permalink
Fixed some layouting issues (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkelM authored Oct 27, 2023
1 parent ce197cd commit 89ed0d0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Changelog

## v2.2.3
## v2.2.4

<!--Releasenotes start-->
- 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.
<!--Releasenotes end-->

## 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.
<!--Releasenotes end-->

## v2.2.2

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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\"",
Expand Down
13 changes: 6 additions & 7 deletions src/buildShuffleButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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}`);
Expand Down Expand Up @@ -69,11 +68,11 @@ export function buildShuffleButton(pageType, channelId, clickHandler) {
</div>`;
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
Expand Down Expand Up @@ -117,7 +116,7 @@ function finalizeButton(pageType, channelId, clickHandler) {
<button
class="yt-spec-button-shape-next yt-spec-button-shape-next--tonal yt-spec-button-shape-next--mono yt-spec-button-shape-next--size-m"
aria-label="Shuffle from this channel">
<span class="material-symbols-outlined">
<span class="material-symbols-outlined" style="width: 24.01px; overflow: hidden;">
shuffle
</span>
<div class="cbox yt-spec-button-shape-next--button-text-content">
Expand Down
2 changes: 1 addition & 1 deletion static/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Random YouTube Video",
"description": "Play a random video uploaded on the current YouTube channel.",
"version": "2.2.3",
"version": "2.2.4",
"manifest_version": 3,
"content_scripts": [
{
Expand Down

0 comments on commit 89ed0d0

Please sign in to comment.