[The following is self-answering post after resolving the problem by myself. I guess some people may find it useful.]
I try to use JQuery’s resizable and draggable in Greasemonkey script, and
- I get error in JS console “Component is not available
(NS_ERROR_NOT_AVAILABLE)”, - OR:
- I get no errors in JS console, but draggable doesn’t work.
How to solve this?
The reason is that some versions of JQuery and its plugins are not compatible with GreaseMonkey.
The following is the code snippet that is confirmed to be working with Firefox 7.0.1 + GreaseMonkey 0.9.11
(should probably work in Fx 3.0+ with GM 0.8+).
It takes advantage of GreaseMonkey’s 0.8+
@requireand@resourcecommands. Files in@requireand@resourceare downloaded (once) when the user script is installed, and stored on disk in the same folder as the user script.
When the set of dependencies is changed e.g. by the user playing with code, all dependencies are re-downloaded.
You may add the following after
@requires to load JQuery UI CSS, but it is not necessary:Some information about compatibility:
Literature:
Related StackOverflow questions: