This commit is contained in:
Hannes Mannerheim 2015-12-10 17:36:28 +01:00
parent 227d15b739
commit 40edfae0a2
2 changed files with 24 additions and 16 deletions

View File

@ -1934,9 +1934,6 @@ function buildQueetHtml(obj, idInStream, extraClasses, requeeted_by, isConversat
});
}
// image attachment thumbnails
var attachmentsBuild = buildAttachmentHTML(obj.attachments);
// requeets get's a context element and a identifying class
// uri used is the repeate-notice's uri for repeats, not the repetED notice's uri (necessary if someone deletes a repeat)
var URItoUse = obj.uri;
@ -1989,7 +1986,7 @@ function buildQueetHtml(obj, idInStream, extraClasses, requeeted_by, isConversat
</small>\
</div>\
<div class="queet-text">' + $.trim(obj.statusnet_html) + '</div>\
<div class="queet-thumbs thumb-num-' + attachmentsBuild.num + '">' + attachmentsBuild.html + '</div>\
' + buildAttachmentHTML(obj.attachments) + '\
<div class="stream-item-footer">\
' + queetActions + '\
</div>\
@ -2019,7 +2016,9 @@ function buildAttachmentHTML(attachments){
var attachmentNum = 0;
if(typeof attachments != "undefined") {
$.each(attachments, function(){
if(typeof this.thumb_url != 'undefined' && this.thumb_url !== null) { // if there's a thumb_url we assume this is a image or video
if(typeof this.thumb_url != 'undefined'
&& this.thumb_url !== null
&& isLocalURL(this.thumb_url)) { // if there's a local thumb_url we assume this is a image or video
var bigThumbW = 1000;
var bigThumbH = 3000;
if(bigThumbW > window.siteMaxThumbnailSize) {
@ -2075,8 +2074,5 @@ function buildAttachmentHTML(attachments){
}
});
}
return {
html: attachment_html,
num: attachmentNum
};
return '<div class="queet-thumbs thumb-num-' + attachmentNum + '">' + attachment_html + '</div>';
}

View File

@ -300,6 +300,22 @@ function localStorageIsEnabled() {
}
/* ·
·
· Is this a local URL?
·
· · · · · · · · · */
function isLocalURL(url) {
if(url.substring(0,window.siteInstanceURL.length) == window.siteInstanceURL) {
return true;
}
else {
return false;
}
}
/* ·
·
· Check for hidden items and show the new queets bar if there are any
@ -812,13 +828,9 @@ function searchForUpdatedNoticeData(obj) {
// attachments might have been added/changed/have had time to be processed
if(streamItemFoundInFeed.attr('data-attachments') != JSON.stringify(obj.attachments)) {
streamItemFoundInFeed.attr('data-attachments',JSON.stringify(obj.attachments));
// we might want to add thumbnails
if(queetFoundInFeed.find('.queet-thumbs').hasClass('thumb-num-0')) {
var attachmentsHTMLBuild = buildAttachmentHTML(obj.attachments);
queetFoundInFeed.find('.queet-thumbs').removeClass('thumb-num-0');
queetFoundInFeed.find('.queet-thumbs').addClass('thumb-num-' + attachmentsHTMLBuild.num);
queetFoundInFeed.find('.queet-thumbs').html(attachmentsHTMLBuild.html);
}
var attachmentsHTMLBuild = buildAttachmentHTML(obj.attachments);
queetFoundInFeed.find('.queet-thumbs').remove();
queetFoundInFeed.find('.stream-item-footer').before(attachmentsHTMLBuild);
}
// set favorite data