print download history

Discussion of general topics about Mozilla Firefox
Post Reply
User avatar
firestorm31
Posts: 33
Joined: January 2nd, 2013, 4:47 pm
Location: New Orleans, LA

print download history

Post by firestorm31 »

is there an extension that would let me print download history to the printer?
Dilbert Firestorm
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

Re: print download history

Post by morat »

I didn't find a downloads addon on AMO just for printing.

AMO search for "downloads"
http://addons.mozilla.org/firefox/search/?q=downloads

It's possible to create such an addon with the downloads API.

Here is how to print the downloads page using the web console.

Instructions:

* open about:downloads page
* open web console i.e. tools > web developer > web console
* copy and paste code into web console, then press enter to run
* select downloads print tab, then print normally

Code: Select all

(function () {
  var a = document.querySelectorAll(".downloadTarget");
  var b = document.querySelectorAll(".downloadDetailsNormal");
  var c = [];
  var d = [];
  for (var i = 0; i < a.length; i++) c.push(a[i].value + "\n" + b[i].value);
  d.push('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">', "<html>", "<head>");
  d.push('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">');
  d.push("<title>Downloads Print</title>", "</head>", "<body>");
  d.push("<pre>", c.join("\n\n"), "</pre>", "</body>", "</html>");
  open("data:text/html;charset=utf-8;base64," +
    btoa(unescape(encodeURIComponent(d.join("\n")))));
})();
Last edited by morat on August 9th, 2019, 1:03 pm, edited 1 time in total.
User avatar
firestorm31
Posts: 33
Joined: January 2nd, 2013, 4:47 pm
Location: New Orleans, LA

Re: print download history

Post by firestorm31 »

it worked sort of. it printed what was viewable. it showed 5 files.

but I don't want it to print the whole download history. just a list of them from the search download history. I made a lot of image downloads the other nite. noticed after counting, I missed a file. would like to see what file I missed.
Dilbert Firestorm
User avatar
therube
Posts: 21703
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Re: print download history

Post by therube »

Might see what Nirsoft's FirefoxDownloadsView can do?
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

Re: print download history

Post by morat »

You can tweak the code to work with the search downloads textbox in the library window.

Instructions:

* open downloads in library window i.e. tools > downloads
* enter a query in search downloads textbox to filter list
* open about:debugging page, then check enable addon debugging
* open browser console i.e. tools > web developer > browser console
* copy and paste code into browser console command line, then press enter to run
* select downloads print tab, then print normally

Code: Select all

(function () {
  var win = Services.wm.getMostRecentWindow("Places:Organizer");
  var a = win.document.querySelectorAll(".download-state:not([hidden]) .downloadTarget");
  var b = win.document.querySelectorAll(".download-state:not([hidden]) .downloadDetailsNormal");
  var c = [];
  var d = [];
  for (var i = 0; i < a.length; i++) c.push(a[i].value + "\n" + b[i].value);
  d.push('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">', "<html>", "<head>");
  d.push('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">');
  d.push("<title>Downloads Print</title>", "</head>", "<body>");
  d.push("<pre>", c.join("\n\n"), "</pre>", "</body>", "</html>");
  var win = Services.wm.getMostRecentWindow("navigator:browser");
  win.gBrowser.addTab("data:text/html;charset=utf-8;base64," +
    btoa(unescape(encodeURIComponent(d.join("\n")))), {
    triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
  });
})();
Last edited by morat on August 9th, 2019, 1:01 pm, edited 1 time in total.
User avatar
firestorm31
Posts: 33
Joined: January 2nd, 2013, 4:47 pm
Location: New Orleans, LA

Re: print download history

Post by firestorm31 »

therube wrote:Might see what Nirsoft's FirefoxDownloadsView can do?
that program did the trick. it won't print. but it will let you search, save it to the csv delimited file and export it to a spread sheet of your choice which in this case is Apache Open Office; delete some columns and then print.
Dilbert Firestorm
User avatar
firestorm31
Posts: 33
Joined: January 2nd, 2013, 4:47 pm
Location: New Orleans, LA

Re: print download history

Post by firestorm31 »

oh btw, thanx for the help.
Dilbert Firestorm
User avatar
dickvl
Posts: 54145
Joined: July 18th, 2005, 3:25 am

Re: print download history

Post by dickvl »

There is also this place query possible to get a list of all downloads.
place:transition=7&sort=4

If you copy the content of this smart folder to the clipboard then you get "A HREF" HTML code (flavor: text/html) that you can paste in an HTML capable editor.
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

Re: print download history

Post by morat »

The smart folder trick works well.

Remember to restart for the smart folder to take effect.

Online html editor
http://html-online.com/editor/
Post Reply