@@ -519,27 +519,38 @@ var unbxdSearchInit = function(jQuery, Handlebars){
519
519
, hashChangeInterval : null
520
520
, ajaxCall : null
521
521
, init : function ( ) {
522
- this . isHashChange = ! ! ( "onhashchange" in window . document . body ) ;
523
-
524
- this . $input = jQuery ( this . options . inputSelector ) ;
525
- this . $input . val ( '' ) ;
526
- this . input = this . $input [ 0 ] ;
527
-
528
- this . setEvents ( ) ;
529
-
530
- this . reset ( ) ;
531
-
532
- this . params . categoryId = this . options . type == "browse" && typeof this . options . getCategoryId == "function" ? this . options . getCategoryId ( ) : "" ;
533
-
534
- if ( this . params . categoryId . length > 0 ) {
535
- if ( typeof this . options . setDefaultFilters == "function" )
536
- this . setDefaultParams ( this . params ) ;
537
-
538
- this . setPage ( 1 )
539
- . setPageSize ( this . options . pageSize ) ;
540
-
541
- this . callResults ( this . paintResultSet ) ;
542
- } else if ( this . options . type == "search" && this . input . value . trim ( ) . length ) {
522
+ this . isHashChange = ! ! ( "onhashchange" in window . document . body ) ;
523
+ this . $input = jQuery ( this . options . inputSelector ) ;
524
+ this . $input . val ( '' ) ;
525
+ this . input = this . $input [ 0 ] ;
526
+ this . setEvents ( ) ;
527
+ this . reset ( ) ;
528
+ this . params . categoryId = this . options . type == "browse" && typeof this . options . getCategoryId == "function" ? this . options . getCategoryId ( ) : "" ;
529
+ if ( this . params . categoryId . length > 0 ) {
530
+ if ( this . getQueryParams ( ) [ "category-id" ] == this . params . categoryId ) {
531
+ var cur_url = this . getUrlSubstring ( )
532
+ , urlqueryparams = this . getQueryParams ( cur_url )
533
+ , decodedParams = ! / [ ^ A - Z a - z 0 - 9 \+ \/ \= ] / g. test ( cur_url ) ? this . getQueryParams ( this . decode ( cur_url ) ) : { }
534
+ , queryparamcount = Object . keys ( urlqueryparams ) . length
535
+ , decodedParamscount = Object . keys ( decodedParams ) . length
536
+ , finalParams = null ;
537
+ if ( ! this . options . noEncoding && decodedParamscount > 0 ) {
538
+ finalParams = this . _processURL ( decodedParams )
539
+ } else {
540
+ finalParams = this . _processURL ( urlqueryparams )
541
+ }
542
+ this . params = finalParams ;
543
+ this . setPage ( "page" in finalParams . extra ? finalParams . extra . page : 1 ) . setPageSize ( "rows" in finalParams . extra ? finalParams . extra . rows : this . options . pageSize ) ;
544
+ if ( typeof this . options . setDefaultFilters == "function" )
545
+ this . setDefaultParams ( this . params ) ;
546
+ this . callResults ( this . paintResultSet )
547
+ } else {
548
+ if ( typeof this . options . setDefaultFilters == "function" )
549
+ this . setDefaultParams ( this . params ) ;
550
+ this . setPage ( 1 ) . setPageSize ( this . options . pageSize ) ;
551
+ this . callResults ( this . paintResultSet )
552
+ }
553
+ } else if ( this . options . type == "search" && this . input . value . trim ( ) . length ) {
543
554
if ( typeof this . options . setDefaultFilters == "function" )
544
555
this . setDefaultParams ( this . params ) ;
545
556
0 commit comments