Download Button Added

This commit is contained in:
cleontay 2023-05-31 09:24:03 +08:00
parent 129ecce981
commit 88acf38da4
2 changed files with 39 additions and 6 deletions

View File

@ -20,7 +20,8 @@
var html_content = `<section style="margin: 100px auto; width:50%; height:50%; text-align:center;">
<div style="width:100%; height:100%; text-align:center;">
<h1 style="height:15%; width:90%; padding: 5%">Decoded</h1>
<img src="upload/` + response["image"] + `" alt="Image Not Found">
<img src="upload/` + response["image"] + `" alt="Image Not Found" class="result_box">
<a href="upload/` + response["image"] + `" class="result_box_download" download >Download Image</a>
</div>
<div style="width:100%; height:100%; text-align:center;">
<h1 style="height:15%; width:90%; padding: 5%">Secret Text:</h1>
@ -36,6 +37,7 @@
<source src="upload/` + response["wav"] + `" type="audio/wav">
Your browser does not support the audio element.
</audio>
<a href="upload/` + response["wav"] + `" download>Download Audio</a>
<div>
<h1 style="height:15%; width:90%; padding: 5%">Secret Text:</h1>
<p style="color: red">` + response["payload"] + `</p>
@ -50,6 +52,7 @@
<source src="upload/` + response["mp3"] + `" type="audio/wav">
Your browser does not support the audio element.
</audio>
<a href="upload/` + response["mp3"] + `" download>Download Audio</a>
<div>
<h1 style="height:15%; width:90%; padding: 5%">Secret Text:</h1>
<p style="color: red">` + response["payload"] + `</p>
@ -63,6 +66,7 @@
<video style="width: 100%" src="upload/` + response["mp4"] + `" controls autoplay>
Sorry, your browser doesn't support embedded videos.
</video>
<a href="upload/` + response["mp4"] + `" download>Download Video</a>
<div>
<h1 style="height:15%; width:90%; padding: 5%">Secret Text:</h1>
<p style="color: red">` + response["payload"] + `</p>
@ -78,6 +82,7 @@
<div style="width:100%; height:100%; text-align:center;">
<h1 style="height:15%; width:90%; padding: 5%">Decoded</h1>
<textarea style="height:75%; width:90%; padding: 5%">` + data + `</textarea>
<a href="upload/` + response["txt"] + `" download>Download Text File</a>
</div>
<div style="width:100%; height:100%; text-align:center;">
<h1 style="height:15%; width:90%; padding: 5%">Secret Text:</h1>
@ -101,6 +106,11 @@
$("body").append(html_content)
}
});
$(".result_box").on("click", function(){
$(".result_box_download").click()
})
})
</script>

View File

@ -28,14 +28,18 @@
$.get('/get_session', function(response) {
console.log(response)
if(response.hasOwnProperty("image")){
var html_content = `<section style="margin: 100px auto; width:50%; height:50%; display: flex; justify-content: space-between;">
var html_content = `<section style="margin: 100px auto; width:50%; height:55%; display: flex; justify-content: space-between;">
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
<h1 style="height:15%; width:90%; padding: 5%">Original</h1>
<img src="upload/` + response["image"] + `" alt="Image Not Found">
<img src="upload/` + response["image"] + `" alt="Image Not Found" class="result_box">
<br>
<a href="upload/` + response["image"] + `" download rel="nofollow" class="result_box_download">Download Image</a>
</div>
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
<h1 style="height:15%; width:90%; padding: 5%">Encoded</h1>
<img src="upload/` + response["image2"] + `" alt="Image Not Found">
<img src="upload/` + response["image2"] + `" alt="Image Not Found" class="result_box">
<br>
<a href="upload/` + response["image2"] + `" download rel="nofollow" class="result_box_download">Download Image</a>
</div>
</section>`
@ -49,6 +53,8 @@
<source src="upload/` + response["wav"] + `" type="audio/wav">
Your browser does not support the audio element.
</audio>
<br>
<a href="upload/` + response["wav"] + `" download rel="nofollow">Download Audio</a>
</div>
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
<h1 style="height:15%; width:90%; padding: 5%">Encoded</h1>
@ -56,6 +62,8 @@
<source src="upload/` + response["wav2"] + `" type="audio/wav">
Your browser does not support the audio element.
</audio>
<br>
<a href="upload/` + response["wav2"] + `" download rel="nofollow">Download Audio</a>
</div>
</section>`
$("body").append(html_content)
@ -68,6 +76,8 @@
<source src="upload/` + response["mp3"] + `" type="audio/wav">
Your browser does not support the audio element.
</audio>
<br>
<a href="upload/` + response["mp3"] + `" download rel="nofollow">Download Audio</a>
</div>
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
<h1 style="height:15%; width:90%; padding: 5%">Encoded</h1>
@ -75,6 +85,8 @@
<source src="upload/` + response["mp3_2"] + `" type="audio/wav">
Your browser does not support the audio element.
</audio>
<br>
<a href="upload/` + response["mp3_2"] + `" download rel="nofollow">Download Audio</a>
</div>
</section>`
$("body").append(html_content)
@ -86,12 +98,16 @@
<video style="width: 100%" src="upload/` + response["mp4"] + `" controls autoplay>
Sorry, your browser doesn't support embedded videos.
</video>
<br>
<a href="upload/` + response["mp4"] + `" download rel="nofollow">Download Video</a>
</div>
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
<h1 style="height:15%; width:90%; padding: 5%">Encoded</h1>
<video style="width: 100%" src="upload/` + response["mp4_2"] + `" controls autoplay>
Sorry, your browser doesn't support embedded videos.
</video>
<br>
<a href="upload/` + response["mp4_2"] + `" download rel="nofollow">Download Video</a>
</div>
</section>`
$("body").append(html_content)
@ -101,11 +117,13 @@
var html_content = `<section style="margin: 100px auto; width:50%; height:50%; display: flex; justify-content: space-between;">
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
<h1 style="height:15%; width:90%; padding: 5%">Original</h1>
<a href="upload/` + response["document"] + `" download>Download Document</a>
<br>
<a href="upload/` + response["document"] + `" download rel="nofollow">Download Document</a>
</div>
<div style="border: 1px solid black; width:100%; height:100%; text-align:center;">
<h1 style="height:15%; width:90%; padding: 5%">Encoded</h1>
<a href="upload/` + response["document_2"] + `" download>Download Document</a>
<br>
<a href="upload/` + response["document_2"] + `" download rel="nofollow">Download Document</a>
</div>
</section>`
$("body").append(html_content)
@ -140,6 +158,11 @@
});
}
});
$("body").on("click", ".result_box", function(e){
e.preventDefault()
window.location.href = $(this).parent().find("a").attr("href")
})
})
</script>