Perhaps Fernando can make a screencap based tutorial - especially for
debugging Ubiquity code?
- Mayuresh
On Sat, Nov 29, 2008 at 1:42 AM, Christian Sonne <[EMAIL PROTECTED]>wrote:
> I still haven't figured out how people actually use firebug for anything -
> other than inspecting elements... :-S
> ahh yes.. good old window.alert() is all you need for js-debugging :-P
>
>
> On Fri, Nov 28, 2008 at 11:23 PM, Fernando Takai <[EMAIL PROTECTED]
> > wrote:
>
>> You never used Firebug? And did you debugged js? o.0
>>
>>
>> On Fri, Nov 28, 2008 at 8:18 PM, <[EMAIL PROTECTED]> wrote:
>>
>>> yes, you are right (and I've discovered Firebug!)
>>>
>>> On Fri, Nov 28, 2008 at 10:04 PM, Fernando Takai <
>>> [EMAIL PROTECTED]> wrote:
>>>
>>>> Try changing the CmdUtils.getWindow to getWindowInsecure. It should
>>>> work.
>>>>
>>>> On Fri, Nov 28, 2008 at 7:18 PM, Fernando Takai <
>>>> [EMAIL PROTECTED]> wrote:
>>>>
>>>>> Ok, I never really used this function, but i tried today - and i found
>>>>> that CmdUtils.injectJavascript calls CmdUtils.getWindowInsecure. Well, for
>>>>> me (using the dev version - latest tip) it was giving a
>>>>> CmdUtils.getWindowInsecure is not defined - I had to change it to
>>>>> getWindow,
>>>>> and it worked.
>>>>>
>>>>> Sample:
>>>>>
>>>>> CmdUtils.CreateCommand({
>>>>> name: "inject",
>>>>> preview: function( pblock, input ) {
>>>>> },
>>>>> execute: function(input) {
>>>>> CmdUtils.injectJavascript("
>>>>> http://www.prototypejs.org/javascripts/prototype.js",function(){
>>>>> CmdUtils.log(CmdUtils.getWindow().Prototype)
>>>>> })
>>>>> }
>>>>> });
>>>>>
>>>>>
>>>>> On Fri, Nov 28, 2008 at 6:33 PM, <[EMAIL PROTECTED]> wrote:
>>>>>
>>>>>> Perhaps Atul can shed some light? Strangely enough the members of the
>>>>>> core development team have been silent on this??
>>>>>>
>>>>>>
>>>>>> On Fri, Nov 28, 2008 at 4:57 PM, Aurimas <[EMAIL PROTECTED]>wrote:
>>>>>>
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Mayuresh
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Fernando "Takai"
>>>>> http://flickr.com/photos/supeertakai
>>>>> http://fernandotakai.jaiku.com
>>>>>
>>>>> Get Ubiquity: https://wiki.mozilla.org/Labs/Ubiquity/
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Fernando "Takai"
>>>> http://flickr.com/photos/supeertakai
>>>> http://fernandotakai.jaiku.com
>>>>
>>>> Get Ubiquity: https://wiki.mozilla.org/Labs/Ubiquity/
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Mayuresh
>>>
>>>
>>>
>>
>>
>> --
>> Fernando "Takai"
>> http://flickr.com/photos/supeertakai
>> http://fernandotakai.jaiku.com
>>
>> Get Ubiquity: https://wiki.mozilla.org/Labs/Ubiquity/
>>
>>
>>
>
> >
>
--
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
-~----------~----~----~----~------~----~------~--~---