NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name DropBox Link Converter and Mass Downloader WIth Button // @namespace http://tampermonkey.net/ // @version 0.1 // @description #1 Change dl=0 to dl=1 #2 Add Textarea with the list of links and wget preppended (so just cut and paste into the command line) // @author fred2010 // @match *://*.dropbox.com/* // @-match *://*.dropbox.com/sm/share_link/* // @grant none // @icon https://cf.dropboxstatic.com/static/images/icons/blue_dropbox_glyph-vflJ8-C5d.png // @license GPL-3.0-or-later // ==/UserScript== (function() { 'use strict'; function applyDirectLink () { var mycopy = document.querySelector("#mycopy"); if (mycopy == null) { mycopy=document.createElement("textarea"); mycopy.name="mycopy" mycopy.id="mycopy" mycopy.maxLength = "5000"; mycopy.cols = "180"; mycopy.rows = "40"; document.querySelector('.sl-page-body').append(mycopy); } var oldurls= new Object(); for (var line in mycopy.value.split("\n")) { oldurls[line]=1; } var urls= new Object(); var l=document.querySelectorAll('a'); var re=/(http)s?(:\/\/)www\.(.*dl=)0/; for(var i=0; i < l.length;i++) { if (re.exec(l[i].href)) { l[i].href=l[i].href.replace(re,"$1$2$31") urls['wget "' + l[i].href + '";' ]=1; } } for (var line2 in urls) { if (! oldurls.hasOwnProperty(line2)) { mycopy.append(line2); mycopy.append("\n"); } } alert("A textarea has been added to the bottom of the page with the wget statements"); } function bootstrap() { var mylink=document.getElementById ("linkifier_link"); if (mylink==null) { mylink=document.createElement("a"); mylink.setAttribute("id", "linkifier_link"); } mylink.addEventListener("click",applyDirectLink,false); var header=document.querySelector(".react-title-bar__controls"); mylink.text="Change Links to Direct"; header.appendChild(mylink); } setInterval (bootstrap, 1000); })();