Skip to content

Commit

Permalink
fix: dispatch more event to ensure it works
Browse files Browse the repository at this point in the history
  • Loading branch information
SunriseFox authored and Jack-Works committed Oct 10, 2019
1 parent 7b77c61 commit cddff6e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export async function pasteIntoBioFacebook(text: string) {
await sleep(200)
input.focus()
dispatchCustomEvents('input', input.value + text)
input.dispatchEvent(new CustomEvent('input', { bubbles: true, cancelable: false, composed: true }))
} catch {
console.warn('Text not pasted to the text area')
prompt(geti18nString('automation_request_paste_into_bio_box'), text)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export async function pasteIntoPostBoxFacebook(
await sleep(100)
if ('value' in document.activeElement!) dispatchCustomEvents('input', text)
else dispatchCustomEvents('paste', text)
element.dispatchEvent(new CustomEvent('input', { bubbles: true, cancelable: false, composed: true }))
await sleep(400)
if (isMobileFacebook) {
const e = document.querySelector<HTMLDivElement | HTMLTextAreaElement>('.mentions-placeholder')
Expand Down
1 change: 1 addition & 0 deletions src/social-network-provider/facebook.com/ui-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const facebookUISelf = defineSocialNetworkUI({
if (!textarea) return fail()
textarea.focus()
dispatchCustomEvents('input', encryptedComment)
textarea.dispatchEvent(new CustomEvent('input', { bubbles: true, cancelable: false, composed: true }))
await sleep(200)
if (!root.innerText.includes(encryptedComment)) return fail()
} else {
Expand Down

0 comments on commit cddff6e

Please sign in to comment.