Browse Source

add `click to post citation to open related conversation`

master
Simon Grim 9 years ago
parent
commit
7a6669d926
  1. 5
      js/interface_common.js
  2. 9
      js/twister_formatpost.js

5
js/interface_common.js

@ -293,7 +293,7 @@ function openConversationClick(e) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
var postData = $(this).parents('.module.post.original.open .module.post.original .post-data'); var postData = $(this).closest(e.data.feeder);
window.location.hash = '#conversation?post=' + postData.attr('data-screen-name') + window.location.hash = '#conversation?post=' + postData.attr('data-screen-name') +
':post' + postData.attr('data-id'); ':post' + postData.attr('data-id');
@ -1427,7 +1427,8 @@ function initInterfaceCommon() {
; ;
$('.post-submit').on('click', postSubmit); $('.post-submit').on('click', postSubmit);
$('.modal-propagate').on('click', retweetSubmit); $('.modal-propagate').on('click', retweetSubmit);
$('.expanded-content .show-more').on('click', openConversationClick); $('.expanded-content .show-more').on('click',
{feeder: '.module.post.original.open .module.post.original .post-data'}, openConversationClick);
if ($.Options.unicodeConversion.val === 'disable') if ($.Options.unicodeConversion.val === 'disable')
$('.undo-unicode').on('click', undoLastUnicode).css('display', 'none'); $('.undo-unicode').on('click', undoLastUnicode).css('display', 'none');

9
js/twister_formatpost.js

@ -12,6 +12,8 @@ var _htmlFormatMsgLinkTemplateHashtag;
$(document).ready(function() { $(document).ready(function() {
// we're setting it here for perfomance improvement purpose // to not search and prepare it for for every post every time // we're setting it here for perfomance improvement purpose // to not search and prepare it for for every post every time
_templatePostRtReference = $('#post-rt-reference-template').children().clone(true); _templatePostRtReference = $('#post-rt-reference-template').children().clone(true);
_templatePostRtReference.find('.post-text')
.on('click', {feeder: '.post-rt-reference'}, openConversationClick);
_templatePostRtBy = $('#post-retransmited-by-template').children().clone(true); _templatePostRtBy = $('#post-retransmited-by-template').children().clone(true);
_htmlFormatMsgLinkTemplateExternal = $('#external-page-link-template') _htmlFormatMsgLinkTemplateExternal = $('#external-page-link-template')
if (_htmlFormatMsgLinkTemplateExternal.length) { if (_htmlFormatMsgLinkTemplateExternal.length) {
@ -165,9 +167,12 @@ function postToElem(post, kind, promoted) {
var postContext = elem.find('.post-context'); var postContext = elem.find('.post-context');
if (userpost.msg) { if (userpost.msg) {
postContext.append(_templatePostRtReference.clone(true)) postContext.append(_templatePostRtReference.clone(true))
.find('.post-text').html(htmlFormatMsg(rt.msg).html); .find('.post-rt-reference')
.attr('data-screen-name', rt.n)
.attr('data-id', rt.k)
.find('.post-text').html(htmlFormatMsg(rt.msg).html)
; ;
setPostCommon(postContext, rt.n, rt.time) setPostCommon(postContext, rt.n, rt.time);
} else { } else {
postContext.append(_templatePostRtBy.clone(true)) postContext.append(_templatePostRtBy.clone(true))
.find('.post-retransmited-by') .find('.post-retransmited-by')

Loading…
Cancel
Save