Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. fileList.empty().hide();
  2.  
  3. if(!scannedFolders.length && !scannedFiles.length) {
  4. filemanager.find('.nothingfound').show();
  5. }
  6. else {
  7. filemanager.find('.nothingfound').hide();
  8. }
  9.  
  10. if(scannedFolders.length) {
  11.  
  12. scannedFolders.forEach(function(f) {
  13.  
  14. var itemsLength = f.items.length,
  15. name = escapeHTML(f.name),
  16. icon = '<span class="icon folder"></span>';
  17.  
  18. if(itemsLength) {
  19. icon = '<span class="icon folder full"></span>';
  20. }
  21.  
  22. if(itemsLength == 1) {
  23. itemsLength += ' item';
  24. }
  25. else if(itemsLength > 1) {
  26. itemsLength += ' items';
  27. }
  28. else {
  29. itemsLength = 'Empty';
  30. }
  31.  
  32. var folder = $('<li class="folders"><a href="'+ f.path +'" title="'+ f.path +'" class="folders">'+icon+'<span class="name">' + name + '</span> <span class="details">' + itemsLength + '</span></a></li>');
  33. folder.appendTo(fileList);
  34. });
  35.  
  36. }
  37.  
  38. if(scannedFiles.length) {
  39.  
  40. scannedFiles.forEach(function(f) {
  41.  
  42. var fileSize = bytesToSize(f.size),
  43. name = escapeHTML(f.name),
  44. fileType = name.split('.'),
  45. icon = '<span class="icon file"></span>';
  46.  
  47. fileType = fileType[fileType.length-1];
  48.  
  49. if (fileType == "jpg") {
  50. icon = '<div style="display:inline-block;margin:20px 30px 0px 25px;border-radius:8px;width:60px;height:70px;background-position: center center;background-size: cover; background-repeat:no-repeat;background-image: url(' + f.path + ');"></div>';
  51. } else {
  52. icon = '<span class="icon file f-'+fileType+'">.'+fileType+'</span>';
  53. }
  54.  
  55. var file = $('<li class="files"><a href="'+ f.path+'" title="'+ f.path +'" class="files">'+icon+'<span class="name">'+ name +'</span> <span class="details">'+fileSize+'</span></a></li>');
  56. file.appendTo(fileList);
  57. });
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement