Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter klsnk99

    (@klsnk99)

    Thanks for the feedback, but it didn’t help. I have written another code that works in the moment, I will wait for the bug to be fixed in the plugin.

    
    document.addEventListener('DOMContentLoaded', function () {
    function showPlaceholder() {
    document.querySelector('.tribe-events-view-loader').classList.remove('tribe-common-a11y-hidden');
    }
    
    function hidePlaceholder() {
    document.querySelector('.tribe-events-view-loader').classList.add('tribe-common-a11y-hidden');
    }
    function checkClassesAtBreakpoint() {
    var breakpoint = window.matchMedia("(min-width: 991px)");
    var divElement = document.querySelector('.tribe-common');
    
    function checkClasses() {
    
    if (divElement) {
    
    if (!divElement.classList.contains('tribe-common--breakpoint-xsmall')) {
    divElement.classList.add('tribe-common--breakpoint-xsmall');
    }
    if (!divElement.classList.contains('tribe-common--breakpoint-medium')) {
    divElement.classList.add('tribe-common--breakpoint-medium');
    }
    if (!divElement.classList.contains('tribe-common--breakpoint-full')) {
    divElement.classList.add('tribe-common--breakpoint-full');
    }
    document.querySelector('.tribe-events-view-loader').classList.remove('tribe-common-a11y-hidden');
    }
    }
    
    function handleBreakpointChange(breakpoint) {
    if (breakpoint.matches) {
    checkClasses();
    }
    }
    
    handleBreakpointChange(breakpoint);
    
    }
    
    (function () {
    const originalSend = XMLHttpRequest.prototype.send;
    XMLHttpRequest.prototype.send = function () {
    showPlaceholder()
    this.addEventListener('readystatechange', function () {
    if (this.readyState === 4 && this.status === 200) {
    setTimeout(() => {
    checkClassesAtBreakpoint();
    
    }, 10);
    setTimeout(() => {
    hidePlaceholder();
    }, 500);
    }
    });
    return originalSend.apply(this, arguments);
    };
    })();
    
    });

Viewing 1 replies (of 1 total)