diff --git a/js/interface_common.js b/js/interface_common.js
index 2170934..604cc6e 100644
--- a/js/interface_common.js
+++ b/js/interface_common.js
@@ -292,7 +292,7 @@ function refreshWhoToFollow(e) {
e.stopPropagation();
e.preventDefault();
- $('.follow-suggestions').html('');
+ $('.module.who-to-follow .follow-suggestions').empty();
getRandomFollowSuggestion(processSuggestion);
getRandomFollowSuggestion(processSuggestion);
@@ -1538,19 +1538,20 @@ function replaceDashboards() {
if ($(window).width() >= 1200 && !$('.wrapper').hasClass('w1200')) {
$('.wrapper').addClass('w1200');
$('.userMenu').addClass('w1200');
- var wf = $('.module.who-to-follow');
- wf.detach();
- wf.appendTo($('.dashboard.right'));
+ var wtf = $('.module.who-to-follow');
+ if (wtf.length > 0) {
+ wtf.detach();
+ wtf.appendTo($('.dashboard.right'));
+ }
} else if ($(window).width() < 1200 && $('.wrapper').hasClass('w1200')) {
$('.wrapper').removeClass('w1200');
$('.userMenu').removeClass('w1200');
- var wf = $('.module.who-to-follow');
- wf.detach();
- $('.module.mini-profile').after(wf);
+ var wtf = $('.module.who-to-follow');
+ if (wtf.length > 0) {
+ wtf.detach();
+ $('.module.mini-profile').after(wtf);
+ }
}
-
- $( ".who-to-follow .refresh-users" ).bind( "click", refreshWhoToFollow );
- //$( ".who-to-follow .view-all-users" ).bind( "click", function(){window.location.hash = "#whotofollow"} );
}
function initInterfaceCommon() {
@@ -1614,6 +1615,11 @@ function initInterfaceCommon() {
replaceDashboards();
$( window ).resize(replaceDashboards);
+ if ($.Options.getWhoToFollowOpt() === 'enable')
+ initWhoToFollow();
+ else
+ killWhoToFollow();
+
$('.tox-ctc').on('click', function(){
window.prompt(polyglot.t('copy_to_clipboard'), $(this).attr('data'))
});
@@ -1630,6 +1636,23 @@ function initInterfaceCommon() {
}
+function initWhoToFollow() {
+ var wtf = $('.module.who-to-follow');
+ if (wtf.length) {
+ wtf.html($('#who-to-follow-template').html()).show();
+ var wtfRefresh = wtf.find('.refresh-users');
+ wtfRefresh.on('click', refreshWhoToFollow);
+ setTimeout(function() { wtfRefresh.click() }, 100);
+ //wtf.find('.view-all-users').on('click', function() { window.location.hash = '#whotofollow'; });
+ }
+}
+
+function killWhoToFollow() {
+ var wtf = $('.module.who-to-follow');
+ if (wtf.length)
+ wtf.empty().hide();
+}
+
function setTextcompleteOn(element) {
var $this = $(element);
// Cursor has not set yet. And wait 100ms to skip global click event.
diff --git a/js/interface_home.js b/js/interface_home.js
index e04c07d..4603759 100644
--- a/js/interface_home.js
+++ b/js/interface_home.js
@@ -99,10 +99,6 @@ var InterfaceFunctions = function()
twisterFollowingO = TwisterFollowing(defaultScreenName);
- setTimeout("getRandomFollowSuggestion(processSuggestion)", 1000);
- setTimeout("getRandomFollowSuggestion(processSuggestion)", 1000);
- setTimeout("getRandomFollowSuggestion(processSuggestion)", 1000);
-
if( args.cbFunc )
args.cbFunc(args.cbArg);
}, {cbFunc:cbFunc, cbArg:cbArg});
diff --git a/js/options.js b/js/options.js
index 1f7e88e..1d76dbc 100644
--- a/js/options.js
+++ b/js/options.js
@@ -402,6 +402,15 @@ var TwisterOptions = function()
$('#TopTrendsAutoUpdateTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));});
}
+ this.getWhoToFollowOpt = function() {
+ return this.getOption('WhoToFollow', 'enable');
+ }
+
+ this.setWhoToFollowOpt = function () {
+ $('#WhoToFollow').val(this.getWhoToFollowOpt());
+ $('#WhoToFollow').on('change', function() { $.Options.setOption(this.id, this.value); });
+ }
+
this.getSplitPostsOpt = function (){
return $.Options.getOption('splitPosts', 'disable');
}
@@ -593,6 +602,7 @@ var TwisterOptions = function()
this.setUseProxyForImgOnlyOpt();
this.setTopTrendsAutoUpdateOpt();
this.setTopTrendsAutoUpdateTimerOpt();
+ this.setWhoToFollowOpt();
this.setSplitPostsOpt();
this.setHideRepliesOpt();
this.setHideCloseRTsHourOpt();
diff --git a/js/twister_following.js b/js/twister_following.js
index 71308c4..6cda347 100644
--- a/js/twister_following.js
+++ b/js/twister_following.js
@@ -441,7 +441,8 @@ function getRandomFollowSuggestion(cbFunc, cbArg) {
var i = parseInt( Math.random() * followingUsers.length );
if ( (i < followingUsers.length && followingUsers[i] == defaultScreenName) ||
- typeof(twisterFollowingO.followingsFollowings[followingUsers[i]]) === 'undefined') {
+ typeof(twisterFollowingO) === 'undefined' ||
+ typeof(twisterFollowingO.followingsFollowings[followingUsers[i]]) === 'undefined') {
setTimeout(function() {getRandomFollowSuggestion(cbFunc, cbArg);}, 500);
return;
@@ -562,7 +563,7 @@ function showFollowingUsers(){
}
function processSuggestion(arg, suggestion, followedBy) {
- var dashboard = $(".follow-suggestions");
+ var dashboard = $('.module.who-to-follow .follow-suggestions');
if( suggestion ) {
var item = $("#follow-suggestion-template").clone(true);
item.removeAttr("id");
diff --git a/options.html b/options.html
index 2d4d6a4..4788250 100644
--- a/options.html
+++ b/options.html
@@ -315,6 +315,17 @@