fix outlook optional parameters
This commit is contained in:
parent
8f4c8dae2d
commit
3a2ae160bc
20
dist/mailgo.js
vendored
20
dist/mailgo.js
vendored
@ -220,7 +220,7 @@ var mailgoRender = function mailgoRender(mailgo) {
|
|||||||
return actions.openGmail(mailtoHref);
|
return actions.openGmail(mailtoHref);
|
||||||
});
|
});
|
||||||
outlookButton.addEventListener("click", function () {
|
outlookButton.addEventListener("click", function () {
|
||||||
return actions.openOutlook(mail, url);
|
return actions.openOutlook(mail, subject, bodyMail);
|
||||||
});
|
});
|
||||||
var encEmail = encodeEmail(mail);
|
var encEmail = encodeEmail(mail);
|
||||||
openButton.addEventListener("click", function () {
|
openButton.addEventListener("click", function () {
|
||||||
@ -243,10 +243,10 @@ var actions = {
|
|||||||
var gmailUrl = "https://mail.google.com/mail?extsrc=mailto&url=" + encodeURIComponent(mailtoHref);
|
var gmailUrl = "https://mail.google.com/mail?extsrc=mailto&url=" + encodeURIComponent(mailtoHref);
|
||||||
window.open(gmailUrl, "_blank");
|
window.open(gmailUrl, "_blank");
|
||||||
},
|
},
|
||||||
openOutlook: function openOutlook(mail, bodyMail, subject) {
|
openOutlook: function openOutlook(mail, subject, bodyMail) {
|
||||||
var outlookUrl = "https://outlook.live.com/owa/?path=/mail/action/compose&to=" + encodeURIComponent(mail);
|
var outlookUrl = "https://outlook.live.com/owa/?path=/mail/action/compose&to=" + encodeURIComponent(mail);
|
||||||
if (subject != "") outlookUrl = outlookUrl + "&subject=" + subject;
|
if (subject != "") outlookUrl = outlookUrl.concat("&subject=" + subject);
|
||||||
if (bodyMail != "") outlookUrl = outlookUrl + "&body=" + bodyMail;
|
if (bodyMail != "") outlookUrl = outlookUrl.concat("&body=" + bodyMail);
|
||||||
window.open(outlookUrl, "_blank");
|
window.open(outlookUrl, "_blank");
|
||||||
},
|
},
|
||||||
openDefault: function openDefault(encEmail) {
|
openDefault: function openDefault(encEmail) {
|
||||||
@ -297,7 +297,15 @@ var mailgoCheckRender = function mailgoCheckRender(event) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
var mailgoKeydown = function mailgoKeydown(mail, url, mailtoHref, encEmail, copyButton) {
|
var mailgoKeydown = function mailgoKeydown(mail) {
|
||||||
|
var cc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
||||||
|
var bcc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
||||||
|
var bodyMail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
|
||||||
|
var subject = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
|
||||||
|
var url = arguments.length > 5 ? arguments[5] : undefined;
|
||||||
|
var mailtoHref = arguments.length > 6 ? arguments[6] : undefined;
|
||||||
|
var encEmail = arguments.length > 7 ? arguments[7] : undefined;
|
||||||
|
var copyButton = arguments.length > 8 ? arguments[8] : undefined;
|
||||||
// if mailgo is not showing do nothing
|
// if mailgo is not showing do nothing
|
||||||
if (!mailgoIsShowing()) return;
|
if (!mailgoIsShowing()) return;
|
||||||
|
|
||||||
@ -314,7 +322,7 @@ var mailgoKeydown = function mailgoKeydown(mail, url, mailtoHref, encEmail, copy
|
|||||||
|
|
||||||
case 79:
|
case 79:
|
||||||
// o -> open Outlook
|
// o -> open Outlook
|
||||||
actions.openOutlook(mail, url);
|
actions.openOutlook(mail, subject, bodyMail);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 32:
|
case 32:
|
||||||
|
2
dist/mailgo.min.js
vendored
2
dist/mailgo.min.js
vendored
File diff suppressed because one or more lines are too long
@ -276,7 +276,9 @@ const mailgoRender = mailgo => {
|
|||||||
// add the actions
|
// add the actions
|
||||||
gmailButton.addEventListener("click", () => actions.openGmail(mailtoHref));
|
gmailButton.addEventListener("click", () => actions.openGmail(mailtoHref));
|
||||||
|
|
||||||
outlookButton.addEventListener("click", () => actions.openOutlook(mail, url));
|
outlookButton.addEventListener("click", () =>
|
||||||
|
actions.openOutlook(mail, subject, bodyMail)
|
||||||
|
);
|
||||||
|
|
||||||
let encEmail = encodeEmail(mail);
|
let encEmail = encodeEmail(mail);
|
||||||
openButton.addEventListener("click", () => actions.openDefault(encEmail));
|
openButton.addEventListener("click", () => actions.openDefault(encEmail));
|
||||||
@ -304,12 +306,12 @@ const actions = {
|
|||||||
window.open(gmailUrl, "_blank");
|
window.open(gmailUrl, "_blank");
|
||||||
},
|
},
|
||||||
|
|
||||||
openOutlook: (mail, bodyMail, subject) => {
|
openOutlook: (mail, subject, bodyMail) => {
|
||||||
let outlookUrl =
|
let outlookUrl =
|
||||||
"https://outlook.live.com/owa/?path=/mail/action/compose&to=" +
|
"https://outlook.live.com/owa/?path=/mail/action/compose&to=" +
|
||||||
encodeURIComponent(mail);
|
encodeURIComponent(mail);
|
||||||
if (subject != "") outlookUrl = outlookUrl + "&subject=" + subject;
|
if (subject != "") outlookUrl = outlookUrl.concat("&subject=" + subject);
|
||||||
if (bodyMail != "") outlookUrl = outlookUrl + "&body=" + bodyMail;
|
if (bodyMail != "") outlookUrl = outlookUrl.concat("&body=" + bodyMail);
|
||||||
|
|
||||||
window.open(outlookUrl, "_blank");
|
window.open(outlookUrl, "_blank");
|
||||||
},
|
},
|
||||||
@ -365,7 +367,17 @@ const mailgoCheckRender = event => {
|
|||||||
* mailgoKeydown
|
* mailgoKeydown
|
||||||
* function to manage the keydown event when the modal is showing
|
* function to manage the keydown event when the modal is showing
|
||||||
*/
|
*/
|
||||||
const mailgoKeydown = (mail, url, mailtoHref, encEmail, copyButton) => {
|
const mailgoKeydown = (
|
||||||
|
mail,
|
||||||
|
cc = "",
|
||||||
|
bcc = "",
|
||||||
|
bodyMail = "",
|
||||||
|
subject = "",
|
||||||
|
url,
|
||||||
|
mailtoHref,
|
||||||
|
encEmail,
|
||||||
|
copyButton
|
||||||
|
) => {
|
||||||
// if mailgo is not showing do nothing
|
// if mailgo is not showing do nothing
|
||||||
if (!mailgoIsShowing()) return;
|
if (!mailgoIsShowing()) return;
|
||||||
switch (event.keyCode) {
|
switch (event.keyCode) {
|
||||||
@ -379,7 +391,7 @@ const mailgoKeydown = (mail, url, mailtoHref, encEmail, copyButton) => {
|
|||||||
break;
|
break;
|
||||||
case 79:
|
case 79:
|
||||||
// o -> open Outlook
|
// o -> open Outlook
|
||||||
actions.openOutlook(mail, url);
|
actions.openOutlook(mail, subject, bodyMail);
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
case 13:
|
case 13:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user