[Greasemonkey] help with user script

Tom Sonsuwan tom.sonsuwan at speedydomainregistration.com
Mon Aug 29 04:07:58 EDT 2005

Thanks John,

Great start.

Is there any way to make the html of the links look like this:
normal:   <a href=someurl>Some anchor</a>
new:  <a href=someurl>Some anchor</a> - <img 

Notice the image tag.   Each link will have different image by 
sending script the url you want image for.

Can this be done?


----- Original Message ----- 
From: "John Plsek" <gm at plsek.id.au>
To: <greasemonkey at mozdev.org>
Sent: Monday, August 29, 2005 2:41 AM
Subject: Re: [Greasemonkey] help with user script

Here's a little something I just knocked up ;-) adds a smiley 
after any
link that has "page" in the anchor text

// ==UserScript==
// @name          anchorImage
// @description      Test
// @include       *
// ==/UserScript==
(function() {
  var style=[
    "a.smilied:after{content: url(",
  var head=document.getElementsByTagName("head")[0];
  var ele=document.createElement('link');
  var xpath="//a[contains(text(), 'page')]";
  links =
  for (var i = 0; i < links.snapshotLength; i++) {
    node = links.snapshotItem(i);
    node.className+=" smilied";

Tom Sonsuwan wrote:

>Been trying to write a script to add an image to the end of
>links on a page.
>Only links with certain anchor text would be selected.
>Tried unsuccessfully for couple of days now.
>Please help.
>Greasemonkey mailing list
>Greasemonkey at mozdev.org
Greasemonkey mailing list
Greasemonkey at mozdev.org

More information about the Greasemonkey mailing list