[Greasemonkey] Colour-coding of visited links

esquifit esquifit at googlemail.com
Wed Oct 4 06:52:51 PDT 2006


Oh, I thought you were looking for a way to accomplish this from a
regular GM script, not from a compiled one.
It would be interesting, however, to know of alternative solutions in
this situation (not compiled scripts). Any ideas?

2006/10/4, Edward Hibbert <Edward.Hibbert at dataconnection.com>:
> I did some digging and tweaked the script-compiler.js file to add a
> method to allow me to do this:
>
>  var historyService =
> Components.classes["@mozilla.org/browser/global-history;1"]
>
> .getService(Components.interfaces.nsIGlobalHistory);
>
> sandbox.HS_isVisited=freecycleedinburgh_gmCompiler.hitch(historyService,
> "isVisited");
>
> This seems to do the trick nicely.
>
> Edward.
>
> -----Original Message-----
> From: greasemonkey-bounces at mozdev.org
> [mailto:greasemonkey-bounces at mozdev.org] On Behalf Of esquifit
> Sent: 04 October 2006 14:09
> To: greasemonkey at mozdev.org
> Subject: Re: [Greasemonkey] Colour-coding of visited links
>
> If I understand correctly, the problem is here to *determine* whether a
> given link has been clicked on or not.  As far as I know, there is no
> direct API for this in javascript, excepting the (admittedly
> deficient) method I've suggested above.
>
> 2006/10/4, Henrik Nyh <henrik at nyh.se>:
> > esquifit wrote:
> > > You can compare the computed style[1] of a link against one you are
> > > sure it has not been visited, for example a hidden dummy link added
> > > by your script.
> > >
> > > [1] http://developer.mozilla.org/en/docs/DOM:window.getComputedStyle
> >
> > A simpler solution would be to set the color-coded links using CSS
> > (with e.g. http://greasemonkey.mozdev.org/authoring.html#GM_addStyle).
> >
> > You'd probably want to use :visited and friends
> > (http://www.w3schools.com/css/css_pseudo_classes.asp) and possibly
> > !important
> (http://www.w3.org/TR/REC-CSS2/cascade.html#important-rules).
> >
> > --
> > Henrik Nyh
> > http://henrik.nyh.se
> >
> > >
> > > 2006/10/4, Edward Hibbert <Edward.Hibbert at dataconnection.com>:
> > >> I have a script which colour-codes links.  This is interfering with
>
> > >> the native colour-coding of a link based on whether you've visited
> > >> it before
> > >> - the native colour-coding is overwritten by mine.
> > >>
> > >> Is there any way for me to tell inside a script whether the link
> > >> has been visited, so that I can modify my colour-coding
> accordingly?
> > >> _______________________________________________
> > >> Greasemonkey mailing list
> > >> Greasemonkey at mozdev.org
> > >> http://mozdev.org/mailman/listinfo/greasemonkey
> > >>
> > > _______________________________________________
> > > Greasemonkey mailing list
> > > Greasemonkey at mozdev.org
> > > http://mozdev.org/mailman/listinfo/greasemonkey
> > _______________________________________________
> > Greasemonkey mailing list
> > Greasemonkey at mozdev.org
> > http://mozdev.org/mailman/listinfo/greasemonkey
> >
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list