I want to add new anchor links to a page using Greasemonkey. Specifically, I want to add custom smileys so that I don't have to find the smiley image and copy-and-paste the link into an [img]
tag every time.
The code I want to add is this
<a href="#" onclick="insert_text(':D', true); return false;">
<img src="./images/smilies/icon_e_biggrin.gif" alt=":D" title="Very Happy" height="17" width="15">
</a>
but I want to change the img src location and the onclick to something like
insert_text('[img]imagesourcelocation[/img]' ,true) return false;
The [img]
source would be the same as the image URL.
I want to be able to add many smileys over time -- changing the alt
and title
attributes would be great too, but I need mainly the other two.
How would I do this?
So far all I have is this:
var para=document.createElement("a");
var node=document.createTextNode("This is new.");
para.appendChild(node);
var element=document.getElementById("smiley-box");
element.appendChild(para);
As you can see, I need to add this new smiley to the <div>
with the id smiley-box
.
If anyone can help me do this I would be so happy.