fix auto update timer on histo projects

This commit is contained in:
2019-03-11 12:05:17 +01:00
parent 34ad20f572
commit 900619f8e2

View File

@@ -28,6 +28,7 @@ oSpot.onSamePageMove = function(asHash) {
self.tmp('map').remove();
self.tmp('$Map').empty();
self.tmp('map', null);
setFeedUpdateTimer(false);
initProject(asHash.items[0]);
}
return false;
@@ -213,8 +214,8 @@ function initSpotMessages(aoMessages, aoTracks) {
var oElev = L.control.elevation({
collapsed: true,
position: "bottomright",
width: $('#projects').width() - $('#feed').outerWidth(true) - $('.leaflet-bottom.leaflet-left').outerWidth(true) + 4,
height: 125,
width: $('#projects').width() - $('#feed').outerWidth(true) - $('.leaflet-bottom.leaflet-left').outerWidth(true) - 6,
height: 129,
hoverNumber: {
decimalsX: 0, //distance (km)
decimalsY: 0 //elevation (m)
@@ -386,12 +387,12 @@ function updateFeed(bFirstChunk, bDiscrete)
if(bFirstChunk===true) {
self.tmp('news_chunk', 0);
$('#projects').removeClass('with-feed');
if(!bDiscrete) $('#projects').removeClass('with-feed');
}
self.get('feed', function(asData) {
$('#loading').hide();
$('#projects').addClass('with-feed');
if(!bDiscrete) $('#projects').addClass('with-feed');
$.each(asData, function(iKey, asPost){
$Posts.append(getPost(asPost));
@@ -416,7 +417,7 @@ function updateFeed(bFirstChunk, bDiscrete)
function setFeedUpdateTimer(iSeconds, fCallback) {
fCallback = fCallback || function(){updateFeed(true);};
if(typeof self.tmp('update_timer') != 'undefined') clearTimeout(self.tmp('update_timer'));
self.tmp('update_timer', setTimeout(fCallback, iSeconds * 1000));
if(iSeconds > 0) self.tmp('update_timer', setTimeout(fCallback, iSeconds * 1000));
}