Move code into own function
This commit is contained in:
parent
b4354a9fdb
commit
69dec59a4c
|
@ -45,8 +45,7 @@ function translate(text, source, target) {
|
|||
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
(async function () {
|
||||
await sleep(1000);
|
||||
function addButtons() {
|
||||
console.log("sn-translator: Adding button to every comment ...");
|
||||
const commentSection = document.querySelector(".item_comments__cN57K");
|
||||
const comments = commentSection.querySelectorAll(".comment_comment__5uvl3");
|
||||
|
@ -68,4 +67,9 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|||
topBar.appendChild(btn);
|
||||
}
|
||||
console.log("Done");
|
||||
}
|
||||
|
||||
(async function () {
|
||||
await sleep(1000);
|
||||
addButtons();
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue