66 * @returns false
77 */
88var changeTab = function ( e , level = "" ) {
9- var eid = $ ( e . target ) . parent ( ) . attr ( "id" ) . split ( "_" ) [ 0 ] ;
9+ var label = $ ( e . target ) . parent ( ) . attr ( "id" ) . split ( "_" ) [ 0 ] ;
1010
1111 // TODO: Add error checking
1212
@@ -21,8 +21,15 @@ var changeTab = function(e, level = "") {
2121 } ) ;
2222
2323 // Show the current tab, and add an "active" class to the button that opened the tab
24- $ ( '#' + eid + "_button" ) . addClass ( "active" ) ;
25- $ ( '#' + eid + "_block" ) . show ( ) ;
24+ $ ( '#' + label + "_button" ) . addClass ( "active" ) ;
25+ $ ( '#' + label + "_block" ) . show ( ) ;
26+ 27+ // if this has a *, remove
28+ var button_text = $ ( '#' + label + '_button-link' ) . text ( ) ;
29+ if ( button_text . indexOf ( "*" ) > - 1 ) {
30+ button_text = button_text . replace ( "*" , "" ) ;
31+ $ ( '#' + label + '_button-link' ) . html ( button_text ) ;
32+ }
2633
2734 return false ;
2835}
@@ -583,6 +590,9 @@ $(function () {
583590 n_results = req . getResponseHeader ( 'Search-Results' ) ;
584591 $ ( '#cand-search-text' ) . text ( "Search (" + n_results + " results)" ) ;
585592
593+ // Update the candidate button text.
594+ $ ( '#cand_button-link' ) . text ( "Candidate Events*" ) ;
595+ 586596 // Update the URL search params.
587597 let curr_search_params = new URLSearchParams ( window . location . search ) ;
588598 var search_params = jQuery . parseJSON ( req . getResponseHeader ( 'Query' ) ) ;
@@ -593,6 +603,8 @@ $(function () {
593603 var new_url = 'adj?' + curr_search_params . toString ( ) ;
594604 window . history . pushState ( { path : new_url } , '' , new_url ) ;
595605
606+ initializeSearchListeners ( ) ;
607+ 596608 // get rid of loading flash
597609 $ ( '.flash' ) . hide ( ) ;
598610 $ ( '.flash' ) . removeClass ( 'alert-info' ) ;
0 commit comments