From 9aa8c5f0a101451f5d8f29010d2e1701a51e43ba Mon Sep 17 00:00:00 2001 From: Hannes Mannerheim Date: Wed, 17 Jun 2015 02:16:03 +0200 Subject: [PATCH] small bugfixes --- js/dom-functions.js | 94 +++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 46 deletions(-) diff --git a/js/dom-functions.js b/js/dom-functions.js index 841b9ca..133e8fe 100644 --- a/js/dom-functions.js +++ b/js/dom-functions.js @@ -1139,54 +1139,55 @@ function expand_queet(q,doScrolling) { } // show certain attachments in expanded content - $.each(q.data('attachments'), function() { + if(q.data('attachments') != 'undefined') { + $.each(q.data('attachments'), function() { - var attachment_mimetype = this.mimetype; - var attachment_title = this.url; + var attachment_mimetype = this.mimetype; + var attachment_title = this.url; - // filename extension - var attachment_title_extension = attachment_title.substr((~-attachment_title.lastIndexOf(".") >>> 0) + 2); + // filename extension + var attachment_title_extension = attachment_title.substr((~-attachment_title.lastIndexOf(".") >>> 0) + 2); - // attachments in the content link to /attachment/etc url and not direct to image/video, link is in title - if(typeof attachment_title != 'undefined') { + // attachments in the content link to /attachment/etc url and not direct to image/video, link is in title + if(typeof attachment_title != 'undefined') { - // hack to make remote webm-movies load - if(attachment_title_extension == 'webm') { - attachment_mimetype = 'video/webm'; - } + // hack to make remote webm-movies load + if(attachment_title_extension == 'webm') { + attachment_mimetype = 'video/webm'; + } - // videos - if($.inArray(attachment_mimetype, ['video/mp4', 'video/ogg', 'video/quicktime', 'video/webm']) >=0) { - if(q.children('.queet').find('.expanded-content').children('.media').children('video').children('source[href="' + attachment_title + '"]').length < 1) { // not if already showed + // videos + if($.inArray(attachment_mimetype, ['video/mp4', 'video/ogg', 'video/quicktime', 'video/webm']) >=0) { + if(q.children('.queet').find('.expanded-content').children('.media').children('video').children('source[href="' + attachment_title + '"]').length < 1) { // not if already showed - // local attachment with a thumbnail - var attachment_poster = ''; - if(typeof this.thumb_url != 'undefined') { - attachment_poster = ' poster="' + this.thumb_url + '"'; - } + // local attachment with a thumbnail + var attachment_poster = ''; + if(typeof this.thumb_url != 'undefined') { + attachment_poster = ' poster="' + this.thumb_url + '"'; + } - if(q.children('.queet').find('.expanded-content').children('.media').length > 0) { - q.children('.queet').find('.media').last().after('
'); - } - else { - q.children('.queet').find('.expanded-content').prepend('
'); - } + if(q.children('.queet').find('.expanded-content').children('.media').length > 0) { + q.children('.queet').find('.media').last().after('
'); + } + else { + q.children('.queet').find('.expanded-content').prepend('
'); + } + } } - } - else { - // other plugins, e.g. gotabulo, can check for other attachment file formats to expand - window.currentlyExpanding = { - "attachment_title":attachment_title, - "attachment_mimetype":attachment_mimetype, - "attachment_title_extension":attachment_title_extension, - "streamItem":q, - "thisAttachmentLink":$(this) - }; - $(document).trigger('qvitterExpandOtherAttachments'); + else { + // other plugins, e.g. gotabulo, can check for other attachment file formats to expand + window.currentlyExpanding = { + "attachment_title":attachment_title, + "attachment_mimetype":attachment_mimetype, + "attachment_title_extension":attachment_title_extension, + "streamItem":q, + "thisAttachmentLink":$(this) + }; + $(document).trigger('qvitterExpandOtherAttachments'); + } } - } - }); - + }); + } // get and show favs and repeats getFavsAndRequeetsForQueet(q, qid); @@ -1202,7 +1203,7 @@ function expand_queet(q,doScrolling) { // show inline reply form if logged in if(typeof window.loggedIn.screen_name != 'undefined') { - q.find('#q-' + qid).append(replyFormHtml(q,qid)); + q.children('.queet').append(replyFormHtml(q,qid)); } } @@ -1272,9 +1273,10 @@ function replyFormHtml(q,qid) { var more_reply_tos = ''; var more_reply_tos_text = ''; $.each(q.children('.queet').find('.queet-text').find('.mention'),function(key,obj){ - if($(obj).html() != user_screen_name && $(obj).html() != reply_to_screen_name && $(obj).html() != $('#user-screen-name').html()) { - more_reply_tos = more_reply_tos + ' @' + $(obj).html() + ''; - more_reply_tos_text = more_reply_tos_text + ' @' + $(obj).html(); + var thisMention = $(obj).html().replace('@',''); + if(thisMention != user_screen_name && thisMention != reply_to_screen_name && thisMention != $('#user-screen-name').html()) { + more_reply_tos = more_reply_tos + ' @' + thisMention + ''; + more_reply_tos_text = more_reply_tos_text + ' @' + thisMention; } }); @@ -1409,14 +1411,14 @@ function showConversation(q, qid, data) { if(obj.source == 'activity') { var queetHtml = '
' + $.trim(obj.statusnet_html) + '
'; + + // detect rtl + queetHtml = detectRTL(queetHtml); } else { var queetHtml = buildQueetHtml(obj, obj.id, 'conversation hidden-conversation', false, true); } - // detect rtl - queetHtml = detectRTL(queetHtml); - if(q.hasClass('expanded')) { // add queet to conversation only if still expanded // replace already existing queets' html