chg: replaced google-search property with search.provider

enabled button for more results at other search providers
This commit is contained in:
Tobi Schäfer 2018-05-18 20:46:14 +02:00
parent f65eff0015
commit b8b58a2ce7
2 changed files with 11 additions and 1 deletions

View file

@ -288,6 +288,15 @@
<dl class='uk-description-list-line'>
<% response.result %>
</dl>
<% if <% property search.provider %> is null then '' else <% site.skin $Site#moreResults %> %>
<% #moreResults %>
<div class='uk-text-center'>
<a href='<% property search.provider %>?q=<% request.q %>+site:<% site.href %>' class='uk-button'>
<% gettext 'More results at {0}' <% property search.provider | replace 'https?://' '' %> %>
<i class='uk-icon uk-icon-arrow-circle-right'></i>
</a>
</div>
<% #opensearchdescription %>
<?xml version="1.0" encoding="UTF-8"?>

View file

@ -234,7 +234,8 @@ Members.prototype.onCodeUpdate = function() {
});
helma.aspects.addBefore(this, 'search_action', function (args, func, site) {
if (getProperty('google-search') === 'true') {
const provider = getProperty('search.provider');
if (provider === 'google') {
if (req.data.q) {
if (!req.data.q.contains('site:')) {
res.redirect(site.href(req.action) + '?q=' + encodeURIComponent(req.data.q + ' site:' + site.href().replace('test.www.', '')));