Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 42 additions & 22 deletions beeMovieSendScript.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,45 @@
async function enviarScript(scriptText){
const lines = scriptText.split(/[\n\t]+/).map(line => line.trim()).filter(line => line);
main = document.querySelector("#main"),
textarea = main.querySelector(`div[contenteditable="true"]`)

if(!textarea) throw new Error("Não há uma conversa aberta")

for(const line of lines){
console.log(line)

textarea.focus();
document.execCommand('insertText', false, line);
textarea.dispatchEvent(new Event('change', {bubbles: true}));

setTimeout(() => {
(main.querySelector(`[data-testid="send"]`) || main.querySelector(`[data-icon="send"]`)).click();
}, 100);

if(lines.indexOf(line) !== lines.length - 1) await new Promise(resolve => setTimeout(resolve, 250));
}

return lines.length;
async function enviarScript(scriptText) {
const lines = scriptText
.split(/[\n\t]+/)
.map(line => line.trim())
.filter(line => line);

const main = document.querySelector("#main");
const textarea = main?.querySelector('[contenteditable="true"]');

if (!main || !textarea) throw new Error("Não há uma conversa aberta");

for (const [index, line] of lines.entries()) {
console.log(`Enviando: ${line}`);

const dataTransfer = new DataTransfer();
dataTransfer.setData("text", line);
const pasteEvent = new ClipboardEvent("paste", {
clipboardData: dataTransfer,
bubbles: true,
});

textarea.focus();
textarea.dispatchEvent(pasteEvent);

await new Promise(resolve => setTimeout(resolve, 100));

const enterEvent = new KeyboardEvent("keydown", {
key: "Enter",
code: "Enter",
keyCode: 13,
which: 13,
bubbles: true,
cancelable: true
});
textarea.dispatchEvent(enterEvent);

if (index < lines.length - 1) {
await new Promise(resolve => setTimeout(resolve, 300));
}
}

return lines.length;
}

enviarScript(`
Expand Down
64 changes: 42 additions & 22 deletions shrekSendScript.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,45 @@
async function enviarScript(scriptText){
const lines = scriptText.split(/[\n\t]+/).map(line => line.trim()).filter(line => line);
main = document.querySelector("#main"),
textarea = main.querySelector(`div[contenteditable="true"]`)

if(!textarea) throw new Error("Não há uma conversa aberta")

for(const line of lines){
console.log(line)

textarea.focus();
document.execCommand('insertText', false, line);
textarea.dispatchEvent(new Event('change', {bubbles: true}));

setTimeout(() => {
(main.querySelector(`[data-testid="send"]`) || main.querySelector(`[data-icon="send"]`)).click();
}, 100);

if(lines.indexOf(line) !== lines.length - 1) await new Promise(resolve => setTimeout(resolve, 250));
}

return lines.length;
async function enviarScript(scriptText) {
const lines = scriptText
.split(/[\n\t]+/)
.map(line => line.trim())
.filter(line => line);

const main = document.querySelector("#main");
const textarea = main?.querySelector('[contenteditable="true"]');

if (!main || !textarea) throw new Error("Não há uma conversa aberta");

for (const [index, line] of lines.entries()) {
console.log(`Enviando: ${line}`);

const dataTransfer = new DataTransfer();
dataTransfer.setData("text", line);
const pasteEvent = new ClipboardEvent("paste", {
clipboardData: dataTransfer,
bubbles: true,
});

textarea.focus();
textarea.dispatchEvent(pasteEvent);

await new Promise(resolve => setTimeout(resolve, 100));

const enterEvent = new KeyboardEvent("keydown", {
key: "Enter",
code: "Enter",
keyCode: 13,
which: 13,
bubbles: true,
cancelable: true
});
textarea.dispatchEvent(enterEvent);

if (index < lines.length - 1) {
await new Promise(resolve => setTimeout(resolve, 300));
}
}

return lines.length;
}

enviarScript(`
Expand Down