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">';
        }
    }
}
@@ -834,25 +834,24 @@
 heme');%0A
-%0A
         
 if (this
@@ -846,33 +846,114 @@
     
-if (
 this.
-theme === 'main'
+link = themeBlock.querySelectorAll('link')%5B1%5D;%0A        this.linkExist = true;%0A%0A        if (!this.link
 ) %7B%0A
@@ -970,75 +970,177 @@
   th
-emeBlock.innerHTML = '%3Clink rel=%22stylesheet%22 href=%22built/mai
+is.linkExist = false;%0A            this.link = document.createElement('link');%0A            this.link.rel = 'stylesheet';%0A            this.link.href = 'built/hallowee
 n.css
-%22%3E
 ';%0A 
@@ -1151,104 +1151,208 @@
    %7D
- else %7B%0A            themeBlock.innerHTML += '%3Clink rel=%22stylesheet%22 href=%22built/halloween.css%22%3E'
+%0A%0A        if (this.theme === 'main') %7B%0A            if (this.linkExist) %7B%0A                themeBlock.removeChild(this.link);%0A            %7D%0A        %7D else %7B%0A            themeBlock.appendChild(this.link)
 ;%0A  

Fix theming