Scroll up facebook message page

Is there any javascript code that I can execute to scroll to the top of the message box on Facebook? Therefore, when you click "see all" and go to the main page of the message, when you scroll up, it loads more messages. I want to make it continue to scroll in order to continue to download messages. I tried

document.body.scrollTop = document.documentElement.scrollTop = 0;

But this, of course, is only a scroll at the top of the actual page. Any ideas on how to scroll up the message box?

+4
source share
1 answer

Select a conversation and try the script (download it through the console):

var autoLoad = {

    messagesContainer: document.querySelector('#contentArea [role=main] .uiScrollableAreaContent'),

    start: function (speed) {
        var messagesContainer = this.messagesContainer,
            loadMore = document.querySelector('[role=log] .pam.uiBoxLightblue.uiMorePagerPrimary');
        speed = parseInt(speed, 10) || 1000;
        clearInterval(this.interval);
        this.interval = setInterval(function () {
            messagesContainer.style.top = '0px';
            loadMore.click();
        }, speed);
    },

    stop: function () {
        clearInterval(this.interval);
        this.messagesContainer.style.top = '';
    }

};

, :

// Takes a 'speed' parameter, defaults to 1000 milliseconds
autoLoad.start(1200);

(, ):

autoLoad.stop();

:

Facebook DOM , , :

  • ,
  • " " , facebook script .

, bottom top, .

, , top: '0', AJAX , , . , click , AJAX.

/, , , , , Facebook iids/classes - .

Firefox Chrome, . , , , DOM .

+5

Source: https://habr.com/ru/post/1584811/


All Articles