summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-11-07 00:24:50 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2012-11-07 00:24:50 +0100
commit567d19a98934747d0817ad58a008dce7d5df0d92 (patch)
tree71dc846975d00fa8a0ca42d2134588cf37e76bbc /app
parentf3f2bc7471ebb77e6f8adfa5371d055980401bef (diff)
Fix issue #7 : ajout du mode endless
Diffstat (limited to 'app')
-rwxr-xr-xapp/controllers/indexController.php1
-rw-r--r--app/views/index/index.phtml2
-rw-r--r--app/views/javascript/main.phtml13
3 files changed, 13 insertions, 3 deletions
diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php
index c6373cb29..7d878108d 100755
--- a/app/controllers/indexController.php
+++ b/app/controllers/indexController.php
@@ -5,6 +5,7 @@ class indexController extends ActionController {
View::appendScript (Url::display ('/scripts/smoothscroll.js'));
View::appendScript (Url::display ('/scripts/shortcut.js'));
View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'main')));
+ View::appendScript (Url::display ('/scripts/endless_mode.js'));
$entryDAO = new EntryDAO ();
$catDAO = new CategoryDAO ();
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml
index 5e860b8f9..08c3aa721 100644
--- a/app/views/index/index.phtml
+++ b/app/views/index/index.phtml
@@ -14,7 +14,7 @@
<?php $this->entryPaginator->render ('pagination.phtml', 'page'); ?>
<?php foreach ($items as $item) { ?>
- <div class="post flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>">
+ <div class="post flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
<?php $author = $item->author (); ?>
<div class="before">
<?php $feed = $item->feed (true); ?>
diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml
index 82577bd62..e416cad95 100644
--- a/app/views/javascript/main.phtml
+++ b/app/views/javascript/main.phtml
@@ -32,6 +32,11 @@ function slide (new_active, old_active) {
offset: new_active.position ().top + 25
});
}
+
+ // si le dernier post est actif, on charge les suivants
+ if (new_active.attr ("id") == $(".post.flux:last").attr ("id")) {
+ load_more_posts ();
+ }
}
function add_not_read (nb) {
@@ -103,9 +108,9 @@ function mark_favorite (active) {
});
}
-$(document).ready (function () {
+function init_posts () {
if (hide_posts) {
- $(".post.flux .content").slideToggle ();
+ $(".post.flux:not(.active) .content").slideUp ();
}
$(".post.flux").click (function () {
@@ -134,6 +139,10 @@ $(document).ready (function () {
$(".post.flux .content a").click (function () {
$(this).attr ('target', '_blank');
});
+}
+
+$(document).ready (function () {
+ init_posts ();
// Touches de manipulation
shortcut.add("<?php echo $s['mark_read']; ?>", function () {