diff --git a/languages/en.lang b/languages/en.lang index 428b696..224c396 100644 --- a/languages/en.lang +++ b/languages/en.lang @@ -25,6 +25,7 @@ map_otm = Open Topo Map map_ign_france = IGN (France) map_ign_spain = IGN (Spain) map_linz = LINZ (New Zealand) +map_usgs = USGS (USA) pic = Picture pics = Pictures @@ -47,4 +48,8 @@ start = Start end = End date_time = $0 at $1 -time_zone = Time zone \ No newline at end of file +time_zone = Time zone + +unit_day = day +unit_days = days +unit_hour = h \ No newline at end of file diff --git a/languages/fr.lang b/languages/fr.lang index d85f154..c0e0217 100644 --- a/languages/fr.lang +++ b/languages/fr.lang @@ -25,6 +25,7 @@ map_otm = Open Topo Map map_ign_france = IGN (France) map_ign_spain = IGN (Espagne) map_linz = LINZ (Nouvelle-Zélande) +map_usgs = USGS (États-Unis) pic = Photo pics = Photos @@ -47,4 +48,8 @@ start = Départ end = Arrivée date_time = $0 à $1 -time_zone = Fuseau horaire \ No newline at end of file +time_zone = Fuseau horaire + +unit_day = jour +unit_days = jours +unit_hour = h \ No newline at end of file diff --git a/masks/project.html b/masks/project.html index 89a808f..5a71656 100644 --- a/masks/project.html +++ b/masks/project.html @@ -213,6 +213,7 @@ function initSpotMessages(aoMessages, aoTracks) { aoLayers[oSpot.lang('map_ign_france')] = L.tileLayer(self.tmp('tile_api'), {id: 'ign.fr', minZoom: 0, maxZoom: 18, tileSize: 256}); aoLayers[oSpot.lang('map_ign_spain')] = L.tileLayer(self.tmp('tile_api'), {id: 'ign.es', minZoom: 1, maxZoom: 20}); aoLayers[oSpot.lang('map_linz')] = L.tileLayer(self.tmp('tile_api'), {id: 'linz', maxZoom: 17, continuousWorld: true, attribution: 'Sourced from LINZ. CC BY 4.0'}); + aoLayers[oSpot.lang('map_usgs')] = L.tileLayer(self.tmp('tile_api'), {id: 'usgs', minZoom: 1, maxZoom: 16}); //Map var oMap = L.map(self.tmp('$Map')[0], { @@ -307,26 +308,34 @@ function initSpotMessages(aoMessages, aoTracks) { var iSpeedCorrecRatio = 0; var iAngle = iElevDelta / iSegDistance; - if(iAngle < -1) iSpeedCorrecRatio = 0.5; - else if(iAngle < -0.2) iSpeedCorrecRatio = 1.25; - else if(iAngle < 0.1) iSpeedCorrecRatio = 1; - else if(iAngle < 0.25) iSpeedCorrecRatio = 0.85; - else if(iAngle < 0.5) iSpeedCorrecRatio = 0.6; - else if(iAngle < 1) iSpeedCorrecRatio = 0.5; - else iSpeedCorrecRatio = 0.25; + if(iAngle < -1) iSpeedCorrecRatio = 0.5; + else if(iAngle < -0.2) iSpeedCorrecRatio = 1.25; + else if(iAngle < 0.1) iSpeedCorrecRatio = 1; + else if(iAngle < 0.25) iSpeedCorrecRatio = 0.85; + else if(iAngle < 0.5) iSpeedCorrecRatio = 0.6; + else if(iAngle < 1) iSpeedCorrecRatio = 0.5; + else iSpeedCorrecRatio = 0.25; iTime += iSegDistance / 1000 * iSpeedCorrecRatio / 3.5 ; //default speed: 3.5km/h } - var iTimeHours = Math.floor(iTime); - var iTimeMinutes = Math.round((iTime - iTimeHours) * 4) * 15; //Approx 15 minutes - if(iTimeMinutes == 60) { - iTimeMinutes = 0; - iTimeHours += 1; + var iTimeHours = 0, iTimeMinutes = 0; + var iTimeDays = Math.floor(iTime/8); //8 hours a day + if(iTimeDays > 1) iTimeDays = Math.round(iTimeDays * 2) / 2; //Round down to the closest half day + else { + iTimeDays = 0; + iTimeHours = Math.floor(iTime); + iTime -= iTimeHours; + + iTimeMinutes = Math.floor(iTime * 4) * 15; //Round down to the closest 15 minutes } - if(iTimeMinutes==0) iTimeMinutes = ''; - + + var sDuration = '~ ' + +(iTimeDays>0?(iTimeDays+(iTimeDays%2==0?'':'½')+' '+oSpot.lang(iTimeDays>1?'unit_days':'unit_day')):'')//Days + +((iTimeHours>0 || iTimeDays==0)?iTimeHours+oSpot.lang('unit_hour'):'') //Hours + +((iTimeDays>0 || iTimeMinutes==0)?'':iTimeMinutes) //Minutes + $('
', {'class':'detail'}).addIcon('fa-distance fa-fw', true).append(Math.round(iDistance/1000)+'km').appendTo($Tooltip); - $('
', {'class':'detail'}).addIcon('fa-time fa-fw', true).append('~ '+iTimeHours+'h'+iTimeMinutes).appendTo($Tooltip); + $('
', {'class':'detail'}).addIcon('fa-time fa-fw', true).append(sDuration).appendTo($Tooltip); $('
', {'class':'detail'}).addIcon('fa-elev-gain fa-fw', true).append(iElevGain+'m').appendTo($Tooltip); $('
', {'class':'detail'}).addIcon('fa-elev-drop fa-fw', true).append(iElevDrop+'m').appendTo($Tooltip); @@ -445,7 +454,7 @@ function updateFeed(bFirstChunk, bDiscrete) { self.tmp('updatable', true); - if(bFirstChunk && $.isEmptyObject(asData)) toggleFeedPanel(false); + if(bFirstChunk) toggleFeedPanel(!$.isEmptyObject(asData)); }, { 'project_id': self.vars(['project', 'id']), 'chunk': self.tmp('news_chunk')