Lolzteam Auto Refresh

Автоматически обновляет темы в разделах

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.

(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         Lolzteam Auto Refresh
// @version      0.2
// @description  Автоматически обновляет темы в разделах
// @author       vuchaev2015
// @match        https://zelenka.guru/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=zelenka.guru
// @grant        none
// @namespace https://greasyfork.org/users/997663
// ==/UserScript==

function removeUpdateFeedButton() {
    if (document.visibilityState === 'visible' && $('.discussionListItems, .UpdateFeedButton').length) {
        $('.UpdateFeedButton').remove();
    }
}

function updateDiscussionList() {
    if (document.visibilityState === 'visible' && $('.discussionListItems').length) {
        $('.DiscussionList').trigger('LoadPageWithoutCache');
        $('.forumImprovements--mask').remove();
    }
}

setInterval(removeUpdateFeedButton);
setInterval(updateDiscussionList, 5000);

const observer = new MutationObserver((mutationsList, observer) => {
    if (document.visibilityState === 'visible') {
        for (const mutation of mutationsList) {
            if (mutation.type === 'childList' && $('#AjaxProgress').length) {
                $('#AjaxProgress').remove();
            }
        }
    }
});

observer.observe(document.body, { childList: true, subtree: true });