1212jtraceur
12-27-2006, 03:30 AM
Thanks to Ancora, I now have a far better function for 'mailto:' anchor redirection.
// ==UserScript==
// @name mailto2alert
// @namespace http://1212jtraceur.memebot.com/
// @description Changes 'mailto:EMAIL_ADDRESS' anchors to 'alert(EMAIL_ADDRESS)' anchors. This is useful for those who would like email addresses displayed to them, so that they may use a non-default mail application, such as Gmail.
// @include *
// ==/UserScript==
(function mailto2alert()
{
var nAddr = [];
var n = 0;
var nLink = document.getElementsByTagName('a');
for (i=0; i<nLink.length; i++)
{
if (/^mailto/.test(nLink[i].href))
{
nAddr[nAddr.length] = nLink[i].href.replace(/^mailto:/,"").replace(/\?/,"|").replace(/\&/,"|");
nLink[i].href = nLink[i].href.replace(nLink[i].href,"#");
nLink[i].id = "m"+n++;
nLink[i].onclick = function()
{
var nIndex = this.id.replace("m","");
alert(nAddr[nIndex].replace(/\|/g,"\n"));
return false;
};
}
}
})();
However, Greasemonkey is giving me:
Component is not available
I'm new to Greasemonkey, and have no idea how to fix this. I would post elsewhere, but I couldn't find a forum for user script development help. If anyone is familiar with Greasemonkey, I would really appreciate their help.
Thanks,
1212jtraceur
// ==UserScript==
// @name mailto2alert
// @namespace http://1212jtraceur.memebot.com/
// @description Changes 'mailto:EMAIL_ADDRESS' anchors to 'alert(EMAIL_ADDRESS)' anchors. This is useful for those who would like email addresses displayed to them, so that they may use a non-default mail application, such as Gmail.
// @include *
// ==/UserScript==
(function mailto2alert()
{
var nAddr = [];
var n = 0;
var nLink = document.getElementsByTagName('a');
for (i=0; i<nLink.length; i++)
{
if (/^mailto/.test(nLink[i].href))
{
nAddr[nAddr.length] = nLink[i].href.replace(/^mailto:/,"").replace(/\?/,"|").replace(/\&/,"|");
nLink[i].href = nLink[i].href.replace(nLink[i].href,"#");
nLink[i].id = "m"+n++;
nLink[i].onclick = function()
{
var nIndex = this.id.replace("m","");
alert(nAddr[nIndex].replace(/\|/g,"\n"));
return false;
};
}
}
})();
However, Greasemonkey is giving me:
Component is not available
I'm new to Greasemonkey, and have no idea how to fix this. I would post elsewhere, but I couldn't find a forum for user script development help. If anyone is familiar with Greasemonkey, I would really appreciate their help.
Thanks,
1212jtraceur