|
|
@ -118,45 +118,67 @@ var InterfaceFunctions = function() |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setTimeout(updateTrendingHashtags, 1000); |
|
|
|
if ($.Options.getTopTrendsOpt() === 'enable') |
|
|
|
if ($.Options.getTopTrendsAutoUpdateOpt() === 'enable' && $.Options.getTopTrendsAutoUpdateTimerOpt() > 0) |
|
|
|
initTopTrends(); |
|
|
|
setInterval(updateTrendingHashtags, $.Options.getTopTrendsAutoUpdateTimerOpt()*1000); |
|
|
|
else |
|
|
|
|
|
|
|
killTopTrends(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function initTopTrends() { |
|
|
|
|
|
|
|
var $tt = $('.module.toptrends'); |
|
|
|
|
|
|
|
if ($tt.length) { |
|
|
|
|
|
|
|
$tt.html($('#toptrends-template').html()).show(); |
|
|
|
|
|
|
|
var $ttRefresh = $tt.find('.refresh-toptrends'); |
|
|
|
|
|
|
|
$ttRefresh.on('click', updateTrendingHashtags); |
|
|
|
|
|
|
|
setTimeout(function() { $ttRefresh.click() }, 100); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function killTopTrends() { |
|
|
|
|
|
|
|
var $tt = $('.module.toptrends'); |
|
|
|
|
|
|
|
if ($tt.length) |
|
|
|
|
|
|
|
$tt.empty().hide(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function updateTrendingHashtags() { |
|
|
|
function updateTrendingHashtags() { |
|
|
|
twisterRpc('gettrendinghashtags', [10], |
|
|
|
var $ttl = $('.module.toptrends .toptrends-list'); |
|
|
|
function(args, ret) { |
|
|
|
if ($ttl.length) { |
|
|
|
$('.toptrends-list').empty(); |
|
|
|
twisterRpc('gettrendinghashtags', [10], |
|
|
|
//console.log('hashtags trends: '+ret);
|
|
|
|
function(args, ret) { |
|
|
|
for( var i = 0; i < ret.length; i++ ) { |
|
|
|
$ttl.empty(); |
|
|
|
if ($.Options.getFilterLangOpt() !== 'disable' && $.Options.getFilterLangForTopTrendsOpt()) |
|
|
|
//console.log('hashtags trends: '+ret);
|
|
|
|
var langFilterData = filterLang(ret[i]); |
|
|
|
for( var i = 0; i < ret.length; i++ ) { |
|
|
|
if (typeof(langFilterData) === 'undefined' || langFilterData['pass'] || $.Options.getFilterLangSimulateOpt()) { |
|
|
|
if ($.Options.getFilterLangOpt() !== 'disable' && $.Options.getFilterLangForTopTrendsOpt()) |
|
|
|
var $li = $('<li>'); |
|
|
|
var langFilterData = filterLang(ret[i]); |
|
|
|
var hashtagLinkTemplate = $('#hashtag-link-template').clone(true); |
|
|
|
if (typeof(langFilterData) === 'undefined' || langFilterData['pass'] || $.Options.getFilterLangSimulateOpt()) { |
|
|
|
|
|
|
|
var $li = $('<li>'); |
|
|
|
hashtagLinkTemplate.removeAttr('id'); |
|
|
|
var hashtagLinkTemplate = $('#hashtag-link-template').clone(true); |
|
|
|
hashtagLinkTemplate.attr('href',$.MAL.hashtagUrl(ret[i])); |
|
|
|
|
|
|
|
hashtagLinkTemplate.text('#'+ret[i]); |
|
|
|
hashtagLinkTemplate.removeAttr('id'); |
|
|
|
|
|
|
|
hashtagLinkTemplate.attr('href',$.MAL.hashtagUrl(ret[i])); |
|
|
|
$li.append(hashtagLinkTemplate); |
|
|
|
hashtagLinkTemplate.text('#'+ret[i]); |
|
|
|
if ($.Options.getFilterLangOpt() !== 'disable' && $.Options.getFilterLangSimulateOpt()) { |
|
|
|
|
|
|
|
if (typeof(langFilterData) !== 'undefined') { |
|
|
|
$li.append(hashtagLinkTemplate); |
|
|
|
$li.append(' <span class="langFilterSimData"><em>'+((langFilterData['pass']) ? polyglot.t('passed') : polyglot.t('blocked'))+'</em>: '+langFilterData['prob'][0].toString()+'</span>'); |
|
|
|
if ($.Options.getFilterLangOpt() !== 'disable' && $.Options.getFilterLangSimulateOpt()) { |
|
|
|
} else { |
|
|
|
if (typeof(langFilterData) !== 'undefined') { |
|
|
|
$li.append(' <span class="langFilterSimData"><em>'+polyglot.t('not analyzed')+'</em></span>'); |
|
|
|
$li.append(' <span class="langFilterSimData"><em>'+((langFilterData['pass']) ? polyglot.t('passed') : polyglot.t('blocked'))+'</em>: '+langFilterData['prob'][0].toString()+'</span>'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$li.append(' <span class="langFilterSimData"><em>'+polyglot.t('not analyzed')+'</em></span>'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('.toptrends-list').append($li); |
|
|
|
$ttl.append($li); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, {}, |
|
|
|
}, {}, |
|
|
|
function(args, ret) { |
|
|
|
function(args, ret) { |
|
|
|
console.log('Error with gettrendinghashtags. Older twister daemon?'); |
|
|
|
console.log('Error with gettrendinghashtags. Older twister daemon?'); |
|
|
|
}, {} |
|
|
|
}, {} |
|
|
|
); |
|
|
|
); |
|
|
|
if ($.Options.getTopTrendsAutoUpdateOpt() === 'enable' && $.Options.getTopTrendsAutoUpdateTimerOpt() > 0) |
|
|
|
|
|
|
|
setTimeout(updateTrendingHashtags, $.Options.getTopTrendsAutoUpdateTimerOpt()*1000); |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
//***********************************************
|
|
|
|
//***********************************************
|
|
|
|