mirror of
https://github.com/twisterarmy/twister-calm.git
synced 2025-01-27 07:04:49 +00:00
Merge pull request #35 from dryabov/master
update Tranding Hashtags every 20 minutes
This commit is contained in:
commit
57068db26c
@ -70,27 +70,33 @@ var InterfaceFunctions = function()
|
||||
setTimeout("getRandomFollowSuggestion(processSuggestion)", 1000);
|
||||
setTimeout("getRandomFollowSuggestion(processSuggestion)", 1000);
|
||||
|
||||
twisterRpc("gettrendinghashtags", [10],
|
||||
function(args, ret) {
|
||||
for( var i = 0; i < ret.length; i++ ) {
|
||||
|
||||
var $li = $("<li>");
|
||||
var hashtagLinkTemplate = $("#hashtag-link-template").clone(true);
|
||||
hashtagLinkTemplate.removeAttr("id");
|
||||
hashtagLinkTemplate.attr("href",$.MAL.hashtagUrl(ret[i]));
|
||||
hashtagLinkTemplate.text("#"+ret[i]);
|
||||
$li.append(hashtagLinkTemplate);
|
||||
$(".toptrends-list").append($li);
|
||||
}
|
||||
}, {},
|
||||
function(args, ret) {
|
||||
console.log("Error with gettrendinghashtags. Older twister daemon?");
|
||||
}, {});
|
||||
updateTrendingHashtags();
|
||||
|
||||
if( args.cbFunc )
|
||||
args.cbFunc(args.cbArg);
|
||||
}, {cbFunc:cbFunc, cbArg:cbArg});
|
||||
}
|
||||
|
||||
function updateTrendingHashtags()
|
||||
{
|
||||
$(".toptrends-list").empty();
|
||||
twisterRpc("gettrendinghashtags", [10],
|
||||
function(args, ret) {
|
||||
for( var i = 0; i < ret.length; i++ ) {
|
||||
var $li = $("<li>");
|
||||
var hashtagLinkTemplate = $("#hashtag-link-template").clone(true);
|
||||
hashtagLinkTemplate.removeAttr("id");
|
||||
hashtagLinkTemplate.attr("href",$.MAL.hashtagUrl(ret[i]));
|
||||
hashtagLinkTemplate.text("#"+ret[i]);
|
||||
$li.append(hashtagLinkTemplate);
|
||||
$(".toptrends-list").append($li);
|
||||
}
|
||||
}, {},
|
||||
function(args, ret) {
|
||||
console.log("Error with gettrendinghashtags. Older twister daemon?");
|
||||
}, {});
|
||||
setTimeout(updateTrendingHashtags, 20*60*1000);
|
||||
}
|
||||
}
|
||||
|
||||
//***********************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user