X-Git-Url: https://git.ao2.it/GM_direct_download_links.git/blobdiff_plain/3d5b6fbd5c37bf64cda349f88949a50e2665302c..7bbcfaf476f39716b20897ce799829284d127f3e:/direct_download_links.js diff --git a/direct_download_links.js b/direct_download_links.js index f221e68..6d0f401 100644 --- a/direct_download_links.js +++ b/direct_download_links.js @@ -23,6 +23,7 @@ // @name Direct Download Links // @namespace http://git.ao2.it/GM_direct_download_links.git // @description Add direct download links for (video) files +// @include http://video.repubblica.it/* // @include http://tv.repubblica.it/* // @include http://trovacinema.repubblica.it/* // @include http://www.kataweb.it/tvzap/* @@ -36,21 +37,27 @@ var supported_sites = [ { + locationRegexp: /^http:\/\/video\.repubblica\.it\/.*$/, + fileElem: 'contA', + fileRegexp: /'pcUrl', '((http|mms):\/\/[^']*)'/, + linkDest: 'contA', + }, + { locationRegexp: /^http:\/\/tv\.repubblica\.it\/.*$/, fileElem: 'boxPlayer', - fileRegexp: /'pcUrl', '(http:\/\/[^']*)'/, + fileRegexp: /'pcUrl', '((http|mms):\/\/[^']*)'/, linkDest: 'box_embed', }, { locationRegexp: /^http:\/\/trovacinema\.repubblica\.it\/.*$/, fileElem: 'col-center', - fileRegexp: /'flvUrl', '(http:\/\/[^']*)'/, + fileRegexp: /'flvUrl', '((http|mms):\/\/[^']*)'/, linkDest: 'col-center', }, { locationRegexp: /^http:\/\/www\.kataweb\.it\/tvzap\/.*$/, fileElem: 'tvzap_video', - fileRegexp: /'pcUrl', '(http:\/\/[^']*)'/, + fileRegexp: /'pcUrl', '((http|mms):\/\/[^']*)'/, linkDest: 'playerCont', }, ]; @@ -72,10 +79,10 @@ for (i = 0; i < supported_sites.length; i++) { * Add a Direct Download link on the page for the specified file * * @param pageURL: the URL of the page we are modifying - * @param fileElem: the emelemt containig the file URL + * @param fileElem: the element containing the file URL * @param fileRegexp: the regular expression for finding the file, the first - * subpattern is taken as the file URL - * @param linkDest: the element where to place the DIrect Download link + * sub-pattern is taken as the file URL + * @param linkDest: the element where to place the Direct Download link * * @return: null on error, true on success */ @@ -104,9 +111,13 @@ function direct_download_link_add(pageURL, fileElem, fileRegexp, linkDest) { } var download_link = document.createElement('a'); - download_link.textContent = 'Direct Download'; + download_link.textContent = 'Direct Link'; download_link.setAttribute('href', fileURL); - download_link.setAttribute('style', 'display: block; font-size: large; margin-left: 30px; margin-bottom: 1em;'); + var style = 'background-color: white; color: blue;'; + style += ' border: 2px solid red;' + style += ' float: right; font-size: large;'; + style += ' padding: .5em; margin: 1em;' + download_link.setAttribute('style', style); links.insertBefore(download_link, links.firstChild);