I Probably miss too much understanding of how ubiquity framework works,
but it still does not work
i enter the following into command editor:
//----------------------------------
function getUbiquity(){
var mainWindow =
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindow);
return mainWindow.gUbiquity;
}
function getCommandByName( name ) {
var ubiq = getUbiquity();
return ubiq.__cmdManager.__cmdSource.getCommand( name );
}
function pageLoad_autosetup()
{
var c = getCommandByName("setup");
displayMessage("run");
}
//---------------------------------------
commenting out the getCommandByName call make it show run message on
every page load so this is certainly where it brakes,
(by the way: this might be a really dumb question . but even if it
would work and get me the refernce to "setup" command - how do i
actually execute it?)
leaving the getCommandByName call uncommented gets me the following in
the error console:
Error: context is not defined
Source File:
file:///D:/DOCS/Mozilla_Profile/Petka_Firefox/extensions/[email protected]/modules/sandboxfactory.js
Line: 1481
Error: Traceback for last exception:
()@file:///D:/DOCS/Mozilla_Profile/Petka_Firefox/extensions/[email protected]/modules/sandboxfactory.js:1481
getUbiquity()@file:///D:/DOCS/Mozilla_Profile/Petka_Firefox/extensions/[email protected]/modules/sandboxfactory.js:2565
getCommandByName("setup")@file:///D:/DOCS/Mozilla_Profile/Petka_Firefox/extensions/[email protected]/modules/sandboxfactory.js:2576
pageLoad_autosetup([object
XPCNativeWrapper])@file:///D:/DOCS/Mozilla_Profile/Petka_Firefox/extensions/[email protected]/modules/sandboxfactory.js:2583
safeWrappedFunc([object
XPCNativeWrapper])@file:///D:/DOCS/Mozilla_Profile/Petka_Firefox/extensions/[email protected]/modules/sandboxfactory.js:149
FA_onPageLoad([object
XPCNativeWrapper])@file:///D:/DOCS/Mozilla_Profile/Petka_Firefox/extensions/[email protected]/modules/feedaggregator.js:88
onPageLoad([object
Event])@file:///D:/DOCS/Mozilla_Profile/Petka_Firefox/extensions/[email protected]/modules/setup.js:291
Source File:
file:///D:/DOCS/Mozilla_Profile/Petka_Firefox/extensions/[email protected]/modules/msgservice.js
Line: 88
Thanks a lot in advance!
Peter
Abimanyu Raja wrote:
> Take a look at the first 2 functions
> in http://azarask.in/verbs/mouse/mouse.js
>
> - Abi
>
> 2009/2/25 Peter Lazarev <[email protected]
> <mailto:[email protected]>>
>
> what is the mysterious way of doing this?
> i just haven't got enough ressources myself right now to work on
> the api myself.
> thanks for your help
> peter
>
> On Tue, Feb 24, 2009 at 12:26 PM, Abimanyu Raja
> <[email protected] <mailto:[email protected]>> wrote:
>
> Well, it is possible to run commands from other feeds in a
> very hackish way but yeah, a API would be great! Anyone
> interested to work on this?
>
> - Abi
>
> 2009/2/23 Blair McBride <[email protected]
> <mailto:[email protected]>>
>
>
> Only if the pageLoad_ function is in the same feed. Feeds
> run in their
> own sandbox now, separated from other feeds.
>
> We could do with an API for this type of thing.
>
> - Blair
>
>
>
>
> On 23/02/2009 7:18 PM, Aza wrote:
> > If I remember correctly, you can just call cmd_setup()
> inside the
> > pageLoad_* function
> >
> > -- aza | ɐzɐ --
> >
> >
> > On Sun, Feb 22, 2009 at 5:42 PM, Peter Lazarev
> <[email protected] <mailto:[email protected]>
> > <mailto:[email protected]
> <mailto:[email protected]>>> wrote:
> >
> >
> > Thanks for the answer, but i have even a bigger
> problem figuring out how
> > to call the ubiquity:mouse "setup" command is it a
> method of certain
> > object
> > sorry for the dumb question, though
> > Peter
> >
> > Abimanyu Raja wrote:
> > > Hey Peter,
> > >
> > > All functions that start with "pageLoad_" will be
> run on page load.
> > > You can read more about this here:
> > >
> >
>
> https://wiki.mozilla.org/Labs/Ubiquity/Ubiquity_0.1_Author_Tutorial#Running_on_page_load_and_startup
> > >
> > > Cheers,
> > > Abi
> > >
> > > 2009/2/23 Peter Lazarev <[email protected]
> <mailto:[email protected]>
> > <mailto:[email protected]
> <mailto:[email protected]>>
> > > <mailto:[email protected]
> <mailto:[email protected]>
> <mailto:[email protected]
> <mailto:[email protected]>>>>
> > >
> > > hello folks there must be an easy way to
> autotrigger the setup
> > > command every time a page is loaded. i'm so
> excited about
> > > ubiquity:mouse i really want to start using it,
> but its virtually
> > > useless unless i can get rid of the need to type
> "setup" on every
> > > page.
> > > i think i've figured out how to write commands.
> but how to call an
> > > existing command from insde my own and how to
> hook to the an event
> > > which is triggered when a page is fully loaded?...
> > >
> > > Thanks for your help Peter
> > >
> > >
> > >
> > >
> > > >
> >
> >
> >
> >
> >
> > >
>
>
>
>
>
>
>
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---