<commit_before>export default class Theming {
    getCurrent() {
        const theme = localStorage.getItem('theme');
        if (theme) {
            if (theme === 'main') {
                this.theme = 'main';
            } else {
                this.theme = 'halloween';
            }
            return;
        }
        this.theme = 'main';
    }

    changeTheme() {
        this.getCurrent();

        if (this.theme === 'main') {
            this.theme = 'halloween';
        } else {
            this.theme = 'main';
        }

        this.setCurrent();
        this.addTheme();
    }

    setTheme() {
        this.getCurrent();
        this.setCurrent();
        this.addTheme();
    }

    setCurrent() {
        localStorage.setItem('theme', this.theme);
    }

    addTheme() {
        const themeBlock = document.querySelector('.theme');

        if (this.theme === 'main') {
            themeBlock.innerHTML = '<link rel="stylesheet" href="built/main.css">';
        } else {
            themeBlock.innerHTML += '<link rel="stylesheet" href="built/halloween.css">';
        }
    }
}<commit_msg>Fix theming<commit_after>export default class Theming {
    getCurrent() {
        const theme = localStorage.getItem('theme');
        if (theme) {
            if (theme === 'main') {
                this.theme = 'main';
            } else {
                this.theme = 'halloween';
            }
            return;
        }
        this.theme = 'main';
    }

    changeTheme() {
        this.getCurrent();

        if (this.theme === 'main') {
            this.theme = 'halloween';
        } else {
            this.theme = 'main';
        }

        this.setCurrent();
        this.addTheme();
    }

    setTheme() {
        this.getCurrent();
        this.setCurrent();
        this.addTheme();
    }

    setCurrent() {
        localStorage.setItem('theme', this.theme);
    }

    addTheme() {
        const themeBlock = document.querySelector('.theme');
        this.link = themeBlock.querySelectorAll('link')[1];
        this.linkExist = true;

        if (!this.link) {
            this.linkExist = false;
            this.link = document.createElement('link');
            this.link.rel = 'stylesheet';
            this.link.href = 'built/halloween.css';
        }

        if (this.theme === 'main') {
            if (this.linkExist) {
                themeBlock.removeChild(this.link);
            }
        } else {
            themeBlock.appendChild(this.link);
        }
    }
}
{'fraction_non_alphanumeric': 0.1449044585987261, 'fraction_numerical': 0.0003980891719745223, 'mean_word_length': 1.4807502467917077, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2111352', 'n_tokens_mistral': 709, 'n_tokens_neox': 702, 'n_words': 123}