@@ -100,6 +100,8 @@ function initSearch(name) {
100100 'constructor' : 4
101101 } ;
102102
103+ var baseHref = $ ( 'body' ) . data ( 'base-href' ) ;
104+
103105 function findMatches ( q ) {
104106 var allMatches = [ ] ; // list of matches
105107
@@ -226,7 +228,7 @@ function initSearch(name) {
226228 if ( suggestion . length > 0 ) {
227229 var href = suggestion . data ( "href" ) ;
228230 if ( href != null ) {
229- window . location = href ;
231+ window . location = baseHref + href ;
230232 }
231233 }
232234 }
@@ -235,14 +237,12 @@ function initSearch(name) {
235237
236238 typeaheadElement . bind ( 'typeahead:select' , function ( ev , suggestion ) {
237239 selectedSuggestion = suggestion ;
238- window . location = suggestion . href ;
240+ window . location = baseHref + suggestion . href ;
239241 } ) ;
240242 }
241243
242244 var jsonReq = new XMLHttpRequest ( ) ;
243- var scriptUrl = URI ( document . getElementById ( "dartdoc_script_js" ) . src ) ;
244-
245- jsonReq . open ( 'GET' , URI ( scriptUrl . directory ( ) + '/..' ) . absoluteTo ( scriptUrl ) + '/index.json' , true ) ;
245+ jsonReq . open ( 'GET' , baseHref + 'index.json' , true ) ;
246246 jsonReq . addEventListener ( 'load' , function ( ) {
247247 searchIndex = JSON . parse ( jsonReq . responseText ) ;
248248 initTypeahead ( ) ;
0 commit comments