@@ -158,7 +158,7 @@ $(function() {
158158 if ( searchInput . length == 1 ) {
159159 // Dynamically update forms and faq items while the user types in the search bar
160160 var timer = getTimer ( searchInput ) ;
161- if ( $ ( '#plugin_formcreator_kb_categories .category_active ' ) . length > 0 ) {
161+ if ( $ ( '#plugin_formcreator_kb_categories' ) . length > 0 ) {
162162 var callback = function ( ) {
163163 updateKbitemsView ( currentCategory ) ;
164164 }
@@ -174,13 +174,25 @@ $(function() {
174174 $ ( '#plugin_formcreator_searchBar input' ) . focus ( function ( event ) {
175175 if ( searchInput . val ( ) . length > 0 ) {
176176 searchInput . val ( '' ) ;
177- updateWizardFormsView ( currentCategory ) ;
178- $ . when ( getFormAndFaqItems ( 0 ) ) . then (
179- function ( response ) {
180- tiles = response ;
181- showTiles ( tiles . forms ) ;
182- }
183- ) ;
177+ if ( $ ( '#plugin_formcreator_kb_categories' ) . length > 0 ) {
178+ updateKbitemsView ( null ) ;
179+ $ . when ( getFaqItems ( 0 ) )
180+ . then (
181+ function ( response ) {
182+ tiles = response ;
183+ showTiles ( tiles . forms ) ;
184+ }
185+ ) ;
186+ } else {
187+ updateWizardFormsView ( null ) ;
188+ $ . when ( getFormAndFaqItems ( 0 ) )
189+ . then (
190+ function ( response ) {
191+ tiles = response ;
192+ showTiles ( tiles . forms ) ;
193+ }
194+ ) ;
195+ }
184196 }
185197 } ) ;
186198 }
@@ -285,7 +297,8 @@ function getFaqItems(categoryId) {
285297 data : {
286298 categoriesId : categoryId ,
287299 keywords : keywords ,
288- helpdeskHome : 0 } ,
300+ helpdeskHome : 0
301+ } ,
289302 dataType : "json"
290303 } ) . done ( function ( response ) {
291304 deferred . resolve ( response ) ;
@@ -304,7 +317,12 @@ function getFormAndFaqItems(categoryId) {
304317 var deferred = jQuery . Deferred ( ) ;
305318 $ . post ( {
306319 url : formcreatorRootDoc + '/ajax/homepage_wizard.php' ,
307- data : { wizard : 'forms' , categoriesId : categoryId , keywords : keywords , helpdeskHome : 0 } ,
320+ data : {
321+ wizard : 'forms' ,
322+ categoriesId : categoryId ,
323+ keywords : keywords ,
324+ helpdeskHome : 0
325+ } ,
308326 dataType : "json"
309327 } ) . done ( function ( response ) {
310328 deferred . resolve ( response ) ;
0 commit comments