123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <title>{{hostname}} File Share</title>
- <link rel="stylesheet" href="script/skeleton/offline.css">
- <link rel="stylesheet" href="script/skeleton/normalize.css">
- <link rel="stylesheet" href="script/skeleton/skeleton.css">
- <script type="application/javascript" src="script/jquery.min.js"></script>
- <style>
- body{
- padding-bottom: 100px;
- }
- .bar{
- height: 12px;
- background-color: #1a1a1a;
- width: 100%;
- }
- .footer{
- position: fixed;
- bottom: 0px;
- height: 50px;
- width: 100%;
- background-color: #1a1a1a;
- padding: 20px;
- color: white;
- }
- .fileobject{
- cursor: pointer;
- }
- .fileobject:hover{
- background-color: #f5f5f5;
- }
- </style>
- </head>
- <body>
- <div class="bar"></div>
- <br>
- <div class="container">
- <h5>{{hostname}} File Sharing</h5>
- <h3>{{filename}}</h3>
- <div class="row">
- <div class="one-half column">
- <table class="u-full-width">
- <thead>
- <tr>
- <th>Property</th>
- <th>Value</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>MIME Type</td>
- <td>{{mime}}</td>
- </tr>
- <tr>
- <td>Folder Size</td>
- <td>{{size}}</td>
- </tr>
- <tr>
- <td>File Counts</td>
- <td>{{filecount}}</td>
- </tr>
- <tr>
- <td>Last Modification Time</td>
- <td>{{modtime}}</td>
- </tr>
- </tbody>
- </table>
- <a href="{{downloadurl}}"><button class="button-primary">Download</button></a>
- <p style="font-size: 80%;"><b>Depending on folder size, zipping might take a while to complete.</b></p>
- <br>
- <p>Request File ID: {{reqid}}</p>
- <p>Request Timestamp: {{reqtime}}</p>
- </div>
- <div class="one-half column" id="filelistWrapper" style="overflow-y: auto; padding-right: 0.5em;">
- <table class="u-full-width">
- <thead>
- <tr>
- <th>Filename</th>
- <th>Type</th>
- <th>Size</th>
- </tr>
- </thead>
- <tbody id="folderList">
-
- </tbody>
- </table>
- </div>
- </div>
-
- </div>
- <div class="footer">
- <div class="container">
- Cloud File Sharing Interface, Powered by <a style="color: white;" href="http://arozos.com">arozos</a>
- </div>
- </div>
- <script>
- var treeFileList = {{treelist}};
- var currentViewingRoot = ".";
- renderFileList(treeFileList["."]);
- console.log(treeFileList);
- function renderFileList(filelist){
- $("#folderList").html("");
- if (currentViewingRoot != "."){
- $("#folderList").append(`<tr class="fileobject" ondblclick="event.preventDefault(); parentdir();">
- <td style="padding-left: 8px;" colspan="3" > ↩ Back</td>
- </tr>`);
-
- }
- filelist.forEach(file => {
- var filetype = "File";
- var displayName = "";
- if (file.IsDir == true){
- filetype = "Folder";
- displayName = "📁 " + file.Filename;
- }else{
- displayName = "📄 " + file.Filename;
- }
- $("#folderList").append(`<tr class="fileobject" filename="${file.Filename}" relpath="${file.RelPath}" type="${filetype.toLocaleLowerCase()}" ondblclick="event.preventDefault(); openThis(this);">
- <td style="padding-left: 8px;">${displayName}</td>
- <td>${filetype}</td>
- <td>${file.Filesize}</td>
- </tr>`);
- });
- }
- //Went up one level
- function parentdir(){
- if (currentViewingRoot == "."){
- //Root dir. Do nothing
-
- }else{
- //Subdirs. travel up
- var dirinfo = currentViewingRoot.split("/");
- var nextDir = ".";
- if (currentViewingRoot.indexOf("/") < 0){
- //Parent dir will be root
- }else{
- dirinfo.pop();
- nextDir = dirinfo.join("/");
- }
-
- //Load the filelist
- if (treeFileList[nextDir] != undefined){
- currentViewingRoot = nextDir;
- renderFileList(treeFileList[nextDir]);
- }else{
- //Back to root on error
- currentViewingRoot = ".";
- renderFileList(treeFileList["."]);
- }
- }
- }
- function openThis(object){
- var targetFilename = $(object).attr("filename");
- var targetType = $(object).attr("type");
- var targetRelPath = $(object).attr("relpath");
-
- if (targetType == "folder"){
- //Folder. Build a new root file list for this
- var targetRenderList = treeFileList[targetRelPath];
- if (targetRenderList != undefined){
- currentViewingRoot = targetRelPath;
- renderFileList(targetRenderList);
- }
-
-
- }else{
- //File. Download it
- }
- }
- resizeDOMElement();
- function resizeDOMElement(){
- $("#filelistWrapper").css({
- height: window.innerHeight - $("#filelistWrapper").offset().top - 100,
- })
- }
- $(window).on("resize", function(){
- resizeDOMElement();
- })
- </script>
- </body>
- </html>
|