Update the number of unread items when marking an item as read

This commit is contained in:
doubleface 2013-06-14 08:43:50 -04:00
parent 4abf966878
commit bdfd7a19a3
2 changed files with 7 additions and 1 deletions

View File

@ -171,6 +171,12 @@
{ {
var item = document.getElementById("item-" + item_id); var item = document.getElementById("item-" + item_id);
if (item) item.parentNode.removeChild(item); if (item) item.parentNode.removeChild(item);
var $unread_span = document.getElementById("unread-count");
var unread_count = parseInt($unread_span.innerHTML, 10) - 1;
$unread_span.innerHTML = unread_count;
document.querySelector("title").innerHTML = "miniflux (" + unread_count + ")";
} }

View File

@ -5,7 +5,7 @@
<?php else: ?> <?php else: ?>
<div class="page-header"> <div class="page-header">
<h2><?= t('%d unread items', $nb_items) ?></h2> <h2> <?= t('<span id="unread-count">%d</span> unread items', $nb_items) ?></h2>
<ul> <ul>
<li><a href="?action=mark-as-read"><?= t('mark all as read') ?></a></li> <li><a href="?action=mark-as-read"><?= t('mark all as read') ?></a></li>
</ul> </ul>