Browse Source

Merge pull request #240 from slr/tasty-appearance-options

option to disable who-to-follow module
master
miguelfreitas 10 years ago
parent
commit
16bc37e8c2
  1. 32
      home.html
  2. 43
      js/interface_common.js
  3. 4
      js/interface_home.js
  4. 10
      js/options.js
  5. 3
      js/twister_following.js
  6. 11
      options.html

32
home.html

@ -114,7 +114,7 @@
<!-- LADO ESQUERDO DE MÓDULOS INIT --> <!-- LADO ESQUERDO DE MÓDULOS INIT -->
<div class="dashboard left"> <div class="dashboard left">
<!-- PROFILE MODULE INIT --> <!-- PROFILE MODULE -->
<div class="module mini-profile"> <div class="module mini-profile">
<div class="mini-profile-info"> <div class="mini-profile-info">
<!-- THEME NIN added sub-menu (mentions, messages and edit profile) --> <!-- THEME NIN added sub-menu (mentions, messages and edit profile) -->
@ -151,29 +151,17 @@
</form> </form>
</div> </div>
</div> </div>
<!-- PROFILE MODULE INIT -->
<!-- WHO TO FOLLOW MODULE INIT --> <!-- WHO TO FOLLOW MODULE -->
<div class="module who-to-follow"> <div class="module who-to-follow"></div>
<h3>Who to Follow</h3>
<small>.</small>
<a class="refresh-users">Refresh</a>
<small>.</small>
<a class="view-all-users" href="#whotofollow">View All</a>
<ol class="follow-suggestions">
<!-- use "follow-suggestion-template" here -->
</ol>
</div>
<!-- WHO TO FOLLOW MODULE END -->
<!-- WHO TO FOLLOW MODULE INIT --> <!-- WHO TO FOLLOW MODULE -->
<div class="module toptrends"> <div class="module toptrends">
<h3><span>Top Trends</span></h3> <h3><span>Top Trends</span></h3>
<ol class="toptrends-list"> <ol class="toptrends-list">
<!-- use "follow-suggestion-template" here --> <!-- use "follow-suggestion-template" here -->
</ol> </ol>
</div> </div>
<!-- WHO TO FOLLOW MODULE END -->
</div> </div>
<!-- LADO ESQUERDO DE MÓDULOS END --> <!-- LADO ESQUERDO DE MÓDULOS END -->
@ -225,6 +213,18 @@
<!-- TEMPLATES INIT --> <!-- TEMPLATES INIT -->
<div id="templates" style="display:none;"> <div id="templates" style="display:none;">
<!-- TEMPLATE DE WHO-TO-FOLLOW MODULE -->
<div id="who-to-follow-template">
<h3>Who to Follow</h3>
<small>.</small>
<a class="refresh-users">Refresh</a>
<small>.</small>
<a class="view-all-users" href="#whotofollow">View All</a>
<ol class="follow-suggestions">
<!-- use "follow-suggestion-template" here -->
</ol>
</div>
<!-- TEMPLATE DE WHO-TO-FOLLOW SUGGESTION --> <!-- TEMPLATE DE WHO-TO-FOLLOW SUGGESTION -->
<li id="follow-suggestion-template" class="twister-user"> <li id="follow-suggestion-template" class="twister-user">
<div class=""> <div class="">

43
js/interface_common.js

@ -292,7 +292,7 @@ function refreshWhoToFollow(e) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
$('.follow-suggestions').html(''); $('.module.who-to-follow .follow-suggestions').empty();
getRandomFollowSuggestion(processSuggestion); getRandomFollowSuggestion(processSuggestion);
getRandomFollowSuggestion(processSuggestion); getRandomFollowSuggestion(processSuggestion);
@ -1538,19 +1538,20 @@ function replaceDashboards() {
if ($(window).width() >= 1200 && !$('.wrapper').hasClass('w1200')) { if ($(window).width() >= 1200 && !$('.wrapper').hasClass('w1200')) {
$('.wrapper').addClass('w1200'); $('.wrapper').addClass('w1200');
$('.userMenu').addClass('w1200'); $('.userMenu').addClass('w1200');
var wf = $('.module.who-to-follow'); var wtf = $('.module.who-to-follow');
wf.detach(); if (wtf.length > 0) {
wf.appendTo($('.dashboard.right')); wtf.detach();
wtf.appendTo($('.dashboard.right'));
}
} else if ($(window).width() < 1200 && $('.wrapper').hasClass('w1200')) { } else if ($(window).width() < 1200 && $('.wrapper').hasClass('w1200')) {
$('.wrapper').removeClass('w1200'); $('.wrapper').removeClass('w1200');
$('.userMenu').removeClass('w1200'); $('.userMenu').removeClass('w1200');
var wf = $('.module.who-to-follow'); var wtf = $('.module.who-to-follow');
wf.detach(); if (wtf.length > 0) {
$('.module.mini-profile').after(wf); 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() { function initInterfaceCommon() {
@ -1614,6 +1615,11 @@ function initInterfaceCommon() {
replaceDashboards(); replaceDashboards();
$( window ).resize(replaceDashboards); $( window ).resize(replaceDashboards);
if ($.Options.getWhoToFollowOpt() === 'enable')
initWhoToFollow();
else
killWhoToFollow();
$('.tox-ctc').on('click', function(){ $('.tox-ctc').on('click', function(){
window.prompt(polyglot.t('copy_to_clipboard'), $(this).attr('data')) 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) { function setTextcompleteOn(element) {
var $this = $(element); var $this = $(element);
// Cursor has not set yet. And wait 100ms to skip global click event. // Cursor has not set yet. And wait 100ms to skip global click event.

4
js/interface_home.js

@ -99,10 +99,6 @@ var InterfaceFunctions = function()
twisterFollowingO = TwisterFollowing(defaultScreenName); twisterFollowingO = TwisterFollowing(defaultScreenName);
setTimeout("getRandomFollowSuggestion(processSuggestion)", 1000);
setTimeout("getRandomFollowSuggestion(processSuggestion)", 1000);
setTimeout("getRandomFollowSuggestion(processSuggestion)", 1000);
if( args.cbFunc ) if( args.cbFunc )
args.cbFunc(args.cbArg); args.cbFunc(args.cbArg);
}, {cbFunc:cbFunc, cbArg:cbArg}); }, {cbFunc:cbFunc, cbArg:cbArg});

10
js/options.js

@ -402,6 +402,15 @@ var TwisterOptions = function()
$('#TopTrendsAutoUpdateTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));}); $('#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 (){ this.getSplitPostsOpt = function (){
return $.Options.getOption('splitPosts', 'disable'); return $.Options.getOption('splitPosts', 'disable');
} }
@ -593,6 +602,7 @@ var TwisterOptions = function()
this.setUseProxyForImgOnlyOpt(); this.setUseProxyForImgOnlyOpt();
this.setTopTrendsAutoUpdateOpt(); this.setTopTrendsAutoUpdateOpt();
this.setTopTrendsAutoUpdateTimerOpt(); this.setTopTrendsAutoUpdateTimerOpt();
this.setWhoToFollowOpt();
this.setSplitPostsOpt(); this.setSplitPostsOpt();
this.setHideRepliesOpt(); this.setHideRepliesOpt();
this.setHideCloseRTsHourOpt(); this.setHideCloseRTsHourOpt();

3
js/twister_following.js

@ -441,6 +441,7 @@ function getRandomFollowSuggestion(cbFunc, cbArg) {
var i = parseInt( Math.random() * followingUsers.length ); var i = parseInt( Math.random() * followingUsers.length );
if ( (i < followingUsers.length && followingUsers[i] == defaultScreenName) || if ( (i < followingUsers.length && followingUsers[i] == defaultScreenName) ||
typeof(twisterFollowingO) === 'undefined' ||
typeof(twisterFollowingO.followingsFollowings[followingUsers[i]]) === 'undefined') { typeof(twisterFollowingO.followingsFollowings[followingUsers[i]]) === 'undefined') {
setTimeout(function() {getRandomFollowSuggestion(cbFunc, cbArg);}, 500); setTimeout(function() {getRandomFollowSuggestion(cbFunc, cbArg);}, 500);
@ -562,7 +563,7 @@ function showFollowingUsers(){
} }
function processSuggestion(arg, suggestion, followedBy) { function processSuggestion(arg, suggestion, followedBy) {
var dashboard = $(".follow-suggestions"); var dashboard = $('.module.who-to-follow .follow-suggestions');
if( suggestion ) { if( suggestion ) {
var item = $("#follow-suggestion-template").clone(true); var item = $("#follow-suggestion-template").clone(true);
item.removeAttr("id"); item.removeAttr("id");

11
options.html

@ -315,6 +315,17 @@
</form> </form>
</div> </div>
</div> </div>
<div class="module">
<p class="label label-h"> Who to Follow </p>
<div class="container">
<form>
<select id="WhoToFollow">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
</form>
</div>
</div>
<div class="post-editor"> <div class="post-editor">
<div class="module"> <div class="module">

Loading…
Cancel
Save