File Downloading
This commit is contained in:
@@ -65,9 +65,9 @@ body{
|
||||
background-color:aliceblue;
|
||||
z-index:2;
|
||||
padding:0.5rem;
|
||||
height: 1.5rem;
|
||||
height: 2rem;
|
||||
width:100%;
|
||||
|
||||
font-size:1.5em;
|
||||
}
|
||||
.nav-bottom-button-container{
|
||||
width:100%;
|
||||
@@ -94,6 +94,14 @@ body{
|
||||
margin-top:0.5rem;
|
||||
}
|
||||
|
||||
.icon-tabs{
|
||||
float:right;
|
||||
padding-right:1em;
|
||||
}
|
||||
.icon-tabs .file-download-button,.icon-tabs .file-rename-button{
|
||||
margin-left:0.5em;
|
||||
}
|
||||
|
||||
table#files-details{
|
||||
width:100%;
|
||||
}
|
||||
|
@@ -1,15 +1,16 @@
|
||||
|
||||
let currDir = {'loc':'','contents':null};
|
||||
let currSel = {'loc':'','path':''}
|
||||
let currDir = {'loc':'','contents':null}
|
||||
let currSel = {'loc':null,'name':null}
|
||||
|
||||
function doUpdate(ele,isDir=false){
|
||||
//console.log(ele.attr('data-choice'));
|
||||
if(ele.hasClass('file-isDir')){
|
||||
currDir.loc = ele.attr('data-choice');
|
||||
currDir.loc = ele.attr('data-choice')
|
||||
populateContents();
|
||||
}
|
||||
if(!isDir){
|
||||
$('.nav-bottom-text').html(ele.html())
|
||||
currSel.loc = ele.attr('data-choice')
|
||||
$('.nav-bottom-text').html(currSel.name = ele.html())
|
||||
|
||||
}
|
||||
//$()
|
||||
@@ -57,5 +58,21 @@ function populateContents(){
|
||||
|
||||
$(document).ready(()=>{
|
||||
populateContents();
|
||||
//updateContents();
|
||||
$('.file-download-button').click(()=>{
|
||||
console.log(currSel)
|
||||
$.ajax('/files/cat',{
|
||||
method:'post',
|
||||
data:currSel,
|
||||
xhrFields: {
|
||||
responseType: 'blob'
|
||||
},
|
||||
success:(msg)=>{
|
||||
//console.log(msg)
|
||||
$('.file-download-button').after(`<a id="down-temp" href="${window.URL.createObjectURL(msg)}" download="${currSel.name}"></a>`)
|
||||
document.getElementById('down-temp').click()
|
||||
$('#down-temp').remove();
|
||||
},
|
||||
error: err=>console.log(err)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@@ -5,13 +5,14 @@
|
||||
<title>FM</title>
|
||||
<link rel="stylesheet" href="base.css" />
|
||||
<script src="jquery/jquery.min.js"></script>
|
||||
<script src="fa/js/all.js"></script>
|
||||
<script src="base.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="cover" class="hidden"></div>
|
||||
<div class="navbar-container box-shadow-1">
|
||||
<div class="navbar">
|
||||
<div class="navbar-text">Location: /<span id="files-location"></span></div>
|
||||
<div class="navbar-text">Location: <span id="files-location"></span></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -25,14 +26,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="files-table">
|
||||
<!--<tr>
|
||||
<td>TEST1</td>
|
||||
<td class="file-handlers">TEST2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TEST3</td>
|
||||
<td class="file-handlers">TEST4</td>
|
||||
</tr>-->
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -44,7 +38,18 @@
|
||||
<button class="nav-bottom-button box-shadow-3 box-shadow-3-active">+</button>
|
||||
</div>
|
||||
<div class="nav-bottom box-shadow-3">
|
||||
<span class="nav-bottom-text">Select file</span>
|
||||
<span class="nav-bottom-text">
|
||||
Select file
|
||||
</span>
|
||||
<span class="icon-tabs">
|
||||
<span class="file-download-button" alt="Download">
|
||||
<span class="fas fa-file-download"></span>
|
||||
</span>
|
||||
<span class="file-rename-button" alt="Rename">
|
||||
<span class="fas fa-file-export"></span>
|
||||
</span>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
Reference in New Issue
Block a user