From a518799ffff8b76912874737a15027bf48dcab53 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 3 Aug 2021 19:13:51 +0300 Subject: [PATCH] [BZ Fresh UI] Minor tweak in implementation. There was no need to fetch commenst to access the headers. --- bz_fresh_ui.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bz_fresh_ui.js b/bz_fresh_ui.js index 3c9d9f5..3acef40 100644 --- a/bz_fresh_ui.js +++ b/bz_fresh_ui.js @@ -83,11 +83,10 @@ async function formatComments() { log('Started'); - const comments = [...document.getElementsByClassName('bz_comment')]; - comments.forEach(async comment => { - const header = comment.getElementsByClassName('bz_comment_head')[0] || - comment.getElementsByClassName('bz_first_comment_head')[0]; - if (!header) return; + const headers = [...document.getElementsByClassName('bz_comment_head'), + ...document.getElementsByClassName('bz_first_comment_head')]; + log(`Found ${headers.length} headers to add avatars to`); + headers.forEach(async header => { if ([...header.getElementsByClassName('sd_bz_user_avatar')].length) return; const children = [...header.children]; const userDataElm = children