Jira touch scroll

Someone had to do it... Atlassian, please fix.

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.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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         Jira touch scroll
// @namespace    http://tampermonkey.net/
// @version      0.1
// @license      MIT
// @description  Someone had to do it... Atlassian, please fix.
// @author       Creta Park
// @match        https://*.atlassian.net/jira/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=atlassian.net
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    //Smoothness of swiping gesture for scroll.
    let swipeSmoothness = 4;

    swipeSmoothness = 1 + (1 / swipeSmoothness);
    if (swipeSmoothness < 0)
        swipeSmoothness = NaN;

    function addTouchScrolling(element) {
        let startY;
        let deltaY;
        let swipeID = 0;

        element.addEventListener("touchstart", (e) => {
            clearTimeout(swipeID);
            e.preventDefault();
            startY = e.touches[0].clientY;
        });

        element.addEventListener("touchmove", (e) => {
            deltaY = startY - e.touches[0].clientY;
            element.scrollTop += deltaY;
            startY = e.touches[0].clientY;
        });

        element.addEventListener("touchend", (e) => {
            if (!isNaN(swipeSmoothness))
                swipeID = setTimeout(swipeScroll, 16, deltaY);
        });

        function swipeScroll(deltaY) {
            element.scrollTop += deltaY;
            swipeID = setTimeout(swipeScroll, 16, deltaY / swipeSmoothness);
        }
    }
    
    //TODO : Maybe better use MutationObserver, but I have no time for doing it...
    //       This trying registers touch event for these each second.
    var registered = [];

    setInterval(() => {

        var list = Array.from(document.querySelectorAll('[data-component-selector*="full-size-mode-column"]'));

        for (var el of list) {

            if (registered.includes(el))
                continue;

            registered.push(el);
            addTouchScrolling(el.parentElement);
        }

    }, 1000);

    console.log("Confluence story touch scroll enabled.");
})();