|
|
@ -379,13 +379,25 @@ function reTwistPopup(e) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
openModal({ |
|
|
|
var modal = openModal({ |
|
|
|
classBase: '.prompt-wrapper', |
|
|
|
classBase: '.prompt-wrapper', |
|
|
|
classAdd: 'reTwist', |
|
|
|
classAdd: 'reTwist', |
|
|
|
title: polyglot.t('retransmit_this') |
|
|
|
title: polyglot.t('retransmit_this') |
|
|
|
}) |
|
|
|
}); |
|
|
|
.content |
|
|
|
|
|
|
|
.append(postToElem($.evalJSON($(this).parents('.post-data').attr('data-userpost')), '')); |
|
|
|
modal.content |
|
|
|
|
|
|
|
.append(postToElem($.evalJSON($(this).parents('.post-data').attr('data-userpost')), '')) |
|
|
|
|
|
|
|
.append($('#reply-modal-template').children().clone(true)) // FIXME retwist-reply-modal-template
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var replyArea = modal.content.find('.post-area .post-area-new'); |
|
|
|
|
|
|
|
var textArea = replyArea.find('textarea'); |
|
|
|
|
|
|
|
var textAreaPostInline = modal.content.find('.post .post-area-new textarea'); |
|
|
|
|
|
|
|
$.each(['placeholder', 'data-reply-to'], function(i, attribute) { |
|
|
|
|
|
|
|
textArea.attr(attribute, textAreaPostInline.attr(attribute)); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
replyArea.find('.post-submit').addClass('with-reference'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Expande Área do Novo post
|
|
|
|
// Expande Área do Novo post
|
|
|
@ -399,16 +411,16 @@ function replyInitPopup(e, post) { |
|
|
|
getFullname(post.userpost.n, modal.self.find('h3 .fullname')); |
|
|
|
getFullname(post.userpost.n, modal.self.find('h3 .fullname')); |
|
|
|
|
|
|
|
|
|
|
|
modal.content |
|
|
|
modal.content |
|
|
|
.append($('#reply-modal-template').children().clone(true)) |
|
|
|
|
|
|
|
.append(postToElem(post, '')) |
|
|
|
.append(postToElem(post, '')) |
|
|
|
|
|
|
|
.append($('#reply-modal-template').children().clone(true)) |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
// FIXME passing data through attributes may result in a mess like following
|
|
|
|
// FIXME passing data through attributes may result in a mess like following
|
|
|
|
var replyArea = modal.content.find('.post-area .post-area-new').addClass('open'); |
|
|
|
var replyArea = modal.content.find('.post-area .post-area-new').addClass('open'); |
|
|
|
var replyText = replyArea.find('textarea'); |
|
|
|
var textArea = replyArea.find('textarea'); |
|
|
|
var postInlineReplyText = modal.content.find('.post .post-area-new textarea'); |
|
|
|
var textAreaPostInline = modal.content.find('.post .post-area-new textarea'); |
|
|
|
$.each(['placeholder', 'data-reply-to'], function(i, attribute) { |
|
|
|
$.each(['placeholder', 'data-reply-to'], function(i, attribute) { |
|
|
|
replyText.attr(attribute, postInlineReplyText.attr(attribute)); |
|
|
|
textArea.attr(attribute, textAreaPostInline.attr(attribute)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
composeNewPost(e, replyArea); |
|
|
|
composeNewPost(e, replyArea); |
|
|
@ -1202,82 +1214,95 @@ function undoLastUnicode(e) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function postSubmit(e, oldLastPostId) { |
|
|
|
function postSubmit(e, oldLastPostId) { |
|
|
|
|
|
|
|
var btnPostSubmit; |
|
|
|
|
|
|
|
|
|
|
|
if (e instanceof $) { |
|
|
|
if (e instanceof $) { |
|
|
|
var $this = e; |
|
|
|
btnPostSubmit = e; |
|
|
|
//check if previous part was sent...
|
|
|
|
//check if previous part was sent...
|
|
|
|
if (oldLastPostId === lastPostId) { |
|
|
|
if (oldLastPostId === lastPostId) { |
|
|
|
setTimeout(postSubmit, 1000, $this, oldLastPostId); |
|
|
|
setTimeout(postSubmit, 1000, btnPostSubmit, oldLastPostId); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
e.stopPropagation(); |
|
|
|
e.stopPropagation(); |
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
var $this = $(this); |
|
|
|
btnPostSubmit = $(this); |
|
|
|
} |
|
|
|
} |
|
|
|
$.MAL.disableButton($this); |
|
|
|
$.MAL.disableButton(btnPostSubmit); |
|
|
|
|
|
|
|
|
|
|
|
var $replyText = $this.closest('.post-area-new').find('textarea'); |
|
|
|
var textArea = btnPostSubmit.closest('.post-area-new').find('textarea'); |
|
|
|
|
|
|
|
|
|
|
|
$replyText.siblings('#post-preview').hide(); |
|
|
|
textArea.siblings('#post-preview').hide(); |
|
|
|
|
|
|
|
|
|
|
|
var $postOrig = $this.closest('.post-data'); |
|
|
|
var postData = btnPostSubmit.closest('.post-data'); |
|
|
|
if (!$postOrig.length) { |
|
|
|
if (!postData.length) { |
|
|
|
$postOrig = $this.closest('.modal-content').find('.post-data'); |
|
|
|
postData = btnPostSubmit.closest('.modal-content').find('.post-data'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (btnPostSubmit.hasClass('with-reference')) { |
|
|
|
|
|
|
|
function doSubmitPost(postText, postData) { |
|
|
|
|
|
|
|
newRtMsg(postData, postText); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
if (splitedPostsCount > 1) { |
|
|
|
if (splitedPostsCount > 1) { |
|
|
|
if ($replyText.length < splitedPostsCount) { |
|
|
|
if (textArea.length < splitedPostsCount) { |
|
|
|
//current part will be sent as reply to the previous part...
|
|
|
|
//current part will be sent as reply to the previous part...
|
|
|
|
$postOrig = $('<div data-id="' + lastPostId + '" data-screen-name="' + defaultScreenName + '"></div>'); |
|
|
|
postData = $('<div data-id="' + lastPostId + '" data-screen-name="' + defaultScreenName + '"></div>'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($replyText.length <= 1) { |
|
|
|
function doSubmitPost(postText, postData) { |
|
|
|
|
|
|
|
newPostMsg(postText, postData); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (textArea.length <= 1) { |
|
|
|
if (splitedPostsCount > 1) { |
|
|
|
if (splitedPostsCount > 1) { |
|
|
|
var postxt = ''; |
|
|
|
var postText = ''; |
|
|
|
var reply_to = $replyText.attr('data-reply-to'); |
|
|
|
var reply_to = textArea.attr('data-reply-to'); |
|
|
|
var val = $replyText.val(); |
|
|
|
var val = textArea.val(); |
|
|
|
if (typeof reply_to === 'undefined' || checkPostForMentions(val, reply_to, 140)) |
|
|
|
if (typeof reply_to === 'undefined' || checkPostForMentions(val, reply_to, 140)) |
|
|
|
postxt = val + ' (' + splitedPostsCount.toString() + '/' + splitedPostsCount.toString() + ')'; |
|
|
|
postText = val + ' (' + splitedPostsCount.toString() + '/' + splitedPostsCount.toString() + ')'; |
|
|
|
else |
|
|
|
else |
|
|
|
postxt = reply_to + val + ' (' + splitedPostsCount.toString() + '/' + splitedPostsCount.toString() + ')'; |
|
|
|
postText = reply_to + val + ' (' + splitedPostsCount.toString() + '/' + splitedPostsCount.toString() + ')'; |
|
|
|
|
|
|
|
|
|
|
|
newPostMsg(postxt, $postOrig); |
|
|
|
doSubmitPost(postText, postData); |
|
|
|
} else |
|
|
|
} else |
|
|
|
newPostMsg($replyText.val(), $postOrig); |
|
|
|
doSubmitPost(textArea.val(), postData); |
|
|
|
|
|
|
|
|
|
|
|
splitedPostsCount = 1; |
|
|
|
splitedPostsCount = 1; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var postxt = ''; |
|
|
|
var postText = ''; |
|
|
|
var reply_to = $replyText.attr('data-reply-to'); |
|
|
|
var reply_to = textArea.attr('data-reply-to'); |
|
|
|
var val = $replyText[0].value; |
|
|
|
var val = textArea[0].value; |
|
|
|
if (typeof reply_to === 'undefined' || checkPostForMentions(val, reply_to, 140)) |
|
|
|
if (typeof reply_to === 'undefined' || checkPostForMentions(val, reply_to, 140)) |
|
|
|
postxt = val + ' (' + (splitedPostsCount - $replyText.length + 1).toString() + '/' + splitedPostsCount.toString() + ')'; |
|
|
|
postText = val + ' (' + (splitedPostsCount - textArea.length + 1).toString() + '/' + splitedPostsCount.toString() + ')'; |
|
|
|
else |
|
|
|
else |
|
|
|
postxt = reply_to + val + ' (' + (splitedPostsCount - $replyText.length + 1).toString() + '/' + splitedPostsCount.toString() + ')'; |
|
|
|
postText = reply_to + val + ' (' + (splitedPostsCount - textArea.length + 1).toString() + '/' + splitedPostsCount.toString() + ')'; |
|
|
|
|
|
|
|
|
|
|
|
$($replyText[0]).remove(); |
|
|
|
$(textArea[0]).remove(); |
|
|
|
|
|
|
|
|
|
|
|
oldLastPostId = lastPostId; |
|
|
|
oldLastPostId = lastPostId; |
|
|
|
newPostMsg(postxt, $postOrig); |
|
|
|
doSubmitPost(postText, postData); |
|
|
|
setTimeout(postSubmit, 1000, $this, oldLastPostId); |
|
|
|
setTimeout(postSubmit, 1000, btnPostSubmit, oldLastPostId); |
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$replyText.val('').attr('placeholder', polyglot.t('Your message was sent!')); |
|
|
|
if (btnPostSubmit.parents('.prompt-wrapper').length) |
|
|
|
var tweetForm = $this.parents('form'); |
|
|
|
closeModalHandler('.prompt-wrapper'); |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
textArea.val('').attr('placeholder', polyglot.t('Your message was sent!')); |
|
|
|
|
|
|
|
var tweetForm = btnPostSubmit.parents('form'); |
|
|
|
var remainingCount = tweetForm.find('.post-area-remaining'); |
|
|
|
var remainingCount = tweetForm.find('.post-area-remaining'); |
|
|
|
remainingCount.text(140); |
|
|
|
remainingCount.text(140); |
|
|
|
|
|
|
|
|
|
|
|
if ($this.parents('.prompt-wrapper').length) |
|
|
|
if (btnPostSubmit.closest('.post-area,.post-reply-content')) { |
|
|
|
closeModalHandler('.prompt-wrapper'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($this.closest('.post-area,.post-reply-content')) { |
|
|
|
|
|
|
|
$('.post-area-new').removeClass('open').find('textarea').blur(); |
|
|
|
$('.post-area-new').removeClass('open').find('textarea').blur(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
$replyText.data('unicodeConversionStack', []); |
|
|
|
textArea.data('unicodeConversionStack', []); |
|
|
|
$replyText.data('disabledUnicodeRules', []); |
|
|
|
textArea.data('disabledUnicodeRules', []); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function retweetSubmit(e) { |
|
|
|
function retweetSubmit(e) { |
|
|
|