Simon Legner 1 year ago
parent 416363a551
commit ff7a10c003

@ -87,7 +87,8 @@ class App extends Events {
},
dataCallback(data) {
try {
$.extend(data.user || (data.user = {}), app.settings.dump());
data.user ||= {};
Object.assign(data.user, app.settings.dump());
if (data.user.docs) {
data.user.docs = data.user.docs.split("/");
}

@ -185,7 +185,7 @@ app.Searcher = class Searcher extends Events {
constructor(options) {
super();
this.options = $.extend({}, Searcher.DEFAULTS, options || {});
this.options = { ...Searcher.DEFAULTS, ...(options || {}) };
}
find(data, attr, q) {
@ -332,7 +332,7 @@ app.Searcher = class Searcher extends Events {
for (let j = this.scoreMap.length - 1; j >= 0; j--) {
var objects = this.scoreMap[j];
if (objects) {
results.push.apply(results, objects);
results.push(...objects);
}
}
return results.slice(0, this.options.max_results);
@ -369,7 +369,7 @@ app.SynchronousSearcher = class SynchronousSearcher extends app.Searcher {
if (!this.allResults) {
this.allResults = [];
}
this.allResults.push.apply(this.allResults, this.getResults());
this.allResults.push(...this.getResults());
}
return super.match(...arguments);
}

@ -421,18 +421,6 @@ $.smoothScroll = function (el, end) {
// Utilities
//
$.extend = function (target, ...objects) {
for (var object of objects) {
if (object) {
for (var key in object) {
var value = object[key];
target[key] = value;
}
}
}
return target;
};
$.makeArray = function (object) {
if (Array.isArray(object)) {
return object;
@ -573,10 +561,7 @@ const HIGHLIGHT_DEFAULTS = {
};
$.highlight = function (el, options) {
if (options == null) {
options = {};
}
options = $.extend({}, HIGHLIGHT_DEFAULTS, options);
options = { ...HIGHLIGHT_DEFAULTS, ...(options || {}) };
el.classList.add(options.className);
setTimeout(() => el.classList.remove(options.className), options.delay);
};

@ -10,7 +10,7 @@ app.views.Notif = class Notif extends app.View {
constructor(type, options) {
super();
this.type = type;
this.options = $.extend({}, this.constructor.defaultOptions, options || {});
this.options = { ...this.constructor.defaultOptions, ...(options || {}) };
this.init0(); // needs this.options
this.refreshElements();
}

Loading…
Cancel
Save