times of notifications didn't update properly

This commit is contained in:
Hannes Mannerheim 2015-12-03 16:19:03 +01:00
parent 7534937fb7
commit 44815db8d0
2 changed files with 11 additions and 4 deletions

View File

@ -1588,7 +1588,7 @@ function addToFeed(feed, after, extraClasses) {
</small>\
</div>\
<div class="small-grey-notice">\
<a data-tooltip="' + parseTwitterLongDate(obj.notice.created_at) + '" href="' + window.siteInstanceURL + 'notice/' + obj.notice.id + '">\
<a data-created-at="' + obj.notice.created_at + '" data-tooltip="' + parseTwitterLongDate(obj.notice.created_at) + '" href="' + window.siteInstanceURL + 'notice/' + obj.notice.id + '">\
' + noticeTime + '\
</a>: \
' + $.trim(obj.notice.statusnet_html) + '\
@ -1617,7 +1617,7 @@ function addToFeed(feed, after, extraClasses) {
</small>\
</div>\
<div class="small-grey-notice">\
<a data-tooltip="' + parseTwitterLongDate(obj.notice.created_at) + '" href="' + window.siteInstanceURL + 'notice/' + obj.notice.id + '">\
<a data-created-at="' + obj.notice.created_at + '" data-tooltip="' + parseTwitterLongDate(obj.notice.created_at) + '" href="' + window.siteInstanceURL + 'notice/' + obj.notice.id + '">\
' + noticeTime + '\
</a>: \
' + $.trim(obj.notice.statusnet_html) + '\

View File

@ -1661,8 +1661,15 @@ $(window).scroll(function() {
· · · · · · · · · · · · · */
var updateTimesInterval=self.setInterval(function(){
$('.created-at').each(function(){
$(this).children('a').html(parseTwitterDate($(this).attr('data-created-at')));
$('[data-created-at]').each(function(){
// if the element with the data-created-at doesn't have an a-child, we change the html of the element
if($(this).children('a').length==0){
$(this).html(parseTwitterDate($(this).attr('data-created-at')));
}
// otherwise the change the child's html
else {
$(this).children('a').html(parseTwitterDate($(this).attr('data-created-at')));
}
});
},10000);