Skip to content

Commit db338e1

Browse files
authored
Fixed the fetch percentage on the shuffling page being misaligned (#256)
1 parent 11f1ac7 commit db338e1

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# Changelog
22

3-
## v3.0.1
3+
## v3.0.2
44

55
<!--Releasenotes start-->
6-
- Fixed the old "Ignore shorts" option not being updated to the new format correctly.
6+
- Fixed the fetch percentage in the shuffling page being misaligned.
77
<!--Releasenotes end-->
88

9+
## v3.0.1
10+
11+
- Fixed the old "Ignore shorts" option not being updated to the new format correctly.
12+
913
## v3.0.0
1014

1115
- Shorts pages are now supported! Shuffle buttons can now be found on all shorts pages.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "random-youtube-video",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "Customize, shuffle and play random videos from any YouTube channel.",
55
"scripts": {
66
"dev": "concurrently \"npm run dev:chromium\" \"npm run dev:firefox\"",

src/html/shufflingPage.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function getDomElements() {
4040
// The div containing all other elements
4141
randomYoutubeVideo: document.getElementById("randomYoutubeVideo"),
4242
// Shows the percentage of videos that have been fetched
43-
fetchPercentageNotice: document.getElementById("fetchPercentageNotice"),
43+
fetchPercentageNoticeShufflingPage: document.getElementById("fetchPercentageNoticeShufflingPage"),
4444
// The text that is displayed when an error has occurred
4545
shuffleErrorText: document.getElementById("shuffleErrorText"),
4646
// Div containing all elements that should only be displayed if we are still shuffling
@@ -76,11 +76,11 @@ async function setDomElemenEventListeners(domElements) {
7676
async function shuffleButtonClicked() {
7777
try {
7878
domElements.shufflingFromChannelHeading.innerText = configSync.currentChannelName;
79-
const shuffleButtonTextElement = domElements.fetchPercentageNotice;
79+
const shuffleButtonTextElement = domElements.fetchPercentageNoticeShufflingPage;
8080

8181
setDOMTextWithDelay(shuffleButtonTextElement, "Applying filters...", 4000, () => { return ((shuffleButtonTextElement.innerText === "Please wait..." || shuffleButtonTextElement.innerText === "Fetching: 100%")); });
8282
setDOMTextWithDelay(shuffleButtonTextElement, "Should be done soon...", 8000, () => { return (shuffleButtonTextElement.innerText === "Applying filters..." || shuffleButtonTextElement.innerText === "Fetching: 100%"); });
83-
83+
8484
if (configSync.shuffleIgnoreShortsOption != "1") {
8585
setDOMTextWithDelay(shuffleButtonTextElement, "Sorting shorts...", 12000, () => { return ((shuffleButtonTextElement.innerText === "Should be done soon..." || shuffleButtonTextElement.innerText === "Fetching: 100%")); });
8686
if (configSync.shuffleIgnoreShortsOption == "2") {
@@ -93,6 +93,7 @@ async function shuffleButtonClicked() {
9393
setDOMTextWithDelay(shuffleButtonTextElement, "Still shuffling...", 20000, () => { return ((shuffleButtonTextElement.innerText === "Should be done soon..." || shuffleButtonTextElement.innerText === "Fetching: 100%")); });
9494
}
9595

96+
// await delay(100000);
9697
await chooseRandomVideo(configSync.currentChannelId, true, shuffleButtonTextElement);
9798

9899
// Focus this tab when the shuffle completes
@@ -125,7 +126,7 @@ async function shuffleButtonClicked() {
125126
const errorMessage = `${error.message ?? ""}${error.reason ? "\n" + error.reason : ""}${error.solveHint ? "\n" + error.solveHint : ""}${error.showTrace !== false ? "\n\n" + error.stack : ""}`;
126127

127128
// Immediately display the error
128-
domElements.fetchPercentageNotice.innerText = errorHeading;
129+
domElements.fetchPercentageNoticeShufflingPage.innerText = errorHeading;
129130
domElements.shuffleErrorText.innerText = errorMessage;
130131
domElements.shuffleErrorText.classList.remove("hidden");
131132

src/shuffleVideo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ function validatePlaylistInfo(playlistInfo) {
11281128
/* c8 ignore stop */
11291129

11301130
function updateProgressTextElement(progressTextElement, largeButtonText, smallButtonText) {
1131-
if (progressTextElement.id.includes("large-shuffle-button")) {
1131+
if (progressTextElement.id.includes("large-shuffle-button") || progressTextElement.id == "fetchPercentageNoticeShufflingPage") {
11321132
progressTextElement.innerText = largeButtonText;
11331133
} else {
11341134
// Make it the icon style if an icon is set, otherwise the text style

static/html/shufflingPage.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h2>Shuffling from channel:</h2>
1313
<h1 id="shufflingFromChannelHeading" style="margin-top: 0px">Current channel</h1>
1414

1515
<br />
16-
<h3 id="fetchPercentageNotice">Please wait...</h3>
16+
<h3 id="fetchPercentageNoticeShufflingPage">Please wait...</h3>
1717
<p id="shuffleErrorText" class="hidden"></p>
1818

1919
<br />

static/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Random YouTube Video",
33
"description": "Customize, shuffle and play random videos from any YouTube channel.",
4-
"version": "3.0.1",
4+
"version": "3.0.2",
55
"manifest_version": 3,
66
"content_scripts": [
77
{

0 commit comments

Comments
 (0)