From 878e96202e8a22e4857b98e29b0a1fce68eccbc9 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 15 Dec 2013 03:30:24 +0100 Subject: Grosse refactorisation pour permettre le chargement automatique des classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C'est parti de changements pour https://github.com/marienfressinaud/FreshRSS/issues/255 et finalement j'ai continué la refactorisation... Ajout de préfixes FreshRSS_ et Minz_ sur le modèle de SimplePie_. Toutes les classes sont maintenant en chargement automatique (devrait améliorer les performances en évitant de charger plein de classes inutilisées, et faciliter la maintenance). Suppression de set_include_path(). Si souhaité, certaines classes de Minz pourraient être déplacées dans un sous-répertoire, par exemple les exceptions. Tests et relecture nécessaires. --- app/views/javascript/actualize.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/views/javascript/actualize.phtml') diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml index f39540a9a..69689133c 100644 --- a/app/views/javascript/actualize.phtml +++ b/app/views/javascript/actualize.phtml @@ -1,12 +1,12 @@ var feeds = new Array (); feeds as $feed) { ?> -feeds.push (" 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>"); +feeds.push (" 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>"); function initProgressBar (init) { if (init) { $("body").after ("\
\ - 0 / " + feeds.length + "
\ + 0 / " + feeds.length + "
\ \
"); } else { -- cgit v1.2.3 From b48b7939d78ffbd35a7efca792e2cb9897e8f160 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 2 Jan 2014 19:08:21 +0100 Subject: JavaScript : Bug actualize quand il n'y a aucun flux + un peu de JSLint. --- app/views/javascript/actualize.phtml | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'app/views/javascript/actualize.phtml') diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml index 69689133c..1f6072c29 100644 --- a/app/views/javascript/actualize.phtml +++ b/app/views/javascript/actualize.phtml @@ -1,37 +1,41 @@ -var feeds = new Array (); +"use strict"; +var feeds = []; feeds as $feed) { ?> -feeds.push (" 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>"); +feeds.push(" 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>"); -function initProgressBar (init) { +function initProgressBar(init) { if (init) { - $("body").after ("\
\ + $("body").after("\
\ 0 / " + feeds.length + "
\ \
"); } else { - window.location.reload (); + window.location.reload(); } } -function updateProgressBar (i) { +function updateProgressBar(i) { $("#actualizeProgressBar").val(i); - $("#actualizeProgress .progress").html (i + " / " + feeds.length); + $("#actualizeProgress .progress").html(i + " / " + feeds.length); } -function updateFeeds () { - initProgressBar (true); +function updateFeeds() { + if (feeds.length === 0) { + return; + } + initProgressBar(true); var i = 0; for (var f in feeds) { - $.ajax ({ + $.ajax({ type: 'POST', url: feeds[f], - }).done (function (data) { + }).done(function (data) { i++; - updateProgressBar (i); + updateProgressBar(i); - if (i == feeds.length) { - initProgressBar (false); + if (i === feeds.length) { + initProgressBar(false); } }); } -- cgit v1.2.3