forked from zaclys/searxng
Merge branch 'master' of https://github.com/asciimoo/searx into csp-oscar-theme
This commit is contained in:
commit
434e452d54
|
@ -24,6 +24,12 @@ ui:
|
||||||
default_locale : "" # Default interface locale - leave blank to detect from browser information or use codes from the 'locales' config section
|
default_locale : "" # Default interface locale - leave blank to detect from browser information or use codes from the 'locales' config section
|
||||||
theme_args :
|
theme_args :
|
||||||
oscar_style : logicodev # default style of oscar
|
oscar_style : logicodev # default style of oscar
|
||||||
|
# categories_order :
|
||||||
|
# - general
|
||||||
|
# - files
|
||||||
|
# - map
|
||||||
|
# - it
|
||||||
|
# - science
|
||||||
|
|
||||||
# searx supports result proxification using an external service: https://github.com/asciimoo/morty
|
# searx supports result proxification using an external service: https://github.com/asciimoo/morty
|
||||||
# uncomment below section if you have running morty proxy
|
# uncomment below section if you have running morty proxy
|
||||||
|
|
|
@ -172,7 +172,7 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
|
||||||
.result-videos,
|
.result-videos,
|
||||||
.result-map {
|
.result-map {
|
||||||
clear: both;
|
clear: both;
|
||||||
padding: 2px 4px;
|
padding: 0.5em 4px;
|
||||||
}
|
}
|
||||||
.result-default:hover,
|
.result-default:hover,
|
||||||
.result-code:hover,
|
.result-code:hover,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -145,7 +145,7 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
|
||||||
.result-videos,
|
.result-videos,
|
||||||
.result-map {
|
.result-map {
|
||||||
clear: both;
|
clear: both;
|
||||||
padding: 2px 4px;
|
padding: 0.5em 4px;
|
||||||
}
|
}
|
||||||
.result-default:hover,
|
.result-default:hover,
|
||||||
.result-code:hover,
|
.result-code:hover,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -78,7 +78,13 @@ if(searx.autocompleter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
var original_search_value = '';
|
||||||
if(searx.autocompleter) {
|
if(searx.autocompleter) {
|
||||||
|
$("#q").on('keydown', function(e) {
|
||||||
|
if(e.which == 13) {
|
||||||
|
original_search_value = $('#q').val();
|
||||||
|
}
|
||||||
|
});
|
||||||
$('#q').typeahead(null, {
|
$('#q').typeahead(null, {
|
||||||
name: 'search-results',
|
name: 'search-results',
|
||||||
displayKey: function(result) {
|
displayKey: function(result) {
|
||||||
|
@ -87,6 +93,9 @@ $(document).ready(function(){
|
||||||
source: searx.searchResults.ttAdapter()
|
source: searx.searchResults.ttAdapter()
|
||||||
});
|
});
|
||||||
$('#q').bind('typeahead:selected', function(ev, suggestion) {
|
$('#q').bind('typeahead:selected', function(ev, suggestion) {
|
||||||
|
if(original_search_value) {
|
||||||
|
$('#q').val(original_search_value);
|
||||||
|
}
|
||||||
$("#search_form").submit();
|
$("#search_form").submit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -25,7 +25,13 @@ if(searx.autocompleter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
var original_search_value = '';
|
||||||
if(searx.autocompleter) {
|
if(searx.autocompleter) {
|
||||||
|
$("#q").on('keydown', function(e) {
|
||||||
|
if(e.which == 13) {
|
||||||
|
original_search_value = $('#q').val();
|
||||||
|
}
|
||||||
|
});
|
||||||
$('#q').typeahead(null, {
|
$('#q').typeahead(null, {
|
||||||
name: 'search-results',
|
name: 'search-results',
|
||||||
displayKey: function(result) {
|
displayKey: function(result) {
|
||||||
|
@ -34,6 +40,9 @@ $(document).ready(function(){
|
||||||
source: searx.searchResults.ttAdapter()
|
source: searx.searchResults.ttAdapter()
|
||||||
});
|
});
|
||||||
$('#q').bind('typeahead:selected', function(ev, suggestion) {
|
$('#q').bind('typeahead:selected', function(ev, suggestion) {
|
||||||
|
if(original_search_value) {
|
||||||
|
$('#q').val(original_search_value);
|
||||||
|
}
|
||||||
$("#search_form").submit();
|
$("#search_form").submit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
// default formating of results
|
// default formating of results
|
||||||
.result-default, .result-code, .result-torrent, .result-videos, .result-map {
|
.result-default, .result-code, .result-torrent, .result-videos, .result-map {
|
||||||
clear: both;
|
clear: both;
|
||||||
padding: 2px 4px;
|
padding: 0.5em 4px;
|
||||||
&:hover{
|
&:hover{
|
||||||
background-color: @dim-gray;
|
background-color: @dim-gray;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
{
|
{
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "~0.4.5",
|
"grunt": "^0.4.5",
|
||||||
"grunt-contrib-uglify": "~0.6.0",
|
|
||||||
"grunt-contrib-watch": "~0.6.1",
|
|
||||||
"grunt-contrib-concat": "~0.5.0",
|
"grunt-contrib-concat": "~0.5.0",
|
||||||
"grunt-contrib-jshint": "~0.10.0",
|
"grunt-contrib-jshint": "~0.10.0",
|
||||||
"grunt-contrib-less": "~0.11.0"
|
"grunt-contrib-less": "~0.11.0",
|
||||||
|
"grunt-contrib-uglify": "~0.6.0",
|
||||||
|
"grunt-contrib-watch": "~0.6.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm install && grunt",
|
"build": "npm install && grunt",
|
||||||
"start": "grunt watch",
|
"start": "grunt watch",
|
||||||
"test": "grunt"
|
"test": "grunt"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"grunt-cli": "^1.3.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
|
searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="{{ endpoint }}_endpoint" >
|
||||||
<div id="container">
|
<div id="container">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -98,6 +98,7 @@
|
||||||
<table class="engine-table">
|
<table class="engine-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ _('Engine name') }}</th>
|
<th>{{ _('Engine name') }}</th>
|
||||||
|
<th>{{ _('Shortcut') }}</th>
|
||||||
<th>{{ _('Category') }}</th>
|
<th>{{ _('Category') }}</th>
|
||||||
<th>{{ _('Allow') }} / {{ _('Block') }}</th>
|
<th>{{ _('Allow') }} / {{ _('Block') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -106,7 +107,8 @@
|
||||||
|
|
||||||
{% if not search_engine.private %}
|
{% if not search_engine.private %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})‎</td>
|
<td>{{ search_engine.name }}</td>
|
||||||
|
<td>{{ shortcuts[search_engine.name] }}</td>
|
||||||
<td>{{ _(categ) }}</td>
|
<td>{{ _(categ) }}</td>
|
||||||
<td class="engine_checkbox">
|
<td class="engine_checkbox">
|
||||||
<input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in disabled_engines %} checked="checked"{% endif %} />
|
<input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in disabled_engines %} checked="checked"{% endif %} />
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
|
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="{{ endpoint }}_endpoint" >
|
||||||
<div id="container">
|
<div id="container">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -95,6 +95,7 @@
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ _('Engine name') }}</th>
|
<th>{{ _('Engine name') }}</th>
|
||||||
|
<th>{{ _('Shortcut') }}</th>
|
||||||
<th>{{ _('Category') }}</th>
|
<th>{{ _('Category') }}</th>
|
||||||
<th>{{ _('Allow') }} / {{ _('Block') }}</th>
|
<th>{{ _('Allow') }} / {{ _('Block') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -103,7 +104,8 @@
|
||||||
|
|
||||||
{% if not search_engine.private %}
|
{% if not search_engine.private %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})‎</td>
|
<td>{{ search_engine.name }}</td>
|
||||||
|
<td>{{ shortcuts[search_engine.name] }}</td>
|
||||||
<td>{{ _(categ) }}</td>
|
<td>{{ _(categ) }}</td>
|
||||||
<td class="engine_checkbox">
|
<td class="engine_checkbox">
|
||||||
<input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in disabled_engines %} checked="checked"{% endif %} />
|
<input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in disabled_engines %} checked="checked"{% endif %} />
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
</style>
|
</style>
|
||||||
</noscript>
|
</noscript>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="{{ endpoint }}_endpoint" >
|
||||||
{% include 'oscar/navbar.html' %}
|
{% include 'oscar/navbar.html' %}
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
<link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}" />
|
<link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="{{ endpoint }}_endpoint" >
|
||||||
<main id="main_{{ self._TemplateReference__context.name|replace("simple/", "")|replace(".html", "") }}">
|
<main id="main_{{ self._TemplateReference__context.name|replace("simple/", "")|replace(".html", "") }}">
|
||||||
{% if errors %}
|
{% if errors %}
|
||||||
<div class="dialog-error" role="alert">
|
<div class="dialog-error" role="alert">
|
||||||
|
|
|
@ -355,17 +355,12 @@ def render(template_name, override_theme=None, **kwargs):
|
||||||
if (engine_name, category) not in disabled_engines)
|
if (engine_name, category) not in disabled_engines)
|
||||||
|
|
||||||
if 'categories' not in kwargs:
|
if 'categories' not in kwargs:
|
||||||
kwargs['categories'] = ['general']
|
kwargs['categories'] = [x for x in
|
||||||
kwargs['categories'].extend(x for x in
|
_get_ordered_categories()
|
||||||
sorted(categories.keys())
|
if x in enabled_categories]
|
||||||
if x != 'general'
|
|
||||||
and x in enabled_categories)
|
|
||||||
|
|
||||||
if 'all_categories' not in kwargs:
|
if 'all_categories' not in kwargs:
|
||||||
kwargs['all_categories'] = ['general']
|
kwargs['all_categories'] = _get_ordered_categories()
|
||||||
kwargs['all_categories'].extend(x for x in
|
|
||||||
sorted(categories.keys())
|
|
||||||
if x != 'general')
|
|
||||||
|
|
||||||
if 'selected_categories' not in kwargs:
|
if 'selected_categories' not in kwargs:
|
||||||
kwargs['selected_categories'] = []
|
kwargs['selected_categories'] = []
|
||||||
|
@ -430,6 +425,7 @@ def render(template_name, override_theme=None, **kwargs):
|
||||||
kwargs['brand'] = brand
|
kwargs['brand'] = brand
|
||||||
|
|
||||||
kwargs['scripts'] = set()
|
kwargs['scripts'] = set()
|
||||||
|
kwargs['endpoint'] = 'results' if 'q' in kwargs else request.endpoint
|
||||||
for plugin in request.user_plugins:
|
for plugin in request.user_plugins:
|
||||||
for script in plugin.js_dependencies:
|
for script in plugin.js_dependencies:
|
||||||
kwargs['scripts'].add(script)
|
kwargs['scripts'].add(script)
|
||||||
|
@ -443,6 +439,17 @@ def render(template_name, override_theme=None, **kwargs):
|
||||||
'{}/{}'.format(kwargs['theme'], template_name), **kwargs)
|
'{}/{}'.format(kwargs['theme'], template_name), **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def _get_ordered_categories():
|
||||||
|
ordered_categories = []
|
||||||
|
if 'categories_order' not in settings['ui']:
|
||||||
|
ordered_categories = ['general']
|
||||||
|
ordered_categories.extend(x for x in sorted(categories.keys()) if x != 'general')
|
||||||
|
return ordered_categories
|
||||||
|
ordered_categories = settings['ui']['categories_order']
|
||||||
|
ordered_categories.extend(x for x in sorted(categories.keys()) if x not in ordered_categories)
|
||||||
|
return ordered_categories
|
||||||
|
|
||||||
|
|
||||||
@app.before_request
|
@app.before_request
|
||||||
def pre_request():
|
def pre_request():
|
||||||
request.start_time = time()
|
request.start_time = time()
|
||||||
|
|
Loading…
Reference in New Issue