File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed
Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change 11async function omniBox ( query ) {
2- const results = await fetch ( `/search=${ query } ` ) . then ( ( res ) => res . json ( ) ) ;
2+ let results ;
3+ if ( query . startsWith ( "http:" ) || query . startsWith ( "https:" ) ) {
4+ results = [ [ ] , [ ] ] ;
5+ }
6+ else {
7+ results = await fetch ( `/search=${ query } ` ) . then ( ( res ) => res . json ( ) ) . catch ( ( err ) => console . log ( "OmniBox Error ignoring..." ) ) ;
8+ }
39 document . getElementById ( "omnibox-list" ) . innerHTML = '' ;
410 document . getElementById ( "uv-form" ) . style . marginTop = "120px" ;
511 document . getElementById ( "omnibox" ) . removeAttribute ( "class" , "dnone" ) ;
6- await results [ 1 ] . forEach ( ( result ) => {
7- //the only issue is that this passes passed the height of the omnibox and so it needs to be fixed
8- document . getElementById ( "omnibox-list" ) . innerHTML += `
9- <li class="omniBoxResult" onclick="omniBoxSelect('${ result } ')">${ result } </li>
10- <div id="seperator"></div>
11- `
12- } ) ;
12+ try {
13+ await results [ 1 ] . forEach ( ( result ) => {
14+ //the only issue is that this passes passed the height of the omnibox and so it needs to be fixed
15+ document . getElementById ( "omnibox-list" ) . innerHTML += `
16+ <li class="omniBoxResult" onclick="omniBoxSelect('${ result } ')">${ result } </li>
17+ <div id="seperator"></div>
18+ `
19+ } ) ;
20+ }
21+ catch ( err ) {
22+ results = [ [ ] , [ ] ] ;
23+ }
1324 if ( results [ 1 ] . length == 0 ) {
1425 document . getElementById ( "omnibox-list" ) . innerHTML = ''
1526 document . getElementById ( "uv-form" ) . style . marginTop = "20px" ;
You can’t perform that action at this time.
0 commit comments