actualize.phtml 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. var feeds = new Array ();
  2. <?php foreach ($this->feeds as $feed) { ?>
  3. feeds.push ("<?php echo Url::display (array ('c' => 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>");
  4. <?php } ?>
  5. function initProgressBar (init) {
  6. if (init) {
  7. $("body").after ("\<div id=\"actualizeProgress\" class=\"actualizeProgress\">\
  8. <?php echo Translate::t ('refresh'); ?> <span class=\"progress\">0 / " + feeds.length + "</span><br />\
  9. <progress id=\"actualizeProgressBar\" value=\"0\" max=\"" + feeds.length + "\"></progress>\
  10. </div>");
  11. } else {
  12. window.location.reload ();
  13. }
  14. }
  15. function updateProgressBar (i) {
  16. $("#actualizeProgressBar").val(i);
  17. $("#actualizeProgress .progress").html (i + " / " + feeds.length);
  18. }
  19. function updateFeeds () {
  20. initProgressBar (true);
  21. var i = 0;
  22. for (var f in feeds) {
  23. $.ajax ({
  24. type: 'POST',
  25. url: feeds[f],
  26. }).done (function (data) {
  27. i++;
  28. updateProgressBar (i);
  29. if (i == feeds.length) {
  30. initProgressBar (false);
  31. }
  32. });
  33. }
  34. }