diff options
| author | 2013-05-05 13:29:31 +0200 | |
|---|---|---|
| committer | 2013-05-05 13:29:31 +0200 | |
| commit | 51e9a7abe10b312a6887c75c5a9d51812d356cb4 (patch) | |
| tree | 27208483aac8262cdc42ee492a0f222991a0b4fa /app/views/javascript/actualize.phtml | |
| parent | 044908439bdd7280f7539e12441d7dfa6c4d4c63 (diff) | |
| parent | d4e6176a1ae210c011b14839023f91b4014f2881 (diff) | |
Merge branch 'releases' into hotfixes
Diffstat (limited to 'app/views/javascript/actualize.phtml')
| -rw-r--r-- | app/views/javascript/actualize.phtml | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml new file mode 100644 index 000000000..fa6e67ddb --- /dev/null +++ b/app/views/javascript/actualize.phtml @@ -0,0 +1,45 @@ +var feeds = new Array (); +<?php foreach ($this->feeds as $feed) { ?> +feeds.push ("<?php echo Url::display (array ('c' => 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>"); +<?php } ?> + +function initProgressBar (init) { + if (init) { + $("body").after ("\<div id=\"actualizeProgress\" class=\"actualizeProgress\">\ + <?php echo 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 (); + } +} +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; + }); +}); |
