Instagram DM Auto Scroll

Rola automaticamente para o topo das conversas do Instagram até carregar tudo

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Instagram DM Auto Scroll
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Rola automaticamente para o topo das conversas do Instagram até carregar tudo
// @author       Você
// @match        https://www.instagram.com/direct/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    console.log("Tampermonkey: Instagram Auto Scroll carregado!");

    // tempo em milissegundos entre cada rolagem (2000 = 2s)
    const intervalo = 2000;

    function autoScroll() {
        let chatBox = document.querySelector("div[role='dialog'] div[role='main']"); 

        if (chatBox) {
            chatBox.scrollTop = 0; // sobe para o topo
            console.log("Subindo para carregar mensagens antigas...");
        } else {
            console.log("Chat não encontrado, abra uma conversa.");
        }
    }

    // repete a rolagem automaticamente
    setInterval(autoScroll, intervalo);

})();