jquery length instead of size
This commit is contained in:
@@ -457,7 +457,7 @@ Espo.define('crm:views/calendar/calendar', ['view', 'lib!full-calendar'], functi
|
||||
},
|
||||
|
||||
getCalculatedHeight: function () {
|
||||
if (this.$container && this.$container.size()) {
|
||||
if (this.$container && this.$container.length) {
|
||||
return this.$container.height();
|
||||
}
|
||||
var height = $(window).height();
|
||||
@@ -727,7 +727,7 @@ Espo.define('crm:views/calendar/calendar', ['view', 'lib!full-calendar'], functi
|
||||
setTimeout(function () {
|
||||
$calendar.fullCalendar(options);
|
||||
this.updateDate();
|
||||
if (this.$container && this.$container.size()) {
|
||||
if (this.$container && this.$container.length) {
|
||||
this.adjustSize();
|
||||
}
|
||||
}.bind(this), 150);
|
||||
|
||||
@@ -184,7 +184,7 @@ Espo.define('crm:views/dashlets/abstract/chart', ['views/dashlets/abstract/base'
|
||||
|
||||
var width = Math.floor((containerWidth - dashletChartLegendBoxWidth * number) / number);
|
||||
|
||||
var columnNumber = this.$legendContainer.find('> table tr:first-child > td').size() / 2;
|
||||
var columnNumber = this.$legendContainer.find('> table tr:first-child > td').length / 2;
|
||||
|
||||
var tableWidth = (width + dashletChartLegendBoxWidth) * columnNumber;
|
||||
|
||||
@@ -215,7 +215,7 @@ Espo.define('crm:views/dashlets/abstract/chart', ['views/dashlets/abstract/base'
|
||||
this.adjustContainer();
|
||||
|
||||
setTimeout(function () {
|
||||
if (!this.$container.size() || !this.$container.is(":visible")) return;
|
||||
if (!this.$container.length || !this.$container.is(":visible")) return;
|
||||
this.draw();
|
||||
}.bind(this), 1);
|
||||
});
|
||||
|
||||
+4
-4
@@ -229,7 +229,7 @@ Espo.define('ui', [], function () {
|
||||
var $body = $(document.body);
|
||||
|
||||
this.$el.on('hidden.bs.modal', function (e) {
|
||||
if ($('.modal:visible').size() > 0) {
|
||||
if ($('.modal:visible').length > 0) {
|
||||
$body.addClass('modal-open');
|
||||
}
|
||||
});
|
||||
@@ -244,14 +244,14 @@ Espo.define('ui', [], function () {
|
||||
|
||||
var $modalBackdrop = $('.modal-backdrop');
|
||||
$modalBackdrop.each(function (i, el) {
|
||||
if (i < $modalBackdrop.size() - 1) {
|
||||
if (i < $modalBackdrop.length - 1) {
|
||||
$(el).addClass('hidden');
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
var $modalConainer = $('.modal-container');
|
||||
$modalConainer.each(function (i, el) {
|
||||
if (i < $modalConainer.size() - 1) {
|
||||
if (i < $modalConainer.length - 1) {
|
||||
$(el).addClass('overlaid');
|
||||
}
|
||||
}.bind(this));
|
||||
@@ -276,7 +276,7 @@ Espo.define('ui', [], function () {
|
||||
$modalBackdrop.last().removeClass('hidden');
|
||||
|
||||
var $modalConainer = $('.modal-container');
|
||||
$($modalConainer.get($modalConainer.size() - 2)).removeClass('overlaid');
|
||||
$($modalConainer.get($modalConainer.length - 2)).removeClass('overlaid');
|
||||
|
||||
this.$el.modal('hide');
|
||||
$(this).trigger('dialog:close');
|
||||
|
||||
@@ -140,7 +140,7 @@ Espo.define('views/admin/layouts/grid', 'views/admin/layouts/base', function (De
|
||||
var count = 0;
|
||||
|
||||
var isEmpty = false;
|
||||
if ($ul.children('li:not(.empty)').size() == 0) {
|
||||
if ($ul.children('li:not(.empty)').length == 0) {
|
||||
isEmpty = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ Espo.define('views/fields/base', 'view', function (Dep) {
|
||||
* {jQuery}
|
||||
*/
|
||||
getLabelElement: function () {
|
||||
if (!this.$label || !this.$label.size()) {
|
||||
if (!this.$label || !this.$label.length) {
|
||||
this.$label = this.$el.parent().children('label');
|
||||
}
|
||||
return this.$label;
|
||||
@@ -351,7 +351,7 @@ Espo.define('views/fields/base', 'view', function (Dep) {
|
||||
var $label = this.getLabelElement();
|
||||
var $sign = $label.find('span.required-sign');
|
||||
|
||||
if ($label.size() && !$sign.size()) {
|
||||
if ($label.length && !$sign.length) {
|
||||
$text = $label.find('span.label-text');
|
||||
$('<span class="required-sign"> *</span>').insertAfter($text);
|
||||
$sign = $label.find('span.required-sign');
|
||||
@@ -385,7 +385,7 @@ Espo.define('views/fields/base', 'view', function (Dep) {
|
||||
var $cell = this.getCellElement();
|
||||
var $editLink = $('<a href="javascript:" class="pull-right inline-edit-link hidden"><span class="fas fa-pencil-alt fa-sm"></span></a>');
|
||||
|
||||
if ($cell.size() == 0) {
|
||||
if ($cell.length == 0) {
|
||||
this.listenToOnce(this, 'after:render', this.initInlineEdit, this);
|
||||
return;
|
||||
}
|
||||
@@ -552,7 +552,7 @@ Espo.define('views/fields/base', 'view', function (Dep) {
|
||||
$el = $(target);
|
||||
}
|
||||
|
||||
if (!$el.size() && this.$element) {
|
||||
if (!$el.length && this.$element) {
|
||||
$el = this.$element;
|
||||
}
|
||||
$el.popover({
|
||||
|
||||
@@ -220,7 +220,7 @@ Espo.define('views/fields/duration', 'views/fields/enum', function (Dep) {
|
||||
return $(el).val() >= seconds;
|
||||
}).first();
|
||||
|
||||
if ($found.size()) {
|
||||
if ($found.length) {
|
||||
if ($found.val() != seconds) {
|
||||
$o.insertBefore($found);
|
||||
};
|
||||
|
||||
@@ -155,7 +155,7 @@ Espo.define('views/fields/email', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
'click [data-action="removeEmailAddress"]': function (e) {
|
||||
var $block = $(e.currentTarget).closest('div.email-address-block');
|
||||
if ($block.parent().children().size() == 1) {
|
||||
if ($block.parent().children().length == 1) {
|
||||
$block.find('input.email-address').val('');
|
||||
} else {
|
||||
this.removeEmailAddressBlock($block);
|
||||
@@ -168,7 +168,7 @@ Espo.define('views/fields/email', 'views/fields/varchar', function (Dep) {
|
||||
var $block = $input.closest('div.email-address-block');
|
||||
|
||||
if ($input.val() == '') {
|
||||
if ($block.parent().children().size() == 1) {
|
||||
if ($block.parent().children().length == 1) {
|
||||
$block.find('input.email-address').val('');
|
||||
} else {
|
||||
this.removeEmailAddressBlock($block);
|
||||
@@ -273,7 +273,7 @@ Espo.define('views/fields/email', 'views/fields/varchar', function (Dep) {
|
||||
}
|
||||
});
|
||||
|
||||
if (c == $input.size()) {
|
||||
if (c == $input.length) {
|
||||
this.$el.find('[data-action="addEmailAddress"]').removeClass('disabled').removeAttr('disabled');
|
||||
} else {
|
||||
this.$el.find('[data-action="addEmailAddress"]').addClass('disabled').attr('disabled', 'disabled');
|
||||
@@ -283,7 +283,7 @@ Espo.define('views/fields/email', 'views/fields/varchar', function (Dep) {
|
||||
manageButtonsVisibility: function () {
|
||||
var $primary = this.$el.find('button[data-property-type="primary"]');
|
||||
var $remove = this.$el.find('button[data-action="removeEmailAddress"]');
|
||||
if ($primary.size() > 1) {
|
||||
if ($primary.length > 1) {
|
||||
$primary.removeClass('hidden');
|
||||
$remove.removeClass('hidden');
|
||||
} else {
|
||||
@@ -387,7 +387,7 @@ Espo.define('views/fields/email', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
var $list = this.$el.find('div.email-address-block');
|
||||
|
||||
if ($list.size()) {
|
||||
if ($list.length) {
|
||||
$list.each(function (i, d) {
|
||||
var row = {};
|
||||
var $d = $(d);
|
||||
|
||||
@@ -89,7 +89,7 @@ Espo.define('views/fields/formula', 'views/fields/text', function (Dep) {
|
||||
|
||||
this.$editor = this.$el.find('#' + this.containerId);
|
||||
|
||||
if (this.$editor.size() && (this.mode === 'edit' || this.mode == 'detail')) {
|
||||
if (this.$editor.length && (this.mode === 'edit' || this.mode == 'detail')) {
|
||||
this.$editor
|
||||
.css('height', this.height + 'px')
|
||||
.css('fontSize', '14px');
|
||||
|
||||
@@ -282,7 +282,7 @@ Espo.define('views/fields/link-multiple-with-columns', 'views/fields/link-multip
|
||||
if (this.mode == 'edit') {
|
||||
columnFormElementJQList.forEach(function ($column) {
|
||||
var fetch = function ($target) {
|
||||
if (!$target || !$target.size()) return;
|
||||
if (!$target || !$target.length) return;
|
||||
var column = $target.data('column');
|
||||
var value = $target.val().toString().trim();
|
||||
var id = $target.data('id');
|
||||
|
||||
@@ -160,15 +160,15 @@ Espo.define('views/fields/link-multiple-with-primary', 'views/fields/link-multip
|
||||
|
||||
managePrimaryButton: function () {
|
||||
var $primary = this.$el.find('button[data-action="switchPrimary"]');
|
||||
if ($primary.size() > 1) {
|
||||
if ($primary.length > 1) {
|
||||
$primary.removeClass('hidden');
|
||||
} else {
|
||||
$primary.addClass('hidden');
|
||||
}
|
||||
|
||||
if ($primary.filter('.active').size() == 0) {
|
||||
if ($primary.filter('.active').length == 0) {
|
||||
var $first = $primary.first();
|
||||
if ($first.size()) {
|
||||
if ($first.length) {
|
||||
$first.addClass('active').children().removeClass('text-muted');
|
||||
this.setPrimaryId($first.data('id'));
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ Espo.define('views/fields/link-multiple-with-role', 'views/fields/link-multiple'
|
||||
if (this.mode == 'edit') {
|
||||
if ($role) {
|
||||
var fetch = function ($target) {
|
||||
if (!$target || !$target.size()) return;
|
||||
if (!$target || !$target.length) return;
|
||||
|
||||
var value = $target.val().toString().trim();
|
||||
var id = $target.data('id');
|
||||
|
||||
@@ -133,7 +133,7 @@ Espo.define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
'click [data-action="removePhoneNumber"]': function (e) {
|
||||
var $block = $(e.currentTarget).closest('div.phone-number-block');
|
||||
if ($block.parent().children().size() == 1) {
|
||||
if ($block.parent().children().length == 1) {
|
||||
$block.find('input.phone-number').val('');
|
||||
} else {
|
||||
this.removePhoneNumberBlock($block);
|
||||
@@ -146,7 +146,7 @@ Espo.define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
var $block = $input.closest('div.phone-number-block');
|
||||
|
||||
if ($input.val() == '') {
|
||||
if ($block.parent().children().size() == 1) {
|
||||
if ($block.parent().children().length == 1) {
|
||||
$block.find('input.phone-number').val('');
|
||||
} else {
|
||||
this.removePhoneNumberBlock($block);
|
||||
@@ -214,7 +214,7 @@ Espo.define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
}
|
||||
});
|
||||
|
||||
if (c == $input.size()) {
|
||||
if (c == $input.length) {
|
||||
this.$el.find('[data-action="addPhoneNumber"]').removeClass('disabled').removeAttr('disabled');
|
||||
} else {
|
||||
this.$el.find('[data-action="addPhoneNumber"]').addClass('disabled').attr('disabled', 'disabled');
|
||||
@@ -224,7 +224,7 @@ Espo.define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
manageButtonsVisibility: function () {
|
||||
var $primary = this.$el.find('button[data-property-type="primary"]');
|
||||
var $remove = this.$el.find('button[data-action="removePhoneNumber"]');
|
||||
if ($primary.size() > 1) {
|
||||
if ($primary.length > 1) {
|
||||
$primary.removeClass('hidden');
|
||||
$remove.removeClass('hidden');
|
||||
} else {
|
||||
@@ -253,7 +253,7 @@ Espo.define('views/fields/phone', 'views/fields/varchar', function (Dep) {
|
||||
|
||||
var $list = this.$el.find('div.phone-number-block');
|
||||
|
||||
if ($list.size()) {
|
||||
if ($list.length) {
|
||||
$list.each(function (i, d) {
|
||||
var row = {};
|
||||
var $d = $(d);
|
||||
|
||||
@@ -374,7 +374,7 @@ Espo.define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], fun
|
||||
options.height = this.height;
|
||||
} else {
|
||||
var $scrollable = this.$el.closest('.modal-body');
|
||||
if (!$scrollable.size()) {
|
||||
if (!$scrollable.length) {
|
||||
$scrollable = $(window);
|
||||
}
|
||||
this.$scrollable = $scrollable;
|
||||
|
||||
@@ -59,7 +59,7 @@ Espo.define('views/modals/image-crop', ['views/modal', 'lib!Cropper'], function
|
||||
];
|
||||
|
||||
this.on('remove', function () {
|
||||
if (this.$img.size()) {
|
||||
if (this.$img.length) {
|
||||
this.$img.cropper('destroy');
|
||||
this.$img.parent().empty();
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ Espo.define('views/modals/mass-update', 'views/modal', function (Dep) {
|
||||
|
||||
this.$el.find('ul.filter-list li[data-name="'+name+'"]').addClass('hidden');
|
||||
|
||||
if (this.$el.find('ul.filter-list li:not(.hidden)').size() == 0) {
|
||||
if (this.$el.find('ul.filter-list li:not(.hidden)').length == 0) {
|
||||
this.$el.find('button.select-field').addClass('disabled').attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ Espo.define('views/note/fields/post', ['views/fields/text', 'lib!Textcomplete'],
|
||||
});
|
||||
|
||||
this.once('remove', function () {
|
||||
if (this.$element.size()) {
|
||||
if (this.$element.length) {
|
||||
this.$element.textcomplete('destroy');
|
||||
}
|
||||
}, this);
|
||||
|
||||
@@ -97,7 +97,7 @@ Espo.define('views/notification/badge', 'view', function (Dep) {
|
||||
this.runCheckUpdates(true);
|
||||
|
||||
this.$popupContainer = $('#popup-notifications-container');
|
||||
if (!$(this.$popupContainer).size()) {
|
||||
if (!$(this.$popupContainer).length) {
|
||||
this.$popupContainer = $('<div>').attr('id', 'popup-notifications-container').addClass('hidden').appendTo('body');
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ Espo.define('views/notification/badge', 'view', function (Dep) {
|
||||
$document = $(document);
|
||||
$document.on('mouseup.notification', function (e) {
|
||||
if (!$container.is(e.target) && $container.has(e.target).length === 0) {
|
||||
if (!$(e.target).closest('div.modal-dialog').size()) {
|
||||
if (!$(e.target).closest('div.modal-dialog').length) {
|
||||
this.closeNotifications();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ Espo.define('views/record/kanban', ['views/record/list'], function (Dep) {
|
||||
var $item = this.$el.find('.item[data-id="'+id+'"]');
|
||||
var $column = this.$el.find('.group-column[data-name="'+group+'"] .group-column-list');
|
||||
|
||||
if ($column.size()) {
|
||||
if ($column.length) {
|
||||
$column.prepend($item);
|
||||
} else {
|
||||
$item.remove();
|
||||
|
||||
@@ -209,7 +209,7 @@ Espo.define('views/record/list', 'view', function (Dep) {
|
||||
var top;
|
||||
|
||||
|
||||
if (this.$el.closest('.modal-body').size()) {
|
||||
if (this.$el.closest('.modal-body').length) {
|
||||
$scrollable = this.$el.closest('.modal-body');
|
||||
top = 0;
|
||||
} else {
|
||||
@@ -1176,7 +1176,7 @@ Espo.define('views/record/list', 'view', function (Dep) {
|
||||
checkRecord: function (id, $target, isSilent) {
|
||||
$target = $target || this.$el.find('.record-checkbox[data-id="' + id + '"]');
|
||||
|
||||
if (!$target.size()) return;
|
||||
if (!$target.length) return;
|
||||
|
||||
$target.get(0).checked = true;
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ Espo.define('views/record/panels/side', 'view', function (Dep) {
|
||||
},
|
||||
|
||||
afterRender: function () {
|
||||
if (this.$el.children().size() === 0) {
|
||||
if (this.$el.children().length === 0) {
|
||||
this.$el.parent().addClass('hidden');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -462,7 +462,7 @@ Espo.define('views/record/search', 'view', function (Dep) {
|
||||
|
||||
updateAddFilterButton: function () {
|
||||
var $ul = this.$el.find('ul.filter-list');
|
||||
if ($ul.children().not('.hide').size() == 0) {
|
||||
if ($ul.children().not('.hide').length == 0) {
|
||||
this.$el.find('button.add-filter-button').addClass('disabled');
|
||||
} else {
|
||||
this.$el.find('button.add-filter-button').removeClass('disabled');
|
||||
|
||||
@@ -375,7 +375,7 @@ Espo.define('views/role/record/table', 'view', function (Dep) {
|
||||
var fieldObj = {};
|
||||
this.fieldActionList.forEach(function (action) {
|
||||
var $select = this.$el.find('select[data-scope="'+scope+'"][data-field="'+field+'"][data-action="'+action+'"]');
|
||||
if (!$select.size()) return;
|
||||
if (!$select.length) return;
|
||||
fieldObj[action] = $select.val();
|
||||
}, this);
|
||||
scopeObj[field] = fieldObj;
|
||||
|
||||
@@ -188,14 +188,14 @@ Espo.define('views/site/navbar', 'view', function (Dep) {
|
||||
});
|
||||
|
||||
var hideOneTab = function () {
|
||||
var count = $tabs.children().size();
|
||||
var count = $tabs.children().length;
|
||||
if (count <= 1) return;
|
||||
var $one = $tabs.children().eq(count - 2);
|
||||
$one.prependTo($more);
|
||||
};
|
||||
var unhideOneTab = function () {
|
||||
var $one = $more.children().eq(0);
|
||||
if ($one.size()) {
|
||||
if ($one.length) {
|
||||
$one.insertBefore($moreDropdown);
|
||||
}
|
||||
};
|
||||
@@ -242,7 +242,7 @@ Espo.define('views/site/navbar', 'view', function (Dep) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($more.children().size() > 0) {
|
||||
if ($more.children().length > 0) {
|
||||
$moreDropdown.removeClass('hidden');
|
||||
}
|
||||
}.bind(this);
|
||||
@@ -265,7 +265,7 @@ Espo.define('views/site/navbar', 'view', function (Dep) {
|
||||
}
|
||||
};
|
||||
|
||||
if ($navbar.height() <= navbarNeededHeight && $more.children().size() === 0) {
|
||||
if ($navbar.height() <= navbarNeededHeight && $more.children().length === 0) {
|
||||
$more.parent().addClass('hidden');
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ Espo.define('views/site/navbar', 'view', function (Dep) {
|
||||
|
||||
var $more = $tabs.find('li.more > ul');
|
||||
|
||||
if ($more.children().size() === 0) {
|
||||
if ($more.children().length === 0) {
|
||||
$more.parent().addClass('hidden');
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ Espo.define('views/stream/panel', ['views/record/panels/relationship', 'lib!Text
|
||||
},
|
||||
|
||||
storeControl: function () {
|
||||
if (this.$textarea && this.$textarea.size()) {
|
||||
if (this.$textarea && this.$textarea.length) {
|
||||
var text = this.$textarea.val();
|
||||
if (text.length) {
|
||||
this.getSessionStorage().set(this.storageTextKey, text);
|
||||
@@ -327,7 +327,7 @@ Espo.define('views/stream/panel', ['views/record/panels/relationship', 'lib!Text
|
||||
}]);
|
||||
|
||||
this.once('remove', function () {
|
||||
if (this.$textarea.size()) {
|
||||
if (this.$textarea.length) {
|
||||
this.$textarea.textcomplete('destroy');
|
||||
}
|
||||
}, this);
|
||||
|
||||
@@ -185,7 +185,7 @@ Espo.define('views/stream/record/edit', 'views/record/base', function (Dep) {
|
||||
if (!this.postingMode) {
|
||||
$('body').off('click.stream-create-post');
|
||||
$('body').on('click.stream-create-post', function (e) {
|
||||
if ($.contains(window.document.body, e.target) && !$.contains(this.$el.get(0), e.target) && !$(e.target).closest('.modal-dialog').size()) {
|
||||
if ($.contains(window.document.body, e.target) && !$.contains(this.$el.get(0), e.target) && !$(e.target).closest('.modal-dialog').length) {
|
||||
if (this.getFieldView('post') && this.getFieldView('post').$element.val() == '') {
|
||||
if (!(this.model.get('attachmentsIds') || []).length) {
|
||||
this.disablePostingMode();
|
||||
|
||||
Reference in New Issue
Block a user