diff --git a/app/models/Entry.php b/app/models/Entry.php index e835f9aed..99edf94b4 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -487,11 +487,6 @@ class EntryDAO extends Model_pdo { return $readUnread; } - public function countFavorites () { //Deprecated: use countUnreadReadFavorites() instead - $unreadRead = $this->countUnreadReadFavorites (); //This makes better use of caching - return $unreadRead['unread'] + $unreadRead['read']; - } - public function optimizeTable() { $sql = 'OPTIMIZE TABLE ' . $this->prefix . 'entry'; $stm = $this->bd->prepare ($sql); diff --git a/public/scripts/main.js b/public/scripts/main.js index 3d4c1f30a..9723e617d 100644 --- a/public/scripts/main.js +++ b/public/scripts/main.js @@ -72,6 +72,13 @@ function mark_read(active, only_not_read) { elem.setAttribute('data-unread', Math.max(0, feed_unread + inc)); } + //Update unread: favourites + if (active.closest('div').hasClass('favorite')) { + elem = $('#aside_flux .favorites').children(':first').get(0); + feed_unread = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0; + elem.setAttribute('data-unread', Math.max(0, feed_unread + inc)); + } + //Update unread: title document.title = document.title.replace(/((?: \(\d+\))?)( - .*?)((?: \(\d+\))?)$/, function (m, p1, p2, p3) { return incLabel(p1, inc) + p2 + incLabel(p3, feed_priority > 0 ? inc : 0); @@ -112,6 +119,12 @@ function mark_favorite(active) { return incLabel(p1, inc); }); } + + if (active.closest('div').hasClass('not_read')) { + var elem = $('#aside_flux .favorites').children(':first').get(0), + feed_unread = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0; + elem.setAttribute('data-unread', Math.max(0, feed_unread + inc)); + } }); } @@ -193,15 +206,6 @@ function next_entry() { } } -/*function init_img() { - var maxWidth = $(".flux_content .content").width() / 2; - $(".flux_content .content img").each(function () { - if ($(this).width() > maxWidth) { - $(this).addClass("big"); - } - }); -}*/ - function inMarkViewport(flux, box_to_follow, relative_follow) { var top = flux.position().top; if (relative_follow) { @@ -229,7 +233,6 @@ function init_lazyload() { } function init_posts() { - //init_img(); //Alex init_lazyload(); var box_to_follow = $(window),