Created
March 24, 2015 02:01
-
-
Save oxguy3/30b4ad5ca5a00291cfb2 to your computer and use it in GitHub Desktop.
Custom artist icons for Google Play Music
This file contains hidden or 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
// ==UserScript== | |
// @name Custom artist icons for Google Play Music | |
// @namespace https://play.google.com/music/ | |
// @version 0.1 | |
// @description Allows for custom icons for your artists in Google Play Music | |
// @author Hayden Schiff (oxguy3) | |
// @match https://play.google.com/music/* | |
// @grant unsafeWindow | |
// @require https://code.jquery.com/jquery-1.11.2.min.js | |
// ==/UserScript== | |
function injectIcon(artist, img) { | |
console.log(stringToDataId(artist)); | |
var card = $('.card[data-type=artist][data-id$="/' + stringToDataId(artist) + '"]'); | |
card.find("img.image").attr("src", img); | |
} | |
function stringToDataId(str) { | |
return encodeURIComponent(str).replace(/%20/g, "+"); | |
} | |
function injectCustomIcons() { | |
var customIcons = [ | |
{ | |
artist: "Adhesive Wombat", | |
img: "//i.imgur.com/QAaCUGq.png" | |
}, | |
{ | |
artist: "Benjamin Briggs", | |
img: "//i.imgur.com/TH1MpWg.png" | |
}, | |
{ | |
artist: "Big Giant Circles", | |
img: "//i.imgur.com/CLBmk1Y.png" | |
}, | |
{ | |
artist: "C418", | |
img: "//i.imgur.com/vOaz9TQ.png" | |
}, | |
{ | |
artist: "Chipzel", | |
img: "//i.imgur.com/EfvnP9t.png" | |
}, | |
{ | |
artist: "_ensnare_", | |
img: "//i.imgur.com/wgt1FP1.png" | |
}, | |
{ | |
artist: "Jake Kaufman", | |
img: "//i.imgur.com/56fiaGN.png" | |
}, | |
{ | |
artist: "Wolfgun", | |
img: "//i.imgur.com/rWk1hOz.png" | |
} | |
]; | |
for (var i = 0; i < customIcons.length; i++) { | |
var icon = customIcons[i]; | |
injectIcon(icon.artist, icon.img); | |
} | |
} | |
// yes this is bad but idk how else to go about it | |
var checkStuff = setInterval(function() { | |
var ct = $('#music-content>.g-content').length; | |
if (ct > 0) { | |
injectCustomIcons(); | |
//clearInterval(checkStuff); | |
} | |
}, 500); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment