mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-03-12 13:31:14 +00:00
improving hashtag modal latency
This commit is contained in:
parent
8099b91d1a
commit
b5baa85362
@ -185,15 +185,18 @@ function openHashtagModalFromSearchHandler(hashtag)
|
|||||||
$( "."+hashtagModalClass + " h3" ).text( "#" + hashtag );
|
$( "."+hashtagModalClass + " h3" ).text( "#" + hashtag );
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateHashtagModal(postboard,hashtag) {
|
function updateHashtagModal(postboard,hashtag,timeoutArgs) {
|
||||||
var $hashtagModalClass = $(".hashtag-modal");
|
var $hashtagModalClass = $(".hashtag-modal");
|
||||||
if( !$hashtagModalClass.length || $hashtagModalClass.css("display") == 'none' )
|
if( !$hashtagModalClass.length || $hashtagModalClass.css("display") == 'none' )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var resource = $hashtagModalClass.attr("data-resource");
|
var resource = $hashtagModalClass.attr("data-resource");
|
||||||
|
|
||||||
requestHashtag(postboard,hashtag,resource);
|
requestHashtag(postboard,hashtag,resource,timeoutArgs);
|
||||||
setTimeout( function() {updateHashtagModal(postboard,hashtag);}, 5000);
|
// use extended timeout parameters on modal refresh (requires twister_core >= 0.9.14).
|
||||||
|
// our first query above should be faster (with default timeoutArgs of twisterd),
|
||||||
|
// then we may possibly collect more posts on our second try by waiting more.
|
||||||
|
setTimeout( function() {updateHashtagModal(postboard,hashtag,[10000,2000,3]);}, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openMentionsModal(e)
|
function openMentionsModal(e)
|
||||||
|
@ -298,12 +298,12 @@ function clearHashtagProcessed() {
|
|||||||
_hashtagPendingPosts = [];
|
_hashtagPendingPosts = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestHashtag(postboard,hashtag,resource) {
|
function requestHashtag(postboard,hashtag,resource, timeoutArgs) {
|
||||||
dhtget( hashtag, resource, "m",
|
dhtget( hashtag, resource, "m",
|
||||||
function(args, data) {
|
function(args, data) {
|
||||||
processHashtag(args.postboard, args.hashtag, data);
|
processHashtag(args.postboard, args.hashtag, data);
|
||||||
}, {postboard:postboard,hashtag:hashtag},
|
}, {postboard:postboard,hashtag:hashtag},
|
||||||
[10000,2000,3]); // use extended timeout parameters (requires twister_core >= 0.9.14)
|
timeoutArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
function processHashtag(postboard, hashtag, data) {
|
function processHashtag(postboard, hashtag, data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user