Browse Source

change refreshTwistdayReminder() to match first twist time in local shift, like it was New Year event; fix for #344

readme-update
Simon Grim 9 years ago
parent
commit
c306ef4401
  1. 24
      js/interface_home.js

24
js/interface_home.js

@ -253,12 +253,12 @@ function refreshTwistdayReminder() {
var listCurrent = module.find('.current .list'); var listCurrent = module.find('.current .list');
var listUpcoming = module.find('.upcoming .list'); var listUpcoming = module.find('.upcoming .list');
var d = new Date(); var d = new Date();
var todayYear = d.getUTCFullYear(); var curYear = d.getFullYear(), curYearUTC = d.getUTCFullYear();
var todayMonth = d.getUTCMonth(); var curMonth = d.getMonth();
var todayDate = d.getUTCDate(); var curDate = d.getDate();
var todaySec = Date.UTC(todayYear, todayMonth, todayDate, var curSecUTC = Date.UTC(curYearUTC, d.getUTCMonth(), d.getUTCDate(),
d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()) /1000; d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()) / 1000;
var thatSec; var upcSecUTC;
posts.sort(function(a, b) { posts.sort(function(a, b) {
return (parseInt(a.userpost.time) > parseInt(b.userpost.time)) ? 1 : -1; return (parseInt(a.userpost.time) > parseInt(b.userpost.time)) ? 1 : -1;
@ -268,16 +268,16 @@ function refreshTwistdayReminder() {
if (followingUsers.indexOf(posts[i].userpost.n) > -1) { if (followingUsers.indexOf(posts[i].userpost.n) > -1) {
d.setTime(0); d.setTime(0);
d.setUTCSeconds(posts[i].userpost.time); d.setUTCSeconds(posts[i].userpost.time);
if (d.getUTCMonth() === todayMonth && d.getUTCDate() === todayDate) { if (d.getMonth() === curMonth && d.getDate() === curDate) {
addLuckyToList(listCurrent, posts[i]); addLuckyToList(listCurrent, posts[i]);
removeLuckyFromList(listUpcoming, posts[i].userpost.n); removeLuckyFromList(listUpcoming, posts[i].userpost.n);
} else if (showUpcomingTimer > 0) { } else if (showUpcomingTimer > 0) {
thatSec = Date.UTC(todayYear, d.getUTCMonth(), d.getUTCDate(), upcSecUTC = Date.UTC(curYearUTC, d.getUTCMonth(), d.getUTCDate(),
d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()) /1000; d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()) / 1000;
if (thatSec > todaySec && thatSec -todaySec <= showUpcomingTimer) { if (upcSecUTC > curSecUTC && upcSecUTC - curSecUTC <= showUpcomingTimer) {
d.setTime(0); d.setTime(0);
d.setUTCSeconds(thatSec); d.setUTCSeconds(upcSecUTC);
addLuckyToList(listUpcoming, posts[i], d.getTime() /1000); addLuckyToList(listUpcoming, posts[i], d.getTime() / 1000);
} else { } else {
removeLuckyFromList(listCurrent, posts[i].userpost.n); removeLuckyFromList(listCurrent, posts[i].userpost.n);
removeLuckyFromList(listUpcoming, posts[i].userpost.n); removeLuckyFromList(listUpcoming, posts[i].userpost.n);

Loading…
Cancel
Save