Skip to content

Commit 3f1657a

Browse files
committed
Added search box to google
JAVA-1752
1 parent 8b8c543 commit 3f1657a

File tree

6 files changed

+44
-4
lines changed

6 files changed

+44
-4
lines changed

docs/reference/themes/mongodb/layouts/partials/header/main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
</a>
1212
</div>
1313
<!--logo end-->
14-
{{ partial "header/topRight.html" }}
14+
{{ partial "header/topRight.html" . }}
1515
</div>
1616
</header>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div id="search">
2+
<form method="get" action="//www.google.com/search" target="_blank">
3+
<input type="text" name="searchQuery" size="20" value="" autocomplete="off" placeholder="Search docs">
4+
<input type="hidden" name="site" value="site:{{.Site.BaseUrl}}">
5+
<input type="hidden" name="q" value="">
6+
<label for="searchQuery"><i class="fa fa-search fa-1"></i></label>
7+
</form>
8+
</div>

docs/reference/themes/mongodb/layouts/partials/header/topRight.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
<a href="http://www.mongodb.org/get-involved" data-toggle="tooltip" data-placement="bottom" title="Get involved with MongoDB">Community</a>
66
<a href="http://docs.mongodb.org" data-toggle="tooltip" data-placement="bottom" title="The MongoDB Documentation">Docs</a>
77
<a href="http://blog.mongodb.org" data-toggle="tooltip" data-placement="bottom" title="The MongoDB Blog">Blog</a>
8+
{{ partial "header/search.html" . }}
89
</div>
910
</div>

docs/reference/themes/mongodb/static/css/overrides.css

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
margin-left: 5px;
2424
}
2525

26-
.hljsCode pre { padding: 0px; overflow: auto; word-wrap: normal; white-space: nowrap;}
27-
.hljsCode pre code { padding: 24px 12px; overflow: auto; white-space: pre;}
26+
.jsEnabled pre { padding: 0px; overflow: auto; word-wrap: normal; white-space: nowrap;}
27+
.jsEnabled pre code { padding: 24px 12px; overflow: auto; white-space: pre;}
2828

2929
.body blockquote {
3030
background-color: #edf4e8;
@@ -88,3 +88,30 @@ code {
8888
a code {
8989
color: #006cbc;
9090
}
91+
92+
#search {
93+
visibility: hidden;
94+
display: inline-block;
95+
background-color: rgba(255,255,255,0.3);
96+
border-radius: 6px;
97+
border: 1px solid #3b2920;
98+
font-weight: 300;
99+
font-size: 15px;
100+
padding: 2px;
101+
}
102+
103+
#search label {
104+
padding-right: 5px;
105+
}
106+
107+
#search input[name="searchQuery"] {
108+
background-color: transparent !important;
109+
color: white;
110+
border: none;
111+
padding: 2px 0 0 4px;
112+
outline: none;
113+
}
114+
115+
.jsEnabled #search {
116+
visibility: visible;
117+
}
5.95 KB
Loading

docs/reference/themes/mongodb/static/js/scripts.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ function initializeJS() {
1515
jQuery(document).ready(function(){
1616
initializeJS();
1717
jQuery('[data-toggle="tooltip"]').tooltip();
18-
jQuery("body").addClass("hljsCode");
18+
jQuery("body").addClass("jsEnabled");
1919
hljs.initHighlightingOnLoad();
2020
var linkRegex = new RegExp('/' + window.location.host + '/');
2121
jQuery('a').not('[href*="mailto:"]').each(function () {
2222
if ( ! linkRegex.test(this.href) ) {
2323
$(this).attr('target', '_blank');
2424
}
2525
});
26+
jQuery('.body table').addClass('table').addClass('table-striped');
27+
jQuery("#search form").submit(function() {
28+
$('#search input[name="q"]').attr("value", $('#search input[name="searchQuery"]').val() + ' ' + $('#search input[name="site"]').val());
29+
});
2630
});

0 commit comments

Comments
 (0)