From 9b9543109e36a5409fe71eb084cfac680dfc7cbd Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 13 Apr 2013 15:27:36 +0200 Subject: Fix issue #39 : actualisation de tous les flux grâce à Ajax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/javascript/actualize.phtml | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 app/views/javascript/actualize.phtml (limited to 'app/views/javascript/actualize.phtml') diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml new file mode 100644 index 000000000..ad1c4e2e6 --- /dev/null +++ b/app/views/javascript/actualize.phtml @@ -0,0 +1,46 @@ +var feeds = new Array (); +feeds as $feed) { ?> +feeds.push (" 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>"); + + +function initProgressBar (init) { + if (init) { + $("body").after ("\
\ + Actualisation :\ + \ + 0 / " + feeds.length + "\ +
"); + } else { + window.location.reload (); + } +} +function updateProgressBar (i) { + $("#actualizeProgressBar").val(i); + $("#actualizeProgress .progress").html (i + " / " + feeds.length); +} + +function updateFeeds () { + initProgressBar (true); + + var i = 0; + for (var f in feeds) { + $.ajax ({ + type: 'POST', + url: feeds[f], + }).done (function (data) { + i++; + updateProgressBar (i); + + if (i == feeds.length) { + initProgressBar (false); + } + }); + } +} + +$(document).ready (function () { + $("#actualize").click (function () { + updateFeeds (); + return false; + }); +}); -- cgit v1.2.3 From 5768d0fc7fe7e29491b788b08096ca1435b82aeb Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 14 Apr 2013 19:40:29 +0200 Subject: Amélioration esthétique pour l'actualisation des flux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/javascript/actualize.phtml | 3 +-- public/theme/freshrss.css | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'app/views/javascript/actualize.phtml') diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml index ad1c4e2e6..16188422a 100644 --- a/app/views/javascript/actualize.phtml +++ b/app/views/javascript/actualize.phtml @@ -6,9 +6,8 @@ feeds.push (" 'feed', 'a' => 'actualize', function initProgressBar (init) { if (init) { $("body").after ("\
\ - Actualisation :\ + Actualisation 0 / " + feeds.length + "
\ \ - 0 / " + feeds.length + "\
"); } else { window.location.reload (); diff --git a/public/theme/freshrss.css b/public/theme/freshrss.css index f64770b81..ed6646269 100644 --- a/public/theme/freshrss.css +++ b/public/theme/freshrss.css @@ -383,8 +383,8 @@ .actualizeProgress { position: fixed; - top: 0; left: 33%; right: 33%; - width: 33%; + top: 0; left: 25%; right: 25%; + width: 50%; padding: 5px; background: #fff; text-align: center; @@ -393,6 +393,7 @@ border-radius: 0 0 5px 5px; } .actualizeProgress progress { + max-width: 100%; vertical-align: middle; } .actualizeProgress .progress { -- cgit v1.2.3