diff options
| author | 2013-04-17 19:45:16 +0200 | |
|---|---|---|
| committer | 2013-04-17 19:45:16 +0200 | |
| commit | ae7c9787cd8afd4313d356c6525e40d4ce79f99b (patch) | |
| tree | dbac8b756486c5266e914026ef5a679002d0eb85 /app/views/javascript | |
| parent | 044908439bdd7280f7539e12441d7dfa6c4d4c63 (diff) | |
| parent | 23dd73ddeec2473c3e8a3c517317e074ac53a1d8 (diff) | |
Merge branch 'releases'0.2.0
Diffstat (limited to 'app/views/javascript')
| -rw-r--r-- | app/views/javascript/actualize.phtml | 45 | ||||
| -rw-r--r-- | app/views/javascript/main.phtml | 8 |
2 files changed, 49 insertions, 4 deletions
diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml new file mode 100644 index 000000000..16188422a --- /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\">\ + Actualisation <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; + }); +}); diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml index 4f049e11d..e6c882333 100644 --- a/app/views/javascript/main.phtml +++ b/app/views/javascript/main.phtml @@ -26,10 +26,10 @@ function toggleContent (new_active, old_active) { } if (hide_posts) { - old_active.children (".content").toggle (0); + old_active.children (".flux_content").toggle (0); if (old_active[0] != new_active[0]) { - new_active.children (".content").toggle (0, function () { + new_active.children (".flux_content").toggle (0, function () { $("html,body").scrollTop (new_active.position ().top); }); } @@ -110,7 +110,7 @@ function mark_favorite (active) { function init_img () { $(".flux .content img").each (function () { - if ($(this).width () > ($("#stream").width()) / 2) { + if ($(this).width () > ($("#stream .content").width()) / 2) { $(this).addClass("big"); } }); @@ -127,7 +127,7 @@ function init_posts () { init_img (); if (hide_posts) { - $(".flux:not(.active) .content").hide (); + $(".flux:not(.active) .flux_content").hide (); } $(".flux_header .item.title, .flux_header .item.date").click (function () { |
