[chore] var naming problem fix

This commit is contained in:
zzossig 2020-02-08 23:48:40 +09:00
parent d7c9185329
commit e9ceb3250c
1 changed files with 6 additions and 6 deletions

View File

@ -844,12 +844,12 @@
var searchElem = document.getElementById('search'); var searchElem = document.getElementById('search');
var searchMobile = document.getElementById('search-mobile'); var searchMobile = document.getElementById('search-mobile');
var searchResults = document.getElementById('search-results'); var searchResultsContainer = document.getElementById('search-results');
searchElem ? searchElem ?
searchElem.addEventListener('input', function(e) { searchElem.addEventListener('input', function(e) {
if (!e.target.value | window.innerWidth < 770) { if (!e.target.value | window.innerWidth < 770) {
searchResults ? searchResults.setAttribute('class', 'dropdown') : null; searchResultsContainer ? searchResultsContainer.setAttribute('class', 'dropdown') : null;
searchResult ? searchResult.setAttribute('data-display', 'none') : null; searchResult ? searchResult.setAttribute('data-display', 'none') : null;
summaryContainer ? summaryContainer.setAttribute('data-display', 'block') : null; summaryContainer ? summaryContainer.setAttribute('data-display', 'block') : null;
return null; return null;
@ -871,7 +871,7 @@
renderSearchResultsSide(searchText, results); renderSearchResultsSide(searchText, results);
} }
var dropdownItems = searchResults.querySelectorAll('.dropdown-item'); var dropdownItems = searchResultsContainer.querySelectorAll('.dropdown-item');
dropdownItems ? dropdownItems.forEach(function(item) { dropdownItems ? dropdownItems.forEach(function(item) {
item.addEventListener('mousedown', function(e) { item.addEventListener('mousedown', function(e) {
e.target.click(); e.target.click();
@ -885,7 +885,7 @@
if (window.innerWidth < 770) { if (window.innerWidth < 770) {
return null; return null;
} }
searchResults ? searchResults.setAttribute('class', 'dropdown') : null; searchResultsContainer ? searchResultsContainer.setAttribute('class', 'dropdown') : null;
}) : null; }) : null;
searchElem ? searchElem ?
@ -894,7 +894,7 @@
return null; return null;
} }
if (!e.target.value) { if (!e.target.value) {
searchResults ? searchResults.setAttribute('class', 'dropdown') : null; searchResultsContainer ? searchResultsContainer.setAttribute('class', 'dropdown') : null;
return null; return null;
} }
@ -914,7 +914,7 @@
renderSearchResultsSide(searchText, results); renderSearchResultsSide(searchText, results);
} }
var dropdownItems = searchResults.querySelectorAll('.dropdown-item'); var dropdownItems = searchResultsContainer.querySelectorAll('.dropdown-item');
dropdownItems ? dropdownItems.forEach(function (item) { dropdownItems ? dropdownItems.forEach(function (item) {
item.addEventListener('mousedown', function (e) { item.addEventListener('mousedown', function (e) {
e.target.click(); e.target.click();