X-Git-Url: https://git.ao2.it/GM_direct_download_links.git/blobdiff_plain/516bf735577311e367c4f0167cb7ef266df28826..1455e0e032945acd03d9384e6015c6d3a476f264:/direct_download_links.user.js diff --git a/direct_download_links.user.js b/direct_download_links.user.js index 8253247..8421b49 100644 --- a/direct_download_links.user.js +++ b/direct_download_links.user.js @@ -28,6 +28,7 @@ // @include http://trovacinema.repubblica.it/* // @include http://www.kataweb.it/tvzap/* // @include http://www.rai.tv/* +// @include http://soundcloud.com/* // ==/UserScript== // @@ -38,12 +39,14 @@ * the regexp starting from a glob line. * - use xpath instead of regexp like in http://a32.me/2009/11/greasemonkey/ * - use jquery, like shown in http://a32.me/2009/11/greasemonkey/ + * - Support the "download" attribute for anchors: + * http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#downloading-resources */ /* Fields supported by the "site" object. * * Manadatory fields: - * pageURL: the URL of the page we are modifying + * locationRegExp: the regexp describing the URL of the page we are modifying * urlContainer: the element containing the URL to link * urlRegexp: the regular expression for finding the URL, the first * sub-pattern is taken as the URL @@ -110,6 +113,12 @@ var supported_sites = [ processURL: _rai_get_actual_url, linkDest: 'Player', }, + { + locationRegexp: /^http:\/\/soundcloud.com\/.*$/, + urlContainer: 'main-content-inner', + urlRegexp: /"streamUrl":"([^"]*)"/, + linkDest: 'main-content-inner', + }, ]; /* Apply different rules to different sites */ @@ -212,6 +221,7 @@ function _add_link(e) { style += ' border: 2px solid red;' style += ' float: right; font-size: large;'; style += ' padding: .5em; margin: 1em;' + style += ' position: relative; z-index: 1000;' download_link.setAttribute('style', style); destination.insertBefore(download_link, destination.firstChild);