From 327926a748957c02e471d5150a9704847d574fa4 Mon Sep 17 00:00:00 2001 From: adrianmarinwork Date: Tue, 6 Dec 2022 18:56:53 +0100 Subject: [PATCH] converted to foreach as requested in PR #7 --- src/content_script.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/content_script.js b/src/content_script.js index c65a904..09b50de 100644 --- a/src/content_script.js +++ b/src/content_script.js @@ -76,20 +76,16 @@ function downloadThread({ as = Format.PNG } = {}) { onclone: function (cloneDoc) { //Make small fix of position to all the text containers let listOfTexts = cloneDoc.getElementsByClassName('min-h-[20px]'); - - for (let i = 0, leng = listOfTexts.length; i < leng; i++) { - let text = listOfTexts[i]; - text.style['position'] = 'relative'; - text.style['top'] = '-8px'; - } + Array.from(listOfTexts).forEach((text) => { + text.style.position = 'relative'; + text.style.top = '-8px'; + }); //Delete copy button from code blocks let listOfCopyBtns = cloneDoc.querySelectorAll('button.flex'); - - for (let i = 0, leng = listOfCopyBtns.length; i < leng; i++) { - let button = listOfCopyBtns[i]; - button.remove(); - } + Array.from(listOfCopyBtns).forEach( + (btn) => (btn.remove()) + ); } } ).then(async function (canvas) {