OmniSupervisor page help

Setup default OmniSupervisor page size// @namespace https://github.com/WindrunnerMax/TKScript

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         OmniSupervisor page help
// @namespace   DavidShang
// @description  Setup default OmniSupervisor page size// @namespace   https://github.com/WindrunnerMax/TKScript
// @version     1.0.0
// @author      [email protected]
// @match        https://*.lightning.force.com/*
// @license     GPL License
// @run-at      document-start
// ==/UserScript==

(function() {
    'use strict';
    let elm
    let currentPage
    let pageSize = localStorage.getItem('sf_omnisupervisor_pagesize') ?? 10

    var id = setInterval(function(){
        currentPage = document.querySelector('.selectedListItem')
        if(currentPage != null && currentPage.innerText != "Select..." && currentPage.innerText != "Omni Supervisor"){
            clearInterval(id)
        }
        elm = document.querySelector('.pagerPageSize select')
        if(elm != null){
            elm.addEventListener('change',function(){
                localStorage.setItem('sf_omnisupervisor_pagesize',elm.value)
            })
            elm.value = pageSize
            var event = document.createEvent('HTMLEvents');
            event.initEvent('change', true, true);
            elm.dispatchEvent(event);
            clearInterval(id)
        }
    },300)
})();