File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 2222
2323    doc . getElementById ( 'searchbox' ) . addEventListener ( 'keyup' ,  function  ( event )  { 
2424        const  url  =  new  URL ( window . location ) ; 
25-         url . searchParams . set ( 'sq' ,  event . target . value ) ; 
26-         url . searchParams . set ( 'p' ,  1 ) ; 
27-         window . history . pushState ( { } ,  '' ,  url ) ; 
25+         url . searchParams . set ( 'sq' ,  event . target . value . trim ( ) ) ; 
26+         if  ( url . href  !=  window . location . href )  { 
27+             url . searchParams . set ( 'p' ,  1 ) ; 
28+             window . history . pushState ( { } ,  '' ,  url ) ; 
29+         } 
2830    } ) 
2931
3032    doc . getElementById ( 'pagination' ) . addEventListener ( 'click' ,  function  ( event )  { 
3436        window . history . pushState ( { } ,  '' ,  url ) ; 
3537    } ) 
3638
39+     window . onpopstate  =  ( event )  =>  { 
40+         window . location . reload ( ) ; 
41+     } ; 
42+ 
3743    search . addWidgets ( [ 
3844        instantsearch . widgets . configure ( { 
3945            hitsPerPage : 10 , 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments