where should I get started?

hi, all
    I want to build an extension which help user to extract
information in a web page. User may select a td and mark it as author
of the article and click on span and mark it as title... After "teach"
it, my extension can "learn" some pattern and extract information from
similar web page. To achieve this, I need to know how to capture mouse
event, like inspect element in firebug. That is I need to know which
element is clicked by mouse. Also I need to get postion information
such as left top width of element which help me analyze the web page.
firebug and dom inspector are similar to my need. But it's hard for me
to understand all the codes of these extensions. is there any tutorial
for me ? thank you.
0
fancyerii
2/24/2010 12:25:29 PM
mozilla.dev.extensions 5694 articles. 0 followers. Post Follow

2 Replies
614 Views

Similar Articles

[PageSpeed] 22
Get it on Google Play
Get it on Apple App Store

Hi,

You can get mouse events with javascript

 document.addEventListener('click', getClicked, false);

after the registered function you can do this

 function getClicked(event)
{
    try{
        if (!event.target)
            return;
        var srcElement =3D event.target;
        // Testing if the click event was triggered by a valid element type
(<a>, ...)
        if (srcElement.tagName !=3D 'a' && srcElement.tagName !=3D "A" &&
srcElement.tagName !=3D 'input' ) //&&              return;

Additional information about mouse events.
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-m=
ouseevents

Cheers!!


On Wed, Feb 24, 2010 at 9:25 AM, fancyerii <fancyerii@gmail.com> wrote:

> hi, all
>    I want to build an extension which help user to extract
> information in a web page. User may select a td and mark it as author
> of the article and click on span and mark it as title... After "teach"
> it, my extension can "learn" some pattern and extract information from
> similar web page. To achieve this, I need to know how to capture mouse
> event, like inspect element in firebug. That is I need to know which
> element is clicked by mouse. Also I need to get postion information
> such as left top width of element which help me analyze the web page.
> firebug and dom inspector are similar to my need. But it's hard for me
> to understand all the codes of these extensions. is there any tutorial
> for me ? thank you.
> _______________________________________________
> dev-extensions mailing list
> dev-extensions@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-extensions
>



--=20
Felipe Frechiani de Oliveira
Vit=F3ria - ES
0
Felipe
2/24/2010 1:04:59 PM
it depend on your extension organization. You can split it into lot's of js
files, which i recommend if your are planning to increase your extension.
You can find information and guides of how to configure it in https://*
developer*.*mozilla*.org/



On Wed, Feb 24, 2010 at 10:17 AM, galuschka
<galuschka.christoph@gmail.com>wrote:

>
> Hi,
> > -----Original Message-----
> > From:
> > dev-extensions-bounces+galuschka.christoph=3Dgmail.com@lists.mozilla.or=
g
> > [mailto:dev-extensions-bounces+galuschka.christoph<dev-extensions-bounc=
es%2Bgaluschka.christoph>
> =3Dgmail.com@lists.mozil
> > la.org] On Behalf Of Felipe Frechiani
> > Sent: Wednesday, February 24, 2010 9:05 PM
> > To: dev-extensions@lists.mozilla.org
> > Subject: Re: where should I get started?
> >
> > Hi,
> >
> > You can get mouse events with javascript
> >
> >  document.addEventListener('click', getClicked, false);
> >
> > after the registered function you can do this
> >
> >  function getClicked(event)
> > {
> >     try{
> >         if (!event.target)
> >             return;
> >         var srcElement =3D event.target;
> >         // Testing if the click event was triggered by a valid element
> type
> > (<a>, ...)
> >         if (srcElement.tagName !=3D 'a' && srcElement.tagName !=3D "A" =
&&
> > srcElement.tagName !=3D 'input' ) //&&              return;
> >
> am I adding these code into overlay.js ?
> > Additional information about mouse events.
> > http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgrou
> > pings-mouseevents
> >
> > Cheers!!
> >
> >
> > On Wed, Feb 24, 2010 at 9:25 AM, fancyerii <fancyerii@gmail.com> wrote:
> >
> > > hi, all
> > >    I want to build an extension which help user to extract
> > > information in a web page. User may select a td and mark it as author
> > > of the article and click on span and mark it as title... After "teach=
"
> > > it, my extension can "learn" some pattern and extract information fro=
m
> > > similar web page. To achieve this, I need to know how to capture mous=
e
> > > event, like inspect element in firebug. That is I need to know which
> > > element is clicked by mouse. Also I need to get postion information
> > > such as left top width of element which help me analyze the web page.
> > > firebug and dom inspector are similar to my need. But it's hard for m=
e
> > > to understand all the codes of these extensions. is there any tutoria=
l
> > > for me ? thank you.
> > > _______________________________________________
> > > dev-extensions mailing list
> > > dev-extensions@lists.mozilla.org
> > > https://lists.mozilla.org/listinfo/dev-extensions
> > >
> >
> cheers,
> galuschka
>
>


--=20
Felipe Frechiani de Oliveira
Vit=F3ria - ES
0
Felipe
2/24/2010 1:29:26 PM
Reply: