JS: Replace jquery.find() with pure js

This commit is contained in:
Yonas Habteab 2022-04-01 16:57:59 +02:00
parent 96c3b31686
commit d903b902fc

View File

@ -161,8 +161,9 @@
Dashboard.prototype.onRendered = function (e) { Dashboard.prototype.onRendered = function (e) {
let _this = e.data.self; let _this = e.data.self;
$(e.target).find('.dashboard-settings, .dashboard.content, .dashboard-item-list, .dashlet-item-list').each(function () { e.target.querySelectorAll('.dashboard-settings, .dashboard.content, .dashboard-item-list, .dashlet-item-list')
let groupName = _this.getTypeFor(this), .forEach(sortable => {
let groupName = _this.getTypeFor(sortable),
draggable, draggable,
handle; handle;
@ -181,7 +182,7 @@
} }
case WIDGET_TYPES.Dashlet: { case WIDGET_TYPES.Dashlet: {
groupName = WIDGET_TYPES.Dashlet; groupName = WIDGET_TYPES.Dashlet;
if (this.matches('.dashboard.content')) { if (sortable.matches('.dashboard.content')) {
draggable = '> .container'; draggable = '> .container';
} else { } else {
draggable = '.dashlet-list-item'; draggable = '.dashlet-list-item';
@ -205,7 +206,7 @@
} }
}; };
Sortable.create(this, options); Sortable.create(sortable, options);
}); });
}; };