-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalbum.js
More file actions
37 lines (32 loc) · 1.22 KB
/
album.js
File metadata and controls
37 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// ==UserScript==
// @name Hide Spotify Album
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Hides specific albums by their Spotify IDs from Spotify Web UI, including Home, Search, etc.
// @author ChatGPT
// @match https://open.spotify.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Replace with one or more album IDs
const albumIdsToHide = ['id1', 'id2']; // open.spotify.com/album/ID
function hideAlbums() {
const albumLinks = document.querySelectorAll('a[href*="/album/"]');
albumLinks.forEach(link => {
const href = link.href.toLowerCase();
albumIdsToHide.forEach(albumId => {
if (href.includes(`/album/${albumId.toLowerCase()}`)) {
const parent = link.closest('div[data-testid], div[class*="EntityRow"], section');
if (parent) {
parent.style.display = 'none';
} else {
link.style.display = 'none';
}
}
});
});
}
// Run regularly to catch dynamically loaded elements
setInterval(hideAlbums, 1000);
})();