@@ -20,7 +20,7 @@ led_strip.initialize = function (callback, scrollPosition) {
2020
2121    TABS . led_strip . functions  =  [ 'i' ,  'w' ,  'f' ,  'a' ,  't' ,  'r' ,  'c' ,  'g' ,  's' ,  'b' ,  'l' ,  'o' ,  'y' ] ; 
2222    TABS . led_strip . baseFuncs  =  [ 'c' ,  'f' ,  'a' ,  'l' ,  's' ,  'g' ,  'r' ,  'p' ,  'e' ,  'u' ] ; 
23-     TABS . led_strip . overlays  =   [ 't' ,  'y' ,  'o' ,  'b' ,  'v' ,  'i' ,  'w' ] ; 
23+     TABS . led_strip . overlays  =   [ 't' ,  'y' ,  'o' ,  'x'  ,   ' b',  'v' ,  'i' ,  'w' ] ; 
2424
2525    if  ( semver . lt ( FC . CONFIG . apiVersion , API_VERSION_1_46 ) )  { 
2626        TABS . led_strip . overlays  =  TABS . led_strip . overlays . filter ( x  =>  x  !==  'y' ) ; 
@@ -456,6 +456,7 @@ led_strip.initialize = function (callback, scrollPosition) {
456456                                case  't' :
457457                                case  'y' :
458458                                case  'o' :
459+                                 case  'x' :
459460                                case  's' :
460461                                    if  ( areModifiersActive ( `function-${ f }  ) ) 
461462                                        p . addClass ( `function-${ letter }  ) ; 
@@ -489,28 +490,46 @@ led_strip.initialize = function (callback, scrollPosition) {
489490            return  $ ( that ) . is ( ':checked' ) ; 
490491        } 
491492
493+         // Disable all other functions except the one being activated 
494+         function  disableOtherFunctions ( activeFunction )  { 
495+             const  functions  =  [ '.function-o' ,  '.function-b' ,  '.function-x' ] ; 
496+ 
497+             functions . forEach ( func  =>  { 
498+                 if  ( ! activeFunction . is ( func ) )  { 
499+                     const  checkbox  =  $ ( `.checkbox ${ func }  ) ; 
500+                     if  ( checkbox . is ( ':checked' ) )  { 
501+                         checkbox . prop ( 'checked' ,  false ) ; 
502+                         checkbox . trigger ( 'change' ) ; 
503+                         toggleSwitch ( checkbox ,  func . slice ( - 1 ) ) ;  // Pass the last character as the identifier 
504+                     } 
505+                 } 
506+             } ) ; 
507+         } 
508+ 
492509        // UI: check-box toggle 
493510        $ ( '.checkbox' ) . on ( 'change' ,  function ( e )  { 
494511            if  ( e . originalEvent )  { 
495512                // user-triggered event 
496513                const  that  =  $ ( this ) . find ( 'input' ) ; 
497514
498-                 //disable Blink always or Larson scanner, both functions are not working properly at the same time 
499-                 if  ( that . is ( '.function-o' ) )  { 
500-                     const  blink  =  $ ( '.checkbox .function-b' ) ; 
501-                     if  ( blink . is ( ':checked' ) )  { 
502-                         blink . prop ( 'checked' ,  false ) ; 
503-                         blink . trigger ( 'change' ) ; 
504-                         toggleSwitch ( blink ,  'b' ) ; 
515+                 // Event handlers for each function 
516+                 $ ( '.checkbox .function-o' ) . on ( 'change' ,  function  ( )  { 
517+                     if  ( $ ( this ) . is ( ':checked' ) )  { 
518+                         disableOtherFunctions ( $ ( this ) ) ; 
519+                     } 
520+                 } ) ; 
521+ 
522+                 $ ( '.checkbox .function-b' ) . on ( 'change' ,  function  ( )  { 
523+                     if  ( $ ( this ) . is ( ':checked' ) )  { 
524+                         disableOtherFunctions ( $ ( this ) ) ; 
505525                    } 
506-                 }  else  if  ( that . is ( '.function-b' ) )  { 
507-                     const  larson  =  $ ( '.checkbox .function-o' ) ; 
508-                     if  ( $ ( '.checkbox .function-o' ) . is ( ':checked' ) )  { 
509-                         larson . prop ( 'checked' ,  false ) ; 
510-                         larson . trigger ( 'change' ) ; 
511-                         toggleSwitch ( larson ,  'o' ) ; 
526+                 } ) ; 
527+ 
528+                 $ ( '.checkbox .function-x' ) . on ( 'change' ,  function  ( )  { 
529+                     if  ( $ ( this ) . is ( ':checked' ) )  { 
530+                         disableOtherFunctions ( $ ( this ) ) ; 
512531                    } 
513-                 } 
532+                 } ) ; 
514533
515534                //Change Rainbow slider visibility 
516535                if  ( that . is ( '.function-y' ) )  { 
@@ -827,6 +846,7 @@ led_strip.initialize = function (callback, scrollPosition) {
827846            case  "function-r" :
828847            case  "function-y" :
829848            case  "function-o" :
849+             case  "function-x" :
830850            case  "function-b" :
831851            case  "function-g" :
832852                return  true ; 
0 commit comments