Fix Code Smell: Unexpected var, use let or const instead.

https://sonarcloud.io/project/issues?issues=AYEpqxwP3DjyH4ZzxfLw&open=AYEpqxwP3DjyH4ZzxfLw&id=adityatelange_hugo-PaperMod
This commit is contained in:
Aditya Telange 2022-08-20 14:20:51 +05:30
parent fd077de0f4
commit 198a4d74ae
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77

View File

@ -1,21 +1,21 @@
import * as params from '@params'; import * as params from '@params';
var fuse; // holds our search engine let fuse; // holds our search engine
var resList = document.getElementById('searchResults'); let resList = document.getElementById('searchResults');
var sInput = document.getElementById('searchInput'); let sInput = document.getElementById('searchInput');
var first, last, current_elem = null let first, last, current_elem = null
var resultsAvailable = false; let resultsAvailable = false;
// load our search index // load our search index
window.onload = function () { window.onload = function () {
var xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
if (xhr.readyState === 4) { if (xhr.readyState === 4) {
if (xhr.status === 200) { if (xhr.status === 200) {
var data = JSON.parse(xhr.responseText); let data = JSON.parse(xhr.responseText);
if (data) { if (data) {
// fuse.js options; check fuse.js website for details // fuse.js options; check fuse.js website for details
var options = { let options = {
distance: 100, distance: 100,
threshold: 0.4, threshold: 0.4,
ignoreLocation: true, ignoreLocation: true,
@ -106,12 +106,12 @@ sInput.addEventListener('search', function (e) {
// kb bindings // kb bindings
document.onkeydown = function (e) { document.onkeydown = function (e) {
let key = e.key; let key = e.key;
var ae = document.activeElement; let ae = document.activeElement;
let inbox = document.getElementById("searchbox").contains(ae) let inbox = document.getElementById("searchbox").contains(ae)
if (ae === sInput) { if (ae === sInput) {
var elements = document.getElementsByClassName('focus'); let elements = document.getElementsByClassName('focus');
while (elements.length > 0) { while (elements.length > 0) {
elements[0].classList.remove('focus'); elements[0].classList.remove('focus');
} }