aboutsummaryrefslogtreecommitdiff
path: root/public/scripts
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-08-21 19:59:56 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-08-21 19:59:56 +0200
commit48f8401c8b9f22342f319692a5fda5da58cc75ed (patch)
treed6c4fecf6de10747bb23d98e450259798752fe4e /public/scripts
parent695af6e1fe72865eb8cf67d83d592661936a080b (diff)
Fix issue #130 : amélioration vue globale
Désormais, en cliquant sur une catégorie ou un flux, une "popup" s'ouvre nous proposant les flux à lire directement. Les mêmes actions que la vue normale sont alors possibles Cela a impliqué de gros changements javascript en aval puisque les articles n'étaient plus repérés en fonction de la fenêtre, mais en fonction du popup (#panel) Le code va vraiment devoir être repris pour avoir une architecture logique (voir issue #121)
Diffstat (limited to 'public/scripts')
-rw-r--r--public/scripts/endless_mode.js14
-rw-r--r--public/scripts/global_view.js48
2 files changed, 56 insertions, 6 deletions
diff --git a/public/scripts/endless_mode.js b/public/scripts/endless_mode.js
index 6b3ef41d5..713247428 100644
--- a/public/scripts/endless_mode.js
+++ b/public/scripts/endless_mode.js
@@ -1,9 +1,11 @@
var url_load_more = "";
var load_more = false;
+var container = null;
-function init_load_more() {
+function init_load_more(block) {
url_load_more = $("a#load_more").attr("href");
-
+ container = block;
+
$("#load_more").click (function () {
load_more_posts ();
@@ -19,10 +21,10 @@ function load_more_posts () {
load_more = true;
$("#load_more").addClass("loading");
$.get (url_load_more, function (data) {
- $("#stream .flux:last").after($("#stream .flux", data));
+ container.children(".flux:last").after($("#stream .flux", data));
$(".pagination").html($(".pagination", data).html());
-
- init_load_more();
+
+ init_load_more(container);
init_posts();
$("#load_more").removeClass("loading");
@@ -31,5 +33,5 @@ function load_more_posts () {
}
$(document).ready (function () {
- init_load_more();
+ init_load_more($("#stream"));
}); \ No newline at end of file
diff --git a/public/scripts/global_view.js b/public/scripts/global_view.js
new file mode 100644
index 000000000..b23e6680c
--- /dev/null
+++ b/public/scripts/global_view.js
@@ -0,0 +1,48 @@
+var panel_loading = false;
+
+function load_panel(link) {
+ if(panel_loading) {
+ return;
+ }
+
+ panel_loading = true;
+
+ $.get (link, function (data) {
+ $("#panel").append($(".nav_menu, #stream .day, #stream .flux, #stream .pagination", data));
+
+ $("#panel .nav_menu").children().not("#nav_menu_read_all").remove();
+
+ init_load_more($("#panel"));
+ init_posts();
+
+ $("#panel").slideToggle();
+
+ panel_loading = false;
+ });
+}
+
+function init_close_panel() {
+ $("#panel .close").click(function() {
+ $("#panel").html('<a class="close" href="#"><i class="icon i_close"></i></a>');
+ init_close_panel();
+ $("#panel").slideToggle();
+ });
+}
+
+function init_global_view() {
+ $("#stream .category a").click(function() {
+ var link = $(this).attr("href");
+
+ load_panel(link);
+
+ return false;
+ });
+
+ $(".nav_menu #nav_menu_read_all, .nav_menu .toggle_aside").remove();
+}
+
+
+$(document).ready (function () {
+ init_global_view();
+ init_close_panel();
+}); \ No newline at end of file