Fix TypeError if no comment section was found

This commit is contained in:
ekzyis 2022-12-25 02:57:52 +01:00
parent 6f1a38bb7d
commit 76aac85ad4
1 changed files with 1 additions and 0 deletions

View File

@ -48,6 +48,7 @@ const log = (msg) => console.log(`sn-translator: `, msg);
function addButtons() { function addButtons() {
const commentSection = document.querySelector('.item_comments__cN57K'); const commentSection = document.querySelector('.item_comments__cN57K');
if (!commentSection) return;
const comments = commentSection.querySelectorAll('.comment_comment__5uvl3'); const comments = commentSection.querySelectorAll('.comment_comment__5uvl3');
log(`Found ${comments.length} comment(s)`); log(`Found ${comments.length} comment(s)`);
log(`Adding translate button to every comment ...`); log(`Adding translate button to every comment ...`);