From 9acf81b31a4f4b031a3fed8ada2223332aaa9eec Mon Sep 17 00:00:00 2001 From: Zankaria Date: Tue, 1 Oct 2024 01:14:31 +0200 Subject: [PATCH] thread-watcher.js: add support for new ui --- js/thread-watcher.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/js/thread-watcher.js b/js/thread-watcher.js index a7afccd5..c2a196bb 100644 --- a/js/thread-watcher.js +++ b/js/thread-watcher.js @@ -88,10 +88,11 @@ watchlist.add = function(sel) { // Grab the reply link.; let threadLink = $(sel).siblings('a:not(.watchThread)').last().attr('href'); // Figure out the thread name. If anon, use the thread id. - if ($(sel).parent().find('.subject').length) { - threadName = $(sel).parent().find('.subject').text().substring(0,20); + let subject = $(sel).parent().parent().find('.subject'); + if (subject.length) { + threadName = subject.text().substring(0, 20); } else { - threadName = $(sel).parents('div').last().attr('id'); + threadName = $(sel).parent('div')[0].id.slice(3); // Remove "op_". } threadInfo = [board_name, threadName, postCount, threadLink]; @@ -153,8 +154,8 @@ $(document).ready(function() { // Append the watchlist toggle button. $('.boardlist').append('
[' + _('Watchlist') + ']
'); - // Append a watch thread button after every OP post number. - $('.op>.intro>.post_no:odd').after('[' + _('Watch Thread') + ']'); + // Append a watch thread button in the user controls container. + $('div.post.op>.intro>.user-controls').append('[' + _('Watch Thread') + ']'); // Draw the watchlist, hidden. watchlist.render();