Skip to content

Commit

Permalink
fix: fixes auto scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
diasjoaovitor committed Sep 12, 2024
1 parent 1a4947d commit c73165e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion public/scripts/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const reset = document.getElementById('reset')

const notes = document.querySelector('input')

let height = 0

const getStorage = () => JSON.parse(localStorage.getItem('bot_sambanet')) || []

const setStorage = (data) => {
Expand All @@ -21,6 +23,7 @@ const clearAll = () => {
setStorage([])
logs = []
ul.innerHTML = '<li>Painel de logs</li>'
height = 0
}

const disableButtons = () => {
Expand All @@ -41,7 +44,8 @@ const render = (msg) => {
? text
: `<a href="${link.replace(']', '')}" target="_blank">${text}</a>`
ul.appendChild(li)
ul.scrollTop = ul.clientHeight
height += li.clientHeight
ul.scrollTop = height
}

start.onclick = () => {
Expand Down

0 comments on commit c73165e

Please sign in to comment.