diff --git a/TFR/server/static/js/flash.js b/TFR/server/static/js/flash.js index b9807a6..3c2f0bf 100644 --- a/TFR/server/static/js/flash.js +++ b/TFR/server/static/js/flash.js @@ -1,10 +1,10 @@ function addFlashMessage(message, type='success') { - let flask = document.createElement('p'); + const flask = document.createElement('p'); flask.onclick = () => flask.remove(); flask.classList.add(type); flask.innerHTML = message; - let close = document.createElement('span'); + const close = document.createElement('span'); close.innerHTML = ''; flask.appendChild(close); diff --git a/TFR/server/static/js/search.js b/TFR/server/static/js/search.js index da4cc23..15f1312 100644 --- a/TFR/server/static/js/search.js +++ b/TFR/server/static/js/search.js @@ -1,11 +1,13 @@ +let typingTimer; + function showHint() { - let search = document.querySelector('#search'); - let searchPos = search.getBoundingClientRect(); + const search = document.querySelector('#search'); + const searchPos = search.getBoundingClientRect(); let hint = document.querySelector('.search-hint'); - hint.style.width = search.offsetWidth + 'px'; - hint.style.left = searchPos.left + 'px'; - hint.style.top = searchPos.bottom + 'px'; + hint.style.width = `${search.offsetWidth}px`; + hint.style.left = `${searchPos.left}px`; + hint.style.top = `${searchPos.bottom}px`; hint.style.display = 'flex'; } @@ -18,13 +20,13 @@ function hideHint() { function updateHint() { - let search = document.querySelector('#search'); - let searchPos = search.getBoundingClientRect(); + const search = document.querySelector('#search'); + const searchPos = search.getBoundingClientRect(); let hint = document.querySelector('.search-hint'); - hint.style.width = search.offsetWidth + 'px'; - hint.style.left = searchPos.left + 'px'; - hint.style.top = searchPos.bottom + 'px'; + hint.style.width = `${search.offsetWidth}px`; + hint.style.left = `${searchPos.left}px`; + hint.style.top = `${searchPos.bottom}px`; } @@ -37,7 +39,7 @@ function getSearch() { return; } - fetch('/api/search?q=' + search.toString(), { + fetch(`/api/search?q=${search}`, { method: 'GET', }) .then(response => response.json()) @@ -54,8 +56,7 @@ function getSearch() { el.innerHTML = user; el.onmousedown = function (event) { event.preventDefault(); - search = document.querySelector('#search'); - search.value = user.toString(); + search = user.toString(); search.blur(); } hint.appendChild(el); @@ -68,7 +69,6 @@ function getSearch() { window.onload = () => { - let typingTimer; let search = document.querySelector('#search'); if (search === null) { diff --git a/TFR/server/static/js/sessions.js b/TFR/server/static/js/sessions.js index e2ec13a..ca707a6 100644 --- a/TFR/server/static/js/sessions.js +++ b/TFR/server/static/js/sessions.js @@ -1,6 +1,6 @@ function yeetSession(id) { let form = new FormData(); - form.append('session_id', id); + form.append('session', id); fetch('/api/tokens', { method: 'POST',