Skip to content

Instantly share code, notes, and snippets.

@DelusionalLogic
Created August 24, 2012 18:58
Show Gist options
  • Save DelusionalLogic/3454343 to your computer and use it in GitHub Desktop.
Save DelusionalLogic/3454343 to your computer and use it in GitHub Desktop.
Grooveplay
// ==UserScript==
// @name Grooveshark to TDC PLAY
// @namespace GroovePlay
// @match *grooveshark.*
// @require http://code.jquery.com/jquery-latest.min.js
// @author Delusional Logic
// @description This script aims to implement TDC play playlists into grooveshark.
// ==/UserScript==
var playUrl = "http://musik.tdconline.dk/servlets/2452306090224Dispatch/19/jspforward?file=.%2Findex.jsp&page=search&searchquery=";
var processed = true;
// the guts of this userscript
function main() {
if (processed == true)
{
processed = false;
$(".grid-canvas .slick-row").each(function (i) {
if ($(this).children("div.slick-cell").html() == undefined || $(this).children("div.slick-cell").html() == "-")
return true;
var songName = $(this).children(".slick-cell").children(".songName").children("a").html();
if (songName == undefined)
return true;
songName = songName.replace(/ /g, "+");
var optionsPanel = $(this).children(".song").children("div.options");
if(optionsPanel.find("a.TDCPlay").length === 0)
{
optionsPanel.append('<a class="rowOption option TDCPlay" target="_blank" href="' + playUrl + songName + '"> </a>');
var option = optionsPanel.find("a.TDCPlay").css({
"background" : "url(http://musik.tdconline.dk/hostshops/247/type_d/sites/tdcdk2453325083407/jsp/public/pix/icon_orange_phone_dimmed-hovered.gif)",
"width" : "18px",
"height" : "18px",
"margin-left" : "1px",
"target-new" : "tab ! important",
});
}
});
processed = true;
}
}
var container = document.getElementById("page");
container.addEventListener("DOMSubtreeModified", main, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment