#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0

    AddEventListener - change execution order


    Hello everyone,

    Let's suppose an element has some attached functions on keydown, which where added using the addEventListener function.

    I want to add my own function to be executed but move its execution to the top. In other words I want my function to be executed before any other.

    Changing the source and adding my own addEventListener first is not an option :/

    Has anyone faced anything a similar issue? Do you have any ideas on how to solve it?

    I would like to mention that ANY solution is acceptable even if it requires additional JS frameworks etc.

    Thanks in advance
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,188
    Rep Power
    184
    Originally Posted by Howlett
    Changing the source and adding my own addEventListener first is not an option :/
    What are limitations; as far as how you are able to use/apply this source code? If you tell me this; I can make further suggestions or... better yet; post your code and I can get a better idea of how to tackle, what your trying to do.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0
    Hi.

    What I'm trying to do is simple but yet complicated.

    If you have a facebook account you can navigate to facebook/messages (I cannot include any URL in my posts).

    That's the textarea I want to hook and what I want to do is when the user hits the ENTER key I want to be able to add something to the text before letting it get processed.

    But whatever I do (I try simply to display an alert box), the alert shows up after the input has already been processed.

    *ANY* help would be really appreciated.

    Thanks
  6. #4
  7. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,188
    Rep Power
    184
    You cannot manipulate the content of an individual's Facebook form elements, because of login/security reasons and hence-forth; this would defeat the purpose of having a login authentication process.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0
    What does authentication have to do with it?

    I want to create a browser extension that can add extra functionality to the textarea of facebook chat, from within facebook. I don't think there is anything security-related about that.
  10. #6
  11. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,188
    Rep Power
    184
    Originally Posted by Howlett
    That's the textarea I want to hook and what I want to do is when the user hits the ENTER key I want to be able to add something to the text before letting it get processed.
    From this comment and the fact, that you did not mention; you were trying to create a browser extension; lead me to believe you were wanting access and/or have control over an individual's FB messages. Look into: CrossRider or Kango; that should help you out with this.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0
    I see, I apologize for the misunderstanding then

    As I can see CrossRider and Kango are frameworks to build a browser extension. But my problem isn't the extension itself but the ability to bind a function to an object and move that function to the top of the execution list so that it will be executed before any other function.

IMN logo majestic logo threadwatch logo seochat tools logo