~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/browser/browser.js

  • Committer: mattgiuca
  • Date: 2008-01-12 16:19:19 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:204
browser.js: Now correctly writes file size.

Show diffs side-by-side

added added

removed removed

Lines of Context:
373
373
 
374
374
 
375
375
    /* Now after the table "middle", there is a status bar */
376
 
    var statusbar = dom_make_text_elem("div", "5 files, 14 kB");
 
376
    var statusbar = document.createElement("div");
377
377
    filesbody.appendChild(statusbar);
378
378
    statusbar.setAttribute("id", "statusbar");
379
379
}
399
399
    var td;
400
400
    var checkbox;
401
401
 
 
402
    var total_files = 0;
 
403
    var total_file_size = 0;    /* In bytes */
 
404
 
402
405
    /* Create all of the files */
403
406
    for (var filename in listing)
404
407
    {
405
408
        file = listing[filename];
 
409
        total_files++;
 
410
        if ("size" in file)
 
411
            total_file_size += file.size;
406
412
        /* Make a 'tr' element */
407
413
        row = document.createElement("tr");
408
414
        /* Column 1: Selection checkbox */
459
465
        files.appendChild(row);
460
466
    }
461
467
 
 
468
    /* Write to the status bar */
 
469
    var statusbar = document.getElementById("statusbar");
 
470
    var statusmsg = total_files.toString() + " files, "
 
471
        + nice_filesize(total_file_size);
 
472
    dom_removechildren(statusbar);
 
473
    statusbar.appendChild(document.createTextNode(statusmsg));
462
474
}
463
475
 
464
476
/** Presents the text editor.