From ddca421b290ff0891f1c4220e09faabdf70bbff6 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Wed, 20 Apr 2022 23:12:15 -0700 Subject: [PATCH] clicking favorites puts into input --- resources/js/index.js | 7 +++++++ resources/style/index.css | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/resources/js/index.js b/resources/js/index.js index fd4a1a5..9417a1d 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -153,6 +153,12 @@ async function handleFavoriteInput() { } } +async function setIp(ip) { + const ipInput = document.querySelector('#ip') + + ipInput.value = ip +} + async function handleFavoriteList() { const ipArr = await getFavIps() const ipList = document.querySelector('#ipList') @@ -167,6 +173,7 @@ async function handleFavoriteList() { for (const ip of ipArr) { const elm = document.createElement('li') elm.innerHTML = ip + elm.addEventListener('click', () => setIp(ip)) list.appendChild(elm) } diff --git a/resources/style/index.css b/resources/style/index.css index a92cb4d..7148948 100644 --- a/resources/style/index.css +++ b/resources/style/index.css @@ -36,6 +36,11 @@ body { border-bottom: 1px solid #ccc; } +#ipList li:hover { + color: #ffc61e; + cursor: pointer; +} + #ipList li:last-child { border-bottom: none; }