aboutsummaryrefslogtreecommitdiff
path: root/app/views/javascript
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-04 01:47:07 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-01-04 01:47:07 +0100
commitd7c929e53b889460cd416d2864563e16200d2a01 (patch)
treeb91657455d48fa31aaa9b0bc6d8828db3622db1d /app/views/javascript
parentcf8b3d080942ad682665569250038eda494d346b (diff)
parentc80ab2af7e0f6de4acf6dc02fab208d7b5baff45 (diff)
Merge remote-tracking branch 'origin/dev' into beta
Diffstat (limited to 'app/views/javascript')
-rw-r--r--app/views/javascript/actualize.phtml32
1 files changed, 18 insertions, 14 deletions
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 = [];
<?php foreach ($this->feeds as $feed) { ?>
-feeds.push ("<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>");
+feeds.push("<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>");
<?php } ?>
-function initProgressBar (init) {
+function initProgressBar(init) {
if (init) {
- $("body").after ("\<div id=\"actualizeProgress\" class=\"actualizeProgress\">\
+ $("body").after("\<div id=\"actualizeProgress\" class=\"actualizeProgress\">\
<?php echo Minz_Translate::t ('refresh'); ?> <span class=\"progress\">0 / " + feeds.length + "</span><br />\
<progress id=\"actualizeProgressBar\" value=\"0\" max=\"" + feeds.length + "\"></progress>\
</div>");
} 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);
}
});
}