Add eslint and style fix

This commit is contained in:
Alex Ling
2022-08-19 11:40:41 +00:00
parent e4af194d0c
commit 28c098a56e
19 changed files with 1795 additions and 1677 deletions
+26 -28
View File
@@ -1,30 +1,28 @@
$(function(){
var filter = [];
var result = [];
$('.uk-card-title').each(function(){
filter.push($(this).text());
});
$('.uk-search-input').keyup(function(){
var input = $('.uk-search-input').val();
var regex = new RegExp(input, 'i');
$(function () {
let filter = [];
let result = [];
$('.uk-card-title').each(function () {
filter.push($(this).text());
});
$('.uk-search-input').keyup(function () {
let input = $('.uk-search-input').val();
let regex = new RegExp(input, 'i');
if (input === '') {
$('.item').each(function(){
$(this).removeAttr('hidden');
});
}
else {
filter.forEach(function(text, i){
result[i] = text.match(regex);
});
$('.item').each(function(i){
if (result[i]) {
$(this).removeAttr('hidden');
}
else {
$(this).attr('hidden', '');
}
});
}
});
if (input === '') {
$('.item').each(function () {
$(this).removeAttr('hidden');
});
} else {
filter.forEach(function (text, i) {
result[i] = text.match(regex);
});
$('.item').each(function (i) {
if (result[i]) {
$(this).removeAttr('hidden');
} else {
$(this).attr('hidden', '');
}
});
}
});
});