panwauu / tac-with-bug

Webapp for the popular boardgame TAC
https://tac-with-bug.herokuapp.com/
4 stars 4 forks source link

New Messages don't scroll automatically #118

Closed Letssharearow closed 1 year ago

Letssharearow commented 1 year ago

I wrote this tempermonkey script for me to scroll automatically

`// ==UserScript== // @name Tac // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://tac-with-bug.herokuapp.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=herokuapp.com // @grant none // ==/UserScript==

(function () { "use strict"; console.log("Tac");

function scrollText(e) { console.log("DOMNodeInserted", e); const inputLength = e.target.querySelector("textarea")?.textContent.length; console.log("inputLength", inputLength); if (inputLength && inputLength <= 0) { e.target.scrollHeight = e.target.scrollTop; } }

function onClickSetDomListener() { const messagesContainer = document.querySelector(".chatBodyMessages"); messagesContainer.removeEventListener("DOMNodeInserted", scrollText); messagesContainer.addEventListener("DOMNodeInserted", scrollText); }

window.addEventListener("click", onClickSetDomListener); })(); `

panwauu commented 1 year ago

I thought I already implemented this. Does it never work for you? Can you add what browser you are using?

Letssharearow commented 1 year ago

I am using chrome. I disabled my extension, reproduced it, tried to reproduce it with recording, coudln't reproduce it. I will come back to this, when I have the issue again