Skip to content

Instantly share code, notes, and snippets.

@BenWard
Created August 12, 2010 21:05
Show Gist options
  • Save BenWard/521725 to your computer and use it in GitHub Desktop.
Save BenWard/521725 to your computer and use it in GitHub Desktop.
A quick quick quick bookmarklet to redirect from an Rdio.com artist or album page to the equivalent page on MOG.
javascript:MOGRdioExt%20=%20{redirect:%20function()%20{var%20artist%20=%20%22%22;var%20album%20=%20%22%22;var%20parts%20=%20window.location.href.split(%27/%27);for(var%20i=0;%20i%20<%20parts.length;%20i++)%20{p=parts[i];switch(p)%20{case%20%27artist%27:i%20=%20i+1;artist%20=%20parts[i];break;case%20%27album%27:i%20=%20i+1;album%20=%20parts[i];break;default:break;}}if(%22%22%20===%20artist)%20{alert(%22This%20only%20works%20if%20you%27re%20viewing%20an%20Rdio%20artist%20or%20album.%22);}else%20{window.location.href%20=%20%22http://mog.com/music/%22+artist+%22/%22+album;}}};MOGRdioExt.redirect();
MOGRdioExt = {
redirect: function() {
var artist = "";
var album = "";
var parts = window.location.href.split('/');
for(var i=0; i < parts.length; i++) {
p=parts[i];
switch(p) {
case 'artist':
i = i+1;
artist = parts[i];
break;
case 'album':
i = i+1;
album = parts[i];
break;
default:
break;
}
}
if("" === artist) {
alert("This only works if you're viewing an Rdio artist or album.");
}
else {
window.location.href = "http://mog.com/music/"+artist+"/"+album;
}
}
};
MOGRdioExt.redirect();
@BenWard
Copy link
Author

BenWard commented Aug 12, 2010

People are often sharing links to stream albums on Rdio, which is great, they're cool. But if you're a paying MOG user instead, it's less useful. So here's a bookmarklet to tokenize Rdio's excellent artist or album URLs and redirect you to the equivalent MOG page with one click.

To install, select all and copy the single-line bookmarklet version above, paste it into your browser address bar. Drag that onto your Bookmarks Toolbar, and then name it ‘MOGRdio’. Or a better name.

@BenWard
Copy link
Author

BenWard commented Nov 25, 2010

Now superseded by MOGthis, which redirects from both Rdio and Spotify URLs, and supports Rdio track URLs. https://gist.github.com/714812

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment