@@ -5,10 +5,7 @@ define(['jquery', 'ractive', 'rv!templates/template', 'text!css/widget-styles.cs
55 var xhr_suggestions = null ;
66 var timeout_suggestions = null ;
77 var search_widget = {
8- init : function ( baseUrl , context ) {
9-
10- baseUrl = baseUrl ? baseUrl : 'devbranch.search.openstack.org' ;
11- context = context ? context : 'www-openstack' ;
8+ init : function ( z ) {
129
1310 var $style = $ ( "<style></style>" , { type : "text/css" } ) ;
1411 $style . text ( css ) ;
@@ -18,6 +15,8 @@ define(['jquery', 'ractive', 'rv!templates/template', 'text!css/widget-styles.cs
1815 $ ( '.openstack-search-bar' ) . each ( function ( ) {
1916
2017 var el = $ ( this ) ;
18+ var baseUrl = el . data ( 'baseurl' ) ? el . data ( 'baseurl' ) : 'devbranch.search.openstack.org' ;
19+ var context = el . data ( 'context' ) ? el . data ( 'context' ) : 'www-openstack' ;
2120 // render our main view
2221 this . ractive = new Ractive ( {
2322 el : el ,
@@ -40,11 +39,10 @@ define(['jquery', 'ractive', 'rv!templates/template', 'text!css/widget-styles.cs
4039 this . ractive . on ( {
4140 clear : function ( ev ) {
4241 ev . original . preventDefault ( ) ;
43- $ ( '.ossw-search-suggestions' , el ) . hide ( ) ;
42+ $ ( '.ossw-search-suggestions-wrapper ' , el ) . hide ( ) ;
4443 this . set ( 'term' , '' ) ;
4544 } ,
4645 search : function ( ev ) {
47- var term = this . get ( 'term' ) ;
4846 var that = this ;
4947 ev . original . preventDefault ( ) ;
5048
@@ -56,13 +54,12 @@ define(['jquery', 'ractive', 'rv!templates/template', 'text!css/widget-styles.cs
5654 centerPopup ( el ) ;
5755
5856 } else {
59- $ ( '.ossw-search-suggestions' , el ) . show ( ) ;
57+ $ ( '.ossw-search-suggestions-wrapper ' , el ) . show ( ) ;
6058 if ( timeout_suggestions ) clearTimeout ( timeout_suggestions ) ;
6159 timeout_suggestions = window . setTimeout ( doSuggestions , 500 , that ) ;
6260 }
6361 } ,
6462 searchPopup : function ( ev ) {
65- var term = this . get ( 'term' ) ;
6663 var that = this ;
6764
6865 ev . original . preventDefault ( ) ;
@@ -209,8 +206,8 @@ define(['jquery', 'ractive', 'rv!templates/template', 'text!css/widget-styles.cs
209206 var popMaxWidth = parseInt ( $ ( '.ossw-container' , el ) . css ( 'max-width' ) . slice ( 0 , - 2 ) ) ;
210207
211208 $ ( '.ossw-search-results' , el ) . show ( ) ;
212- $ ( '.ossw-search-suggestions' , el ) . hide ( ) ;
213209 $ ( '.ossw-suggestions-wrapper' , el ) . hide ( ) ;
210+ $ ( '.ossw-search-suggestions-wrapper' , el ) . hide ( ) ;
214211
215212 if ( newPopWidth < popMaxWidth ) {
216213 $ ( '.ossw-container' , el ) . css ( 'left' , winW * 0.1 ) ;
0 commit comments