|
|
@@ -0,0 +1,46 @@
|
|
|
+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\">\
|
|
|
+ Actualisation :\
|
|
|
+ <progress id=\"actualizeProgressBar\" value=\"0\" max=\"" + feeds.length + "\"></progress>\
|
|
|
+ <span class=\"progress\">0 / " + feeds.length + "</span>\
|
|
|
+ </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;
|
|
|
+ });
|
|
|
+});
|