Here is the same code as above, but with the link tracking feature added!
Code:
case "A": {
cm_newlink = prompt (cm_linkprompt, "");
if (cm_newlink) {
document.all("edittextarea").focus();
document.execCommand("CreateLink", false, cm_newlink);
// Added by Mark Coudriet - Date: May 16, 2003
// Insert target to open a new window
var eLink;
var aTag = document.all.tags("A");
if (aTag != null) {
for (var i = aTag.length - 1; i >= 0; i--) {
if (aTag[i].href == cm_newlink) {
eLink = aTag[i];
}
}
}
eLink.target = "_new";
// Mark Coudriet - Date: May 19, 2003
// Added link tracking to HTML editor
var replaceTxt = new RegExp("http", "gi");
eLink.href = eLink.href.replace(replaceTxt, "redir.php?cm_elink=http");
// End Added
// End Added
}
break;
}
Hope this is useful! =]
Mark