Created
April 2, 2013 15:18
-
-
Save omgmog/5293029 to your computer and use it in GitHub Desktop.
A userscript that turns `spotify:album:` links into `http://youfm.org` links
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
// ==UserScript== | |
// @name Spotify album links to youfm.org links | |
// @namespace http://omgmog.net | |
// @description Turns spotify:album: links into youfm.org links | |
// @include * | |
// @version 1.0 | |
// ==/UserScript== | |
function get_anchors(){ | |
var anchors = new Array(); | |
var elms = document.getElementsByTagName('a'); | |
for(var i=0; i<elms.length; i++){ | |
if(elms[i].href) anchors.push(elms[i]); | |
} | |
return anchors; | |
} | |
var allLinks, thisLink; | |
allLinks = get_anchors(); | |
for (var i = 0; i < allLinks.length; i++) { | |
thisLink = allLinks[i]; | |
if (thisLink.href.match('^spotify:album:')) { | |
thisLink.href = 'http://www.youfm.org/#/album/'+thisLink.href; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment