I was able to get it to work, but there are other smaller problems.
Here's what worked:
// ==UserScript==
// @name Dialog Test
// @namespace http://strd6.com
// @description jquery-ui-1.6rc6 Dialog Test
// @include *
//
// @resource jQuery
http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js
// @resource jQueryUI
http://strd6.com/stuff/jqui/jquery-ui-personalized-1.6rc6.min.js
// ==/UserScript==
// Inject jQuery into page... gross hack... for now...
(function() {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
var jQuery = GM_getResourceText('jQuery');
var jQueryUI = GM_getResourceText('jQueryUI');
script.innerHTML = jQuery + jQueryUI;
head.appendChild(script);
$ = unsafeWindow.$;
})();
$(document).ready(function() {
$('<div title="Test">SomeText</div>').dialog();
});
The problems I'm having now stem from $ being in the unsafeWindow
context, so I can't call certain GM methods from the unsafe context
(like inside $.each). I can 'learn to deal', but there's got to be a
way to get to the root of this and have jQueryUI work from within
Greasemonkey. Maybe in a couple of weeks when I'm more familiar with
both jQuery and GM I'll be able to go in and patch it. I'm now also
90% certain that it's an XPCNativeWrapper issue, so there should be an
simple workaround by changing some code in the dialog plugin.
On Feb 19, 6:39 am, Fontzter <[email protected]> wrote:
> Hey Daniel,
>
> Not sure, but this might help:http://joanpiedra.com/jquery/greasemonkey/
>
> Lmk, if you get it working.
>
> Dave
>
> On Feb 19, 12:50 am, Daniel X Moore <[email protected]> wrote:
>
> > I'm getting this awkward error any time I try and create a dialog from
> > Greasemonkey... I believe it has to do with the limitations of
> > XPCNativeWrapperhttps://developer.mozilla.org/en/XPCNativeWrapper#Limitations_of_XPCN...
> > , though I am not 100% sure.
>
> > None of the core jQuery methods that I've used have caused errors
> > (append, css, submit, keydown, each, ...).
>
> > It is possible that this could be an error in Greasemonkey or due to
> > the interaction between Greasemonkey and jquery ui, but I am really
> > interested in figuring out how to get them to work together.
>
> > // ==UserScript==
> > // @name Dialog Test
> > // @namespace http://strd6.com
> > // @description jquery-ui-1.6rc6 Dialog Test
> > // @include *
> > //
> > // @require
> > http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js
> > // @require
> > http://strd6.com/stuff/jqui/jquery-ui-personalized-1.6rc6.min.js
>
> > // ==/UserScript==
>
> > $(document).ready(function() {
> > $('<div title="Test">SomeText</div>').dialog();
>
> > });
>
> > Error:
> > [Exception... "Component is not available" nsresult: "0x80040111
> > (NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
> > file:///home/daniel/.mozilla/firefox/.../components/greasemonkey.js ::
> > anonymous :: line 347" data: no]
> > [Break on this error] if (line) {
>
> > Firefox version:
> > Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.6) Gecko/2009020911
> > Ubuntu/8.04 (hardy) Firefox/3.0.6
>
> > Any help will be greatly appreciated!
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---