A free, self-hostable news aggregator…
nombre de non lus est màj directement en js
Marien Fressinaudb5c39ef5ef10
diff --git a/app/layout/aside.phtml b/app/layout/aside.phtmlindex 36e1bede2..51c64fa08 100644--- a/app/layout/aside.phtml+++ b/app/layout/aside.phtml@@ -7,7 +7,7 @@<ul id="menu"><li <?php echo Request::controllerName () == 'index' ? 'class="active"' : ''; ?>><a href="<?php echo Url::display (array ()); ?>">- Flux RSS <?php if ($this->nb_not_read > 0) { ?><span>(<?php echo $this->nb_not_read; ?> non lu<?php echo $this->nb_not_read > 1 ? 's' : ''; ?>)</span><?php } ?>+ Flux RSS <span class="nb_not_read"><?php if ($this->nb_not_read > 0) { ?>(<?php echo $this->nb_not_read; ?> non lu<?php echo $this->nb_not_read > 1 ? 's' : ''; ?>)<?php } ?></span></a><?php if (isset ($this->cat_aside)) { ?>diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.phpindex 2ca60379a..0d95bec1d 100755--- a/app/models/RSSConfiguration.php+++ b/app/models/RSSConfiguration.php@@ -100,7 +100,7 @@ class RSSConfigurationDAO extends Model_array {public $shortcuts = array ('mark_read' => 'r','mark_favorite' => 'f',- 'go_website' => 'enter',+ 'go_website' => 'space','next_entry' => 'page_down','prev_entry' => 'page_up','next_page' => 'right',diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtmlindex 7d077d93f..c94526885 100644--- a/app/views/javascript/main.phtml+++ b/app/views/javascript/main.phtml@@ -34,6 +34,31 @@ function slide (new_active, old_active) {}}+function add_not_read (nb) {+ span_not_read = $("#main_aside #menu a 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";+ }++ if (nb_not_read > 0) {+ span_not_read.html ("(" + nb_not_read + " non lu" + pluriel + ")");+ } else {+ span_not_read.html ("");+ }+}+function mark_read (active) {if (active[0] === undefined) {return false;@@ -52,9 +77,11 @@ function mark_read (active) {if (active.hasClass ("not_read")) {active.removeClass ("not_read");active.find ("a.read").html ("Marquer comme non lu");+ add_not_read (-1);} else {active.addClass ("not_read");active.find ("a.read").html ("J'ai fini de lire l'article");+ add_not_read (1);}});}@@ -104,6 +131,7 @@ $(document).ready (function () {}});+$(".post.flux a.read").click (function () {active = $(this).parents (".post.flux");mark_read (active);@@ -116,6 +144,12 @@ $(document).ready (function () {return false;});++ $(".post.flux .content a").click (function () {+ url = $(this).attr ("href");+ redirect (url, true);+ return false;+ });// Touches de manipulationshortcut.add("<?php echo $s['mark_read']; ?>", function () {