From c34a4c85bde242c991baf1f383694e9a4fa82940 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 23 Mar 2021 10:47:06 +0300 Subject: [PATCH] clip max displayed counter value to 9999 because of container node width --- classes/pref/feeds.php | 2 +- js/Feeds.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 5f7635736..305da4376 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -140,7 +140,7 @@ class Pref_Feeds extends Handler_Protected { } foreach (array(-4, -3, -1, -2, 0, -6) as $i) { - array_push($cat['items'], $this->feedlist_init_feed($i)); + array_push($cat['items'], $this->feedlist_init_feed($i, false, 0)); } /* Plugin feeds for -1 */ diff --git a/js/Feeds.js b/js/Feeds.js index 818973542..a65e8d9c6 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -3,6 +3,7 @@ /* global __, App, Headlines, xhr, dojo, dijit, fox, PluginHost, Notify, fox */ const Feeds = { + _max_counter_value: 9999, _default_feed_id: -3, counters_last_request: 0, _active_feed_id: undefined, @@ -69,7 +70,7 @@ const Feeds = { const id = elems[l].id; const kind = elems[l].kind; - const ctr = parseInt(elems[l].counter); + const ctr = Math.min(this._max_counter_value, parseInt(elems[l].counter)); const error = elems[l].error; const has_img = elems[l].has_img; const updated = elems[l].updated; @@ -90,8 +91,10 @@ const Feeds = { }*/ this.setUnread(id, (kind == "cat"), ctr); - this.setValue(id, (kind == "cat"), 'auxcounter', parseInt(elems[l].auxcounter)); - this.setValue(id, (kind == "cat"), 'markedcounter', parseInt(elems[l].markedcounter)); + this.setValue(id, (kind == "cat"), 'auxcounter', + Math.min(this._max_counter_value, parseInt(elems[l].auxcounter))); + this.setValue(id, (kind == "cat"), 'markedcounter', + Math.min(this._max_counter_value, parseInt(elems[l].markedcounter))); if (kind != "cat") { this.setValue(id, false, 'error', error);