forked from GithubBackups/vichan
thread-watcher.js: add support for new ui
This commit is contained in:
parent
dfebd02614
commit
9acf81b31a
@ -88,10 +88,11 @@ watchlist.add = function(sel) {
|
|||||||
// Grab the reply link.;
|
// Grab the reply link.;
|
||||||
let threadLink = $(sel).siblings('a:not(.watchThread)').last().attr('href');
|
let threadLink = $(sel).siblings('a:not(.watchThread)').last().attr('href');
|
||||||
// Figure out the thread name. If anon, use the thread id.
|
// Figure out the thread name. If anon, use the thread id.
|
||||||
if ($(sel).parent().find('.subject').length) {
|
let subject = $(sel).parent().parent().find('.subject');
|
||||||
threadName = $(sel).parent().find('.subject').text().substring(0,20);
|
if (subject.length) {
|
||||||
|
threadName = subject.text().substring(0, 20);
|
||||||
} else {
|
} else {
|
||||||
threadName = $(sel).parents('div').last().attr('id');
|
threadName = $(sel).parent('div')[0].id.slice(3); // Remove "op_".
|
||||||
}
|
}
|
||||||
|
|
||||||
threadInfo = [board_name, threadName, postCount, threadLink];
|
threadInfo = [board_name, threadName, postCount, threadLink];
|
||||||
@ -153,8 +154,8 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// Append the watchlist toggle button.
|
// Append the watchlist toggle button.
|
||||||
$('.boardlist').append('<div class="watchlist-container" style="float:right;"><a class="watchlist-toggle" href="#">[' + _('Watchlist') + ']</a></div>');
|
$('.boardlist').append('<div class="watchlist-container" style="float:right;"><a class="watchlist-toggle" href="#">[' + _('Watchlist') + ']</a></div>');
|
||||||
// Append a watch thread button after every OP post number.
|
// Append a watch thread button in the user controls container.
|
||||||
$('.op>.intro>.post_no:odd').after('<a class="watchThread" href="#">[' + _('Watch Thread') + ']</a>');
|
$('div.post.op>.intro>.user-controls').append('<a class="watchThread" href="#">[' + _('Watch Thread') + ']</a>');
|
||||||
|
|
||||||
// Draw the watchlist, hidden.
|
// Draw the watchlist, hidden.
|
||||||
watchlist.render();
|
watchlist.render();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user