Chrome Extension: Modify messagetext in facebook-chat when submitted

余生长醉 提交于 2019-12-07 14:03:09

问题


I'm trying to create a Chrome Extension which modifies the submitted message when the user presses enter in the chatbox. HTML-Code for textarea:

<textarea class="uiTextareaAutogrow input" onkeydown="Bootloader.loadComponents([&quot;control-textarea&quot;], function() { TextAreaControl.getInstance(this) }.bind(this)); "></textarea>

I tried to use something like this for onkeydown-event. I want to replace users message with the text 'test' when he presses Enter and submits the text

if (event.keyCode == 13) {this.value='test';}

But of course this doesn't work because facebooks javascript uses Eventlisteners and .bind so the value in the textarea changes AFTER the text is processed and submitted but I need to modify it BEFORE it is processed. Does somebody know how I could solve this?

来源:https://stackoverflow.com/questions/11529083/chrome-extension-modify-messagetext-in-facebook-chat-when-submitted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!