altus icon indicating copy to clipboard operation
altus copied to clipboard

Prevent WhatsApp from scrolling all the way to the top when you reply to a message from the bottom

Open iamvinny opened this issue 3 years ago • 0 comments

It would be super useful if Altus had an option to prevent WhatsApp from automatically scrolling all the way to the top when you reply to a message from the bottom. This way, when you reply to an older message from the bottom, you won't have to scroll all the way back to the bottom to reply to the next chat.

It can be very useful for companies who are using WhatsApp Business to stay in touch with customers, or individuals who get a lot of messages.

It may seem simple, but I'm not quite sure how hard it would be to implement something like this on Altus.

This piece of code used to work just fine, but ever since WhatsApp updated their web client (about 2 months ago) it stopped working.

if(document.URL.includes('web.whatsapp.com') == true){

console.log('script added')

var p=setInterval(function(){

  if(document.querySelectorAll('.DuUXI')[0]){

    var t=setInterval(function(){

      document.querySelectorAll('.DuUXI')[0].addEventListener('keydown',function(){
      if (event.keyCode === 13) {

        var y = document.querySelector('#pane-side').scrollTop

        setTimeout(function() {

             document.querySelector('#pane-side').scrollTop = y
                    }, 1500);
      }

    })
    },1000);

    clearInterval(p)

  }
},500)

}

iamvinny avatar Apr 12 '21 01:04 iamvinny