Update dynamically unread counter in multiple places
This commit is contained in:
parent
a48afcbc0d
commit
f9146f078a
@ -172,11 +172,23 @@
|
|||||||
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 container = document.getElementById("page-counter");
|
||||||
var unread_count = parseInt($unread_span.innerHTML, 10) - 1;
|
|
||||||
|
|
||||||
$unread_span.innerHTML = unread_count;
|
if (container) {
|
||||||
document.querySelector("title").innerHTML = "miniflux (" + unread_count + ")";
|
|
||||||
|
counter = parseInt(container.textContent.trim(), 10) - 1;
|
||||||
|
|
||||||
|
if (counter == 0) {
|
||||||
|
|
||||||
|
window.location = "?action=feeds¬hing_to_read=1";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
container.textContent = counter + " ";
|
||||||
|
document.title = "miniflux (" + counter + ")";
|
||||||
|
document.getElementById("nav-counter").textContent = "(" + counter + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ return array(
|
|||||||
'About' => 'A propos',
|
'About' => 'A propos',
|
||||||
'Miniflux version:' => 'Version de Miniflux :',
|
'Miniflux version:' => 'Version de Miniflux :',
|
||||||
'Nothing to read' => 'Rien à lire',
|
'Nothing to read' => 'Rien à lire',
|
||||||
'%d unread items' => '%d éléments non lus',
|
'unread items' => 'éléments non lus',
|
||||||
'mark all as read' => 'tout marquer comme lu',
|
'mark all as read' => 'tout marquer comme lu',
|
||||||
'original link' => 'lien original',
|
'original link' => 'lien original',
|
||||||
'mark as read' => 'marquer comme lu',
|
'mark as read' => 'marquer comme lu',
|
||||||
|
@ -18,11 +18,21 @@
|
|||||||
<nav>
|
<nav>
|
||||||
<a class="logo" href="?">mini<span>flux</span></a>
|
<a class="logo" href="?">mini<span>flux</span></a>
|
||||||
<ul>
|
<ul>
|
||||||
<li <?= isset($menu) && $menu === 'unread' ? 'class="active"' : '' ?>><a href="?action=default"><?= t('unread') ?></a></li>
|
<li <?= isset($menu) && $menu === 'unread' ? 'class="active"' : '' ?>>
|
||||||
<li <?= isset($menu) && $menu === 'history' ? 'class="active"' : '' ?>><a href="?action=history"><?= t('history') ?></a></li>
|
<a href="?action=default"><?= t('unread') ?> <span id="nav-counter"><?= isset($nb_items) ? '('.$nb_items.')' : '' ?></span></a>
|
||||||
<li <?= isset($menu) && $menu === 'feeds' ? 'class="active"' : '' ?>><a href="?action=feeds"><?= t('subscriptions') ?></a></li>
|
</li>
|
||||||
<li <?= isset($menu) && $menu === 'config' ? 'class="active"' : '' ?>><a href="?action=config"><?= t('preferences') ?></a></li>
|
<li <?= isset($menu) && $menu === 'history' ? 'class="active"' : '' ?>>
|
||||||
<li><a href="?action=logout"><?= t('logout') ?></a></li>
|
<a href="?action=history"><?= t('history') ?></a>
|
||||||
|
</li>
|
||||||
|
<li <?= isset($menu) && $menu === 'feeds' ? 'class="active"' : '' ?>>
|
||||||
|
<a href="?action=feeds"><?= t('subscriptions') ?></a>
|
||||||
|
</li>
|
||||||
|
<li <?= isset($menu) && $menu === 'config' ? 'class="active"' : '' ?>>
|
||||||
|
<a href="?action=config"><?= t('preferences') ?></a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="?action=logout"><?= t('logout') ?></a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h2> <?= t('<span id="unread-count">%d</span> unread items', $nb_items) ?></h2>
|
<h2><span id="page-counter"><?= isset($nb_items) ? $nb_items.' ' : '' ?></span><?= t('unread 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>
|
||||||
|
Loading…
Reference in New Issue
Block a user