Skip to content

Commit 4f30332

Browse files
author
Chris Hunt
committed
Fix lint issues
1 parent 852c231 commit 4f30332

3 files changed

Lines changed: 36 additions & 36 deletions

File tree

public/js/app.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4120,20 +4120,20 @@ $.when($.ready).then(function () {
41204120
var width = $input.outerWidth();
41214121
var $autocomplete = $('<div id="search-autocomplete"></div>');
41224122
suggestions.forEach(function (suggestion) {
4123-
var $item = $('<div class="autocomplete-item"></div>').text(suggestion).on('click', function () {
4123+
var $item = $('<div class="autocomplete-item"></div>').text(suggestion).on("click", function () {
41244124
$input.val(suggestion);
41254125
hideAutocomplete();
4126-
$input.closest('form').submit();
4126+
$input.closest("form").submit();
41274127
});
41284128
$autocomplete.append($item);
41294129
});
41304130
$autocomplete.css({
4131-
position: 'absolute',
4132-
top: position.top + $input.outerHeight() + 'px',
4133-
left: position.left + 'px',
4134-
width: width + 'px'
4131+
position: "absolute",
4132+
top: "".concat(position.top + $input.outerHeight(), "px"),
4133+
left: "".concat(position.left, "px"),
4134+
width: "".concat(width, "px")
41354135
});
4136-
$input.closest('#search-container').append($autocomplete);
4136+
$input.closest("#search-container").append($autocomplete);
41374137
}
41384138
function fetchAutocomplete(query, provider) {
41394139
// Cancel previous request if any
@@ -4145,8 +4145,8 @@ $.when($.ready).then(function () {
41454145
return;
41464146
}
41474147
currentAutocompleteRequest = $.ajax({
4148-
url: base + 'search/autocomplete',
4149-
method: 'GET',
4148+
url: "".concat(base, "search/autocomplete"),
4149+
method: "GET",
41504150
data: {
41514151
q: query,
41524152
provider: provider
@@ -4209,15 +4209,15 @@ $.when($.ready).then(function () {
42094209
});
42104210

42114211
// Hide autocomplete when clicking outside
4212-
$(document).on('click', function (e) {
4213-
if (!$(e.target).closest('#search-container').length) {
4212+
$(document).on("click", function (e) {
4213+
if (!$(e.target).closest("#search-container").length) {
42144214
hideAutocomplete();
42154215
}
42164216
});
42174217

42184218
// Hide autocomplete on Escape key
4219-
$(document).on('keydown', function (e) {
4220-
if (e.key === 'Escape') {
4219+
$(document).on("keydown", function (e) {
4220+
if (e.key === "Escape") {
42214221
hideAutocomplete();
42224222
}
42234223
});

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/assets/js/app.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ $.when($.ready).then(() => {
118118

119119
function showAutocomplete(suggestions, inputElement) {
120120
hideAutocomplete();
121-
121+
122122
if (!suggestions || suggestions.length === 0) {
123123
return;
124124
}
@@ -128,26 +128,26 @@ $.when($.ready).then(() => {
128128
const width = $input.outerWidth();
129129

130130
const $autocomplete = $('<div id="search-autocomplete"></div>');
131-
131+
132132
suggestions.forEach((suggestion) => {
133133
const $item = $('<div class="autocomplete-item"></div>')
134134
.text(suggestion)
135-
.on('click', function() {
135+
.on("click", () => {
136136
$input.val(suggestion);
137137
hideAutocomplete();
138-
$input.closest('form').submit();
138+
$input.closest("form").submit();
139139
});
140140
$autocomplete.append($item);
141141
});
142142

143143
$autocomplete.css({
144-
position: 'absolute',
145-
top: position.top + $input.outerHeight() + 'px',
146-
left: position.left + 'px',
147-
width: width + 'px'
144+
position: "absolute",
145+
top: `${position.top + $input.outerHeight()}px`,
146+
left: `${position.left}px`,
147+
width: `${width}px`,
148148
});
149149

150-
$input.closest('#search-container').append($autocomplete);
150+
$input.closest("#search-container").append($autocomplete);
151151
}
152152

153153
function fetchAutocomplete(query, provider) {
@@ -162,22 +162,22 @@ $.when($.ready).then(() => {
162162
}
163163

164164
currentAutocompleteRequest = $.ajax({
165-
url: base + 'search/autocomplete',
166-
method: 'GET',
165+
url: `${base}search/autocomplete`,
166+
method: "GET",
167167
data: {
168168
q: query,
169-
provider: provider
169+
provider,
170170
},
171-
success: function(data) {
171+
success(data) {
172172
const inputElement = $("#search-container input[name=q]")[0];
173173
showAutocomplete(data, inputElement);
174174
},
175-
error: function() {
175+
error() {
176176
hideAutocomplete();
177177
},
178-
complete: function() {
178+
complete() {
179179
currentAutocompleteRequest = null;
180-
}
180+
},
181181
});
182182
}
183183

@@ -186,7 +186,7 @@ $.when($.ready).then(() => {
186186
const search = this.value;
187187
const items = $("#sortable").find(".item-container");
188188
const provider = $("#search-container select[name=provider]").val();
189-
189+
190190
if (provider === "tiles") {
191191
hideAutocomplete();
192192
if (search.length > 0) {
@@ -202,7 +202,7 @@ $.when($.ready).then(() => {
202202
}
203203
} else {
204204
items.show();
205-
205+
206206
// Debounce autocomplete requests
207207
clearTimeout(autocompleteTimeout);
208208
autocompleteTimeout = setTimeout(() => {
@@ -234,15 +234,15 @@ $.when($.ready).then(() => {
234234
});
235235

236236
// Hide autocomplete when clicking outside
237-
$(document).on('click', function(e) {
238-
if (!$(e.target).closest('#search-container').length) {
237+
$(document).on("click", (e) => {
238+
if (!$(e.target).closest("#search-container").length) {
239239
hideAutocomplete();
240240
}
241241
});
242242

243243
// Hide autocomplete on Escape key
244-
$(document).on('keydown', function(e) {
245-
if (e.key === 'Escape') {
244+
$(document).on("keydown", (e) => {
245+
if (e.key === "Escape") {
246246
hideAutocomplete();
247247
}
248248
});

0 commit comments

Comments
 (0)