summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-28 00:54:52 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-10-28 00:54:52 +0200
commitb5c39ef5ef10ca80816260030ef6a3e9a6c59acf (patch)
treee0ac65dfecfdfbda1bdf0e971e4514cbb3d8e6bd
parente0774203b0027dd4fe794140b9057c9a82f44d07 (diff)
nombre de non lus est màj directement en js
-rw-r--r--app/layout/aside.phtml2
-rwxr-xr-xapp/models/RSSConfiguration.php2
-rw-r--r--app/views/javascript/main.phtml34
3 files changed, 36 insertions, 2 deletions
diff --git a/app/layout/aside.phtml b/app/layout/aside.phtml
index 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.php
index 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.phtml
index 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 manipulation
shortcut.add("<?php echo $s['mark_read']; ?>", function () {