diff --git a/modules/contacts/site.js b/modules/contacts/site.js
index 0bde1867e5..61e89f6444 100644
--- a/modules/contacts/site.js
+++ b/modules/contacts/site.js
@@ -37,19 +37,31 @@ var add_contact_from_message_view = function() {
}
};
-var add_contact_from_popup = function() {
+var add_contact_from_popup = function(event) {
+ event.stopPropagation()
var source = 'local:local';
var contact = $('#contact_info').text().replace('>','').replace('<','');
+
if (contact) {
+ var emailRegex = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g;
+ var email = contact.match(emailRegex)[0];
+ var name = contact.replace(emailRegex, "");
+
+ var saveContactContent = `
+ Name : | ${name} |
+ Email : | ${email} |
+ Source : | Local |
+
`
+
Hm_Ajax.request(
[{'name': 'hm_ajax_hook', 'value': 'ajax_add_contact'},
{'name': 'contact_value', 'value': contact},
{'name': 'contact_source', 'value': source}],
function (res) {
- $(".popup .show").removeClass('show');
- remove_message_content();
- window.location.reload();
+ $("#contact_popup_body").html(saveContactContent);
+ sessionStorage.removeItem(`${window.location.pathname}imap_4_${hm_list_path()}`);
+ sessionStorage.removeItem(`${window.location.pathname}${hm_msg_uid()}_${hm_list_path()}`);
}
);
}
diff --git a/modules/imap/output_modules.php b/modules/imap/output_modules.php
index 9f1e7494e5..6ba5bb0593 100644
--- a/modules/imap/output_modules.php
+++ b/modules/imap/output_modules.php
@@ -225,7 +225,7 @@ protected function output() {
$txt .= '';
@@ -362,7 +364,7 @@ protected function output() {
$txt .= ' | '.$this->trans('Delete').'';
$txt .= ' | '.$this->trans('Copy').'';
$txt .= ' | '.$this->trans('Move').'';
- $txt .= ' | '.$this->trans('Archive').'';
+ $txt .= ' | '.$this->trans('Archive').'';
$txt .= ' | ' . snooze_dropdown($this, isset($headers['X-Snoozed']));
if ($this->get('sieve_filters_enabled')) {
diff --git a/modules/imap/site.css b/modules/imap/site.css
index c31957e33b..3d7b8dedcf 100644
--- a/modules/imap/site.css
+++ b/modules/imap/site.css
@@ -162,17 +162,17 @@
/* Toggle this class - hide and show the popup */
- .show > .popup-container {
+ .show.popup-container {
visibility: visible;
-webkit-animation: fadeIn 1s;
animation: fadeIn 1s;
}
- .show > .icon_arrow_up {
+ .show.icon_arrow_up {
display: block;
}
- .show > .icon_arrow_down {
+ .show.icon_arrow_down {
display: none;
}
@@ -198,3 +198,21 @@
from {opacity: 0;}
to {opacity:1 ;}
}
+
+ @keyframes fadeOut {
+ 0% { opacity: 1; }
+ 100% { opacity: 0; }
+ }
+
+ .fade {
+ animation-duration: 0.5s;
+ animation-fill-mode: forwards;
+ }
+
+ .fade-out {
+ animation-name: fadeOut;
+ }
+
+ .fade-in {
+ animation-name: fadeIn;
+ }
diff --git a/modules/imap/site.js b/modules/imap/site.js
index a4e05f3842..28c6dc86e9 100644
--- a/modules/imap/site.js
+++ b/modules/imap/site.js
@@ -301,7 +301,7 @@ var imap_message_list_content = function(id, folder, hook, batch_callback) {
}
Hm_Message_List.update(ids, res.formatted_message_list, 'imap');
-
+
$('.page_links').html(res.page_links);
cache_imap_page();
},
@@ -793,7 +793,7 @@ var imap_prefetch_message_content = function(uid, server_id, folder) {
var imap_prefetch_msgs = function() {
var detail;
var key;
-
+
$(Hm_Utils.get_from_local_storage('formatted_unread_data')).each(function() {
if ($(this).attr('class').match(/^imap/)) {
detail = Hm_Utils.parse_folder_path($(this).attr('class'), 'imap');
@@ -902,7 +902,7 @@ var imap_move_copy = function(e, action, context) {
folders.show();
$('.imap_folder_link', folders).addClass('imap_move_folder_link').removeClass('imap_folder_link');
if (action == 'move') {
- label = $('.move_to_string1').val();
+ label = $('.move_to_string1').val();
}
else {
label = $('.move_to_string2').val();
@@ -1131,7 +1131,7 @@ var imap_setup_snooze = function() {
});
}
-var imap_unsnooze_messages = function() {
+var imap_unsnooze_messages = function() {
Hm_Ajax.request(
[{'name': 'hm_ajax_hook', 'value': 'ajax_imap_unsnooze'}],
function() {},
@@ -1186,7 +1186,7 @@ $(function() {
else if (hm_page_name() === 'info') {
setTimeout(imap_status_update, 100);
}
-
+
if (hm_page_name() === 'message_list' || hm_page_name() === 'message') {
imap_setup_snooze();
}
@@ -1263,7 +1263,11 @@ var imap_archive_message = function(state, supplied_uid, supplied_detail) {
var imap_show_add_contact_popup = function() {
var popup = document.getElementById("contact_popup");
- if(!popup.classList.contains("show")) {
- popup.classList.toggle("show");
- }
+ popup.classList.toggle("show");
+};
+
+var imap_hide_add_contact_popup = function(event) {
+ event.stopPropagation()
+ var popup = document.getElementById("contact_popup");
+ popup.classList.toggle("show");
};