Skip to content

Commit 661dd1a

Browse files
authored
Merge pull request #2055 from wilzbach/select-first
Automatically select the first Ddox entry instead of searching on Google
2 parents 5e49319 + dc72423 commit 661dd1a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

dpl-docs/views/layout.dt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ html(lang='en-US')
2929
link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css')
3030
link(rel='shortcut icon', href='#{root_dir}favicon.ico')
3131
script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', type='text/javascript')
32-
script(type="text/javascript", src="#{root_dir}js/ddox.js")
3332
meta(name='viewport', content='width=device-width, initial-scale=1.0, minimum-scale=0.1, maximum-scale=10.0')
3433

3534
body.std(id='#{info.node.moduleName}')
@@ -115,7 +114,7 @@ html(lang='en-US')
115114
a.expand-toggle(href="#{root_dir}search.html", title="Search")
116115
span Search
117116
#search-box
118-
form(method='get', action='https://google.com/search')
117+
form(method='get', action='https://google.com/search', autocomplete='off')
119118
input#domains(type='hidden', name='domains', value='dlang.org')
120119
|
121120
input#sourceid(type='hidden', name='sourceid', value='google-search')
@@ -232,6 +231,7 @@ html(lang='en-US')
232231
script(type='text/javascript', src='#{root_dir}js/run_examples.js')
233232
script(type='text/javascript', src='#{root_dir}js/dlang.js')
234233
script(type='text/javascript', src='#{root_dir}js/listanchors.js')
234+
script(type="text/javascript", src="#{root_dir}js/ddox.js")
235235
script(type='text/javascript').
236236
jQuery(document).ready(listanchors);
237237
setupDdox();

js/ddox.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,13 @@ function performSymbolSearch(maxlen)
128128

129129
$('#symbolSearchResults').show();
130130
}
131+
132+
$(function(){
133+
$("#search-box form").on("submit", function(e) {
134+
var searchResults = $('#symbolSearchResults').children();
135+
if (searchResults.length > 0) {
136+
window.location = searchResults.first().find("a").attr("href");
137+
e.preventDefault();
138+
}
139+
});
140+
});

0 commit comments

Comments
 (0)