From 6d21948c377266d7c3aaae3e0292d313dcc29dc2 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Wed, 20 Apr 2022 23:14:39 -0700 Subject: [PATCH] exit favorites list when clicking outside --- resources/js/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/js/index.js b/resources/js/index.js index 9417a1d..3b5eb8f 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -17,6 +17,15 @@ document.addEventListener('DOMContentLoaded', async () => { if (ipArr.includes(config.lastConnect)) { document.querySelector('#star').src = 'icons/star_filled.svg' } + + + // Exit favorites list when clicking outside of it + window.addEventListener("click", function() { + const favList = document.querySelector('#ipList') + if (favList.style.display !== 'none') { + favList.style.display = 'none' + } + }); }) async function getFavIps() {