Media comment embedded in picture

This commit is contained in:
2020-05-17 12:16:36 +02:00
parent 332f3df940
commit 7d9a61cdd4
5 changed files with 115 additions and 62 deletions

View File

@@ -195,8 +195,8 @@ function initProject(sProjectCodeName, oFocusPost){
//Timezone difference notice
var bSameTime = ((new Date()).toLocaleString([], {timeZone: oSpot.consts.timezone}) == (new Date()).toLocaleString([], {timeZone: oSpot.vars(['project', 'timezone'])}));
self.tmp('site_tz_notice', bSameTime?'':' ('+getTimeZoneDesc(oSpot.consts.timezone)+')');
self.tmp('proj_tz_notice', bSameTime?'':' ('+getTimeZoneDesc(self.vars(['project', 'timezone']))+')');
self.tmp('site_tz_notice', bSameTime?'':getTimeZoneDesc(oSpot.consts.timezone));
self.tmp('proj_tz_notice', bSameTime?'':getTimeZoneDesc(self.vars(['project', 'timezone'])));
$.when(
//Markers: Spot Messages & Medias
@@ -572,14 +572,21 @@ function initSpotMessages(aoMessages, aoTracks, bNoFeed) {
.append($('<h1>')
.addIcon('fa-message fa-fw fa-lg')
.append('Message '+oMsg.type+' '+oSpot.lang('counter', oMsg.displayed_id)))
.append($('<p>', {'class':'time'})
.addIcon('fa-time fa-fw fa-lg')
.append(oMsg.formatted_time+(self.vars(['project', 'mode'])==self.consts.modes.blog?' ('+oMsg.relative_time+')':'')+self.tmp('site_tz_notice')))
.append($('<p>', {'class':'coordinates'})
.addIcon('fa-coords fa-fw fa-lg', false)
.append(getGoogleMapsLink(oMsg)));
.append(getGoogleMapsLink(oMsg)))
.append($('<p>', {'class':'time'})
.addIcon('fa-time fa-fw fa-lg')
.append(oMsg.formatted_time+(self.vars(['project', 'mode'])==self.consts.modes.blog?' ('+oMsg.relative_time+')':'')));
//Tooltip medias
//Tooltip: Time Zone
if(self.tmp('site_tz_notice')!='') {
$Tooltip.append($('<p>', {'class':'timezone'})
.addIcon('fa-timezone fa-fw fa-lg')
.append(self.tmp('site_tz_notice')));
}
//Tooltip: Medias
if(oMsg.medias) {
var $Medias = $('<div>', {'class':'medias'});
$.each(oMsg.medias, function(iKey, asMedia) {
@@ -690,7 +697,7 @@ function setFeedUpdateTimer(iSeconds, fCallback) {
function getPost(asPost) {
asPost.headerless = asPost.headerless || false;
var $Post = $('<div>', {'class':'post '+asPost.type+(asPost.headerless?' headerless':'')});
var $Post = $('<div>', {'class':'post-item '+asPost.type+(asPost.headerless?' headerless':'')});
if(asPost.id) $Post.prop('id', asPost.type+'-'+asPost.id);
var sRelTime = (asPost.relative_time!='')?((self.vars('project') && self.vars(['project', 'mode'])==self.consts.modes.histo)?asPost.formatted_time.substr(0, 10):asPost.relative_time):'';
@@ -700,10 +707,11 @@ function getPost(asPost) {
switch(asPost.type) {
case 'message':
$Body = $('<div>')
$Body = $('<div>', {'class':'body-box'})
.data('id', asPost.id_message)
.append($('<p>').addIcon('fa-coords', true).append(getGoogleMapsLink(asPost)))
.append($('<p>').addIcon('fa-time', true).append(sAbsTime+self.tmp('site_tz_notice')))
.append($('<p>').addIcon('fa-time', true).append(sAbsTime))
.append((self.tmp('site_tz_notice')!='')?$('<p>').addIcon('fa-timezone', true).append(self.tmp('site_tz_notice')):'')
.append($('<a>', {'class':'drill'})
.append($('<img>', {'class':'staticmap', title: oSpot.lang('click_zoom'), src: getWmtsApiUrl('static', asPost.latitude, asPost.longitude, 13)}))
.append($('<span>', {'class': 'drill-icon fa-stack'})
@@ -737,8 +745,8 @@ function getPost(asPost) {
);
break;
case 'media':
$Body = $('<div>').append(getMediaLink(asPost, 'post'));
if(asPost.comment) $Body.append($('<p>').text(asPost.comment));
$Body = $('<div>', {'class':'body-box'}).append(getMediaLink(asPost, 'post'));
if(asPost.comment) $Body.find('a.drill').append($('<span>', {'class':'comment'}).text(asPost.comment));
break;
case 'post':
$Body = $('<div>')
@@ -759,7 +767,7 @@ function getPost(asPost) {
$Post
.append($('<div>', {'class':'header'})
.append($('<span>', {'class':'index'}).addIcon('fa-'+sType))
.append($('<span>', {'class':'time'}).hoverSwap(sRelTime, sAbsTime+self.tmp('site_tz_notice'))))
.append($('<span>', {'class':'time'}).hoverSwap(sRelTime, sAbsTime+((self.tmp('site_tz_notice')!='')?' ('+self.tmp('site_tz_notice')+')':''))))
.append($('<div>', {'class':'body'}).append($Body));
if(asPost.displayed_id) $Post.find('.index').append(' '+oSpot.lang('counter', asPost.displayed_id));
@@ -787,7 +795,7 @@ function getMediaLink(asData, sType) {
var $Timezone = (self.tmp('site_tz_notice') == '')?'':
$('<span>', {'class': 'lb-caption-line'})
.addIcon('fa-timezone fa-lg fa-fw', true)
.append(getTimeZoneDesc(oSpot.consts.timezone));
.append(self.tmp('site_tz_notice'));
var $Title = $('<div>').append(sType=='marker'?$TakenOn:$PostedOn).append(sType=='marker'?$PostedOn:$TakenOn).append($Timezone);
var $Link =