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" %} {% extends "layout.html" %}
{% set title = _('Search') %} {% 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 %} {% block body %}
<h1 id="search-documentation">{{ _('Search') }}</h1> <h1 id="search-documentation">{{ _('Search') }}</h1>
<div id="fallback" class="admonition warning"> <div id="fallback" class="admonition warning">
@ -23,26 +19,11 @@
</p> </p>
</div> </div>
<p> <p>
{% trans %}From here you can search these documents. Enter your search {% trans %}From here you can search the User Manual. Enter your search
words into the box below and click "search". Note that the search words into the box below and click "search".
function will automatically search for all of the words. Pages {% endtrans %}
containing fewer words won't appear in the result list.{% endtrans %}
</p> </p>
<div id="cse" style="width: 100%;">Loading</div> <div class="gcse-search" data-enableHistory="true">
<script src="https://www.google.com/jsapi" type="text/javascript"></script> <script type="text/javascript" async src="https://cse.google.com/cse.js?cx=partner-pub-5939552585043235:2303012306"></script>
<script type="text/javascript"> </div>
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>
{% endblock %} {% endblock %}

View File

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