Browse Source

option to disable toptrends module

master
Simon Grim 10 years ago
parent
commit
fe5c051081
  1. 10
      css/style.css
  2. 21
      home.html
  3. 86
      js/interface_home.js
  4. 2
      js/interface_localization.js
  5. 20
      js/options.js
  6. 24
      options.html
  7. 5
      theme_calm/css/style.css
  8. 13
      theme_nin/css/style.css
  9. 10
      theme_nin/sass/style.sass

10
css/style.css

@ -785,6 +785,7 @@ textarea.splited-post {
opacity: 1; opacity: 1;
} }
.refresh-toptrends,
.refresh-users, .refresh-users,
.view-all-users .view-all-users
{ {
@ -794,8 +795,9 @@ textarea.splited-post {
} }
/*********************************** /***********************************
**********TOP TRENDS**************** ************ TOP TRENDS ************
***********************************/ ***********************************/
ol.toptrends-list { ol.toptrends-list {
margin: 0% 5% 5% 5%; margin: 0% 5% 5% 5%;
padding: 5px; padding: 5px;
@ -803,9 +805,9 @@ ol.toptrends-list {
border-top: solid 1px rgba( 69, 71, 77, .1 ); border-top: solid 1px rgba( 69, 71, 77, .1 );
} }
.toptrends h3 .toptrends h3 {
{ margin: 5% 0% 2% 5%;
margin: 5% 5% 2% 5%; display: inline;
} }
/*********************************** /***********************************

21
home.html

@ -155,13 +155,8 @@
<!-- WHO TO FOLLOW MODULE --> <!-- WHO TO FOLLOW MODULE -->
<div class="module who-to-follow"></div> <div class="module who-to-follow"></div>
<!-- WHO TO FOLLOW MODULE --> <!-- TOP TRENDS MODULE -->
<div class="module toptrends"> <div class="module toptrends"></div>
<h3><span>Top Trends</span></h3>
<ol class="toptrends-list">
<!-- use "follow-suggestion-template" here -->
</ol>
</div>
</div> </div>
<!-- LADO ESQUERDO DE MÓDULOS END --> <!-- LADO ESQUERDO DE MÓDULOS END -->
@ -215,7 +210,7 @@
<!-- TEMPLATE DE WHO-TO-FOLLOW MODULE --> <!-- TEMPLATE DE WHO-TO-FOLLOW MODULE -->
<div id="who-to-follow-template"> <div id="who-to-follow-template">
<h3>Who to Follow</h3> <h3 class="label">Who to Follow</h3>
<small>.</small> <small>.</small>
<a class="refresh-users">Refresh</a> <a class="refresh-users">Refresh</a>
<small>.</small> <small>.</small>
@ -225,6 +220,16 @@
</ol> </ol>
</div> </div>
<!-- TEMPLATE DE TOP TRENDS MODULE -->
<div id="toptrends-template">
<h3 class="label">Top Trends</h3>
<small>.</small>
<a class="refresh-toptrends">Refresh</a>
<ol class="toptrends-list">
<!-- 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="">

86
js/interface_home.js

@ -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);
}
}; };
//*********************************************** //***********************************************

2
js/interface_localization.js

@ -3570,7 +3570,7 @@ var fixedLabels = [
"button", "button",
".postboard-news", ".postboard-news",
".post-area-new textarea", ".post-area-new textarea",
".refresh-users, .view-all-users", ".refresh-toptrends, .refresh-users, .view-all-users",
".who-to-follow h3", ".who-to-follow h3",
".userMenu-search-field", ".userMenu-search-field",
"a.dropdown-menu-item, a.direct-messages", "a.dropdown-menu-item, a.direct-messages",

20
js/options.js

@ -372,6 +372,25 @@ var TwisterOptions = function()
}); });
} }
this.getTopTrendsOpt = function() {
return this.getOption('TopTrends', 'enable');
}
this.setTopTrendsOpt = function () {
function TopTrendsCfg() {
if ($.Options.getTopTrendsOpt() === 'enable')
$('#TopTrendsCont').show();
else
$('#TopTrendsCont').hide();
}
$('#TopTrends').val(this.getTopTrendsOpt());
TopTrendsCfg();
$('#TopTrends').on('change', function() {
$.Options.setOption(this.id, this.value);
TopTrendsCfg();
});
}
this.getTopTrendsAutoUpdateOpt = function() { this.getTopTrendsAutoUpdateOpt = function() {
return this.getOption('TopTrendsAutoUpdate', 'enable'); return this.getOption('TopTrendsAutoUpdate', 'enable');
} }
@ -601,6 +620,7 @@ var TwisterOptions = function()
this.setUseProxyOpt(); this.setUseProxyOpt();
this.setUseProxyForImgOnlyOpt(); this.setUseProxyForImgOnlyOpt();
this.setTopTrendsAutoUpdateOpt(); this.setTopTrendsAutoUpdateOpt();
this.setTopTrendsOpt();
this.setTopTrendsAutoUpdateTimerOpt(); this.setTopTrendsAutoUpdateTimerOpt();
this.setWhoToFollowOpt(); this.setWhoToFollowOpt();
this.setSplitPostsOpt(); this.setSplitPostsOpt();

24
options.html

@ -302,15 +302,23 @@
</div> </div>
<div class="module"> <div class="module">
<p class="label label-h"> Top Trends </p> <p class="label label-h"> Top Trends </p>
<div id="TopTrendsAutoUpdateCont" class="container"> <div class="container">
<form> <form>
<p class="label">Auto updating</p> <p>
<select id="TopTrendsAutoUpdate" class="container"> <select id="TopTrends">
<option value="enable">Enable</option> <option value="enable">Enable</option>
<option value="disable">Disable</option> <option value="disable">Disable</option>
</select> </select>
<div id="TopTrendsAutoUpdateOpt" class="container"> </p>
<input type="text" id="TopTrendsAutoUpdateTimer" maxlength="6" size="6"/> <span class="label">second(s)</span> <div id="TopTrendsCont" class="container">
<p class="label">Auto updating</p>
<select id="TopTrendsAutoUpdate" class="container">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
<div id="TopTrendsAutoUpdateOpt" class="container">
<input type="text" id="TopTrendsAutoUpdateTimer" maxlength="6" size="6"/> <span class="label">second(s)</span>
</div>
</div> </div>
</form> </form>
</div> </div>

5
theme_calm/css/style.css

@ -969,6 +969,7 @@ textarea.splited-post {
text-decoration: none; text-decoration: none;
} }
.refresh-toptrends,
.refresh-users, .refresh-users,
.view-all-users .view-all-users
{ {
@ -979,14 +980,16 @@ textarea.splited-post {
} }
/*********************************** /***********************************
********************* TOP TRENDS ************ TOP TRENDS ************
***********************************/ ***********************************/
.module.toptrends { .module.toptrends {
margin-top: 10px; margin-top: 10px;
} }
.module.toptrends h3 { .module.toptrends h3 {
margin: 5px 0 5px 10px; margin: 5px 0 5px 10px;
font: 14px 'Open Sans', sans-serif; font: 14px 'Open Sans', sans-serif;
display: inline;
} }
.module.toptrends ol { .module.toptrends ol {
margin: 0 0 10px 10px; margin: 0 0 10px 10px;

13
theme_nin/css/style.css

@ -56,7 +56,7 @@
font-style: normal; font-style: normal;
} }
/* line 64, ../sass/_fonts.sass */ /* line 64, ../sass/_fonts.sass */
[class^="icon-"]:before, [class*=" icon-"]:before, .extend-icon:before, .userMenu li.userMenu-config > a:before, .post-context span:before, .post-reply:before, .post-propagate:before, .post-favorite:before, .post .show-more:before, .mini-profile-actions span:before, ul.userMenu-search-profiles button:before, .mini-profile-indicators .userMenu-connections a:before, .mini-profile-indicators .userMenu-messages a:before, .mini-profile-indicators .userMenu-user a:before, .twister-user-remove:before, .refresh-users:before, .modal-close:before, .mark-all-as-read:before, .modal-back:before, .icon-down-after:after { [class^="icon-"]:before, [class*=" icon-"]:before, .extend-icon:before, .userMenu li.userMenu-config > a:before, .post-context span:before, .post-reply:before, .post-propagate:before, .post-favorite:before, .post .show-more:before, .mini-profile-actions span:before, ul.userMenu-search-profiles button:before, .mini-profile-indicators .userMenu-connections a:before, .mini-profile-indicators .userMenu-messages a:before, .mini-profile-indicators .userMenu-user a:before, .twister-user-remove:before, .refresh-toptrends:before, .refresh-users:before, .modal-close:before, .mark-all-as-read:before, .modal-back:before, .icon-down-after:after {
font-family: "fontello"; font-family: "fontello";
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
@ -198,7 +198,7 @@
/* '' */ /* '' */
/* line 183, ../sass/_fonts.sass */ /* line 183, ../sass/_fonts.sass */
.icon-arrows:before, .refresh-users:before { .icon-arrows:before, .refresh-toptrends:before, .refresh-users:before {
content: ""; content: "";
} }
@ -1823,7 +1823,7 @@ button.disabled:hover, .mini-profile-actions span.disabled:hover, a.button.disab
width: 90%; width: 90%;
} }
.options #filterLangListCont div,.options #TopTrendsAutoUpdateCont div { .options #filterLangListCont div,.options #TopTrendsCont div {
float: none; float: none;
padding: 0px 4px; padding: 0px 4px;
} }
@ -2449,7 +2449,7 @@ button.follow:hover, .mini-profile-actions span.follow:hover, button.unfollow, .
} }
/* line 499, ../sass/style.sass */ /* line 499, ../sass/style.sass */
.refresh-users { .refresh-toptrends, .refresh-users {
color: #66686B; color: #66686B;
cursor: pointer; cursor: pointer;
font-size: 11px; font-size: 11px;
@ -2479,13 +2479,16 @@ button.follow:hover, .mini-profile-actions span.follow:hover, button.unfollow, .
} }
/* line 527, ../sass/style.sass */ /* line 527, ../sass/style.sass */
.refresh-users:hover, .view-all-users:hover { .refresh-toptrends:hover, .refresh-users:hover, .view-all-users:hover {
color: #B4C669; color: #B4C669;
text-decoration: none; text-decoration: none;
background-color: transparent; background-color: transparent;
} }
/***********TOP TRENDS************** */ /***********TOP TRENDS************** */
.toptrends h3 {
float: left;
}
/* line 534, ../sass/style.sass */ /* line 534, ../sass/style.sass */
ol.toptrends-list { ol.toptrends-list {
margin: 0; margin: 0;

10
theme_nin/sass/style.sass

@ -516,7 +516,7 @@ textarea.splited-post
.twister-user-remove:hover .twister-user-remove:hover
opacity: 1 opacity: 1
.refresh-users .refresh-toptrends, .refresh-users
@extend .icon-arrows @extend .icon-arrows
@extend .extend-icon @extend .extend-icon
color: $main-color-dark color: $main-color-dark
@ -544,13 +544,17 @@ textarea.splited-post
margin: 0 0 0 15px margin: 0 0 0 15px
position: relative position: relative
.refresh-users:hover, .view-all-users:hover .refresh-toptrends:hover, .refresh-users:hover, .view-all-users:hover
color: $main-color-color color: $main-color-color
text-decoration: none text-decoration: none
background-color: transparent background-color: transparent
/***********TOP TRENDS***************/ /***********TOP TRENDS***************/
.toptrends
h3
float: left
ol.toptrends-list ol.toptrends-list
margin: 0 margin: 0
margin-bottom: 10px margin-bottom: 10px
@ -1096,7 +1100,7 @@ ol.toptrends-list
#filterLangList #filterLangList
width: 90% width: 90%
#filterLangListCont div, #TopTrendsAutoUpdateCont div #filterLangListCont div, #TopTrendsCont div
float: none float: none
padding: 0px 4px padding: 0px 4px

Loading…
Cancel
Save