pygame-community / pygame-ce

🐍🎮 pygame - Community Edition is a FOSS Python library for multimedia applications (like games). Built on top of the excellent SDL library.
https://pyga.me
929 stars 154 forks source link

Site themes pyga.me/docs #3041

Open Sinus44 opened 3 months ago

Sinus44 commented 3 months ago

While change page, site theme reset to light

oddbookworm commented 3 months ago

Do you have your settings set to block cookies?

Sinus44 commented 3 months ago

cookies allow for "pyga.me". "document.cookie" is empty

Chrome, Win 10

Sinus44 commented 3 months ago

document.addEventListener('DOMContentLoaded', () => {
    const search_buttons = document.querySelectorAll('.searchbar-button');
    const search_submit = document.querySelector('.searchbar-submit');

    // When the icon is clicked, submit the search form
    search_buttons.forEach((button) => {
        button.addEventListener('click', () => {
            search_submit.click();
        });
    });

    const theme_icons = document.querySelectorAll('.theme-icon');
    theme_icons.forEach((icon) => {
        icon.addEventListener('click', () => {
            const theme = icon.getAttribute('data-theme');
            htmlElement.classList.add('light-theme', 'dark-theme');
            htmlElement.classList.remove(theme);
            localStorage.setItem('theme', htmlElement.classList[0]);
        });
    });
});

htmlElement.classList[0] in my case, it turned out to be "...-translated"

bilhox commented 4 weeks ago

Is this really a problem that should be fixed @Sinus44 ? In my side I don't have this problem in my side with chrome.