AntonLV 6 лет назад
Родитель
Сommit
5f2006804c

+ 3 - 2
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -331,14 +331,15 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
     function actionGetPosts()
     {
         $aParams = $this->_prepareParamsGet();
-        list($sItems, $sLoadMore, $sBack, $sEmpty) = $this->_oTemplate->getPosts($aParams);
+        list($sItems, $sLoadMore, $sBack, $sEmpty, $iEvent, $bEventsToLoad) = $this->_oTemplate->getPosts($aParams);
 
         echoJson(array(
             'view' => $aParams['view'],
-            'items' => $sItems, 
+            'items' => $sItems,
             'load_more' => $sLoadMore, 
             'back' => $sBack,
             'empty' => $sEmpty,
+            'events_to_load' => $bEventsToLoad,
             'eval' => $this->_oConfig->getJsObjectView($aParams) . "._onGetPosts(oData)"
         ));
     }

+ 2 - 1
modules/boonex/timeline/js/view.js

@@ -186,7 +186,7 @@ BxTimelineView.prototype.initInfiniteScroll = function(oParent)
         return;
 
     $(window).bind('scroll', function(oEvent) {
-        if($this._bInfScrollBusy || $this._iInfScrollPreloads >= $this._iInfScrollAutoPreloads)
+        if(!$this._bEventsToLoad || $this._bInfScrollBusy || $this._iInfScrollPreloads >= $this._iInfScrollAutoPreloads)
             return;
 
         var iScrollTop = parseInt($(window).scrollTop());
@@ -209,6 +209,7 @@ BxTimelineView.prototype.initInfiniteScroll = function(oParent)
 
         $this._bInfScrollBusy = true;
         $this._getPage(undefined, $this._oRequestParams.start + $this._oRequestParams.per_page, $this._oRequestParams.per_page, function(oData) {
+            $this._bEventsToLoad = oData.events_to_load;
             $this._iInfScrollPreloads += 1;
             $this._bInfScrollBusy = false;
         });