From 0f2891f4325d6f88845790393d006883831118fd Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 30 Oct 2012 22:30:40 +0100 Subject: Fix issue #8 : ajoute le nombre de non lus pour les catégories (mérite amélioration ?) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/javascript/main.phtml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'app/views/javascript') diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml index 9283c89cb..710b04988 100644 --- a/app/views/javascript/main.phtml +++ b/app/views/javascript/main.phtml @@ -35,28 +35,14 @@ function slide (new_active, old_active) { } function add_not_read (nb) { - span_not_read = $("#main_aside #menu a span.nb_not_read"); + span_not_read = $("#categories li.all span.nb_not_read"); html = span_not_read.html (); - if (html == "" && nb > 0) { - nb_not_read = nb; - } else if (html != "") { - regex = /\((\d+) non lus?\)/; - nb_not_read = parseInt (regex.exec (html)[1]) + nb; - } else { - nb_not_read = 0; - } - pluriel = ""; - if (nb_not_read > 1) { - pluriel = "s"; - } + regex = /(\d+)/; + nb_not_read = parseInt (regex.exec (html)[1]) + nb; - if (nb_not_read > 0) { - span_not_read.html ("(" + nb_not_read + " non lu" + pluriel + ")"); - } else { - span_not_read.html (""); - } + span_not_read.html (nb_not_read); } function mark_read (active) { -- cgit v1.2.3