mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-03-12 05:21:18 +00:00
changed conversation listing method...
- made the requestRepliesAfter function recursive - displayed replies indented (something like #153) - changed maxExpandPost value to 8 - added conversation modal to show all post in a conversation... - added Symbola.ttf for possible missing unicode symboles..
This commit is contained in:
parent
114cc7866e
commit
cb7eb0f7ff
BIN
css/Symbola.ttf
Normal file
BIN
css/Symbola.ttf
Normal file
Binary file not shown.
@ -9,6 +9,11 @@
|
|||||||
src: url("OpenSans-Bold.ttf");
|
src: url("OpenSans-Bold.ttf");
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
@font-face
|
||||||
|
{
|
||||||
|
font-family: "Symbola";
|
||||||
|
src: url("Symbola.ttf");
|
||||||
|
}
|
||||||
html, body, div, span, applet, object, iframe,
|
html, body, div, span, applet, object, iframe,
|
||||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||||
a, abbr, acronym, address, big, cite, code,
|
a, abbr, acronym, address, big, cite, code,
|
||||||
@ -30,7 +35,7 @@ time, mark, audio, video, textarea
|
|||||||
font: inherit;
|
font: inherit;
|
||||||
vertical-align: baseline;
|
vertical-align: baseline;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
font-family: 'Open Sans', sans-serif;
|
font-family: 'Open Sans', sans-serif, Symbola;
|
||||||
}
|
}
|
||||||
textarea, input
|
textarea, input
|
||||||
{
|
{
|
||||||
@ -644,6 +649,15 @@ textarea.splited-post {
|
|||||||
{
|
{
|
||||||
color: #ff0000;
|
color: #ff0000;
|
||||||
}
|
}
|
||||||
|
.post .show-more {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-left: 60px;
|
||||||
|
color: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
.post .show-more:before {
|
||||||
|
content: '💭';
|
||||||
|
}
|
||||||
/***********************************
|
/***********************************
|
||||||
********************* WHO TO FOLLOW
|
********************* WHO TO FOLLOW
|
||||||
***********************************/
|
***********************************/
|
||||||
@ -1121,6 +1135,10 @@ ol.toptrends-list {
|
|||||||
{
|
{
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
.post .sub-replies {
|
||||||
|
border-left: solid 3px #E34F42;
|
||||||
|
margin-left: 2px;
|
||||||
|
}
|
||||||
/***********************************
|
/***********************************
|
||||||
******** LOGIN AND NETWORK PAGES ***
|
******** LOGIN AND NETWORK PAGES ***
|
||||||
***********************************/
|
***********************************/
|
||||||
@ -1473,6 +1491,31 @@ ol.toptrends-list {
|
|||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
/*************************************
|
/*************************************
|
||||||
|
****************** CONVERSATION MODAL
|
||||||
|
**************************************/
|
||||||
|
.conversation-modal .modal-wrapper
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
width: 560px;
|
||||||
|
height: 80%;
|
||||||
|
top: 10%;
|
||||||
|
margin: 0 0 0 -330px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.conversation-modal .modal-content
|
||||||
|
{
|
||||||
|
overflow-y: auto;
|
||||||
|
height: 90%;
|
||||||
|
}
|
||||||
|
.conversation-modal .modal-buttons
|
||||||
|
{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.conversation-modal .postboard
|
||||||
|
{
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
/*************************************
|
||||||
****************** FOLLOWING MODAL
|
****************** FOLLOWING MODAL
|
||||||
**************************************/
|
**************************************/
|
||||||
.following-modal .modal-wrapper
|
.following-modal .modal-wrapper
|
||||||
|
@ -234,6 +234,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<span class="show-more label">Show more in this conversation...</span>
|
||||||
</div> <!-- expanded-content -->
|
</div> <!-- expanded-content -->
|
||||||
</div> <!-- post-data -->
|
</div> <!-- post-data -->
|
||||||
</li> <!-- post-template -->
|
</li> <!-- post-template -->
|
||||||
|
@ -261,6 +261,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<span class="show-more label">Show more in this conversation...</span>
|
||||||
</div> <!-- expanded-content -->
|
</div> <!-- expanded-content -->
|
||||||
</div> <!-- post-data -->
|
</div> <!-- post-data -->
|
||||||
</li> <!-- post-template -->
|
</li> <!-- post-template -->
|
||||||
|
@ -320,6 +320,37 @@ function openWhoToFollowModal(e) {
|
|||||||
$( "." + whoToFollowModalClass + " h3" ).text( polyglot.t("Who to Follow") );
|
$( "." + whoToFollowModalClass + " h3" ).text( polyglot.t("Who to Follow") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function newConversationModal(postLi) {
|
||||||
|
var hashtagModalContent = $( "#hashtag-modal-template" ).children().clone(true);
|
||||||
|
hashtagModalContent.find( ".postboard-news").click(function (){
|
||||||
|
$(this).hide();
|
||||||
|
displayHashtagPending($(".conversation-modal .postboard-posts"));
|
||||||
|
});
|
||||||
|
|
||||||
|
getTopPostOfConversation(postLi, null, hashtagModalContent.find(".postboard-posts"));
|
||||||
|
|
||||||
|
return hashtagModalContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
function openConversationModal(e)
|
||||||
|
{
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var $this = $( this );
|
||||||
|
var postLi = $this.parents(".module.post.original.open").find('.module.post.original');
|
||||||
|
|
||||||
|
var conversationModalClass = "conversation-modal";
|
||||||
|
openModal( conversationModalClass );
|
||||||
|
//$( "." + threadingModalClass ).attr("data-resource","hashtag");
|
||||||
|
|
||||||
|
var hashtagModalContent = newConversationModal( postLi );
|
||||||
|
hashtagModalContent.appendTo("." + conversationModalClass + " .modal-content");
|
||||||
|
|
||||||
|
//título do modal
|
||||||
|
$( "." + conversationModalClass + " h3" ).text( polyglot.t('conversation_title', {'username': postLi.find('.post-data').attr('data-screen-name')}) );
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Post actions, submit, count characters
|
// Post actions, submit, count characters
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
@ -1279,6 +1310,7 @@ function initInterfaceCommon() {
|
|||||||
$( ".post-area-new" ).clickoutside( unfocusThis );
|
$( ".post-area-new" ).clickoutside( unfocusThis );
|
||||||
$( ".post-submit").click( postSubmit );
|
$( ".post-submit").click( postSubmit );
|
||||||
$( ".modal-propagate").click( retweetSubmit );
|
$( ".modal-propagate").click( retweetSubmit );
|
||||||
|
$( ".expanded-content .show-more").bind('click', openConversationModal);
|
||||||
|
|
||||||
if ($.Options.getUnicodeConversionOpt() === "disable")
|
if ($.Options.getUnicodeConversionOpt() === "disable")
|
||||||
$( ".undo-unicode" ).click( undoLastUnicode ).css("display", "none");
|
$( ".undo-unicode" ).click( undoLastUnicode ).css("display", "none");
|
||||||
|
@ -227,7 +227,9 @@ if(preferredLanguage == "en"){
|
|||||||
"Show conversation": "Show conversation",
|
"Show conversation": "Show conversation",
|
||||||
"Mark all as read": "Mark all as read",
|
"Mark all as read": "Mark all as read",
|
||||||
"show_more_count": "%{count} more...",
|
"show_more_count": "%{count} more...",
|
||||||
"hide": "hide"
|
"hide": "hide",
|
||||||
|
"Show more in this conversation...": "Show more in this conversation...",
|
||||||
|
"conversation_title": "Conversation of @%{username}"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if(preferredLanguage == "es"){
|
if(preferredLanguage == "es"){
|
||||||
@ -1873,7 +1875,9 @@ if(preferredLanguage == "tr"){
|
|||||||
"Show conversation": "Sohbeti göster",
|
"Show conversation": "Sohbeti göster",
|
||||||
"Mark all as read": "hepsini okundu olarak işaretle",
|
"Mark all as read": "hepsini okundu olarak işaretle",
|
||||||
"show_more_count": "%{count} tane daha...",
|
"show_more_count": "%{count} tane daha...",
|
||||||
"hide": "gizle"
|
"hide": "gizle",
|
||||||
|
"Show more in this conversation...": "Sohbetin tamamını göster...",
|
||||||
|
"conversation_title": "@%{username} kullanıcısının bir sohbeti"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,6 +365,29 @@ var MAL = function()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.reqRepAfterCB = function(postLi, postsFromJson) {
|
||||||
|
if ($.hasOwnProperty("mobile")) {
|
||||||
|
for( var i = 0; i < postsFromJson.length; i++) {
|
||||||
|
var newStreamPost = postToElem(postsFromJson[i], "related");
|
||||||
|
newStreamPost.hide();
|
||||||
|
postLi.after(newStreamPost);
|
||||||
|
newStreamPost.slideDown("fast");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var $replist = $('<ol class="sub-replies"></ol>');
|
||||||
|
var $newli = $('<li class="post open related"></li>');
|
||||||
|
postLi.after($newli);
|
||||||
|
$newli.append($replist);
|
||||||
|
for (var i = 0; i < postsFromJson.length; i++) {
|
||||||
|
var newStreamPost = postToElem(postsFromJson[i], "related");
|
||||||
|
newStreamPost.hide();
|
||||||
|
$replist.prepend(newStreamPost);
|
||||||
|
newStreamPost.slideDown("fast");
|
||||||
|
requestRepliesAfter(newStreamPost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.MAL.relatedPostLoaded();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery.MAL = new MAL;
|
jQuery.MAL = new MAL;
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
// global variables
|
// global variables
|
||||||
|
|
||||||
var postsPerRefresh = 10;
|
var postsPerRefresh = 10;
|
||||||
var maxExpandPost = 20;
|
var maxExpandPost = 8;
|
||||||
|
var maxExpandPostTop = 4;
|
||||||
var _hashtagProcessedMap = {};
|
var _hashtagProcessedMap = {};
|
||||||
var _hashtagPendingPosts = [];
|
var _hashtagPendingPosts = [];
|
||||||
var autoUpdateHashtag = false;
|
var autoUpdateHashtag = false;
|
||||||
@ -19,7 +20,7 @@ var autoUpdateHashtag = false;
|
|||||||
|
|
||||||
function requestRepliedBefore(postLi)
|
function requestRepliedBefore(postLi)
|
||||||
{
|
{
|
||||||
if(postLi.siblings().length >= maxExpandPost)
|
if(postLi.siblings().length >= maxExpandPostTop)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var originalPost = postLi.find(".post-data");
|
var originalPost = postLi.find(".post-data");
|
||||||
@ -41,7 +42,7 @@ function requestRepliedBefore(postLi)
|
|||||||
|
|
||||||
function requestRepliesAfter(postLi)
|
function requestRepliesAfter(postLi)
|
||||||
{
|
{
|
||||||
if(postLi.siblings().length >= maxExpandPost)
|
if(postLi.parents('.module.post.original.open').find('.post.related').length >= maxExpandPost)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var originalPost = postLi.find(".post-data");
|
var originalPost = postLi.find(".post-data");
|
||||||
@ -49,16 +50,56 @@ function requestRepliesAfter(postLi)
|
|||||||
var original_k = originalPost.attr('data-id');
|
var original_k = originalPost.attr('data-id');
|
||||||
|
|
||||||
if( original_n != undefined && original_k != undefined ) {
|
if( original_n != undefined && original_k != undefined ) {
|
||||||
dhtget( original_n, "replies" + original_k, "m",
|
dhtget( original_n, "replies" + original_k, "m", $.MAL.reqRepAfterCB, postLi);
|
||||||
function(postLi, postsFromJson) {
|
}
|
||||||
for( var i = 0; i < postsFromJson.length; i++) {
|
}
|
||||||
var newStreamPost = postToElem(postsFromJson[i], "related");
|
|
||||||
newStreamPost.hide();
|
function getTopPostOfConversation(postLi, post, postboard) {
|
||||||
postLi.after(newStreamPost);
|
var reply_n;
|
||||||
newStreamPost.slideDown("fast");
|
var reply_k;
|
||||||
}
|
|
||||||
$.MAL.relatedPostLoaded();
|
if (post && typeof(post) !== 'undefined' && "reply" in post["userpost"]) {
|
||||||
}, postLi);
|
reply_k = post["userpost"]["reply"]["k"];
|
||||||
|
reply_n = post["userpost"]["reply"]["n"];
|
||||||
|
} else if (postLi && typeof(postLi) !== 'undefined') {
|
||||||
|
var originalPost = postLi.find(".post-data");
|
||||||
|
reply_n = originalPost.attr('data-replied-to-screen-name');
|
||||||
|
reply_k = originalPost.attr('data-replied-to-id');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( reply_n != undefined && reply_k != undefined ) {
|
||||||
|
dhtget( reply_n, "post" + reply_k, "s",
|
||||||
|
function(postLi, postFromJson) {
|
||||||
|
getTopPostOfConversation(null, postFromJson, postboard);
|
||||||
|
}, postLi);
|
||||||
|
} else {
|
||||||
|
var newStreamPost;
|
||||||
|
if (post)
|
||||||
|
newStreamPost = postToElem(post, "related");
|
||||||
|
else {
|
||||||
|
newStreamPost = postLi.clone(true);
|
||||||
|
newStreamPost.removeClass('original');
|
||||||
|
newStreamPost.addClass('related');
|
||||||
|
newStreamPost.find('.expanded-content').hide();
|
||||||
|
newStreamPost.find('.show-more').hide();
|
||||||
|
}
|
||||||
|
requestRepliesAfterAll(newStreamPost);
|
||||||
|
newStreamPost.find('.post-expand').remove();
|
||||||
|
newStreamPost.unbind('click');
|
||||||
|
newStreamPost.hide();
|
||||||
|
postboard.append(newStreamPost);
|
||||||
|
newStreamPost.slideDown("fast");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestRepliesAfterAll(postLi)
|
||||||
|
{
|
||||||
|
var originalPost = postLi.find(".post-data");
|
||||||
|
var original_n = originalPost.attr('data-screen-name');
|
||||||
|
var original_k = originalPost.attr('data-id');
|
||||||
|
|
||||||
|
if( original_n != undefined && original_k != undefined ) {
|
||||||
|
dhtget( original_n, "replies" + original_k, "m", $.MAL.reqRepAfterCB, postLi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user