Remove depreciated jquery.trim function (#7371)

pull/6950/merge
johndoh 4 years ago committed by GitHub
parent 35c29be9b2
commit 3af6303ad7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -33,7 +33,7 @@ function hide_blockquote()
// from merging lines from different quoting level // from merging lines from different quoting level
$('blockquote').before(document.createTextNode("\n")); $('blockquote').before(document.createTextNode("\n"));
text = $.trim(q.text()); text = q.text().trim();
res = text.split(/\n/); res = text.split(/\n/);
if (res.length <= limit) { if (res.length <= limit) {

@ -344,7 +344,7 @@ function rcube_webmail()
n.children().remove(); n.children().remove();
dt.setData('roundcube-uri', href); dt.setData('roundcube-uri', href);
dt.setData('roundcube-name', $.trim(n.text())); dt.setData('roundcube-name', n.text().trim());
} }
}); });
} }
@ -3897,7 +3897,7 @@ function rcube_webmail()
// get recipients // get recipients
var recipients = []; var recipients = [];
$.each(['to', 'cc', 'bcc'], function(i,field) { $.each(['to', 'cc', 'bcc'], function(i,field) {
var pos, rcpt, val = $.trim($('[name="_' + field + '"]').val()); var pos, rcpt, val = $('[name="_' + field + '"]').val().trim();
while (val.length && rcube_check_email(val, true)) { while (val.length && rcube_check_email(val, true)) {
rcpt = RegExp.$2.replace(/^<+/, '').replace(/>+$/, ''); rcpt = RegExp.$2.replace(/^<+/, '').replace(/>+$/, '');
recipients.push(rcpt); recipients.push(rcpt);
@ -4189,7 +4189,7 @@ function rcube_webmail()
this.mailvelope_identity_keygen = function() this.mailvelope_identity_keygen = function()
{ {
var container = $(this.gui_objects.editform).find('.identity-encryption').first(); var container = $(this.gui_objects.editform).find('.identity-encryption').first();
var identity_email = $.trim($(this.gui_objects.editform).find('.ff_email').val()); var identity_email = $(this.gui_objects.editform).find('.ff_email').val().trim();
if (!container.length || !identity_email || !this.mailvelope_keyring.createKeyGenContainer) if (!container.length || !identity_email || !this.mailvelope_keyring.createKeyGenContainer)
return; return;
@ -4260,7 +4260,7 @@ function rcube_webmail()
this.mailvelope_show_keygen_container = function(container, identity_email) this.mailvelope_show_keygen_container = function(container, identity_email)
{ {
var cid = new Date().getTime(); var cid = new Date().getTime();
var user_id = {email: identity_email, fullName: $.trim($(ref.gui_objects.editform).find('.ff_name').val())}; var user_id = {email: identity_email, fullName: $(ref.gui_objects.editform).find('.ff_name').val().trim()};
var options = {userIds: [user_id], keySize: 4096}; var options = {userIds: [user_id], keySize: 4096};
$('<div>').attr('id', 'mailvelope-keygen-container-' + cid) $('<div>').attr('id', 'mailvelope-keygen-container-' + cid)
@ -4871,7 +4871,7 @@ function rcube_webmail()
input_from = $("[name='_from']", form), input_from = $("[name='_from']", form),
get_recipients = function(fields) { get_recipients = function(fields) {
fields = $.map(fields, function(v) { fields = $.map(fields, function(v) {
v = $.trim(v.val()); v = v.val().trim();
return v.length ? v : null; return v.length ? v : null;
}); });
return fields.join(',').replace(/^[\s,;]+/, '').replace(/[\s,;]+$/, ''); return fields.join(',').replace(/^[\s,;]+/, '').replace(/[\s,;]+$/, '');
@ -5881,7 +5881,7 @@ function rcube_webmail()
data = this.ksearch_data; data = this.ksearch_data;
// trim query string // trim query string
q = $.trim(q); q = q.trim();
// Don't (re-)search if the last results are still active // Don't (re-)search if the last results are still active
if (q == this.ksearch_value) if (q == this.ksearch_value)
@ -10106,7 +10106,7 @@ rcube_webmail.long_subject_title_ex = function(elem)
{ {
if (!elem.title) { if (!elem.title) {
var $elem = $(elem), var $elem = $(elem),
txt = $.trim($elem.text()), txt = $elem.text().trim(),
indent = $('span.branch', $elem).width() || 0, indent = $('span.branch', $elem).width() || 0,
tmp = $('<span>').text(txt) tmp = $('<span>').text(txt)
.css({position: 'absolute', 'float': 'left', visibility: 'hidden', .css({position: 'absolute', 'float': 'left', visibility: 'hidden',
@ -10124,7 +10124,7 @@ rcube_webmail.subject_text = function(elem)
{ {
var t = $(elem).clone(); var t = $(elem).clone();
t.find('.skip-on-drag,.skip-content,.voice').remove(); t.find('.skip-on-drag,.skip-content,.voice').remove();
return $.trim(t.text()); return t.text().trim();
}; };
// set event handlers on all iframe elements (and their contents) // set event handlers on all iframe elements (and their contents)

@ -1669,7 +1669,7 @@ drag_mouse_move: function(e)
if (subject) { if (subject) {
// remove leading spaces // remove leading spaces
subject = $.trim(subject); subject = subject.trim();
// truncate line to 50 characters // truncate line to 50 characters
subject = (subject.length > 50 ? subject.substring(0, 50) + '...' : subject); subject = (subject.length > 50 ? subject.substring(0, 50) + '...' : subject);

@ -1284,7 +1284,7 @@ function rcube_treelist_widget(node, p)
create: function(e, ui) { ui_draggable = ui; }, create: function(e, ui) { ui_draggable = ui; },
helper: function(e) { helper: function(e) {
return $('<div>').attr('id', 'rcmdraglayer') return $('<div>').attr('id', 'rcmdraglayer')
.text($.trim($(e.target).first().text())); .text($(e.target).first().text().trim());
} }
}, opts); }, opts);

@ -393,7 +393,7 @@ function rcube_elastic_ui()
btn_class = target[0].className + (add_class ? ' ' + add_class : ''); btn_class = target[0].className + (add_class ? ' ' + add_class : '');
if (!menu_button) { if (!menu_button) {
btn_class = $.trim(btn_class.replace('btn-primary', 'primary').replace(/(btn[a-z-]*|button|disabled)/g, '')) btn_class = btn_class.replace('btn-primary', 'primary').replace(/(btn[a-z-]*|button|disabled)/g, '').trim()
btn_class += ' button' + (!always_active ? ' disabled' : ''); btn_class += ' button' + (!always_active ? ' disabled' : '');
} }
else if (popup = target.data('popup')) { else if (popup = target.data('popup')) {
@ -2134,7 +2134,7 @@ function rcube_elastic_ui()
button = cloned ? create_cloned_button($(button), true, 'hidden-big hidden-large') : $(button).detach(); button = cloned ? create_cloned_button($(button), true, 'hidden-big hidden-large') : $(button).detach();
// Remove empty text nodes that break alignment of text of the menu item // Remove empty text nodes that break alignment of text of the menu item
button.contents().filter(function() { if (this.nodeType == 3 && !$.trim(this.nodeValue).length) $(this).remove(); }); button.contents().filter(function() { if (this.nodeType == 3 && this.nodeValue.trim().length == 0) $(this).remove(); });
if (button.is('.spacer')) { if (button.is('.spacer')) {
item.addClass('spacer'); item.addClass('spacer');
@ -2984,7 +2984,7 @@ function rcube_elastic_ui()
if (txt) { if (txt) {
txt = txt.replace('<' + contact + '>', ''); txt = txt.replace('<' + contact + '>', '');
contact = '"' + $.trim(txt) + '" <' + contact + '>'; contact = '"' + txt.trim() + '" <' + contact + '>';
} }
return rcmail.command('add-contact', contact, this, e.originalEvent); return rcmail.command('add-contact', contact, this, e.originalEvent);
@ -3295,7 +3295,7 @@ function rcube_elastic_ui()
function recipient_input_parser(text) function recipient_input_parser(text)
{ {
// support new-line as a separator, for paste action (#6460) // support new-line as a separator, for paste action (#6460)
text = $.trim(text.replace(/[,;\s]*[\r\n]+/g, ',')); text = text.replace(/[,;\s]*[\r\n]+/g, ',').trim();
var recipients = [], var recipients = [],
address_rx_part = '(\\S+|("[^"]+"))@\\S+', address_rx_part = '(\\S+|("[^"]+"))@\\S+',
@ -3307,7 +3307,7 @@ function rcube_elastic_ui()
$.each(matches || [], function() { $.each(matches || [], function() {
if (this.length && (recipient_rx1.test(this) || recipient_rx2.test(this))) { if (this.length && (recipient_rx1.test(this) || recipient_rx2.test(this))) {
var email = RegExp.$1, var email = RegExp.$1,
name = $.trim(this.replace(email, '')); name = this.replace(email, '').trim();
recipients.push({ recipients.push({
name: name, name: name,

Loading…
Cancel
Save