From dff85f9a304a6ff2ede764a8f62024e7b4ff074e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 23 Jun 2013 15:05:39 +0200 Subject: Ajout d'une barre de navigation en version mobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix issue #57 : pas d'effet de slide (effet trop bling-bling) mais ajout d'une barre de navigation permettant d'aller à l'article suivant / précédent ou de remonter en haut de la page --- app/layout/nav_entries.phtml | 5 +++ app/views/helpers/normal_view.phtml | 2 ++ app/views/javascript/main.phtml | 64 ++++++++++++++++++++++-------------- public/theme/freshrss.css | 33 +++++++++++++++++++ public/theme/global.css | 8 +++++ public/theme/icons/next.png | Bin 0 -> 373 bytes public/theme/icons/next.svg | 31 +++++++++++++++++ public/theme/icons/previous.png | Bin 0 -> 395 bytes public/theme/icons/previous.svg | 31 +++++++++++++++++ 9 files changed, 150 insertions(+), 24 deletions(-) create mode 100644 app/layout/nav_entries.phtml create mode 100644 public/theme/icons/next.png create mode 100644 public/theme/icons/next.svg create mode 100644 public/theme/icons/previous.png create mode 100644 public/theme/icons/previous.svg 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 @@ + \ 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 ()) { entryPaginator->render ('pagination.phtml', 'next'); ?> +partial ('nav_entries'); ?> +
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("", 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("", prev_entry, { 'disable_in_input':true }); shortcut.add("shift+", function () { @@ -230,18 +245,7 @@ function init_shortcuts () { }, { 'disable_in_input':true }); - shortcut.add("", 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("", next_entry, { 'disable_in_input':true }); shortcut.add("shift+", 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(); }); diff --git a/public/theme/freshrss.css b/public/theme/freshrss.css index 613a6f037..178472ac9 100644 --- a/public/theme/freshrss.css +++ b/public/theme/freshrss.css @@ -426,6 +426,11 @@ .pagination:last-child .item { border-top: 1px solid #aaa; } + +.nav_entries { + display: none; +} + .loading { background: url("loader.gif") center center no-repeat; font-size: 0; @@ -538,6 +543,9 @@ font-size: 120%; } + .pagination { + margin: 0 0 40px; + } .pagination .pager-previous, .pagination .pager-next { width: 100px; } @@ -574,4 +582,29 @@ .aside .categories { margin: 30px 0; } + + .nav_entries { + display: table; + width: 100%; + height: 40px; + position: fixed; + bottom: 0; + margin: 0; + background: #fff; + border-top: 1px solid #ddd; + text-align: center; + line-height: 40px; + table-layout: fixed; + } + .nav_entries .item { + display: table-cell; + width: 30%; + } + .nav_entries .item a { + display: block; + } + .nav_entries .item .icon.i_up { + margin: 5px 0 0; + vertical-align: top; + } } diff --git a/public/theme/global.css b/public/theme/global.css index 4c504db63..b1fd01436 100644 --- a/public/theme/global.css +++ b/public/theme/global.css @@ -517,6 +517,14 @@ input, select, textarea { background-image: url("icons/up.png"); background-image: url("icons/up.svg"); } + .icon.i_next { + background-image: url("icons/next.png"); + background-image: url("icons/next.svg"); + } + .icon.i_prev { + background-image: url("icons/previous.png"); + background-image: url("icons/previous.svg"); + } .icon.i_help { background-image: url("icons/help.png"); background-image: url("icons/help.svg"); diff --git a/public/theme/icons/next.png b/public/theme/icons/next.png new file mode 100644 index 000000000..ab3490c3b Binary files /dev/null and b/public/theme/icons/next.png differ diff --git a/public/theme/icons/next.svg b/public/theme/icons/next.svg new file mode 100644 index 000000000..72637b4e6 --- /dev/null +++ b/public/theme/icons/next.svg @@ -0,0 +1,31 @@ + + + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + Gnome Symbolic Icon Theme + + + + + + + + + + + + + + diff --git a/public/theme/icons/previous.png b/public/theme/icons/previous.png new file mode 100644 index 000000000..10e40669e Binary files /dev/null and b/public/theme/icons/previous.png differ diff --git a/public/theme/icons/previous.svg b/public/theme/icons/previous.svg new file mode 100644 index 000000000..67685c50c --- /dev/null +++ b/public/theme/icons/previous.svg @@ -0,0 +1,31 @@ + + + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + Gnome Symbolic Icon Theme + + + + + + + + + + + + + + -- cgit v1.2.3