SearXNG: oscar theme

This commit is contained in:
Alexandre Flament 2021-09-30 17:55:22 +02:00
parent a582cf3d82
commit df06dddc04
19 changed files with 73 additions and 82 deletions

View file

@ -61,29 +61,33 @@ module.exports = function(grunt) {
}, },
dist: { dist: {
src: ['src/js/*.js', '../__common__/js/image_layout.js'], src: ['src/js/*.js', '../__common__/js/image_layout.js'],
dest: 'js/searx.js' dest: 'js/searxng.js'
} }
}, },
uglify: { uglify: {
options: { options: {
output: {
comments: 'some'
},
sourceMap: true, sourceMap: true,
}, },
dist: { dist: {
files: { files: {
'js/searx.min.js': ['<%= concat.dist.dest %>'] 'js/searxng.min.js': ['<%= concat.dist.dest %>']
} }
} }
}, },
jshint: { jshint: {
files: ['gruntfile.js', 'js/searx_src/*.js', '../__common__/js/image_layout.js'], files: ['gruntfile.js', 'src/js/*.js', '../__common__/js/image_layout.js'],
options: { options: {
reporterOutput: "", reporterOutput: "",
esversion: 6,
// options here to override JSHint defaults // options here to override JSHint defaults
globals: { globals: {
jQuery: true, jQuery: true,
console: true, console: true,
module: true, module: true,
document: true document: true,
} }
} }
}, },

View file

@ -1,20 +1,11 @@
/** /**
* searx is free software: you can redistribute it and/or modify * @license
* it under the terms of the GNU Affero General Public License as published by * (C) Copyright Contributors to the SearXNG project.
* the Free Software Foundation, either version 3 of the License, or * (C) Copyright Contributors to the searx project (2014 - 2021).
* (at your option) any later version. * SPDX-License-Identifier: AGPL-3.0-or-later
*
* searx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with searx. If not, see < http://www.gnu.org/licenses/ >.
*
* (C) 2019 by Alexandre Flament
*/ */
window.searx = (function(d) {
window.searxng = (function(d) {
'use strict'; 'use strict';
// //
@ -32,3 +23,5 @@ window.searx = (function(d) {
translations: JSON.parse(script.getAttribute('data-translations')) translations: JSON.parse(script.getAttribute('data-translations'))
}; };
})(document); })(document);
window.searx = {};

View file

@ -1,23 +1,14 @@
/** /**
* searx is free software: you can redistribute it and/or modify * @license
* it under the terms of the GNU Affero General Public License as published by * (C) Copyright Contributors to the SearXNG project.
* the Free Software Foundation, either version 3 of the License, or * (C) Copyright Contributors to the searx project (2014 - 2021).
* (at your option) any later version.
*
* searx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with searx. If not, see < http://www.gnu.org/licenses/ >.
*
* (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at> * (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
$(document).ready(function(){ $(document).ready(function(){
var original_search_value = ''; var original_search_value = '';
if(searx.autocompleter) { if(searxng.autocompleter) {
var searchResults = new Bloodhound({ var searchResults = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace, queryTokenizer: Bloodhound.tokenizers.whitespace,

View file

@ -1,18 +1,9 @@
/** /**
* searx is free software: you can redistribute it and/or modify * @license
* it under the terms of the GNU Affero General Public License as published by * (C) Copyright Contributors to the SearXNG project.
* the Free Software Foundation, either version 3 of the License, or * (C) Copyright Contributors to the searx project (2014 - 2021).
* (at your option) any later version.
*
* searx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with searx. If not, see < http://www.gnu.org/licenses/ >.
*
* (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at> * (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
$(document).ready(function(){ $(document).ready(function(){
@ -112,6 +103,6 @@ $(document).ready(function(){
/** /**
* Layout images according to their sizes * Layout images according to their sizes
*/ */
searx.image_thumbnail_layout = new searx.ImageLayout('#main_results', '#main_results .result-images', 'img.img-thumbnail', 15, 200); searxng.image_thumbnail_layout = new searx.ImageLayout('#main_results', '#main_results .result-images', 'img.img-thumbnail', 15, 200);
searx.image_thumbnail_layout.watch(); searxng.image_thumbnail_layout.watch();
}); });

View file

@ -1,3 +1,10 @@
/**
* @license
* (C) Copyright Contributors to the SearXNG project.
* (C) Copyright Contributors to the searx project (2014 - 2021).
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
window.addEventListener('load', function() { window.addEventListener('load', function() {
// Hide infobox toggle if shrunk size already fits all content. // Hide infobox toggle if shrunk size already fits all content.
$('.infobox').each(function() { $('.infobox').each(function() {

View file

@ -1,22 +1,13 @@
/** /**
* searx is free software: you can redistribute it and/or modify * @license
* it under the terms of the GNU Affero General Public License as published by * (C) Copyright Contributors to the SearXNG project.
* the Free Software Foundation, either version 3 of the License, or * (C) Copyright Contributors to the searx project (2014 - 2021).
* (at your option) any later version.
*
* searx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with searx. If not, see < http://www.gnu.org/licenses/ >.
*
* (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at> * (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
$(document).ready(function(){ $(document).ready(function(){
$(".searx_init_map").on( "click", function( event ) { $(".searxng_init_map").on( "click", function( event ) {
var leaflet_target = $(this).data('leaflet-target'); var leaflet_target = $(this).data('leaflet-target');
var map_lon = $(this).data('map-lon'); var map_lon = $(this).data('map-lon');
var map_lat = $(this).data('map-lat'); var map_lat = $(this).data('map-lat');

View file

@ -1,3 +1,10 @@
/**
* @license
* (C) Copyright Contributors to the SearXNG project.
* (C) Copyright Contributors to the searx project (2014 - 2021).
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
$(document).ready(function(){ $(document).ready(function(){
let engine_descriptions = null; let engine_descriptions = null;
function load_engine_descriptions() { function load_engine_descriptions() {
@ -7,7 +14,7 @@ $(document).ready(function(){
for (const [engine_name, description] of Object.entries(data)) { for (const [engine_name, description] of Object.entries(data)) {
let elements = $('[data-engine-name="' + engine_name + '"] .description'); let elements = $('[data-engine-name="' + engine_name + '"] .description');
for(const element of elements) { for(const element of elements) {
let source = ' (<i>' + searx.translations['Source'] + ':&nbsp;' + description[1] + '</i>)'; let source = ' (<i>' + searxng.translations.Source + ':&nbsp;' + description[1] + '</i>)';
element.innerHTML = description[0] + source; element.innerHTML = description[0] + source;
} }
} }

View file

@ -1,3 +1,10 @@
/**
* @license
* (C) Copyright Contributors to the SearXNG project.
* (C) Copyright Contributors to the searx project (2014 - 2021).
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
$(document).ready(function(){ $(document).ready(function(){
$("#allow-all-engines").click(function() { $("#allow-all-engines").click(function() {
$(".onoffswitch-checkbox").each(function() { this.checked = false;}); $(".onoffswitch-checkbox").each(function() { this.checked = false;});

View file

@ -170,7 +170,7 @@ p.btn.btn-default{
background:#ad1f12 none !important; background:#ad1f12 none !important;
} }
.searx-navbar { .searxng-navbar {
background: #333334; background: #333334;
height: 2.3rem; height: 2.3rem;
font-size: 1.3rem; font-size: 1.3rem;

View file

@ -1,4 +1,4 @@
.searx-navbar { .searxng-navbar {
background: @black; background: @black;
height: 2.3rem; height: 2.3rem;
font-size: 1.3rem; font-size: 1.3rem;

View file

@ -1,4 +1,4 @@
.searx-navbar { .searxng-navbar {
background: #eee; background: #eee;
color: #aaa; color: #aaa;
height: 2.3rem; height: 2.3rem;

View file

@ -3,9 +3,9 @@
<html lang="{{ preferences.get_value('locale') }}" xml:lang="{{ preferences.get_value('locale') }}"{% if rtl %} dir="rtl"{% endif %} class="nojs"> <html lang="{{ preferences.get_value('locale') }}" xml:lang="{{ preferences.get_value('locale') }}"{% if rtl %} dir="rtl"{% endif %} class="nojs">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="description" content="searx - a privacy-respecting, hackable metasearch engine" /> <meta name="description" content="SearXNG - a privacy-respecting, hackable metasearch engine" />
<meta name="keywords" content="searx, search, search engine, metasearch, meta search" /> <meta name="keywords" content="SearXNG, search, search engine, metasearch, meta search" />
<meta name="generator" content="searx/{{ searx_version }}"> <meta name="generator" content="SearXNG/{{ searx_version }}">
<meta name="referrer" content="no-referrer"> <meta name="referrer" content="no-referrer">
<meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=2.0, user-scalable=1" /> <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=2.0, user-scalable=1" />
{% block meta %}{% endblock %} {% block meta %}{% endblock %}
@ -97,7 +97,7 @@
{% if load_leaflet %}{{" "}}<script src="{{ url_for('static', filename='js/leaflet.js') }}"></script>{{ "\n" }}{% endif %} {% if load_leaflet %}{{" "}}<script src="{{ url_for('static', filename='js/leaflet.js') }}"></script>{{ "\n" }}{% endif %}
{% if autocomplete %}{{" "}}<script src="{{ url_for('static', filename='js/typeahead.bundle.min.js') }}"></script>{{ "\n" }}{% endif %} {% if autocomplete %}{{" "}}<script src="{{ url_for('static', filename='js/typeahead.bundle.min.js') }}"></script>{{ "\n" }}{% endif %}
<script src="{{ url_for('static', filename='js/searx.min.js') }}" <script src="{{ url_for('static', filename='js/searxng.min.js') }}"
data-method="{{ method or 'POST' }}" data-method="{{ method or 'POST' }}"
data-autocompleter="{% if autocomplete %}true{% else %}false{% endif %}" data-autocompleter="{% if autocomplete %}true{% else %}false{% endif %}"
data-translations="{{ translations }}"></script> data-translations="{{ translations }}"></script>

View file

@ -4,10 +4,10 @@
<div class="row">{{- "" -}} <div class="row">{{- "" -}}
<div class="text-center col-sm-12 col-md-12"> <div class="text-center col-sm-12 col-md-12">
{%- if cookies['oscar-style'] == 'pointhi' -%} {%- if cookies['oscar-style'] == 'pointhi' -%}
<h1 class="text-hide center-block"><img class="center-block img-responsive" src="{{ url_for('static', filename='img/searx_logo.png') }}" alt="searx logo"/>searx</h1> <h1 class="text-hide center-block"><img class="center-block img-responsive" src="{{ url_for('static', filename='img/searx_logo.png') }}" alt="searx logo"/>SearXNG</h1>
{%- else -%} {%- else -%}
<div class="text-hide center-block" id="main-logo">{{- "" -}} <div class="text-hide center-block" id="main-logo">{{- "" -}}
<img class="center-block img-responsive" src="{{ url_for('static', filename='img/logo_searx_a.png') }}" alt="searx logo" />searx{{- "" -}} <img class="center-block img-responsive" src="{{ url_for('static', filename='img/logo_searx_a.png') }}" alt="searx logo" />SearXNG{{- "" -}}
</div> </div>
{%- endif -%} {%- endif -%}
</div>{{- "" -}} </div>{{- "" -}}

View file

@ -4,5 +4,5 @@
<span class="sr-only">{{ _('Close') }}</span> <span class="sr-only">{{ _('Close') }}</span>
</button> </button>
<strong class="lead">{{ icon('info-sign') }} {{ _('Heads up!') }}</strong> <strong class="lead">{{ icon('info-sign') }} {{ _('Heads up!') }}</strong>
{{ _('It look like you are using searx first time.') }} {{ _('It look like you are using SearXNG first time.') }}
</div> </div>

View file

@ -10,7 +10,7 @@
</a> ){{- '' -}} </a> ){{- '' -}}
</p> </p>
{%- endfor -%} {%- endfor -%}
<p><small>{{ _('Please, try again later or find another searx instance.') }} (<a href="{{ get_setting('brand.public_instances') }}">{{ _('Public instances') }}</a>)</small></p> <p><small>{{ _('Please, try again later or find another SearXNG instance.') }} (<a href="{{ get_setting('brand.public_instances') }}">{{ _('Public instances') }}</a>)</small></p>
</div> </div>
{% else %} {% else %}
<div class="alert alert-info fade in" role="alert"> <div class="alert alert-info fade in" role="alert">

View file

@ -1,4 +1,4 @@
<div class="searx-navbar">{{- "" -}} <div class="searxng-navbar">{{- "" -}}
<span class="instance {% if rtl %}pull-right{% else %}pull-left{% endif%}">{{- "" -}} <span class="instance {% if rtl %}pull-right{% else %}pull-left{% endif%}">{{- "" -}}
<a href="{{ url_for('index') }}">{{ instance_name }}</a>{{- "" -}} <a href="{{ url_for('index') }}">{{ instance_name }}</a>{{- "" -}}
</span>{{- "" -}} </span>{{- "" -}}

View file

@ -208,7 +208,7 @@
{% if 'theme' not in locked_preferences %} {% if 'theme' not in locked_preferences %}
{% set theme_label = _('Themes') %} {% set theme_label = _('Themes') %}
{% set theme_info = _('Change searx layout') %} {% set theme_info = _('Change SearXNG layout') %}
{{ preferences_item_header(theme_info, theme_label, rtl, 'theme') }} {{ preferences_item_header(theme_info, theme_label, rtl, 'theme') }}
<select class="form-control {{ custom_select_class(rtl) }}" name="theme" id="theme"> <select class="form-control {{ custom_select_class(rtl) }}" name="theme" id="theme">
{% for name in themes %} {% for name in themes %}
@ -271,7 +271,7 @@
{% if 'image_proxy' not in locked_preferences %} {% if 'image_proxy' not in locked_preferences %}
{% set image_proxy_label = _('Image proxy') %} {% set image_proxy_label = _('Image proxy') %}
{% set image_proxy_info = _('Proxying image results through searx') %} {% set image_proxy_info = _('Proxying image results through SearXNG') %}
{{ preferences_item_header(image_proxy_info, image_proxy_label, rtl, 'image_proxy') }} {{ preferences_item_header(image_proxy_info, image_proxy_label, rtl, 'image_proxy') }}
<select class="form-control {{ custom_select_class(rtl) }}" name="image_proxy" id="image_proxy"> <select class="form-control {{ custom_select_class(rtl) }}" name="image_proxy" id="image_proxy">
<option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option> <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option>
@ -397,7 +397,7 @@
</thead> </thead>
<tbody> <tbody>
<td></td> <td></td>
<th scope="colgroup" colspan="4">{{ _('This is the list of searx\'s instant answering modules.') }}</th> <th scope="colgroup" colspan="4">{{ _('This is the list of SearXNG\'s instant answering modules.') }}</th>
{% for answerer in answerers %} {% for answerer in answerers %}
<tr> <tr>
<td></td> <td></td>
@ -431,8 +431,8 @@
<h3>{{ _('Cookies') }}</h3> <h3>{{ _('Cookies') }}</h3>
</noscript> </noscript>
<p class="text-muted"> <p class="text-muted">
{{ _('This is the list of cookies and their values searx is storing on your computer.') }}<br /> {{ _('This is the list of cookies and their values SearXNG is storing on your computer.') }}<br />
{{ _('With that list, you can assess searx transparency.') }}<br /> {{ _('With that list, you can assess SearXNG transparency.') }}<br />
</p> </p>
{% if cookies %} {% if cookies %}
<table class="table table-striped"> <table class="table table-striped">

View file

@ -56,7 +56,7 @@
<p class="result-content"> <p class="result-content">
{%- if (result.latitude and result.longitude) or result.boundingbox -%} {%- if (result.latitude and result.longitude) or result.boundingbox -%}
<span><a class="text-info btn-collapse collapsed searx_init_map cursor-pointer disabled_if_nojs" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}">{{ icon('globe') }} {{ _('show map') }}</a></span> <span><a class="text-info btn-collapse collapsed searxng_init_map cursor-pointer disabled_if_nojs" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}">{{ icon('globe') }} {{ _('show map') }}</a></span>
{%- endif -%} {%- endif -%}
</p> </p>

View file

@ -84,7 +84,7 @@ class ViewsTestCase(SearxTestCase):
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
self.assertIn(b'<div class="text-hide center-block" id="main-logo">' self.assertIn(b'<div class="text-hide center-block" id="main-logo">'
+ b'<img class="center-block img-responsive" src="/static/themes/oscar/img/logo_searx_a.png"' + b'<img class="center-block img-responsive" src="/static/themes/oscar/img/logo_searx_a.png"'
+ b' alt="searx logo" />searx</div>', result.data) + b' alt="searx logo" />SearXNG</div>', result.data)
def test_index_html_post(self): def test_index_html_post(self):
result = self.app.post('/', data={'q': 'test'}) result = self.app.post('/', data={'q': 'test'})