This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 899
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes a regression of plugin contact-group-excel-paste since an update of rainloop that modified CSS classes and JavaScript of autocomplete fields
- Loading branch information
1 parent
cdfe5fb
commit b0cf16a
Showing
1 changed file
with
25 additions
and
16 deletions.
There are no files selected for viewing
41 changes: 25 additions & 16 deletions
41
plugins/contact-group-excel-paste/js/excel_contact_group.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
(function(window, $) { | ||
$(function() { | ||
$(window.document).on('paste', '.RL-PopupsContacts .contactValueInput', function() { | ||
// trigger the process on click and paste | ||
var $this = $(this); | ||
|
||
function replaceGroup() { | ||
$('li[data-inputosaurus][title*=","]').each(function (index, elem) { | ||
var $elem = $(elem) | ||
var title = $(elem).attr('title') | ||
var cut = title.indexOf('<') | ||
title = title.substr(cut + 1, title.length - cut - 2) | ||
$elem.parents('ul').find('.ui-autocomplete-input').val(title) | ||
$('.ui-autocomplete-input').trigger('blur') | ||
}) | ||
setTimeout(function () { | ||
$this.trigger('keyup'); | ||
}); | ||
}).on('keyup', '.RL-PopupsContacts .contactValueInput', function() { | ||
var $this = $(this), | ||
value = $this.val(), | ||
match = value && value.match(/@/ig); | ||
$('li[data-inputosaurus][title*=","]').find('a').trigger('click') | ||
}) | ||
} | ||
|
||
$('body').on('click', '.ui-autocomplete a', function () { | ||
replaceGroup() | ||
}) | ||
|
||
if (match && match.length > 1) { | ||
$this.val($this.val().replace(/\n| /ig, ',')); | ||
} | ||
}); | ||
}); | ||
}(window, $)); | ||
$(document).on('keydown', function (e) { | ||
if (e.which === 13) { | ||
setTimeout(function () { | ||
replaceGroup() | ||
}) | ||
} | ||
}) | ||
}) | ||
}(window, $)) |