Door Games Unlimited

Welcome, Guest.


Subject: JavaScript for Files /in/ Directory? Date: Fri Aug 21 2015 12:34:10
From: echicken To: Psi-Jack

  Re: JavaScript for Files /in/ Directory?
  By: Psi-Jack to All on Thu Jul 09 2015 19:00:04

 Ps> I see javascript classes for each library, and directory itself, but I do
 Ps> not see any classes for actual files/details within the actual directory. 

 Ps> Is there any way to actually get that information, as one thing I would
 Ps> like to do is completely customize the file listings themselves.
 Ps> Preferring, of course, not to have to use JavaScript to try to parse the
 Ps> database files directly. 

I recently committed exec/load/filedir.js to the CVS, which will take care of
this for you.

Create an instance of FileDir like so:

  var fd = new FileDir(file_area.dir["dirname"]);

Access the file list like so (or however you prefer):

  for(var f = 0; f < fd.files.length; f++) {
    // Each element is an instance of DirFile
    // This will show you what properties are available
    write(JSON.stringify(fd.files[f]));
  }

This is read-only for now.  I may add in some options to edit details / move /
copy / delete files at some point, or not.

There's also a lightbar file lister at exec/load/filearea-lb.js which does the
basics (browsing, upload, download, batch tagging & downloads), and has a few
simple customization options near the top of the script.  (Or just use FileDir
to make your own lister.)

---
echicken
electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
 ■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com

Previous Message       Next Message
In Reply To: JavaScript for Files /in/ Directory? (Psi-Jack)
Replies: JavaScript for Files /in/ Directory? (Psi-Jack)