mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-12-01 13:24:10 +01:00
Contacts: Use jquery trim()
This commit is contained in:
parent
1e748d26b0
commit
12347f6b0b
@ -763,7 +763,7 @@ OC.Contacts = OC.Contacts || {
|
||||
return;
|
||||
}
|
||||
if($(event.target).is('a.mailto')) {
|
||||
var mailto = 'mailto:' + $(this).find('.email').text().trim();
|
||||
var mailto = 'mailto:' + $.trim($(this).find('.email').text());
|
||||
console.log('mailto', mailto);
|
||||
try {
|
||||
window.location.href=mailto;
|
||||
@ -971,7 +971,7 @@ OC.Contacts = OC.Contacts || {
|
||||
});
|
||||
|
||||
this.$contactList.on('mouseenter', 'td.email', function(event) {
|
||||
if($(this).text().trim().length > 3) {
|
||||
if($.trim($(this).text()).length > 3) {
|
||||
$(this).find('.mailto').css('display', 'inline-block'); //.fadeIn(100);
|
||||
}
|
||||
});
|
||||
@ -1560,7 +1560,7 @@ OC.Contacts = OC.Contacts || {
|
||||
if(aid == 'new') {
|
||||
var displayname = $(this).find('input.name').val();
|
||||
var description = $(this).find('input.desc').val();
|
||||
if(!displayname.trim()) {
|
||||
if(!$.trim(displayname)) {
|
||||
OC.dialogs.alert(t('contacts', 'The address book name cannot be empty.'), t('contacts', 'Error'));
|
||||
return false;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ OC.Contacts = OC.Contacts || {};
|
||||
};
|
||||
if(this.multi_properties.indexOf(element) !== -1) {
|
||||
params['checksum'] = this.checksumFor(obj);
|
||||
if(params['checksum'] === 'new' && this.valueFor(obj).trim() === '') {
|
||||
if(params['checksum'] === 'new' && $.trim(this.valueFor(obj)) === '') {
|
||||
// If there's only one property of this type enable setting as preferred.
|
||||
if(this.data[element].length === 1) {
|
||||
var selector = 'li[data-element="' + element.toLowerCase() + '"]';
|
||||
@ -1061,7 +1061,7 @@ OC.Contacts = OC.Contacts || {};
|
||||
},
|
||||
minLength: 2,
|
||||
select: function( event, ui ) {
|
||||
if(ui.item && $elem.find('.value.country').val().trim().length == 0) {
|
||||
if(ui.item && $.trim($elem.find('.value.country').val()).length == 0) {
|
||||
$elem.find('.value.country').val(ui.item.country);
|
||||
}
|
||||
}
|
||||
@ -1232,7 +1232,7 @@ OC.Contacts = OC.Contacts || {};
|
||||
var found = false;
|
||||
|
||||
$.each(categories, function(idx, category) {
|
||||
if(name.toLowerCase() == category.trim().toLowerCase()) {
|
||||
if(name.toLowerCase() == $.trim(category).toLowerCase()) {
|
||||
found = true
|
||||
return false;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ OC.Contacts = OC.Contacts || {};
|
||||
* @returns string The name of the group.
|
||||
*/
|
||||
GroupList.prototype.nameById = function(id) {
|
||||
return this.findById(id).clone().find("*").remove().end().text().trim(); //.contents().filter(function(){ return(this.nodeType == 3); }).text().trim();
|
||||
return $.trim(this.findById(id).clone().find("*").remove().end().text()); //.contents().filter(function(){ return(this.nodeType == 3); }).text().trim();
|
||||
};
|
||||
|
||||
/** Get the group element by id.
|
||||
@ -432,7 +432,7 @@ OC.Contacts = OC.Contacts || {};
|
||||
// NOTE: Currently this only works for adding, not renaming
|
||||
var saveChanges = function($elem, $input) {
|
||||
console.log('saveChanges', $input.val());
|
||||
var name = $input.val().trim();
|
||||
var name = $.trim($input.val());
|
||||
if(name.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user