Created
September 22, 2009 08:37
-
-
Save youpy/190930 to your computer and use it in GitHub Desktop.
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 soundcloud.com: append extension to download links | |
// @namespace http://d.hatena.ne.jp/youpy/ | |
// @include http://soundcloud.com/* | |
// @require http://gist.github.com/raw/3242/1a7950e033a207efcfc233ae8d9939b676bdbf46 | |
// ==/UserScript== | |
(function() { | |
function appendExtension(links) { | |
links.forEach(function(link) { | |
var format = link.className.match(/filetype (\w+)/)[1]; | |
link.href = [link.href, format].join('.'); | |
}); | |
} | |
function links(doc) { | |
return $X('//a[@title="Uploaded format"]', doc); | |
} | |
appendExtension(links(document)); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment