added count down for download

This commit is contained in:
0xboobface 2018-07-02 17:47:27 +02:00
parent 8aaebc80ed
commit 037ef9381d
1 changed files with 17 additions and 1 deletions

View File

@ -88,8 +88,23 @@
</div>
</div>
<script>
let cnt = 10;
function downloadCounter(uri) {
window.setTimeout(function() {
if(cnt === 0) {
location.href = uri;
} else {
cnt--;
$('#download-counter').html("Your download starts in... " + cnt);
downloadCounter(uri);
}
}, 1000);
}
function downloadFile(uri) {
location.href = uri;
$('#download-counter').show();
$('#download-counter').html("Your download starts in... " + cnt);
cnt = 10;
downloadCounter(uri);
}
</script>
<div class="row text-center">
@ -121,6 +136,7 @@
<hr class="star-light mb-5">
<div class="row">
<div class="col-lg-8 mx-auto text-center">
<p id="download-counter" class="lead text-center" style="display:none"></p>
<p class="lead">
CTB Recorder is free and open source. I'm a student and wrote this software in my spare time.
If you like the software or want to suggest a new feature, please consider buying me a coffee or two. Thanks!