summaryrefslogtreecommitdiff
path: root/searx/templates
diff options
context:
space:
mode:
authorDalf <alex@al-f.net>2019-07-23 14:13:38 +0200
committerDalf <alex@al-f.net>2019-08-06 12:14:11 +0200
commit6fbba63c83b18a652e571ce5a803773cd72e5b6a (patch)
tree48d64f887e762423ba588ce03cdd4453ee30c088 /searx/templates
parent90b24f1060daf97cbf8e18f4a0087cd74ffb7581 (diff)
oscar and simple themes: no inline script (allow A+ Content-Security-Policy)
Diffstat (limited to 'searx/templates')
-rw-r--r--searx/templates/oscar/base.html10
-rw-r--r--searx/templates/simple/base.html25
2 files changed, 14 insertions, 21 deletions
diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html
index 243e8b3d7..321784ebb 100644
--- a/searx/templates/oscar/base.html
+++ b/searx/templates/oscar/base.html
@@ -37,12 +37,6 @@
{% endblock %}
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
-
- <script type="text/javascript">
- searx = {};
- searx.method = "{{ method or 'POST' }}";
- searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
- </script>
<noscript>
<style type="text/css">
.tab-content > .active_if_nojs, .active_if_nojs {display: block !important; visibility: visible !important;}
@@ -101,7 +95,9 @@
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
{% if autocomplete %}<script src="{{ url_for('static', filename='js/typeahead.bundle.min.js') }}"></script>{% endif %}
<script src="{{ url_for('static', filename='js/require-2.1.15.min.js') }}"></script>
- <script src="{{ url_for('static', filename='js/searx.min.js') }}"></script>
+ <script src="{{ url_for('static', filename='js/searx.min.js') }}"
+ data-method="{{ method or 'POST' }}"
+ data-autocompleter="{% if autocomplete %}true{% else %}false{% endif %}"></script>
{% for script in scripts %}
<script src="{{ url_for('static', filename=script) }}"></script>
{% endfor %}
diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html
index 734dccbe8..92597b654 100644
--- a/searx/templates/simple/base.html
+++ b/searx/templates/simple/base.html
@@ -11,29 +11,26 @@
<meta name="HandheldFriendly" content="True">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<title>{% block title %}{% endblock %}{{ instance_name }}</title>
+ {% block meta %}{% endblock %}
{% if rtl %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/searx-rtl.min.css') }}" type="text/css" media="screen" />
{% else %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/searx.min.css') }}" type="text/css" media="screen" />
{% endif %}
{% block styles %}{% endblock %}
- {% block meta %}{% endblock %}
+ <!--[if gte IE 9]>-->
+ <script src="{{ url_for('static', filename='js/searx.head.min.js') }}"
+ data-method="{{ method or 'POST' }}"
+ data-autocompleter="{% if autocomplete %}true{% else %}false{% endif %}"
+ data-search-on-category-select="{{ 'true' if 'plugins/js/search_on_category_select.js' in scripts else 'false'}}"
+ data-infinite-scroll="{{ 'true' if 'plugins/js/infinite_scroll.js' in scripts else 'false' }}"
+ data-static-path="{{ url_for('static', filename='themes/simple') }}/"
+ data-no-item-found="{{ _('No item found') }}"></script>
+ <!--<![endif]-->
{% block head %}
<link title="{{ instance_name }}" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
{% endblock %}
<link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}" />
- <script type="text/javascript">
- var searx = {
- autocompleter: {% if autocomplete %}true{% else %}false{% endif %},
- method: "{{ method or 'POST' }}",
- touch: (("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch) || false,
- staticPath: "{{ url_for('static', filename='themes/simple') }}/",
- noItemFound: "{{ _('No item found') }}",
- search_on_category_select: {{ 'true' if 'plugins/js/search_on_category_select.js' in scripts else 'false'}},
- infinite_scroll: {{ 'true' if 'plugins/js/infinite_scroll.js' in scripts else 'false' }}
- };
- document.getElementsByTagName("html")[0].className = (searx.touch)?"js touch":"js";
- </script>
</head>
<body>
<main id="main_{{ self._TemplateReference__context.name|replace("simple/", "")|replace(".html", "") }}">
@@ -60,7 +57,7 @@
</p>
</footer>
<!--[if gte IE 9]>-->
- <script src="{{ url_for('static', filename='js/searx.min.js') }}" ></script>
+ <script src="{{ url_for('static', filename='js/searx.min.js') }}"></script>
<!--<![endif]-->
</body>
</html>