user javascript functions? - Mozilla

This is a discussion on user javascript functions? - Mozilla ; Hi, Is there an article somewhere of how I can add my own set of functions, so that I can call them from bookmarklets? Are there any hooks (new tab, page load etc.) that I can set to call my ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: user javascript functions?

  1. user javascript functions?

    Hi,

    Is there an article somewhere of how I can add my own set of
    functions, so that I can call them from bookmarklets? Are there any
    hooks (new tab, page load etc.) that I can set to call my functions?

    Thank you,
    Ittay


  2. Re: user javascript functions?

    Ittay Dror wrote:
    > Is there an article somewhere of how I can add my own set of
    > functions, so that I can call them from bookmarklets? Are there any
    > hooks (new tab, page load etc.) that I can set to call my functions?


    I'm sure there are hooks (events), but the purpose of a bookmarklet
    isn't to do that, and I doubt they have access to such things. They just
    run inside web pages.

    I guess you could write an extension or use userChrome.js.

    But what are you trying to do, anyway?
    --

  3. Re: user javascript functions?

    On Nov 3, 2:16 am, Matt Nordhoff wrote:
    > Ittay Dror wrote:
    > > Is there an article somewhere of how I can add my own set of
    > > functions, so that I can call them from bookmarklets? Are there any
    > > hooks (new tab, page load etc.) that I can set to call my functions?

    >
    > I'm sure there are hooks (events), but the purpose of a bookmarklet
    > isn't to do that, and I doubt they have access to such things. They just
    > run inside web pages.
    >
    > I guess you could write an extension or use userChrome.js.
    >
    > But what are you trying to do, anyway?
    > --


    I use bookmarklets for helping me with bugzilla (assign to someone,
    set target milestone), for rewriting urls so they map to an ssh tunnel
    port instead of the name of a server at work etc. Putting all the code
    in the bookmarklet itself is unmanageable, so I want to be able to
    create functions in some .js file and just call the function from the
    bookmarklet (so the bookmarklet is only
    'javascript:void(my_function())'.

    I'll check userChrome.js.

    Thanks,
    Ittay

    Btw, Firefox's extensions are great, but it is hard to learn how to
    create them. I suggest adding 'macro' capabilities to firefox so I can
    quickly hack such things (making macros appear in menues, toolbar
    buttons etc.).


+ Reply to Thread