Browse Source

Correction sur l'affichage des non lus sur les dossiers.

cobalt74 7 years ago
parent
commit
582f5368e3
1 changed files with 24 additions and 12 deletions
  1. 24 12
      templates/marigolds/js/script.js

+ 24 - 12
templates/marigolds/js/script.js

@@ -737,12 +737,18 @@ function addOrRemoveFeedNumber(operator){
         }
         // on diminue le nombre sur le dossier
         var feed_folder = ($(feed).closest('ul').prev('h1').find('.unreadForFolder'));
-        var regex='[0-9]+';
-        var found = feed_folder.html().match(regex);
-        nb = parseInt(found[0])-1;
-        var regex2='[^0-9]+';
-        var lib = feed_folder.html().match(regex2);
-        feed_folder.html(nb +lib[0])
+        if(isNaN(feed_folder.html())) {
+            var regex='[0-9]+';
+            var found = feed_folder.html().match(regex);
+            nb = parseInt(found[0])-1;
+            var regex2='[^0-9]+';
+            var lib = feed_folder.html().match(regex2);
+            if (nb > 0) {
+                feed_folder.html(nb +lib[0])
+            } else {
+                feed_folder.html('0' +lib[0])
+            }
+        }
     } else {
         // on augmente le nombre d'article en haut de page
         var nb = parseInt($('#nbarticle').html()) + 1;
@@ -754,11 +760,17 @@ function addOrRemoveFeedNumber(operator){
         $(feed).text(nb);
         // on augmente le nombre sur le dossier
         var feed_folder = ($(feed).closest('ul').prev('h1').find('.unreadForFolder'));
-        var regex='[0-9]+';
-        var found = feed_folder.html().match(regex);
-        nb = parseInt(found[0])+1;
-        var regex2='[^0-9]+';
-        var lib = feed_folder.html().match(regex2);
-        feed_folder.html(nb +lib[0])
+        if(isNaN(feed_folder.html())) {
+            var regex='[0-9]+';
+            var found = feed_folder.html().match(regex);
+            nb = parseInt(found[0])+1;
+            var regex2='[^0-9]+';
+            var lib = feed_folder.html().match(regex2);
+            if (nb > 0) {
+                feed_folder.html(nb +lib[0])
+            } else {
+                feed_folder.html('0' +lib[0])
+            }
+        }
     }
 }