summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-24 15:08:57 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-24 15:08:57 +0200
commit15316b77f6dd94b46ec8bdac588e273aef259737 (patch)
tree1855864df3d98b40804698706eee6529aca3b4a3
parentbd5757fff83844fef08fb50d0fce3b1d104728dc (diff)
Fix last sections of main.js
See https://github.com/marienfressinaud/FreshRSS/issues/634
-rw-r--r--app/layout/aside_feed.phtml4
-rw-r--r--app/views/index/global.phtml4
-rw-r--r--p/scripts/main.js22
3 files changed, 15 insertions, 15 deletions
diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml
index 06e12a5cf..3c23e0178 100644
--- a/app/layout/aside_feed.phtml
+++ b/app/layout/aside_feed.phtml
@@ -22,13 +22,13 @@
<form id="mark-read-aside" method="post" style="display: none"></form>
<ul class="tree">
- <li class="tree-folder all<?php echo FreshRSS_Context::isCurrentGet('a') ? ' active' : ''; ?>">
+ <li class="tree-folder category all<?php echo FreshRSS_Context::isCurrentGet('a') ? ' active' : ''; ?>">
<div class="tree-folder-title">
<?php echo _i('all'); ?> <a class="title" data-unread="<?php echo format_number(FreshRSS_Context::$total_unread); ?>" href="<?php echo _url('index', 'index'); ?>"><?php echo _t('main_stream'); ?></a>
</div>
</li>
- <li class="tree-folder favorites<?php echo FreshRSS_Context::isCurrentGet('s') ? ' active' : ''; ?>">
+ <li class="tree-folder category favorites<?php echo FreshRSS_Context::isCurrentGet('s') ? ' active' : ''; ?>">
<div class="tree-folder-title">
<?php echo _i('bookmark'); ?> <a class="title" data-unread="<?php echo format_number(FreshRSS_Context::$total_starred['unread']); ?>" href="<?php echo _url('index', 'index', 'get', 's'); ?>"><?php echo _t('favorite_feeds', format_number(FreshRSS_Context::$total_starred['all'])); ?></a>
</div>
diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml
index 5159882ba..0975a5a00 100644
--- a/app/views/index/global.phtml
+++ b/app/views/index/global.phtml
@@ -34,9 +34,9 @@
$empty = $feed->nbEntries() === 0 ? ' empty' : '';
$url_base['params']['get'] = 'f_' . $feed->id();
?>
- <li class="item feed<?php echo $error, $empty; ?>" data-unread="<?php echo $feed->nbNotRead(); ?>">
+ <li id="f_<?php echo $feed->id(); ?>" class="item feed<?php echo $error, $empty; ?>" data-unread="<?php echo $feed->nbNotRead(); ?>" data-priority="<?php echo $feed->priority(); ?>">
<img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" />
- <a class="item-title" data-unread="<?php echo format_number($feed->nbNotRead()); ?>" data-priority="<?php echo $feed->priority(); ?>" href="<?php echo Minz_Url::display($url_base); ?>"><?php echo $feed->name(); ?></a>
+ <a class="item-title" data-unread="<?php echo format_number($feed->nbNotRead()); ?>" href="<?php echo Minz_Url::display($url_base); ?>"><?php echo $feed->name(); ?></a>
</li>
<?php } ?>
</ul>
diff --git a/p/scripts/main.js b/p/scripts/main.js
index 24c0972fc..b6370866f 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -61,18 +61,18 @@ function incUnreadsFeed(article, feed_id, nb) {
feed_priority = elem ? str2int(elem.getAttribute('data-priority')) : 0;
if (elem) {
elem.setAttribute('data-unread', feed_unreads + nb);
- elem = $(elem).children('a').get(0);
+ elem = $(elem).children('.item-title').get(0);
if (elem) {
elem.setAttribute('data-unread', numberFormat(feed_unreads + nb));
}
}
//Update unread: category
- elem = $('#' + feed_id).parents('.tree-folder').get(0);
+ elem = $('#' + feed_id).parents('.category').get(0);
feed_unreads = elem ? str2int(elem.getAttribute('data-unread')) : 0;
if (elem) {
elem.setAttribute('data-unread', feed_unreads + nb);
- elem = $(elem).find('.tree-folder-title .title').get(0);
+ elem = $(elem).find('.title').get(0);
if (elem) {
elem.setAttribute('data-unread', numberFormat(feed_unreads + nb));
}
@@ -80,7 +80,7 @@ function incUnreadsFeed(article, feed_id, nb) {
//Update unread: all
if (feed_priority > 0) {
- elem = $('#aside_feed .all .tree-folder-title .title').get(0);
+ elem = $('#aside_feed .all .title').get(0);
if (elem) {
feed_unreads = elem ? str2int(elem.getAttribute('data-unread')) : 0;
elem.setAttribute('data-unread', numberFormat(feed_unreads + nb));
@@ -89,7 +89,7 @@ function incUnreadsFeed(article, feed_id, nb) {
//Update unread: favourites
if (article && article.closest('div').hasClass('favorite')) {
- elem = $('#aside_feed .favorites .tree-folder-title .title').get(0);
+ elem = $('#aside_feed .favorites .title').get(0);
if (elem) {
feed_unreads = elem ? str2int(elem.getAttribute('data-unread')) : 0;
elem.setAttribute('data-unread', numberFormat(feed_unreads + nb));
@@ -194,7 +194,7 @@ function mark_favorite(active) {
}
$b.find('.icon').replaceWith(data.icon);
- var favourites = $('#aside_feed .favorites .tree-folder-title .title').contents().last().get(0);
+ var favourites = $('#aside_feed .favorites .title').contents().last().get(0);
if (favourites && favourites.textContent) {
favourites.textContent = favourites.textContent.replace(/((?: \([ 0-9]+\))?\s*)$/, function (m, p1) {
return incLabel(p1, inc, false);
@@ -202,7 +202,7 @@ function mark_favorite(active) {
}
if (active.closest('div').hasClass('not_read')) {
- var elem = $('#aside_feed .favorites .tree-folder-title .title').get(0),
+ var elem = $('#aside_feed .favorites .title').get(0),
feed_unreads = elem ? str2int(elem.getAttribute('data-unread')) : 0;
if (elem) {
elem.setAttribute('data-unread', numberFormat(feed_unreads + inc));
@@ -876,12 +876,12 @@ function init_notifs_html5() {
function refreshUnreads() {
$.getJSON('./?c=javascript&a=nbUnreadsPerFeed').done(function (data) {
- var isAll = $('.category.all > .active').length > 0,
+ var isAll = $('.category.all.active').length > 0,
new_articles = false;
$.each(data, function(feed_id, nbUnreads) {
feed_id = 'f_' + feed_id;
- var elem = $('#' + feed_id + '>.feed').get(0),
+ var elem = $('#' + feed_id).get(0),
feed_unreads = elem ? str2int(elem.getAttribute('data-unread')) : 0;
if ((incUnreadsFeed(null, feed_id, nbUnreads - feed_unreads) || isAll) && //Update of current view?
@@ -891,7 +891,7 @@ function refreshUnreads() {
};
});
- var nb_unreads = str2int($('.category.all>a').attr('data-unread'));
+ var nb_unreads = str2int($('.category.all .title').attr('data-unread'));
if (nb_unreads > 0 && new_articles) {
faviconNbUnread(nb_unreads);
@@ -1136,7 +1136,7 @@ function init_password_observers() {
function faviconNbUnread(n) {
if (typeof n === 'undefined') {
- n = str2int($('.category.all>a').attr('data-unread'));
+ n = str2int($('.category.all .title').attr('data-unread'));
}
//http://remysharp.com/2010/08/24/dynamic-favicons/
var canvas = document.createElement('canvas'),