Pause imp
This commit is contained in:
@ -68,6 +68,21 @@
|
||||
#abort-button:hover {
|
||||
background-color: #d32f2f;
|
||||
}
|
||||
#pause-button, #resume-button {
|
||||
background-color: #2196F3;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 15px;
|
||||
margin-top: 10px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#pause-button:hover, #resume-button:hover {
|
||||
background-color: #1976D2;
|
||||
}
|
||||
#resume-button {
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
body {
|
||||
padding: 10px;
|
||||
@ -97,6 +112,8 @@
|
||||
<div id="currentFile"></div>
|
||||
</div>
|
||||
<button id="abort-button" onclick="abortDownload()">Abort Download</button>
|
||||
<button id="pause-button" onclick="pauseDownload()">Pause Download</button>
|
||||
<button id="resume-button" onclick="resumeDownload()">Resume Download</button>
|
||||
<script>
|
||||
function updateProgress() {
|
||||
fetch('/progress?filename={{.Filename}}', {
|
||||
@ -127,6 +144,32 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function pauseDownload() {
|
||||
fetch('/pause?filename={{.Filename}}', { method: 'POST' })
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
alert('Pause signal sent. The download will pause soon.');
|
||||
document.getElementById('pause-button').style.display = 'none';
|
||||
document.getElementById('resume-button').style.display = 'inline-block';
|
||||
} else {
|
||||
alert('Failed to pause the download.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function resumeDownload() {
|
||||
fetch('/resume?filename={{.Filename}}', { method: 'POST' })
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
alert('Resume signal sent. The download will resume soon.');
|
||||
document.getElementById('resume-button').style.display = 'none';
|
||||
document.getElementById('pause-button').style.display = 'inline-block';
|
||||
} else {
|
||||
alert('Failed to resume the download.');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user