362791939qq.com / OmniSupervisor page help

// ==UserScript==
// @namespace     https://openuserjs.org/users/362791939qq.com
// @name         OmniSupervisor page help
// @description  Setup default OmniSupervisor page size.
// @copyright     2022, 362791939qq.com (https://openuserjs.org/users/362791939qq.com)
// @license MIT
// @version       1.0.0
// @match        https://*.lightning.force.com/*
// @grant none
// ==/UserScript==

// ==OpenUserJS==
// @author 362791939qq.com
// ==/OpenUserJS==

(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)
})();