Optimize delta callbacks (new feed)

This commit is contained in:
2021-09-05 20:07:09 +02:00
parent 51e0565e67
commit e9f7cae5f9
6 changed files with 25 additions and 22 deletions

View File

@@ -551,13 +551,14 @@ class Spot extends Main
} }
//Sort Table IDs by type & Get attributes //Sort Table IDs by type & Get attributes
$asFeedIds = array('message'=>array(), 'media'=>array(), 'message'=>array());
foreach($asItems as $asItem) { foreach($asItems as $asItem) {
$asFeedIds[$asItem['type']][$asItem['id']] = $asItem; $asFeedIds[$asItem['type']][$asItem['id']] = $asItem;
} }
$asFeedAttrs = array( $asFeedAttrs = array(
'message' => $this->getSpotMessages(array_keys($asFeedIds['message'])), 'message' => empty($asFeedIds['message'])?array():$this->getSpotMessages(array_keys($asFeedIds['message'])),
'media' => $this->getMedias($sMediaRefField, array_keys($asFeedIds['media'])), 'media' => empty($asFeedIds['media'])?array():$this->getMedias($sMediaRefField, array_keys($asFeedIds['media'])),
'post' => $this->getPosts(array_keys($asFeedIds['post'])) 'post' => empty($asFeedIds['post'])?array():$this->getPosts(array_keys($asFeedIds['post']))
); );
//Replace Array Key with Item ID //Replace Array Key with Item ID

View File

@@ -776,6 +776,8 @@ function updateFeed(bFirstChunk, bDiscrete, fCallback) {
function focusOnPost(oFocusPost) { function focusOnPost(oFocusPost) {
if(oFocusPost) { if(oFocusPost) {
if(oFocusPost.type=='message' && (!oSpot.tmp(['markers', oFocusPost.id]) || !oSpot.tmp('map'))) setTimeout(function(){focusOnPost(oFocusPost);}, 100);
else {
var sElemId = '#'+oFocusPost.type+'-'+oFocusPost.id; var sElemId = '#'+oFocusPost.type+'-'+oFocusPost.id;
var $Post = oSpot.tmp('$PostList').find(sElemId); var $Post = oSpot.tmp('$PostList').find(sElemId);
var bGetToTop = (oSpot.tmp('$PostList').height() - (($Post.length > 0)?$Post.position().top:0) >= $(window).height()); var bGetToTop = (oSpot.tmp('$PostList').height() - (($Post.length > 0)?$Post.position().top:0) >= $(window).height());
@@ -795,6 +797,7 @@ function focusOnPost(oFocusPost) {
oSpot.flushHash(['post', 'message']); oSpot.flushHash(['post', 'message']);
} }
} }
}
function getPost(asPost) { function getPost(asPost) {
asPost.headerless = asPost.headerless || false; asPost.headerless = asPost.headerless || false;

View File

@@ -25,4 +25,4 @@
* Add mail frequency slider * Add mail frequency slider
* Use WMTS servers directly when not using Geo Caching Server * Use WMTS servers directly when not using Geo Caching Server
* Allow HEIF picture format * Allow HEIF picture format
* pbf map format (https://www.arcgis.com/home/item.html?id=7dc6cea0b1764a1f9af2e679f642f0f5) * Vector tiles support (https://www.arcgis.com/home/item.html?id=7dc6cea0b1764a1f9af2e679f642f0f5). Use Mapbox GL JS / Maplibre GL JS?

View File

@@ -531,7 +531,6 @@ $legend-color: $post-color;
border-radius: $block-radius; border-radius: $block-radius;
background: $message-bg; background: $message-bg;
color: $message-color; color: $message-color;
font-size: 1.2em;
cursor: pointer; cursor: pointer;
padding: $elem-spacing; padding: $elem-spacing;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long