Last active
January 5, 2025 10:31
-
-
Save sayhicoelho/04b7fa3289e3265c03f58849c914081c to your computer and use it in GitHub Desktop.
Revisions
-
sayhicoelho revised this gist
Nov 9, 2022 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ function sendMessage(message){ const mainEl = document.querySelector('#main') const textareaEl = mainEl.querySelector('div[contenteditable="true"]') if(!textareaEl) { throw new Error('There is no opened conversation') } textareaEl.focus() document.execCommand('insertText', false, message) textareaEl.dispatchEvent(new Event('change', { bubbles: true })) -
sayhicoelho revised this gist
Nov 9, 2022 . 1 changed file with 12 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,16 @@ function sendMessage(message){ const mainEl = document.querySelector('#main') const textareaEl = mainEl.querySelector('div[contenteditable="true"]') if(!textareaEl) { throw new Error('There is no opened conversation') } textareaEl.focus() document.execCommand('insertText', false, message) textareaEl.dispatchEvent(new Event('change', { bubbles: true })) setTimeout(() => { (mainEl.querySelector('[data-testid="send"]') || mainEl.querySelector('[data-icon="send"]')).click() }, 100) } -
sayhicoelho revised this gist
May 8, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,10 +5,10 @@ function sendMessage (message) { bubbles: true }); var textbox = document.querySelector('[role="textbox"][data-tab="10"]'); textbox.textContent = message; textbox.dispatchEvent(event); $('[data-testid="send"]').closest("button").click(); } -
sayhicoelho revised this gist
Dec 22, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,10 +5,10 @@ function sendMessage (message) { bubbles: true }); var textbox = document.querySelector('div._3u328'); textbox.textContent = message; textbox.dispatchEvent(event); document.querySelector("button._3M-N-").click(); } -
sayhicoelho revised this gist
Nov 25, 2018 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,14 @@ function sendMessage (message) { window.InputEvent = window.Event || window.InputEvent; var event = new InputEvent('input', { bubbles: true }); var textbox = document.querySelector('div._2S1VP'); textbox.textContent = message; textbox.dispatchEvent(event); document.querySelector("button._35EW6").click(); } -
sayhicoelho created this gist
Nov 25, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ function sendMessage (message) { window.InputEvent = window.Event || window.InputEvent; var event = new InputEvent('input', { bubbles: true }); var textbox = document.querySelector('div._2S1VP'); textbox.textContent = message; textbox.dispatchEvent(event); document.querySelector("button._35EW6").click(); }