diff options
Diffstat (limited to 'app/views/javascript')
| -rw-r--r-- | app/views/javascript/actualize.phtml | 34 | ||||
| -rw-r--r-- | app/views/javascript/nbUnreadsPerFeed.phtml | 8 | ||||
| -rw-r--r-- | app/views/javascript/nonce.phtml | 2 |
3 files changed, 29 insertions, 15 deletions
diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml index f39540a9a..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 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\">\ - <?php echo Translate::t ('refresh'); ?> <span class=\"progress\">0 / " + feeds.length + "</span><br />\ + $("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); } }); } diff --git a/app/views/javascript/nbUnreadsPerFeed.phtml b/app/views/javascript/nbUnreadsPerFeed.phtml new file mode 100644 index 000000000..68f98ce9e --- /dev/null +++ b/app/views/javascript/nbUnreadsPerFeed.phtml @@ -0,0 +1,8 @@ +<?php +$result = array(); +foreach ($this->categories as $cat) { + foreach ($cat->feeds() as $feed) { + $result[$feed->id()] = $feed->nbNotRead(); + } +} +echo json_encode($result); diff --git a/app/views/javascript/nonce.phtml b/app/views/javascript/nonce.phtml new file mode 100644 index 000000000..4ac46c8fc --- /dev/null +++ b/app/views/javascript/nonce.phtml @@ -0,0 +1,2 @@ +<?php +echo json_encode(array('salt1' => $this->salt1, 'nonce' => $this->nonce)); |
