-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.js
More file actions
43 lines (37 loc) · 1.62 KB
/
user.js
File metadata and controls
43 lines (37 loc) · 1.62 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
38
39
40
41
42
43
// ==UserScript==
// @name Hide Spotify User Profile
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Visually hides a specific user profile from Spotify Web UI (followers, following, sidebars, etc.)
// @author ChatGPT
// @match https://open.spotify.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
// Replace with the target user's display name or ID
const blockedUsernames = ['id1', 'id2']; // open.spotify.com/user/ID
function hideUserProfileElements() {
const userLinks = document.querySelectorAll('a[href*="/user/"], a[href*="/users/"]');
const textElements = document.querySelectorAll('div[dir="auto"], span');
userLinks.forEach(link => {
blockedUsernames.forEach(username => {
if (link.href.includes(username)) {
const parent = link.closest('div[data-testid], div[class*="EntityRow"], li, div[class*="sidebar"]');
if (parent) parent.style.display = 'none';
}
});
});
textElements.forEach(el => {
const name = el.textContent.trim().toLowerCase();
blockedUsernames.forEach(username => {
if (name.includes(username.toLowerCase())) {
const parent = el.closest('div[data-testid], div[class*="EntityRow"], li, div[class*="sidebar"]');
if (parent) parent.style.display = 'none';
}
});
});
}
// Keep checking — Spotify loads UI dynamically
setInterval(hideUserProfileElements, 1000);
})();