@@ -114,12 +114,27 @@ function toggleFormFields() {
114114 row . classList . toggle ( 'hidden' , ! isFullSelected ) ;
115115 } ) ;
116116
117- // Show/hide popover fields
117+ // Show/hide popover fields (modal and inline are both popover variants)
118118 popoverOnlyRows . forEach ( ( row ) => {
119119 row . classList . toggle ( 'hidden' , isFullSelected ) ;
120120 } ) ;
121121}
122122
123+ /**
124+ * Toggle view all label row visibility based on checkbox state
125+ */
126+ function toggleViewAllLabelRow ( ) {
127+ const checkbox = document . getElementById ( 'searchcraft_enable_view_all_results' ) ;
128+ const labelRows = document . querySelectorAll ( '.searchcraft-view-all-label-row' ) ;
129+ if ( ! checkbox || ! labelRows . length ) {
130+ return ;
131+ }
132+ const isChecked = checkbox . checked ;
133+ labelRows . forEach ( ( row ) => {
134+ row . style . display = isChecked ? '' : 'none' ;
135+ } ) ;
136+ }
137+
123138/**
124139 * Toggle filter panel options visibility
125140 */
@@ -647,32 +662,28 @@ function updateFilterPanelOrder() {
647662}
648663
649664document . addEventListener ( 'DOMContentLoaded' , ( ) => {
650- // Initialize color pickers
651665 initColorPickers ( ) ;
652-
653- // Initialize password toggle functionality
654666 initPasswordToggle ( ) ;
655-
656- // Initialize button with spinner functionality
657667 initButtonWithSpinner ( ) ;
658-
659- // Initialize custom post type checkboxes
660668 initCustomPostTypeCheckboxes ( ) ;
661-
662- // Initialize excerpt override inputs with datalist
663669 initExcerptOverrideInputs ( ) ;
664670
665671 // layout tab functionality
666672 if ( document . querySelector ( '.searchcraft-layout' ) ) {
667- const fullRadio = document . querySelector ( 'input[name="searchcraft_search_experience"][value="full"]' ) ;
668- const popoverRadio = document . querySelector ( 'input[name="searchcraft_search_experience"][value="popover"]' ) ;
673+ // Search behavior toggle for input container description
674+ const onPageRadio = document . querySelector ( 'input[name="searchcraft_search_behavior"][value="on_page"]' ) ;
675+ const standAloneRadio = document . querySelector ( 'input[name="searchcraft_search_behavior"][value="stand_alone"]' ) ;
669676
670677 // Initial state
671678 toggleFormFields ( ) ;
679+ updateSearchInputContainerDescription ( ) ;
672680
673- // Add event listeners
674- fullRadio ?. addEventListener ( 'change' , toggleFormFields ) ;
675- popoverRadio ?. addEventListener ( 'change' , toggleFormFields ) ;
681+ // Add event listeners for all three experience radio buttons
682+ document . querySelectorAll ( 'input[name="searchcraft_search_experience"]' ) . forEach ( ( radio ) => {
683+ radio . addEventListener ( 'change' , toggleFormFields ) ;
684+ } ) ;
685+ onPageRadio ?. addEventListener ( 'change' , updateSearchInputContainerDescription ) ;
686+ standAloneRadio ?. addEventListener ( 'change' , updateSearchInputContainerDescription ) ;
676687
677688 // Filter panel options toggle
678689 const filterPanelCheckbox = document . getElementById ( 'searchcraft_include_filter_panel' ) ;
@@ -684,20 +695,9 @@ document.addEventListener('DOMContentLoaded', () => {
684695 filterPanelCheckbox . addEventListener ( 'change' , toggleFilterPanelOptions ) ;
685696 }
686697
687- // Search behavior toggle for input container description
688- const onPageRadio = document . querySelector ( 'input[name="searchcraft_search_behavior"][value="on_page"]' ) ;
689- const standAloneRadio = document . querySelector ( 'input[name="searchcraft_search_behavior"][value="stand_alone"]' ) ;
690-
691698 // Initialize container ID tag UI
692699 initContainerIdTagUI ( ) ;
693700
694- // Initial state
695- updateSearchInputContainerDescription ( ) ;
696-
697- // Add event listeners
698- onPageRadio ?. addEventListener ( 'change' , updateSearchInputContainerDescription ) ;
699- standAloneRadio ?. addEventListener ( 'change' , updateSearchInputContainerDescription ) ;
700-
701701 // Facets options toggle
702702 const facetsCheckbox = document . getElementById ( 'searchcraft_enable_facets' ) ;
703703 if ( facetsCheckbox ) {
@@ -708,6 +708,16 @@ document.addEventListener('DOMContentLoaded', () => {
708708 facetsCheckbox . addEventListener ( 'change' , toggleFacetsOptions ) ;
709709 }
710710
711+ // View all label row toggle
712+ const viewAllCheckbox = document . getElementById ( 'searchcraft_enable_view_all_results' ) ;
713+ if ( viewAllCheckbox ) {
714+ // Initial state
715+ toggleViewAllLabelRow ( ) ;
716+
717+ // Add event listener
718+ viewAllCheckbox . addEventListener ( 'change' , toggleViewAllLabelRow ) ;
719+ }
720+
711721 // AI summary banner text toggle
712722 const aiSummaryCheckbox = document . getElementById ( 'searchcraft_enable_ai_summary' ) ;
713723 if ( aiSummaryCheckbox ) {
0 commit comments