susee:log
This commit is contained in:
parent
edfd6bb08c
commit
2eb6c789f6
@ -4,6 +4,7 @@
|
|||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
</head>
|
</head>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
@ -195,6 +196,10 @@
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
margin-right: 1rem;
|
margin-right: 1rem;
|
||||||
}
|
}
|
||||||
|
.download{
|
||||||
|
font-size: 25px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -219,7 +224,7 @@
|
|||||||
<%= data[i].file[j] %>
|
<%= data[i].file[j] %>
|
||||||
</li>
|
</li>
|
||||||
<button type="button" id="<%= data[i].file[j]+'|'+data[i].folder %>" class="btn btn-danger delete">Delete</button>
|
<button type="button" id="<%= data[i].file[j]+'|'+data[i].folder %>" class="btn btn-danger delete">Delete</button>
|
||||||
<a onclick="downloadImage('<%= data[i].img[j] %>')">Download link</a>
|
<a onclick="downloadImage('<%= data[i].img[j] %>' , '<%= data[i].file[j] %>')"><i class="fa fa-download download"></i></a>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
@ -292,12 +297,13 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
$(".fileName").click(function(){
|
$(".fileName").click(function(){
|
||||||
data = $(this).attr('id').split("|");
|
data = $(this).attr('id').split("|");
|
||||||
|
var getUrl = window.location;
|
||||||
|
path_name = getUrl.pathname.slice(0,-4)+'readlogs';
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "/api/readlogs",
|
url: path_name,
|
||||||
data: {'file' : data[0] , 'folder' : data[1]},
|
data: {'file' : data[0] , 'folder' : data[1]},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
console.log(response);
|
|
||||||
$('.modal-title').html(data[0]);
|
$('.modal-title').html(data[0]);
|
||||||
$('.modal-body').html(response.data);
|
$('.modal-body').html(response.data);
|
||||||
$('#myModal').modal('show');
|
$('#myModal').modal('show');
|
||||||
@ -310,9 +316,12 @@ $(".fileName").click(function(){
|
|||||||
|
|
||||||
$(".delete").click(function(){
|
$(".delete").click(function(){
|
||||||
data = $(this).attr('id').split("|");
|
data = $(this).attr('id').split("|");
|
||||||
|
var getUrl = window.location;
|
||||||
|
path_name = getUrl.pathname.slice(0,-4)+'deletelog';
|
||||||
|
alert(path_name)
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "/api/deletelog",
|
url: path_name,
|
||||||
data: {'file' : data[0] , 'folder' : data[1]},
|
data: {'file' : data[0] , 'folder' : data[1]},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
@ -324,12 +333,12 @@ $(".delete").click(function(){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function downloadImage(data)
|
function downloadImage(data,fileName)
|
||||||
{
|
{
|
||||||
const base64Image = data; // Replace this with your actual Base64 image data
|
const base64Image = data; // Replace this with your actual Base64 image data
|
||||||
const downloadLink = document.createElement('a');
|
const downloadLink = document.createElement('a');
|
||||||
downloadLink.href = base64Image;
|
downloadLink.href = base64Image;
|
||||||
downloadLink.download = 'log.txt'; // Replace with the desired file name and extension
|
downloadLink.download = fileName; // Replace with the desired file name and extension
|
||||||
downloadLink.click();
|
downloadLink.click();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user