Improve URL handling in popup of events

This commit is contained in:
Francis Lachapelle
2014-02-10 21:49:49 -05:00
parent b91032db8e
commit fcfd8be771
3 changed files with 37 additions and 33 deletions
+35
View File
@@ -334,6 +334,16 @@ function openMailTo(senderMailTo) {
return false; /* stop following the link */
}
function onEmailTo(event) {
var s = this.innerHTML.strip();
if (!/@/.test(s)) {
s += ' <' + this.href.substr(7) + '>';
}
openMailTo(s);
Event.stop(event);
return false;
}
function deleteDraft(url) {
/* this is called by UIxMailEditor with window.opener */
new Ajax.Request(url, {
@@ -1763,6 +1773,31 @@ function configureLinkBanner() {
}
}
function configureLinks(element) {
var onAnchorClick = function (event) {
if (this.href)
window.open(this.href);
preventDefault(event);
};
var anchors = element.getElementsByTagName('a');
for (var i = 0; i < anchors.length; i++) {
var anchor = $(anchors[i]);
if (!anchor.href && anchor.readAttribute("moz-do-not-send")) {
anchor.writeAttribute("moz-do-not-send", false);
anchor.removeClassName("moz-txt-link-abbreviated");
anchor.href = "mailto:" + anchors[i].innerHTML;
}
if (anchor.href.substring(0,7) == "mailto:") {
anchor.observe("click", onEmailTo);
if (typeof onEmailAddressClick == 'function')
anchor.observe("contextmenu", onEmailAddressClick);
anchor.writeAttribute("moz-do-not-send", false);
}
else if (!anchor.id)
anchor.observe("click", onAnchorClick);
}
}
function CurrentModule() {
var module = null;
if (ApplicationBaseURL) {