Scroll to top of page when long process is initiated (#493)

* Scroll to top of page when long process is initiated. Reduce code duplication.

* Add script type
This commit is contained in:
Daniel Markstedt 2021-11-27 18:23:37 -08:00 committed by GitHub
parent 8dfe9d1b5e
commit b682655e56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View File

@ -24,6 +24,13 @@
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<script type="application/javascript">
var processNotify = function(Notification) {
document.getElementById("flash").innerHTML = "<div class='message'>" + Notification + " This process may take a while, and will continue in the background if you navigate away from this page.</div>";
window.scrollTo(0,0);
}
</script>
<script type="application/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.js">
</script>
</head>

View File

@ -201,7 +201,7 @@
<form action="/files/unzip" method="post">
<input name="zip_file" type="hidden" value="{{ file['name'] }}">
<input name="zip_member" type="hidden" value="{{ member }}">
<input type="submit" value="Unzip" onclick='document.getElementById("flash").innerHTML = "<div class=\"message\">Unzipping single file...</div>"'>
<input type="submit" value="Unzip" onclick="processNotify('Unzipping a single file...')">
</form>
</summary>
<ul style="list-style: none;">
@ -215,7 +215,7 @@
<form action="/files/unzip" method="post">
<input name="zip_file" type="hidden" value="{{ file['name'] }}">
<input name="zip_member" type="hidden" value="{{ member }}">
<input type="submit" value="Unzip" onclick='document.getElementById("flash").innerHTML = "<div class=\"message\">Unzipping single file...</div>"'>
<input type="submit" value="Unzip" onclick="processNotify('Unzipping a single file...')">
</form>
{% endif %}
</li>
@ -243,7 +243,7 @@
<form action="/files/unzip" method="post">
<input name="zip_file" type="hidden" value="{{ file['name'] }}">
<input name="zip_members" type="hidden" value="{{ file['zip_members'] }}">
<input type="submit" value="Unzip All" onclick='document.getElementById("flash").innerHTML = "<div class=\"message\">Unzipping all files...</div>"'>
<input type="submit" value="Unzip All" onclick="processNotify('Unzipping all files...')">
</form>
{% else %}
<form action="/scsi/attach" method="post">
@ -388,7 +388,7 @@
<form action="/files/download_to_images" method="post">
<label for="url">URL:</label>
<input name="url" placeholder="URL" required="" type="url">
<input type="submit" value="Download" onclick='document.getElementById("flash").innerHTML = "<div class=\"message\">Downloading File to Images...</div>"'>
<input type="submit" value="Download" onclick="processNotify('Downloading File to Images...')">
</form>
</td>
</tr>
@ -415,7 +415,7 @@
<form action="/files/download_to_afp" method="post">
<label for="url">URL:</label>
<input name="url" placeholder="URL" required="" type="url">
<input type="submit" value="Download" onclick='document.getElementById("flash").innerHTML = "<div class=\"message\">Downloading File to AppleShare...</div>"'>
<input type="submit" value="Download" onclick="processNotify('Downloading File to AppleShare...')">
</form>
</td>
</tr>
@ -458,7 +458,7 @@
</select>
<label for="url">URL:</label>
<input name="url" placeholder="URL" required="" type="url">
<input type="submit" value="Download and Mount ISO" onclick='document.getElementById("flash").innerHTML = "<div class=\"message\">Downloading File as ISO...</div>"'>
<input type="submit" value="Download and Mount ISO" onclick="processNotify('Downloading File as ISO...')">
</form>
</td>
</tr>