Last active
May 23, 2023 23:11
-
-
Save szymonszewcjr/96ad403a9bc4c051c259b5121f1ee4a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let scrollCounter = 0; | |
//error watcher | |
setInterval(() => { | |
if (document.querySelector(`[aria-label="Something went wrong"]`)) { | |
location.reload(); | |
} | |
}, 100) | |
setInterval(() => { | |
removePicsHandler(true); | |
if (document.querySelector(`#main > div > div.Root__top-container > div.Root__top-bar > header >button`).innerText == "UPGRADE") {//this if happens only once | |
tweakGeneric(); | |
document.querySelector(`.os-viewport.os-viewport-native-scrollbars-invisible`).addEventListener("scroll", removePicsHandler) | |
} | |
tweakGeneric(); | |
}, 300); | |
const removePicsHandler = (first) => { | |
// console.log(scrollCounter) | |
if (scrollCounter > 2 || first) { | |
if (document.querySelector(`[aria-label="Liked Songs"]`)) { | |
onlyOnFavs(); | |
scrollCounter = 0; | |
return; | |
} | |
if (!document.querySelector(`[aria-label="Liked Songs"]`) && document.querySelector(`[data-testid="playlist-page"] .contentSpacing:nth-of-type(3) > div:nth-of-type(1) > div:nth-of-type(2)`)) { | |
onlyOnPlaylist(); | |
scrollCounter = 0; | |
return; | |
} | |
} else { | |
scrollCounter++ | |
}; | |
} | |
const tweakGeneric = () => { | |
//sets now playing bar background color; | |
document.querySelector(`.Root__now-playing-bar>footer`).style.backgroundColor = "#2a2a2a"; | |
document.querySelector(`.contentSpacing:nth-of-type(4)`).style="max-width:none"; | |
document.querySelector(`[aria-label="Top bar and user menu"] > button`).style.right = "70px"; | |
try { | |
document.querySelector(`.player-controls__buttons>button:nth-child(3)`).style = "--button-size:32px;background-color:#282828;border:2px solid white"; | |
document.querySelector(`.player-controls__buttons>button:nth-child(3)>svg`).style = "color:white"; | |
} catch (error) { | |
} | |
try { | |
for (let i = 0; i < 5; i++) { | |
document.querySelector(`[style="background-color: rgb(80, 56, 160);"]`).style.backgroundColor = "#282828"; | |
} | |
} catch (e){}; | |
while(document.querySelector(`[alt="Liked Songs"]`)){//removes liked songs cover art and shifts text left | |
document.querySelector(`[alt="Liked Songs"]`).remove(); | |
document.querySelector(`h1`).parentElement.parentElement.style.transform = "translateX(-250px)" | |
} | |
if(document.querySelector(`[aria-current="page"]`).href.split('/')[3] == "search"){ //if on seatch screen | |
document.querySelector(`#searchPage > div >div >div >section`).style.top = "400px" | |
let searchbarWidth = document.querySelector(`[role="search"]`).offsetWidth; | |
let pageWidth = document.querySelector(`#searchPage > div >div >div >section`).clientWidth | |
document.querySelector(`[role="search"]`).style.transform = `translate(${ (pageWidth /2) - searchbarWidth }px,250px)` | |
document.querySelector(`[role="search"]`).style.flex = " 0 1 600px";//wider searchbar | |
} | |
//upgrade button removal | |
//remove only if right button is selected | |
try { | |
if (document.querySelector(`#main > div > div.Root__top-container > div.Root__top-bar > header >button`).innerText == "UPGRADE") { | |
document.querySelector(`#main > div > div.Root__top-container > div.Root__top-bar > header >button`).remove() | |
} | |
} catch (error) { | |
} | |
//background colors; | |
//document.querySelector(`[aria-label="Top bar and user menu"]>div`).style.backgroundColor = "#282828"; //top bar and user menu | |
// document.querySelector(`[data-testid="playlist-page"]>div>div`).style.backgroundColor = "#282828"; //background behind cover art and playlist title | |
//remove blank space from nameplate button | |
try { | |
document.querySelector(`#main > div > div.Root__top-container > div.Root__top-bar > header >button>figure`).remove(); | |
} catch (error) { | |
} | |
//offests nameplate button 70px from right side, so that it doesn't get covered by windows nav buttons; | |
document.querySelector(`[aria-label="Top bar and user menu"] > button`).style.right = "70px"; | |
//play/pause button svg icon is being set to white | |
for (let index = 0; index < 9; index++) { | |
document.querySelector(`.player-controls__buttons>button:nth-child(3)>svg`).style = "color:white"; | |
} | |
document.querySelector(`.player-controls__buttons>button:nth-child(3)>svg`).style = "color:white"; | |
//play/pause button | |
document.querySelector(`.player-controls__buttons>button:nth-child(3)`).style = "--button-size:32px;background-color:#282828;border:2px solid white"; | |
//set navbar color to not be pitch black; | |
document.querySelector(`nav`).style.backgroundColor = "#0d0d0d"; | |
//remove ad spot | |
if (document.querySelector(`.Root__main-view>div`)) { | |
document.querySelector(`.Root__main-view>div`).remove(); | |
} | |
//remove ad and tracking iframe | |
if (document.querySelector(`.ad-iframe`)) { | |
document.querySelector(`.ad-iframe`).remove(); | |
} | |
//sets nav buttons to be squircles instead of round, i thinkthey look better | |
document.querySelector(`[title="Go back"]`).style.borderRadius = "5px"; | |
document.querySelector(`[title="Go forward"]`).style.borderRadius = "5px"; | |
// hides icons from liked songs option | |
document.querySelector(`.GlueDropTarget:nth-of-type(2)`).firstChild.firstElementChild.style.opacity = 0; | |
// hides icon from your episodes menu\ | |
document.querySelector(`.GlueDropTarget:nth-of-type(3)`).firstChild.firstElementChild.style.opacity = 0; | |
// hides download button since i can afford premium anyway | |
document.querySelector(`[aria-label="Download"]`).style.opacity = 0; | |
} | |
const onlyOnFavs = () => { | |
(() => { | |
let array = Array.from(document.querySelector(`[aria-label="Liked Songs"]`).children[1].children[1].children) | |
//console.log(array) | |
if (array.length > 6) { | |
array.forEach(removePicsFromPlaylist); | |
} | |
})(); | |
} | |
const onlyOnPlaylist = () => { | |
(() => { | |
let array = Array.from(document.querySelector(`[data-testid="playlist-page"] .contentSpacing:nth-of-type(3) > div:nth-of-type(1) > div:nth-of-type(2) >div:nth-of-type(2)`).children) | |
//console.log(array) | |
if (array.length > 6) { | |
array.forEach(removePicsFromPlaylist); | |
} | |
})(); | |
} | |
const removePicsFromPlaylist = (itemRaw) => { | |
//ensure that the playlist is shifted 15px up; | |
itemRaw.parentElement.parentElement.style.top = "-15px"; | |
let item = itemRaw.children[0]; | |
if (item.hasAttribute('reworked')) { | |
return; | |
} else { | |
item.style.height = "4vh"; | |
item.style.borderBottomColor = "rgb(60,60,60)" | |
if(item.children[1].children[0].nodeName === "IMG"){ | |
item.children[1].children[0].remove(); //image removal; | |
} | |
item.querySelector(`[aria-colindex="2"] >div`).style = "display:flex"; // set to inline | |
//make rest of items bigger, so that they fit in | |
item.querySelector(`[aria-colindex="3"] >a`).style.fontSize = "12pt"; | |
item.querySelector(`[aria-colindex="4"] >span`).style.fontSize = "12pt" | |
item.querySelector(`[aria-colindex="5"] > div `).style.fontSize = "12pt" | |
//makes song titles a bit bigger 12pt => 13pt; | |
item.children[1].children[0].children[0].style.fontSize = "13pt"; | |
//makes artist names a bit bigger; | |
item.children[1].children[0].children[1].style.fontSize = "12pt"; | |
item.setAttribute('reworked', true) | |
}; | |
} | |
Author
szymonszewcjr
commented
May 23, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment