mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-09-12 06:11:59 +00:00
somewhat working hashscheme for conversation modal
This commit is contained in:
parent
299772ee88
commit
d52ad05630
@ -370,35 +370,46 @@ function openWhoToFollowModal() {
|
|||||||
$( "." + whoToFollowModalClass + " h3" ).text( polyglot.t("Who to Follow") );
|
$( "." + whoToFollowModalClass + " h3" ).text( polyglot.t("Who to Follow") );
|
||||||
}
|
}
|
||||||
|
|
||||||
function newConversationModal(postLi) {
|
function newConversationModal(username,resource) {
|
||||||
|
|
||||||
var hashtagModalContent = $( "#hashtag-modal-template" ).children().clone(true);
|
var hashtagModalContent = $( "#hashtag-modal-template" ).children().clone(true);
|
||||||
|
|
||||||
|
requestPost(hashtagModalContent.find(".postboard-posts"),username,resource,
|
||||||
|
function(args){
|
||||||
|
getTopPostOfConversation(args.hashtagModalContent.find(".postboard-posts").first(),
|
||||||
|
null,
|
||||||
|
args.hashtagModalContent.find(".postboard-posts")
|
||||||
|
);
|
||||||
|
},{ hashtagModalContent:hashtagModalContent }
|
||||||
|
);
|
||||||
|
|
||||||
hashtagModalContent.find( ".postboard-news").click(function (){
|
hashtagModalContent.find( ".postboard-news").click(function (){
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
displayHashtagPending($(".conversation-modal .postboard-posts"));
|
displayHashtagPending($(".conversation-modal .postboard-posts"));
|
||||||
});
|
});
|
||||||
|
|
||||||
getTopPostOfConversation(postLi, null, hashtagModalContent.find(".postboard-posts"));
|
|
||||||
|
|
||||||
return hashtagModalContent;
|
return hashtagModalContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
function openConversationModal(e)
|
function openConversationModal(username,resource)
|
||||||
{
|
{
|
||||||
e.stopPropagation();
|
//e.stopPropagation();
|
||||||
e.preventDefault();
|
//e.preventDefault();
|
||||||
|
|
||||||
var $this = $( this );
|
//var $this = $( this );
|
||||||
var postLi = $this.parents(".module.post.original.open").find('.module.post.original');
|
//var postLi = $this.parents(".module.post.original.open").find('.module.post.original');
|
||||||
|
|
||||||
var conversationModalClass = "conversation-modal";
|
var conversationModalClass = "conversation-modal";
|
||||||
openModal( conversationModalClass );
|
openModal( conversationModalClass );
|
||||||
//$( "." + threadingModalClass ).attr("data-resource","hashtag");
|
//$( "." + threadingModalClass ).attr("data-resource","hashtag");
|
||||||
|
|
||||||
var hashtagModalContent = newConversationModal( postLi );
|
|
||||||
hashtagModalContent.appendTo("." + conversationModalClass + " .modal-content");
|
|
||||||
|
var conversationModalContent = newConversationModal(username,resource);
|
||||||
|
conversationModalContent.appendTo("." + conversationModalClass + " .modal-content");
|
||||||
|
|
||||||
//título do modal
|
//título do modal
|
||||||
$( "." + conversationModalClass + " h3" ).text( polyglot.t('conversation_title', {'username': postLi.find('.post-data').attr('data-screen-name')}) );
|
//$( "." + conversationModalClass + " h3" ).text( polyglot.t('conversation_title', {'username': postLi.find('.post-data').attr('data-screen-name')}) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -435,7 +446,7 @@ function loadModalFromHash(){
|
|||||||
|
|
||||||
var hashdata = hashstring.split(':');
|
var hashdata = hashstring.split(':');
|
||||||
if (hashdata[0] != '#web+twister') {
|
if (hashdata[0] != '#web+twister') {
|
||||||
hashdata = hashstring.match(/(hashtag|profile|mentions|directmessages|following)\?(?:user|hashtag)=(.+)/);
|
hashdata = hashstring.match(/(hashtag|profile|mentions|directmessages|following|conversation)\?(?:user|hashtag|post)=(.+)/);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hashdata && hashdata[1] != undefined && hashdata[2] != undefined) {
|
if (hashdata && hashdata[1] != undefined && hashdata[2] != undefined) {
|
||||||
@ -449,6 +460,10 @@ function loadModalFromHash(){
|
|||||||
openDmWithUserModal(hashdata[2]);
|
openDmWithUserModal(hashdata[2]);
|
||||||
}else if (hashdata[1] == 'following') {
|
}else if (hashdata[1] == 'following') {
|
||||||
openFollowingModal(hashdata[2]);
|
openFollowingModal(hashdata[2]);
|
||||||
|
}else if (hashdata[1] == 'conversation') {
|
||||||
|
splithashdata2=hashdata[2].split(':')
|
||||||
|
//console.log('username='+splithashdata2[0]+' resource='+splithashdata2[1]);
|
||||||
|
openConversationModal(splithashdata2[0],splithashdata2[1]);
|
||||||
}
|
}
|
||||||
} else if (hashstring == '#directmessages') {
|
} else if (hashstring == '#directmessages') {
|
||||||
directMessagesPopup();
|
directMessagesPopup();
|
||||||
|
@ -147,6 +147,27 @@ function appendPostToContainer(postFromJson, containerToAppend)
|
|||||||
|
|
||||||
var profilePostsLoading = false;
|
var profilePostsLoading = false;
|
||||||
|
|
||||||
|
function requestPost(containerToAppend,username,resource,cbFunc,cbArgs){
|
||||||
|
|
||||||
|
console.log('dhtget '+username+' '+resource);
|
||||||
|
|
||||||
|
dhtget( username, resource, "s",
|
||||||
|
function(args, postFromJson) {
|
||||||
|
if( postFromJson ) {
|
||||||
|
|
||||||
|
console.log(postFromJson);
|
||||||
|
|
||||||
|
appendPostToContainer(postFromJson,args.containerToAppend);
|
||||||
|
|
||||||
|
if(args.cbFunc!=undefined) args.cbFunc(args.cbArgs);
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{containerToAppend:containerToAppend,cbFunc:cbFunc,cbArgs:cbArgs}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function requestPostRecursively(containerToAppend,username,resource,count,useGetposts)
|
function requestPostRecursively(containerToAppend,username,resource,count,useGetposts)
|
||||||
{
|
{
|
||||||
var max_id = -1;
|
var max_id = -1;
|
||||||
|
@ -93,6 +93,7 @@ function _dhtgetAbortPending(locator)
|
|||||||
// the value ["v"] is extracted from response and returned to callback
|
// the value ["v"] is extracted from response and returned to callback
|
||||||
// null is passed to callback in case of an error
|
// null is passed to callback in case of an error
|
||||||
function dhtget( username, resource, multi, cbFunc, cbArg, timeoutArgs ) {
|
function dhtget( username, resource, multi, cbFunc, cbArg, timeoutArgs ) {
|
||||||
|
//console.log('dhtget '+username+' '+resource+' '+multi);
|
||||||
var locator = _dhtgetLocator(username, resource, multi);
|
var locator = _dhtgetLocator(username, resource, multi);
|
||||||
if( locator in _dhtgetPendingMap) {
|
if( locator in _dhtgetPendingMap) {
|
||||||
_dhtgetAddPending(locator, cbFunc, cbArg);
|
_dhtgetAddPending(locator, cbFunc, cbArg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user