diff --git a/js/interface_common.js b/js/interface_common.js
index 604cc6e..0f84a9c 100644
--- a/js/interface_common.js
+++ b/js/interface_common.js
@@ -1538,19 +1538,13 @@ function replaceDashboards() {
if ($(window).width() >= 1200 && !$('.wrapper').hasClass('w1200')) {
$('.wrapper').addClass('w1200');
$('.userMenu').addClass('w1200');
- var wtf = $('.module.who-to-follow');
- if (wtf.length > 0) {
- wtf.detach();
- wtf.appendTo($('.dashboard.right'));
- }
+ $('.module.who-to-follow').detach().appendTo($('.dashboard.right'));
+ $('.module.twistday-reminder').detach().appendTo($('.dashboard.right'));
} else if ($(window).width() < 1200 && $('.wrapper').hasClass('w1200')) {
$('.wrapper').removeClass('w1200');
$('.userMenu').removeClass('w1200');
- var wtf = $('.module.who-to-follow');
- if (wtf.length > 0) {
- wtf.detach();
- $('.module.mini-profile').after(wtf);
- }
+ $('.module.who-to-follow').detach().insertAfter($('.module.mini-profile'));
+ $('.module.twistday-reminder').detach().insertAfter($('.module.toptrends'));
}
}
@@ -1618,7 +1612,7 @@ function initInterfaceCommon() {
if ($.Options.getWhoToFollowOpt() === 'enable')
initWhoToFollow();
else
- killWhoToFollow();
+ killInterfaceModule('who-to-follow');
$('.tox-ctc').on('click', function(){
window.prompt(polyglot.t('copy_to_clipboard'), $(this).attr('data'))
@@ -1635,11 +1629,17 @@ function initInterfaceCommon() {
}
}
+function initInterfaceModule(module) {
+ return $('.module.'+module).html($('#'+module+'-template').html()).show();
+}
+
+function killInterfaceModule(module) {
+ $('.module.'+module).empty().hide();
+}
function initWhoToFollow() {
- var wtf = $('.module.who-to-follow');
+ var wtf = initInterfaceModule('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);
@@ -1647,12 +1647,6 @@ function initWhoToFollow() {
}
}
-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 734412a..63f2354 100644
--- a/js/interface_home.js
+++ b/js/interface_home.js
@@ -121,26 +121,24 @@ var InterfaceFunctions = function()
if ($.Options.getTopTrendsOpt() === 'enable')
initTopTrends();
else
- killTopTrends();
+ killInterfaceModule('toptrends');
+
+ if ($.Options.getTwistdayReminderOpt() === 'enable')
+ initTwistdayReminder();
+ else
+ killInterfaceModule('twistday-reminder');
}
};
function initTopTrends() {
- var $tt = $('.module.toptrends');
+ var $tt = initInterfaceModule('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() {
var $ttl = $('.module.toptrends .toptrends-list');
if ($ttl.length) {
@@ -181,6 +179,103 @@ function updateTrendingHashtags() {
}
};
+function initTwistdayReminder() {
+ var $module = initInterfaceModule('twistday-reminder');
+ if ($module.length) {
+ var $moduleRefresh = $module.find('.refresh');
+ $moduleRefresh.on('click', refreshTwistdayReminder);
+ setTimeout(function() { $moduleRefresh.click() }, 100);
+ $module.find('.current').hide();
+ $module.find('.upcoming').hide();
+ }
+}
+
+function refreshTwistdayReminder() {
+ var $list = $('.module.twistday-reminder .list');
+ if ($list.length) {
+ if (defaultScreenName && typeof(followingUsers) !== 'undefined') {
+ var suggests = followingUsers.slice();
+ if (suggests.length > 0) {
+ for (var i = 0; i < suggests.length; i++) {
+ suggests[i] = {'username': suggests[i], 'max_id': 0};
+ }
+ twisterRpc("getposts", [suggests.length + 1,suggests],
+ function(arg, posts) {
+ function addLuckyToList(list, post, time) {
+ var lucky = post.userpost.n;
+ if (list.find('[data-screen-name='+lucky+']').length < 1) {
+ var item = $("#twistday-reminder-suggestion-template").clone(true);
+ item.removeAttr("id");
+ item.find(".twister-user-info").attr("data-screen-name", lucky);
+ item.find(".twister-user-name").attr("href", $.MAL.userUrl(lucky));
+ item.find(".twister-user-tag").text("@" +lucky);
+ if (typeof(time) !== 'undefined')
+ item.find(".twisterday").text(timeGmtToText(time));
+ else
+ item.find(".twisterday").text(timeGmtToText(post.userpost.time));
+
+ getAvatar(lucky, item.find(".twister-user-photo"));
+ getFullname(lucky, item.find(".twister-user-full"));
+
+ list.append(item);
+ }
+ }
+ function removeLuckyFromList(list, post) {
+ var lucky = post.userpost.n;
+ list.find('[data-screen-name='+lucky+']').closest('li').remove();
+ }
+
+ var showUpcomingTimer = ($.Options.getTwistdayReminderShowUpcomingOpt() === 'enable') ? $.Options.getTwistdayReminderShowUpcomingTimerOpt() *3600 : 0;
+ var listCurrent = $('.module.twistday-reminder .current .list');
+ var listUpcoming = $('.module.twistday-reminder .upcoming .list');
+ var d = new Date();
+ var todayYear = d.getUTCFullYear();
+ var todayMonth = d.getUTCMonth();
+ var todayDate = d.getUTCDate();
+ var todaySec = Date.UTC(todayYear,todayMonth,todayDate,d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds()) /1000;
+ var thatSec;
+
+ posts.sort(function(a,b) {
+ if (parseInt(a.userpost.time) > parseInt(b.userpost.time))
+ return 1;
+ else
+ return -1;
+ });
+
+ for (var i = 0; i < posts.length; i++) {
+ d.setTime(0);
+ d.setUTCSeconds(posts[i].userpost.time);
+ if (d.getUTCMonth() === todayMonth && d.getUTCDate() === todayDate) {
+ addLuckyToList(listCurrent, posts[i]);
+ } else if (showUpcomingTimer > 0) {
+ thatSec = Date.UTC(todayYear,d.getUTCMonth(),d.getUTCDate(),d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds()) /1000;
+ if (thatSec > todaySec && thatSec -todaySec <= showUpcomingTimer) {
+ d.setTime(0);
+ d.setUTCSeconds(thatSec);
+ addLuckyToList(listUpcoming, posts[i], d.getTime() /1000);
+ } else {
+ removeLuckyFromList(listCurrent, posts[i]);
+ removeLuckyFromList(listUpcoming, posts[i]);
+ }
+ } else {
+ removeLuckyFromList(listCurrent, posts[i]);
+ removeLuckyFromList(listUpcoming, posts[i]);
+ }
+ }
+
+ if (listCurrent.children().length > 1)
+ listCurrent.parent().show()
+ if (listUpcoming.children().length > 1)
+ listUpcoming.parent().show()
+ }, null,
+ function(arg, ret) { console.log("ajax error:" + ret); }, null);
+ }
+ }
+ if ($.Options.getTwistdayReminderAutoUpdateOpt() === 'enable' && $.Options.getTwistdayReminderAutoUpdateTimerOpt() > 0)
+ setTimeout(refreshTwistdayReminder, $.Options.getTwistdayReminderAutoUpdateTimerOpt()*1000);
+ }
+}
+
//***********************************************
//******************* INIT **************
//***********************************************
diff --git a/js/options.js b/js/options.js
index 39246e0..ee0f278 100644
--- a/js/options.js
+++ b/js/options.js
@@ -389,6 +389,81 @@ var TwisterOptions = function()
$('#TopTrendsAutoUpdateTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('second(s)')); });
}
+ this.getTwistdayReminderOpt = function() {
+ return this.getOption('TwistdayReminder', 'enable');
+ }
+
+ this.setTwistdayReminderOpt = function () {
+ function TwistdayReminderCfg() {
+ if ($.Options.getTwistdayReminderOpt() === 'enable')
+ $('#TwistdayReminderCont').show();
+ else
+ $('#TwistdayReminderCont').hide();
+ }
+ $('#TwistdayReminder').val( this.getTwistdayReminderOpt() );
+ TwistdayReminderCfg();
+ $('#TwistdayReminder').on('change', function() {
+ $.Options.setOption(this.id, this.value);
+ TwistdayReminderCfg();
+ });
+ }
+
+ this.getTwistdayReminderAutoUpdateOpt = function() {
+ return this.getOption('TwistdayReminderAutoUpdate', 'enable');
+ }
+
+ this.setTwistdayReminderAutoUpdateOpt = function () {
+ function TwistdayReminderAutoUpdateCfg() {
+ if ($.Options.getTwistdayReminderAutoUpdateOpt() === 'enable')
+ $('#TwistdayReminderAutoUpdateOpt').css('display', 'inline');
+ else
+ $('#TwistdayReminderAutoUpdateOpt').css('display', 'none');
+ }
+ $('#TwistdayReminderAutoUpdate').val( this.getTwistdayReminderAutoUpdateOpt() );
+ TwistdayReminderAutoUpdateCfg();
+ $('#TwistdayReminderAutoUpdate').on('change', function() {
+ $.Options.setOption(this.id, this.value);
+ TwistdayReminderAutoUpdateCfg();
+ });
+ }
+
+ this.getTwistdayReminderAutoUpdateTimerOpt = function () {
+ return parseInt(this.getOption('TwistdayReminderAutoUpdateTimer', '3600'));
+ }
+
+ this.setTwistdayReminderAutoUpdateTimerOpt = function () {
+ $('#TwistdayReminderAutoUpdateTimer').val( this.getTwistdayReminderAutoUpdateTimerOpt().toString() );
+ $('#TwistdayReminderAutoUpdateTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('second(s)')); });
+ }
+
+ this.getTwistdayReminderShowUpcomingOpt = function() {
+ return this.getOption('TwistdayReminderShowUpcoming', 'enable');
+ }
+
+ this.setTwistdayReminderShowUpcomingOpt = function () {
+ function TwistdayReminderShowUpcomingCfg() {
+ if ($.Options.getTwistdayReminderShowUpcomingOpt() === 'enable')
+ $('#TwistdayReminderShowUpcomingOpt').css('display', 'inline');
+ else
+ $('#TwistdayReminderShowUpcomingOpt').css('display', 'none');
+ }
+ $('#TwistdayReminderShowUpcoming').val( this.getTwistdayReminderShowUpcomingOpt() );
+ TwistdayReminderShowUpcomingCfg();
+ $('#TwistdayReminderShowUpcoming').on('change', function() {
+ $.Options.setOption(this.id, this.value);
+ TwistdayReminderShowUpcomingCfg();
+ });
+ }
+
+ this.getTwistdayReminderShowUpcomingTimerOpt = function () {
+ return parseInt(this.getOption('TwistdayReminderShowUpcomingTimer', '72'));
+ }
+
+ this.setTwistdayReminderShowUpcomingTimerOpt = function () {
+ $('#TwistdayReminderShowUpcomingTimer').val( this.getTwistdayReminderShowUpcomingTimerOpt().toString() );
+ $('#TwistdayReminderShowUpcomingTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('hour(s)')); });
+ }
+
this.getWhoToFollowOpt = function() {
return this.getOption('WhoToFollow', 'enable');
}
@@ -564,9 +639,14 @@ var TwisterOptions = function()
this.setConvertFractionsOpt();
this.setUseProxyOpt();
this.setUseProxyForImgOnlyOpt();
- this.setTopTrendsAutoUpdateOpt();
this.setTopTrendsOpt();
+ this.setTopTrendsAutoUpdateOpt();
this.setTopTrendsAutoUpdateTimerOpt();
+ this.setTwistdayReminderOpt();
+ this.setTwistdayReminderAutoUpdateOpt();
+ this.setTwistdayReminderAutoUpdateTimerOpt();
+ this.setTwistdayReminderShowUpcomingOpt();
+ this.setTwistdayReminderShowUpcomingTimerOpt();
this.setWhoToFollowOpt();
this.setSplitPostsOpt();
this.setHideRepliesOpt();
diff --git a/options.html b/options.html
index 36eaba2..8c77ffc 100644
--- a/options.html
+++ b/options.html
@@ -335,6 +335,37 @@
+
diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css
index aae48a6..4d90f02 100644
--- a/theme_calm/css/style.css
+++ b/theme_calm/css/style.css
@@ -453,6 +453,7 @@ input.userMenu-search-field:focus::-ms-input-placeholder {
top: 55px;
margin-left: 864px;
}
+
.module
{
border: solid 1px rgba( 69, 71, 77, .1 );
@@ -460,6 +461,7 @@ input.userMenu-search-field:focus::-ms-input-placeholder {
}
.dashboard .module {
+ margin: 0 0 3%;
border-radius: 6px;
}
.messages-qtd
@@ -970,6 +972,7 @@ textarea.splited-post {
}
.refresh-toptrends,
+.twistday-reminder .refresh,
.refresh-users,
.view-all-users
{
@@ -984,13 +987,15 @@ textarea.splited-post {
***********************************/
.module.toptrends {
- margin-top: 10px;
+ padding: 8px 4px;
}
+
.module.toptrends h3 {
margin: 5px 0 5px 10px;
font: 14px 'Open Sans', sans-serif;
display: inline;
}
+
.module.toptrends ol {
margin: 0 0 10px 10px;
}
@@ -999,6 +1004,46 @@ textarea.splited-post {
font: 13px 'Open Sans', sans-serif;
}
+/***********************************
+********* TWISTDAY REMINDER ********
+***********************************/
+
+.module.twistday-reminder {
+ padding: 8px 4px;
+}
+
+.twistday-reminder h3 {
+ margin: 5% 0% 2% 5%;
+ display: inline;
+}
+
+.twistday-reminder h4 {
+ margin: 1% 1% 1% 16%;
+ font-size: 90%;
+ color: rgba(0, 0, 0, 0.5);
+}
+
+.twistday-reminder a:hover {
+ text-decoration: none;
+}
+
+.twistday-reminder .list {
+ margin: 0% 5% 5% 5%;
+ padding: 5px;
+}
+
+.twistday-reminder .twister-user-tag,
+.twistday-reminder .twister-user-full {
+ display: block;
+ margin: 0;
+ text-align: center;
+}
+
+.twistday-reminder .twisterday {
+ font-size: 80%;
+ margin: 0 11%;
+}
+
/***********************************
********************* POST BOARD ***
***********************************/
diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css
index 0878ab9..4d131e4 100644
--- a/theme_nin/css/style.css
+++ b/theme_nin/css/style.css
@@ -56,7 +56,7 @@
font-style: normal;
}
/* 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-toptrends: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, .twistday-reminder .refresh:before, .refresh-users:before, .modal-close:before, .mark-all-as-read:before, .modal-back:before, .icon-down-after:after {
font-family: "fontello";
font-style: normal;
font-weight: normal;
@@ -198,7 +198,7 @@
/* '' */
/* line 183, ../sass/_fonts.sass */
-.icon-arrows:before, .refresh-toptrends:before, .refresh-users:before {
+.icon-arrows:before, .refresh-toptrends:before, .twistday-reminder .refresh:before, .refresh-users:before {
content: "";
}
@@ -282,7 +282,7 @@ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu,
/* FONTS */
/* line 2, ../sass/_utils.sass */
-.clear-fix:after, .userMenu ul:after, .profile-modal .profile-data:after, .profile-card .twister-user-info:after, .forEdition.profile-card:after, .postboard:after, .following:after, .expanded-content:after, .following-list li:after, .mini-following-info:after, .network.singleBlock:after, .options .tab-content:after, .promoted-posts-only:after, .dashboard.right:after, ul.userMenu-search-profiles li:after, .mini-profile .post-area:after, .mini-profile-indicators:after, .profile-data:after, #postboard-top:after, #postboard-top .post-area:after, .who-to-follow ol:after, .twister-user:after, .modal-content:after, .modal-header:after, .direct-messages-thread .post:after {
+.clear-fix:after, .userMenu ul:after, .profile-modal .profile-data:after, .profile-card .twister-user-info:after, .forEdition.profile-card:after, .postboard:after, .following:after, .expanded-content:after, .following-list li:after, .twistday-reminder li:after, .mini-following-info:after, .network.singleBlock:after, .options .tab-content:after, .promoted-posts-only:after, .dashboard.right:after, ul.userMenu-search-profiles li:after, .mini-profile .post-area:after, .mini-profile-indicators:after, .profile-data:after, #postboard-top:after, #postboard-top .post-area:after, .who-to-follow ol:after, .twistday-reminder ol:after, .twister-user:after, .modal-content:after, .modal-header:after, .direct-messages-thread .post:after {
content: "";
display: table;
clear: both;
@@ -1901,6 +1901,10 @@ button.disabled:hover, .mini-profile-actions span.disabled:hover, a.button.disab
height: 100%;
}
+.dashboard .module {
+ margin: 0 0 3%;
+}
+
/********** CONFIG SUBMENU & SEARCH RESULTS *********** */
/* line 76, ../sass/style.sass */
.dialog-modal {
@@ -2449,7 +2453,7 @@ button.follow:hover, .mini-profile-actions span.follow:hover, button.unfollow, .
}
/* line 499, ../sass/style.sass */
-.refresh-toptrends, .refresh-users {
+.refresh-toptrends, .twistday-reminder .refresh, .refresh-users {
color: #66686B;
cursor: pointer;
font-size: 11px;
@@ -2479,13 +2483,18 @@ button.follow:hover, .mini-profile-actions span.follow:hover, button.unfollow, .
}
/* line 527, ../sass/style.sass */
-.refresh-toptrends:hover, .refresh-users:hover, .view-all-users:hover {
+.refresh-toptrends:hover, .twistday-reminder .refresh, .refresh-users:hover, .view-all-users:hover {
color: #B4C669;
text-decoration: none;
background-color: transparent;
}
/***********TOP TRENDS************** */
+
+.module.toptrends {
+ padding: 8px 4px;
+}
+
.toptrends h3 {
float: left;
}
@@ -2515,6 +2524,59 @@ ol.toptrends-list a:hover {
color: #66686B;
}
+/********* TWISTDAY REMINDER *******/
+
+.module.twistday-reminder {
+ padding: 8px 4px;
+ top: 30%;
+}
+
+.twistday-reminder {
+ width: inherit;
+}
+
+.twistday-reminder small {
+ display: none;
+}
+
+.twistday-reminder ol {
+ clear: both;
+}
+
+.twistday-reminder h3 {
+ margin: 5% 0% 2% 5%;
+ display: inline;
+ float: left;
+}
+
+.twistday-reminder h4 {
+ margin: 1% 1% 1% 16%;
+ font-size: 90%;
+ color: rgba(0, 0, 0, 0.5);
+}
+
+.twistday-reminder a:hover {
+ text-decoration: none;
+}
+
+.twistday-reminder .list {
+ width: 300px;
+ margin: 0% 5% 5% 5%;
+ padding: 5px;
+}
+
+.twistday-reminder .twister-user-tag,
+.twistday-reminder .twister-user-full {
+ display: block;
+ margin: 0;
+ text-align: center;
+}
+
+.twistday-reminder .twisterday {
+ font-size: 80%;
+ margin: 0 11%;
+}
+
/*********** POPUP PROMPT ************ */
/* line 558, ../sass/style.sass */
.prompt-wrapper {
@@ -3243,7 +3305,7 @@ ul.dropdown-menu .active, ul.dropdown-menu .active a {
}
/* line 14, ../sass/_responsive.sass */
- .following-list li {
+ .following-list li, .twistday-reminder li {
width: 47%;
float: left;
margin: 0 2% 2% 0;
@@ -3271,7 +3333,7 @@ ul.dropdown-menu .active, ul.dropdown-menu .active a {
}
/* line 32, ../sass/_responsive.sass */
- .who-to-follow, .toptrends {
+ .who-to-follow, .toptrends, .twistday-reminder {
display: none;
}
@@ -3281,7 +3343,7 @@ ul.dropdown-menu .active, ul.dropdown-menu .active a {
}
/* line 37, ../sass/_responsive.sass */
- .following-list li {
+ .following-list li, .twistday-reminder li {
width: 98%;
float: none;
margin: 2% 1%;