mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-28 18:41:34 +08:00
fdaefab7cb
correction after review: use the temporary variable instead of recalculating the JQuery node
29 lines
830 B
JavaScript
29 lines
830 B
JavaScript
(function(window, $) {
|
|
$(function() {
|
|
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 () {
|
|
$('li[data-inputosaurus][title*=","]').find('a').trigger('click')
|
|
})
|
|
}
|
|
|
|
$('body').on('click', '.ui-autocomplete a', function () {
|
|
replaceGroup()
|
|
})
|
|
|
|
$(document).on('keydown', function (e) {
|
|
if (e.which === 13) {
|
|
setTimeout(function () {
|
|
replaceGroup()
|
|
})
|
|
}
|
|
})
|
|
})
|
|
}(window, $))
|