make hidden replies / threads local to board

This commit is contained in:
James Campos 2010-04-29 01:46:45 -07:00
parent 6c0ed290bc
commit e2ac09ddbb
2 changed files with 16 additions and 18 deletions

View File

@ -133,8 +133,8 @@ if not favicon: $('link[rel="shortcut icon"]', head)#/f/
favNormal: favicon.href
favEmpty: 'data:image/gif;base64,R0lGODlhEAAQAJEAAAAAAP///9vb2////yH5BAEAAAMALAAAAAAQABAAAAIvnI+pq+D9DBAUoFkPFnbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw=='
hiddenThreads: JSON.parse(GM_getValue('hiddenThreads', '[]'))
hiddenReplies: JSON.parse(GM_getValue('hiddenReplies', '[]'))
hiddenThreads: JSON.parse(GM_getValue("hiddenThreads/$BOARD/", '[]'))
hiddenReplies: JSON.parse(GM_getValue("hiddenReplies/$BOARD/", '[]'))
lastChecked: GM_getValue('lastChecked', 0)
now: getTime()
@ -151,8 +151,8 @@ if lastChecked < now - day
break
hiddenReplies.shift()
GM_setValue('hiddenThreads', JSON.stringify(hiddenThreads))
GM_setValue('hiddenReplies', JSON.stringify(hiddenReplies))
GM_setValue("hiddenThreads/$BOARD/", JSON.stringify(hiddenThreads))
GM_setValue("hiddenReplies/$BOARD/", JSON.stringify(hiddenReplies))
GM_setValue('lastChecked', now)
GM_addStyle('
@ -281,7 +281,7 @@ showThread: ->
hide(this)
id: div.id
slice(hiddenThreads, id)
GM_setValue('hiddenThreads', JSON.stringify(hiddenThreads))
GM_setValue("hiddenThreads/$BOARD/", JSON.stringify(hiddenThreads))
hideThread: (div) ->
@ -291,7 +291,7 @@ hideThread: (div) ->
id: div.id
timestamp: getTime()
})
GM_setValue('hiddenThreads', JSON.stringify(hiddenThreads))
GM_setValue("hiddenThreads/$BOARD/", JSON.stringify(hiddenThreads))
hide(div)
if getValue('Show Stubs')
a: tag('a')
@ -300,7 +300,6 @@ hideThread: (div) ->
n: Number(span.textContent.match(/\d+/)[0])
else
n: 0
console.log(n)
n += $$('table', div).length
text: if n is 1 then "1 reply" else "$n replies"
name: $('span.postername', div).textContent
@ -345,7 +344,7 @@ showReply: ->
remove(div)
id: $('td.reply, td.replyhl', table).id
slice(hiddenReplies, id)
GM_setValue('hiddenReplies', JSON.stringify(hiddenReplies))
GM_setValue("hiddenReplies/$BOARD/", JSON.stringify(hiddenReplies))
hideReply: (reply) ->
@ -355,7 +354,7 @@ hideReply: (reply) ->
id: reply.id
timestamp: getTime()
})
GM_setValue('hiddenReplies', JSON.stringify(hiddenReplies))
GM_setValue("hiddenReplies/$BOARD/", JSON.stringify(hiddenReplies))
name: $('span.commentpostername', reply).textContent
trip: $('span.postertrip', reply)?.textContent || ''

View File

@ -168,8 +168,8 @@
}
favNormal = favicon.href;
favEmpty = 'data:image/gif;base64,R0lGODlhEAAQAJEAAAAAAP///9vb2////yH5BAEAAAMALAAAAAAQABAAAAIvnI+pq+D9DBAUoFkPFnbs7lFZKIJOJJ3MyraoB14jFpOcVMpzrnF3OKlZYsMWowAAOw==';
hiddenThreads = JSON.parse(GM_getValue('hiddenThreads', '[]'));
hiddenReplies = JSON.parse(GM_getValue('hiddenReplies', '[]'));
hiddenThreads = JSON.parse(GM_getValue(("hiddenThreads/" + BOARD + "/"), '[]'));
hiddenReplies = JSON.parse(GM_getValue(("hiddenReplies/" + BOARD + "/"), '[]'));
lastChecked = GM_getValue('lastChecked', 0);
now = getTime();
day = 24 * 60 * 60;
@ -187,8 +187,8 @@
}
hiddenReplies.shift();
}
GM_setValue('hiddenThreads', JSON.stringify(hiddenThreads));
GM_setValue('hiddenReplies', JSON.stringify(hiddenReplies));
GM_setValue(("hiddenThreads/" + BOARD + "/"), JSON.stringify(hiddenThreads));
GM_setValue(("hiddenReplies/" + BOARD + "/"), JSON.stringify(hiddenReplies));
GM_setValue('lastChecked', now);
}
GM_addStyle(' \
@ -321,7 +321,7 @@ cursor: pointer; \
hide(this);
id = div.id;
slice(hiddenThreads, id);
return GM_setValue('hiddenThreads', JSON.stringify(hiddenThreads));
return GM_setValue(("hiddenThreads/" + BOARD + "/"), JSON.stringify(hiddenThreads));
};
hideThread = function hideThread(div) {
var _c, a, n, name, p, span, text, trip;
@ -331,14 +331,13 @@ cursor: pointer; \
id: div.id,
timestamp: getTime()
});
GM_setValue('hiddenThreads', JSON.stringify(hiddenThreads));
GM_setValue(("hiddenThreads/" + BOARD + "/"), JSON.stringify(hiddenThreads));
}
hide(div);
if (getValue('Show Stubs')) {
a = tag('a');
//n: parseInt($('span.omittedposts', div)?.textContent) || 0
(span = $('.omittedposts', div)) ? (n = Number(span.textContent.match(/\d+/)[0])) : (n = 0);
console.log(n);
n += $$('table', div).length;
text = n === 1 ? "1 reply" : ("" + n + " replies");
name = $('span.postername', div).textContent;
@ -386,7 +385,7 @@ cursor: pointer; \
remove(div);
id = $('td.reply, td.replyhl', table).id;
slice(hiddenReplies, id);
return GM_setValue('hiddenReplies', JSON.stringify(hiddenReplies));
return GM_setValue(("hiddenReplies/" + BOARD + "/"), JSON.stringify(hiddenReplies));
};
hideReply = function hideReply(reply) {
var _c, a, div, name, p, table, trip;
@ -396,7 +395,7 @@ cursor: pointer; \
id: reply.id,
timestamp: getTime()
});
GM_setValue('hiddenReplies', JSON.stringify(hiddenReplies));
GM_setValue(("hiddenReplies/" + BOARD + "/"), JSON.stringify(hiddenReplies));
}
name = $('span.commentpostername', reply).textContent;
trip = ((_c = $('span.postertrip', reply)) == undefined ? undefined : _c.textContent) || '';