Explorar o código

Fixed first strand button not working

Lee Morgan %!s(int64=6) %!d(string=hai) anos
pai
achega
8c20da5e11
Modificáronse 1 ficheiros con 8 adicións e 5 borrados
  1. 8 5
      views/shared/controller.js

+ 8 - 5
views/shared/controller.js

@@ -17,6 +17,14 @@ class StrandSelector extends HTMLElement{
                 this.appendChild(selector);
             }
 
+            for(let button of this.querySelectorAll("button")){
+                button.onclick = ()=>{
+                    this.setAttribute("strand", button.strandName.slice(0, button.strandName.indexOf("Strand")));
+
+                    window[`${button.strandName.slice(0, button.strandName.indexOf("Strand"))}Obj`].display();
+                }
+            }
+
             strands[0].style.display = "flex";
         })
     }
@@ -36,11 +44,6 @@ class StrandSelector extends HTMLElement{
                 }else{
                     button.style.borderBottom = "none";
                     button.style.cursor = "pointer";
-                    button.onclick = ()=>{
-                        this.setAttribute("strand", button.strandName.slice(0, button.strandName.indexOf("Strand")));
-
-                        window[`${button.strandName.slice(0, button.strandName.indexOf("Strand"))}Obj`].display();
-                    }
                 }
             }
         })