fix using Date.now()

GM_setValue can only handle 32 bit integers.
band-aid until I JSON. parse/stringify everything
This commit is contained in:
James Campos 2011-03-27 13:33:45 -07:00
parent 520a2f32d1
commit 4a15b1158f
2 changed files with 4 additions and 4 deletions

View File

@ -1560,7 +1560,7 @@
if ($.isDST()) { if ($.isDST()) {
g.chanOffset -= 1; g.chanOffset -= 1;
} }
lastChecked = GM_getValue('lastChecked', 0); lastChecked = Number(GM_getValue('lastChecked', '0'));
now = Date.now(); now = Date.now();
DAY = 24 * 60 * 60; DAY = 24 * 60 * 60;
if (lastChecked < now - 1 * DAY) { if (lastChecked < now - 1 * DAY) {
@ -1579,7 +1579,7 @@
} }
GM_setValue("hiddenThreads/" + g.BOARD + "/", JSON.stringify(g.hiddenThreads)); GM_setValue("hiddenThreads/" + g.BOARD + "/", JSON.stringify(g.hiddenThreads));
GM_setValue("hiddenReplies/" + g.BOARD + "/", JSON.stringify(g.hiddenReplies)); GM_setValue("hiddenReplies/" + g.BOARD + "/", JSON.stringify(g.hiddenReplies));
GM_setValue('lastChecked', now); GM_setValue('lastChecked', now.toString());
} }
GM_addStyle('\ GM_addStyle('\
#iHover {\ #iHover {\

View File

@ -1200,7 +1200,7 @@ tzOffset = (new Date()).getTimezoneOffset() / 60
g.chanOffset = 5 - tzOffset# 4chan = EST = GMT -5 g.chanOffset = 5 - tzOffset# 4chan = EST = GMT -5
if $.isDST() then g.chanOffset -= 1 if $.isDST() then g.chanOffset -= 1
lastChecked = GM_getValue('lastChecked', 0) lastChecked = Number GM_getValue('lastChecked', '0')
now = Date.now() now = Date.now()
DAY = 24 * 60 * 60 DAY = 24 * 60 * 60
if lastChecked < now - 1*DAY if lastChecked < now - 1*DAY
@ -1217,7 +1217,7 @@ if lastChecked < now - 1*DAY
GM_setValue("hiddenThreads/#{g.BOARD}/", JSON.stringify(g.hiddenThreads)) GM_setValue("hiddenThreads/#{g.BOARD}/", JSON.stringify(g.hiddenThreads))
GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies)) GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies))
GM_setValue('lastChecked', now) GM_setValue('lastChecked', now.toString())
GM_addStyle ' GM_addStyle '
#iHover { #iHover {