auto reload

This commit is contained in:
Synox 2018-06-15 20:18:18 +02:00
parent 213ba00505
commit 2b358d0e1c

View File

@ -38,6 +38,9 @@ $mailIdsJoinedString = filter_var(join('|', $mailIds), FILTER_SANITIZE_SPECIAL_C
<link rel="stylesheet" href="spinner.css"> <link rel="stylesheet" href="spinner.css">
<script> <script>
var mailCount = <?php echo count($emails)?>;
function copyToClipboard(text) { function copyToClipboard(text) {
var inp = document.createElement('input'); var inp = document.createElement('input');
document.body.appendChild(inp); document.body.appendChild(inp);
@ -71,9 +74,9 @@ $mailIdsJoinedString = filter_var(join('|', $mailIds), FILTER_SANITIZE_SPECIAL_C
if (r.responseText > 0) { if (r.responseText > 0) {
console.log("There are", r.responseText, "new mails."); console.log("There are", r.responseText, "new mails.");
document.getElementById("new-content-avalable").style.display = 'block'; document.getElementById("new-content-avalable").style.display = 'block';
// If there are no emails displayed, we can reload the page without loosing any state. // If there are no emails displayed, we can reload the page without looing any state.
if(<?php echo count($emails)?> === 0) { if (mailCount === 0) {
location.reload(); location.reload();
} }
} }