Skip to content

Commit 00696c2

Browse files
authored
Fixed playlist renaming (#267)
1 parent 2e2c778 commit 00696c2

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

CHANGELOG.md

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

3-
## v3.1.0
3+
## v3.1.1
44

55
<!--Releasenotes start-->
6+
- Fixed a bug where the extension would rename all playlists, instead of just the ones created by the extension.
7+
- The collapsed playlist menu will now also have the correct playlist name.
8+
<!--Releasenotes end-->
9+
10+
## v3.1.0
11+
612
- Firefox: The welcome page now prompts users to allow the extension to access the youtube.com domain, this is needed for the extension to function.
713
- Fixed a bug where the shuffle button in the popup would only work on the second try.
814
- Firefox: Fixed the options page not being accessible.
915
- Firefox: Fixed a bug where the extension was unable to retrieve the amount of local storage used.
10-
<!--Releasenotes end-->
1116

1217
## v3.0.2
1318

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.1.0",
3+
"version": "3.1.1",
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/domManipulation.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,19 @@ export function buildShuffleButton(pageType, channelId, clickHandler) {
132132
});
133133
}
134134

135+
// With the way that YouTube handles navigation, the playlist title somehow won't get updated correctly when navigating if we change it here at any point
136+
// So we need to change it back if the user moves to a different playlist
135137
export function tryRenameUntitledList() {
136-
let untitledListElement = document.querySelector('ytd-playlist-panel-renderer#playlist.style-scope.ytd-watch-flexy').querySelector('yt-formatted-string');
137-
138-
if (untitledListElement) {
139-
untitledListElement.innerText = "Random YouTube Video - Playlist";
140-
untitledListElement.title = "This playlist is unlisted, temporary and cannot be saved. Until it is removed by YouTube (which will happen automatically), you can revisit it using the link in the URL bar.";
138+
let mainPlaylistElement = document.querySelector('ytd-playlist-panel-renderer#playlist.style-scope.ytd-watch-flexy').querySelector('yt-formatted-string.title.style-scope.ytd-playlist-panel-renderer');
139+
let collapsedPlaylistElement = document.querySelector('ytd-playlist-panel-renderer#playlist.style-scope.ytd-watch-flexy').querySelector('yt-formatted-string.byline-title.style-scope.ytd-playlist-panel-renderer');
140+
141+
for(let playlistType of [mainPlaylistElement, collapsedPlaylistElement]) {
142+
if (playlistType && window.location.href.includes("&list=TL") && playlistType.title == "Untitled List") {
143+
playlistType.innerText = "Random YouTube Video - Playlist";
144+
playlistType.title = "This playlist is unlisted, temporary and cannot be saved. Until it is removed by YouTube (which will happen automatically), you can revisit it using the link in the URL bar.";
145+
} else if (playlistType) {
146+
playlistType.innerText = playlistType.title;
147+
}
141148
}
142149
}
143150

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.1.0",
4+
"version": "3.1.1",
55
"manifest_version": 3,
66
"content_scripts": [
77
{

0 commit comments

Comments
 (0)