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; }