[Twitter] Fix scroll

My very crude attempt at fixing twitter scrolling to top of page on moving back from sub-tweets.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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         [Twitter] Fix scroll
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  My very crude attempt at fixing twitter scrolling to top of page on moving back from sub-tweets.
// @author       SL1900
// @match        *://*.twitter.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    let session_store = {};

    setInterval(()=>{
        if(window.scrollY < 50 && session_store[window.location.href] && session_store[window.location.href] > 300)
        {
            console.log(session_store[window.location.href]);
            window.scroll(window.scrollX, session_store[window.location.href]);
        }

        if(window.scrollY > 150) session_store[window.location.href] = window.scrollY;
    }, 100);
})();