瀏覽代碼

Fix issue #208: chargement dynamique des jours

Les indications de jours (aujourd'hui, hier, à partir d'avant-hier) sont
maintenant chargés dynamiquement
Marien Fressinaud 12 年之前
父節點
當前提交
1b9f16771c
共有 2 個文件被更改,包括 9 次插入4 次删除
  1. 3 3
      app/views/helpers/view/normal_view.phtml
  2. 6 1
      public/scripts/main.js

+ 3 - 3
app/views/helpers/view/normal_view.phtml

@@ -16,21 +16,21 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
 	<?php foreach ($items as $item) { ?>
 
 	<?php if ($display_today && $item->isDay (Days::TODAY)) { ?>
-	<div class="day">
+	<div class="day" id="day_today">
 		<?php echo Translate::t ('today'); ?>
 		<span class="date"> - <?php echo timestamptodate (time (), false); ?></span>
 		<span class="name"><?php echo $this->currentName; ?></span>
 	</div>
 	<?php $display_today = false; } ?>
 	<?php if ($display_yesterday && $item->isDay (Days::YESTERDAY)) { ?>
-	<div class="day">
+	<div class="day" id="day_yesterday">
 		<?php echo Translate::t ('yesterday'); ?>
 		<span class="date"> - <?php echo timestamptodate (time () - 86400, false); ?></span>
 		<span class="name"><?php echo $this->currentName; ?></span>
 	</div>
 	<?php $display_yesterday = false; } ?>
 	<?php if ($display_others && $item->isDay (Days::BEFORE_YESTERDAY)) { ?>
-	<div class="day">
+	<div class="day" id="day_before_yesterday">
 		<?php echo Translate::t ('before_yesterday'); ?>
 		<span class="name"><?php echo $this->currentName; ?></span>
 	</div>

+ 6 - 1
public/scripts/main.js

@@ -477,9 +477,14 @@ function load_more_posts() {
 	load_more = true;
 	$('#load_more').addClass('loading');
 	$.get(url_load_more, function (data) {
-		$stream.children('.flux:last').after($('#stream', data).children('.flux'));
+		$stream.children('.flux:last').after($('#stream', data).children('.flux, .day'));
 		$('.pagination').replaceWith($('.pagination', data));
 
+		$('[id^=day_]').each(function (i) {
+			var ids = $('[id="' + this.id + '"]');
+			if (ids.length > 1) $('[id="' + this.id + '"]:gt(0)').remove();
+		});
+
 		init_load_more();
 		init_lazyload();