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));
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||||
|
|
||||||
(async function () {
|
function addButtons() {
|
||||||
await sleep(1000);
|
|
||||||
console.log("sn-translator: Adding button to every comment ...");
|
console.log("sn-translator: Adding button to every comment ...");
|
||||||
const commentSection = document.querySelector(".item_comments__cN57K");
|
const commentSection = document.querySelector(".item_comments__cN57K");
|
||||||
const comments = commentSection.querySelectorAll(".comment_comment__5uvl3");
|
const comments = commentSection.querySelectorAll(".comment_comment__5uvl3");
|
||||||
@ -68,4 +67,9 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|||||||
topBar.appendChild(btn);
|
topBar.appendChild(btn);
|
||||||
}
|
}
|
||||||
console.log("Done");
|
console.log("Done");
|
||||||
|
}
|
||||||
|
|
||||||
|
(async function () {
|
||||||
|
await sleep(1000);
|
||||||
|
addButtons();
|
||||||
})();
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user