User Manual: Fix errors caused by change to google custom search API

This commit is contained in:
Kovid Goyal 2017-12-10 10:48:58 +05:30
parent 6df445e96d
commit 2d09f5dba1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 29 deletions

View File

@ -9,10 +9,6 @@
#}
{% extends "layout.html" %}
{% set title = _('Search') %}
{% block extrahead %}
<link rel="stylesheet" href="https://www.google.com/cse/style/look/default.css" type="text/css" />
{{ super() }}
{% endblock %}
{% block body %}
<h1 id="search-documentation">{{ _('Search') }}</h1>
<div id="fallback" class="admonition warning">
@ -23,26 +19,11 @@
</p>
</div>
<p>
{% trans %}From here you can search these documents. Enter your search
words into the box below and click "search". Note that the search
function will automatically search for all of the words. Pages
containing fewer words won't appear in the result list.{% endtrans %}
{% trans %}From here you can search the User Manual. Enter your search
words into the box below and click "search".
{% endtrans %}
</p>
<div id="cse" style="width: 100%;">Loading</div>
<script src="https://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1');
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl('partner-pub-5939552585043235:2303012306');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.setAutoComplete(true);
customSearchControl.draw('cse', options);
var params = $.getQueryParameters();
if (params.q) {
var query = params.q[0];
customSearchControl.execute(query);
}
}, true);
</script>
<div class="gcse-search" data-enableHistory="true">
<script type="text/javascript" async src="https://cse.google.com/cse.js?cx=partner-pub-5939552585043235:2303012306"></script>
</div>
{% endblock %}

View File

@ -1,13 +1,11 @@
{%- if pagename != "search" and builder != "singlehtml" %}
<div id="searchbox" style="display: none" role="search">
<div id="searchbox" role="search">
<form class="search" action="{{ pathto('search') }}" method="get">
<div>
<input type="text" name="q" placeholder="{{ search_box_text }}" />&nbsp;
<input type="submit" value="{{ _('Go') }}" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
{%- endif %}