Skip to content

Commit 8425ebd

Browse files
committed
fix: updated custom search to current api
1 parent 039b556 commit 8425ebd

File tree

3 files changed

+26
-180
lines changed

3 files changed

+26
-180
lines changed

doc/_templates/gse.html

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,17 @@
2424
</style>
2525

2626
<div class="sidebarblock">
27-
<div id="cse-search-form">Loading</div>
28-
29-
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
30-
<script type="text/javascript">
31-
google.load('search', '1', {language : 'en'});
32-
google.setOnLoadCallback(function() {
33-
var customSearchControl = new google.search.CustomSearchControl(
34-
'010960497803984932957:u8pmqf7fdoq');
35-
36-
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
37-
var options = new google.search.DrawOptions();
38-
options.enableSearchboxOnly("{{pathto('searchresults')}}");
39-
customSearchControl.draw('cse-search-form', options);
40-
}, true);
27+
<script>
28+
(function() {
29+
var cx = '010960497803984932957:u8pmqf7fdoq';
30+
var gcse = document.createElement('script');
31+
gcse.type = 'text/javascript';
32+
gcse.async = true;
33+
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
34+
var s = document.getElementsByTagName('script')[0];
35+
s.parentNode.insertBefore(gcse, s);
36+
})();
4137
</script>
38+
<gcse:search></gcse:search>
4239
</div>
4340
{% endblock %}

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
# General information about the project.
7575
project = u'nipype'
76-
copyright = u'2009-17, Neuroimaging in Python team'
76+
copyright = u'2009-18, Neuroimaging in Python team'
7777

7878
# The version info for the project you're documenting, acts as replacement for
7979
# |version| and |release|, also used in various other places throughout the

doc/searchresults.rst

Lines changed: 14 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -6,168 +6,17 @@ Search results
66

77
.. raw:: html
88

9-
<div id="cse" style="width: 100%;">Loading</div>
10-
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
11-
<script type="text/javascript">
12-
function parseQueryFromUrl () {
13-
var queryParamName = "q";
14-
var search = window.location.search.substr(1);
15-
var parts = search.split('&');
16-
for (var i = 0; i < parts.length; i++) {
17-
var keyvaluepair = parts[i].split('=');
18-
if (decodeURIComponent(keyvaluepair[0]) == queryParamName) {
19-
return decodeURIComponent(keyvaluepair[1].replace(/\+/g, ' '));
20-
}
21-
}
22-
return '';
23-
}
24-
google.load('search', '1', {language : 'en', style : google.loader.themes.MINIMALIST});
25-
google.setOnLoadCallback(function() {
26-
var customSearchControl = new google.search.CustomSearchControl(
27-
'010960497803984932957:u8pmqf7fdoq');
28-
29-
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
30-
customSearchControl.draw('cse');
31-
var queryFromUrl = parseQueryFromUrl();
32-
if (queryFromUrl) {
33-
customSearchControl.execute(queryFromUrl);
34-
}
35-
}, true);
36-
</script>
37-
<link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" /> <style type="text/css">
38-
.gsc-control-cse {
39-
font-family: Arial, sans-serif;
40-
border-color: #FFFFFF;
41-
background-color: #FFFFFF;
42-
}
43-
input.gsc-input {
44-
border-color: #BCCDF0;
45-
}
46-
input.gsc-search-button {
47-
border-color: #666666;
48-
background-color: #CECECE;
49-
}
50-
.gsc-tabHeader.gsc-tabhInactive {
51-
border-color: #E9E9E9;
52-
background-color: #E9E9E9;
53-
}
54-
.gsc-tabHeader.gsc-tabhActive {
55-
border-top-color: #FF9900;
56-
border-left-color: #E9E9E9;
57-
border-right-color: #E9E9E9;
58-
background-color: #FFFFFF;
59-
}
60-
.gsc-tabsArea {
61-
border-color: #E9E9E9;
62-
}
63-
.gsc-webResult.gsc-result,
64-
.gsc-results .gsc-imageResult {
65-
border-color: #FFFFFF;
66-
background-color: #FFFFFF;
67-
}
68-
.gsc-webResult.gsc-result:hover,
69-
.gsc-imageResult:hover {
70-
border-color: #FFFFFF;
71-
background-color: #FFFFFF;
72-
}
73-
.gs-webResult.gs-result a.gs-title:link,
74-
.gs-webResult.gs-result a.gs-title:link b,
75-
.gs-imageResult a.gs-title:link,
76-
.gs-imageResult a.gs-title:link b {
77-
color: #0000CC;
78-
}
79-
.gs-webResult.gs-result a.gs-title:visited,
80-
.gs-webResult.gs-result a.gs-title:visited b,
81-
.gs-imageResult a.gs-title:visited,
82-
.gs-imageResult a.gs-title:visited b {
83-
color: #0000CC;
84-
}
85-
.gs-webResult.gs-result a.gs-title:hover,
86-
.gs-webResult.gs-result a.gs-title:hover b,
87-
.gs-imageResult a.gs-title:hover,
88-
.gs-imageResult a.gs-title:hover b {
89-
color: #0000CC;
90-
}
91-
.gs-webResult.gs-result a.gs-title:active,
92-
.gs-webResult.gs-result a.gs-title:active b,
93-
.gs-imageResult a.gs-title:active,
94-
.gs-imageResult a.gs-title:active b {
95-
color: #0000CC;
96-
}
97-
.gsc-cursor-page {
98-
color: #0000CC;
99-
}
100-
a.gsc-trailing-more-results:link {
101-
color: #0000CC;
102-
}
103-
.gs-webResult .gs-snippet,
104-
.gs-imageResult .gs-snippet,
105-
.gs-fileFormatType {
106-
color: #000000;
107-
}
108-
.gs-webResult div.gs-visibleUrl,
109-
.gs-imageResult div.gs-visibleUrl {
110-
color: #008000;
111-
}
112-
.gs-webResult div.gs-visibleUrl-short {
113-
color: #008000;
114-
}
115-
.gs-webResult div.gs-visibleUrl-short {
116-
display: none;
117-
}
118-
.gs-webResult div.gs-visibleUrl-long {
119-
display: block;
120-
}
121-
.gsc-cursor-box {
122-
border-color: #FFFFFF;
123-
}
124-
.gsc-results .gsc-cursor-box .gsc-cursor-page {
125-
border-color: #E9E9E9;
126-
background-color: #FFFFFF;
127-
color: #0000CC;
128-
}
129-
.gsc-results .gsc-cursor-box .gsc-cursor-current-page {
130-
border-color: #FF9900;
131-
background-color: #FFFFFF;
132-
color: #0000CC;
133-
}
134-
.gs-promotion {
135-
border-color: #336699;
136-
background-color: #FFFFFF;
137-
}
138-
.gs-promotion a.gs-title:link,
139-
.gs-promotion a.gs-title:link *,
140-
.gs-promotion .gs-snippet a:link {
141-
color: #0000CC;
142-
}
143-
.gs-promotion a.gs-title:visited,
144-
.gs-promotion a.gs-title:visited *,
145-
.gs-promotion .gs-snippet a:visited {
146-
color: #0000CC;
147-
}
148-
.gs-promotion a.gs-title:hover,
149-
.gs-promotion a.gs-title:hover *,
150-
.gs-promotion .gs-snippet a:hover {
151-
color: #0000CC;
152-
}
153-
.gs-promotion a.gs-title:active,
154-
.gs-promotion a.gs-title:active *,
155-
.gs-promotion .gs-snippet a:active {
156-
color: #0000CC;
157-
}
158-
.gs-promotion .gs-snippet,
159-
.gs-promotion .gs-title .gs-promotion-title-right,
160-
.gs-promotion .gs-title .gs-promotion-title-right * {
161-
color: #000000;
162-
}
163-
.gs-promotion .gs-visibleUrl,
164-
.gs-promotion .gs-visibleUrl-short {
165-
color: #008000;
166-
}
167-
/* Manually added - the layout goes wrong without this */
168-
.gsc-tabsArea,
169-
.gsc-webResult:after,
170-
.gsc-resultsHeader {
171-
clear: none;
172-
}
173-
</style>
9+
<div id="cse" style="width: 100%;">Loading
10+
<script>
11+
(function() {
12+
var cx = '010960497803984932957:u8pmqf7fdoq';
13+
var gcse = document.createElement('script');
14+
gcse.type = 'text/javascript';
15+
gcse.async = true;
16+
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
17+
var s = document.getElementsByTagName('script')[0];
18+
s.parentNode.insertBefore(gcse, s);
19+
})();
20+
</script>
21+
<gcse:search></gcse:search>
22+
</div>

0 commit comments

Comments
 (0)