Here http://hg.toolness.com/ubiquity-firefox/rev/9432d68f963f it says
that: "instead of using file:// to inject jQuery we use resource://.
We can't use chrome b/c chrome URI's can't be included in content
code."
Does it mean that I can include other js files only with resource://
URIs ?
On Nov 28, 4:56 pm, [EMAIL PROTECTED] wrote:
> What version of Ubiquity are you using?
>
>
>
> On Fri, Nov 28, 2008 at 1:51 PM, Aurimas <[EMAIL PROTECTED]> wrote:
>
> > I've tried that and it says "CmdUtils is undefined":
>
> > CmdUtils.injectJavascript('file:///c:/ubiquity_commands/script.js',
> > Utils.safeWrapper(function(){
> > CmdUtils.getWindowInsecure().loadCommands();
> > })
> > )
>
> > Contents of script.js:
> > var loadCommands = function(){
> > CmdUtils.CreateCommand({ ... ... ... })
> > CmdUtils.CreateCommand({ ... ... ... })
> > ... ... ...
> > }
>
> > On Nov 28, 11:32 am, [EMAIL PROTECTED] wrote:
> > > I think there are examples in the ubiquity source code itself:
>
> > > CmdUtils.loadJQuery = function loadJQuery(func) {
> > > CmdUtils.injectJavascript(
> > > "resource://ubiquity-scripts/jquery.js",
> > > Utils.safeWrapper( function() {
> > > var contentJQuery = CmdUtils.getWindowInsecure().jQuery;
> > > func(contentJQuery);
> > > })
> > > );
>
> > > And I think injectJavaScript does exactly that (3rd line of the above
> > code).
> > > However, it will become a lot clearer once there is more info on how the
> > > callbacks work (lines 4-6 above).
>
> > > - Mayuresh
>
> > > On Fri, Nov 28, 2008 at 6:45 AM, Aurimas <[EMAIL PROTECTED]>
> > wrote:
>
> > > > I want to keep my commands in several separate JS files. How can I
> > > > load them into one main script?
>
> > > > On Nov 28, 12:58 am, [EMAIL PROTECTED] wrote:
> > > > > No, that does not work. For some reason the Utils.safeWrapper appears
> > to
> > > > be
> > > > > required. I wonder why?? Actual code is as follows:
>
> > > > > ...
> > > > > CmdUtils.injectJavascript(
> > > > > strJSUrl,
> > > > > Utils.safeWrapper( function() {
> > > > > var remoteObject =
> > > > CmdUtils.getWindowInsecure().remoteObject;
> > > > > displayMessage( "Within callback " + remoteObject
> > > > > .remoteAttribute );
>
> > > > > //This is the bit I am having trouble with
> > > > > remoteObject.a( input.text, ???); // ??? is expected
> > to be
> > > > a
> > > > > string!
> > > > > })
> > > > > );
> > > > > ...
>
> > > > > In any case, I am happy to have moved ahead a bit. I come to a point
> > > > where I
> > > > > can see the message notification.
>
> > > > > Here's a further question on how handling callbacks from methods
> > within
> > > > the
> > > > > external JS? Especially when it is a string??
> > > > > Doing the standard route with a
>
> > > > > remoteObject.a( input.text, function( data ) { displayMessage("data =
> > " +
> > > > > data); } );
>
> > > > > does not work!
>
> > > > > Any pointers?
>
> > > > > tia..
>
> > > > > - Mayuresh
>
> > > > > On Thu, Nov 27, 2008 at 4:21 PM, gtdphp developers <
> > > > [EMAIL PROTECTED]>wrote:
>
> > > > > > > But It's the callback bit I cant seem to
> > > > > > > fathom. I need to be able to do something on the lines of (this
> > is
> > > > > > > pseudocode):
>
> > > > > > > var myRemoteScript = CmdUtils.injectJavascript( "
> > > >http://xyz/script.js"
> > > > > > );
> > > > > > > var myRemoteObject = myRemoteScript.MyObject;
> > > > > > > myRemoteObject.a( some_params );
>
> > > > > > Try something like:
>
> > > > > > CmdUtils.injectJavascript( "http://xyz/script.js", function
> > > > > > myremotescript() {
> > > > > > var myRemoteObject = myRemoteScript.MyObject;
> > > > > > myRemoteObject.a(some_params);
> > > > > > });
>
> > > --
> > > Mayuresh
>
> --
> Mayuresh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ubiquity-firefox" 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/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---