diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/layout/nav_entries.phtml | 5 | ||||
| -rw-r--r-- | app/views/helpers/normal_view.phtml | 2 | ||||
| -rw-r--r-- | app/views/javascript/main.phtml | 64 |
3 files changed, 47 insertions, 24 deletions
diff --git a/app/layout/nav_entries.phtml b/app/layout/nav_entries.phtml new file mode 100644 index 000000000..101e7443e --- /dev/null +++ b/app/layout/nav_entries.phtml @@ -0,0 +1,5 @@ +<ul class="nav_entries"> + <li class="item"><a class="previous_entry" href="#"><i class="icon i_prev"></i></a></li> + <li class="item"><a href="#"><i class="icon i_up"></i></a></li> + <li class="item"><a class="next_entry" href="#"><i class="icon i_next"></i></a></li> +</ul>
\ No newline at end of file diff --git a/app/views/helpers/normal_view.phtml b/app/views/helpers/normal_view.phtml index 2ca365552..eaf1e4276 100644 --- a/app/views/helpers/normal_view.phtml +++ b/app/views/helpers/normal_view.phtml @@ -107,6 +107,8 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { <?php $this->entryPaginator->render ('pagination.phtml', 'next'); ?> </div> +<?php $this->partial ('nav_entries'); ?> + <?php } else { ?> <div class="alert alert-warn"> <span class="alert-head"><?php echo Translate::t ('no_feed_to_display'); ?></span> diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml index e290e02d3..e51cf978e 100644 --- a/app/views/javascript/main.phtml +++ b/app/views/javascript/main.phtml @@ -105,6 +105,32 @@ function mark_favorite (active) { }); } +function prev_entry() { + old_active = $(".flux.active"); + last_active = $(".flux:last"); + new_active = old_active.prevAll (".flux:first"); + + if (new_active.hasClass("flux")) { + toggleContent (new_active, old_active); + } else if (old_active[0] === undefined && + new_active[0] === undefined) { + toggleContent (last_active, old_active); + } +} + +function next_entry() { + old_active = $(".flux.active"); + first_active = $(".flux:first"); + new_active = old_active.nextAll (".flux:first"); + + if (new_active.hasClass("flux")) { + toggleContent (new_active, old_active); + } else if (old_active[0] === undefined && + new_active[0] === undefined) { + toggleContent (first_active, old_active); + } +} + function init_img () { $(".flux_content .content img").each (function () { if ($(this).width () > ($(".flux_content .content").width()) / 2) { @@ -206,18 +232,7 @@ function init_shortcuts () { }); // Touches de navigation - shortcut.add("<?php echo $s['prev_entry']; ?>", function () { - old_active = $(".flux.active"); - last_active = $(".flux:last"); - new_active = old_active.prevAll (".flux:first"); - - if (new_active.hasClass("flux")) { - toggleContent (new_active, old_active); - } else if (old_active[0] === undefined && - new_active[0] === undefined) { - toggleContent (last_active, old_active); - } - }, { + shortcut.add("<?php echo $s['prev_entry']; ?>", prev_entry, { 'disable_in_input':true }); shortcut.add("shift+<?php echo $s['prev_entry']; ?>", function () { @@ -230,18 +245,7 @@ function init_shortcuts () { }, { 'disable_in_input':true }); - shortcut.add("<?php echo $s['next_entry']; ?>", function () { - old_active = $(".flux.active"); - first_active = $(".flux:first"); - new_active = old_active.nextAll (".flux:first"); - - if (new_active.hasClass("flux")) { - toggleContent (new_active, old_active); - } else if (old_active[0] === undefined && - new_active[0] === undefined) { - toggleContent (first_active, old_active); - } - }, { + shortcut.add("<?php echo $s['next_entry']; ?>", next_entry, { 'disable_in_input':true }); shortcut.add("shift+<?php echo $s['next_entry']; ?>", function () { @@ -281,6 +285,17 @@ function init_shortcuts () { }); } +function init_nav_entries() { + $('.nav_entries a.previous_entry').click(function() { + prev_entry(); + return false; + }); + $('.nav_entries a.next_entry').click(function() { + next_entry(); + return false; + }); +} + $(document).ready (function () { if(is_reader_mode()) { hide_posts = false; @@ -288,4 +303,5 @@ $(document).ready (function () { init_posts (); init_column_categories (); init_shortcuts (); + init_nav_entries(); }); |
