1
0
mirror of https://github.com/searxng/searxng.git synced 2024-07-05 00:40:15 +02:00

[mod] default template modifications

- more smartphone friendly
- more text browser friendly
- next button always on the right
- in case of small screen supporting touch event, categories are displayed on one line with a scroll
This commit is contained in:
dalf 2014-10-26 11:14:05 +01:00
parent be4d219ae7
commit a71b326d9e
11 changed files with 110 additions and 48 deletions

File diff suppressed because one or more lines are too long

View File

@ -41,5 +41,9 @@ if(searx.autocompleter) {
} }
}); });
if (!!('ontouchstart' in window)) {
document.getElementsByTagName("html")[0].className += " touch";
}
})(window, document); })(window, document);

View File

@ -97,6 +97,7 @@ h1 {
div.title { div.title {
background: url('../img/searx.png') no-repeat; background: url('../img/searx.png') no-repeat;
width: 100%; width: 100%;
min-height: 80px;
background-position: center; background-position: center;
h1 { h1 {
@ -261,8 +262,12 @@ a {
.published_date { .published_date {
font-size: 0.8em; font-size: 0.8em;
color: @color-result-publishdate-font; color: @color-result-publishdate-font;
margin: 5px 20px; Margin: 5px 20px;
} }
.thumbnail {
width: 400px;
}
} }
.engines { .engines {
@ -396,6 +401,14 @@ tr {
} }
} }
#suggestions {
span {
display: block;
}
}
#suggestions, #answers { #suggestions, #answers {
margin-top: 20px; margin-top: 20px;
@ -419,7 +432,8 @@ tr {
} }
form { form {
display: inline; display: inline-block;
min-width: 210px;
} }
} }
@ -437,6 +451,7 @@ tr {
border: 1px solid #ddd; border: 1px solid #ddd;
padding: 5px; padding: 5px;
font-size: 0.8em; font-size: 0.8em;
/* box-shadow: 0px 0px 5px #CCC; */
img { img {
max-width: 20em; max-width: 20em;
@ -502,6 +517,10 @@ tr {
#pagination { #pagination {
clear: both; clear: both;
br {
clear: both;
}
} }
#apis { #apis {
@ -531,7 +550,7 @@ tr {
} }
} }
.right { .preferences_container {
display: none; display: none;
postion: fixed !important; postion: fixed !important;
top: 100px; top: 100px;
@ -542,20 +561,61 @@ tr {
@media screen and (max-width: 75em) { @media screen and (max-width: 75em) {
#infoboxes { div.title {
position: inherit;
max-width: inherit;
.infobox {
clear:both;
img {
float: left;
max-width: 10em;
}
}
} h1 {
font-size: 1em;
}
}
html.touch #categories {
width: 95%;
height: 30px;
text-align: left;
overflow-x: scroll;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
#categories_container {
width: 1000px;
width: -moz-max-content;
width: -webkit-max-content;
width: max-content;
.checkbox_container {
display: inline-block;
width: auto;
}
}
}
#categories {
font-size: 90%;
clear: both;
.checkbox_container {
margin-top: 2px;
margin: auto;
}
}
#suggestions, #answers {
margin-top: 5px;
}
#infoboxes {
position: inherit;
max-width: inherit;
.infobox {
clear:both;
img {
float: left;
max-width: 10em;
}
}
}
#categories { #categories {
font-size: 90%; font-size: 90%;
@ -584,13 +644,17 @@ tr {
display: none; display: none;
} }
#search_url { #search_url {
display: none; display: none;
} }
.result { .result {
border-top: 1px solid @color-result-top-border; border-top: 1px solid @color-result-top-border;
margin: 7px 0 6px 0; margin: 8px 0 8px 0;
.thumbnail {
max-width: 98%;
}
} }
.image_result { .image_result {

View File

@ -13,10 +13,6 @@
{% block head %} {% block head %}
<link title="searx" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/> <link title="searx" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
{% endblock %} {% endblock %}
<script type="text/javascript">
searx = {};
searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
</script>
</head> </head>
<body> <body>
<div id="container"> <div id="container">
@ -26,6 +22,10 @@
<script src="{{ url_for('static', filename='js/mootools-core-1.4.5-min.js') }}" ></script> <script src="{{ url_for('static', filename='js/mootools-core-1.4.5-min.js') }}" ></script>
<script src="{{ url_for('static', filename='js/mootools-autocompleter-1.1.2-min.js') }}" ></script> <script src="{{ url_for('static', filename='js/mootools-autocompleter-1.1.2-min.js') }}" ></script>
{% endif %} {% endif %}
<script type="text/javascript">
searx = {};
searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
</script>
<script src="{{ url_for('static', filename='js/searx.js') }}" ></script> <script src="{{ url_for('static', filename='js/searx.js') }}" ></script>
</div> </div>
</body> </body>

View File

@ -1,7 +1,9 @@
<div id="categories"> <div id="categories">
<div id="categories_container">
{% for category in categories %} {% for category in categories %}
<div class="checkbox_container"> <div class="checkbox_container">
<input type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /><label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label> <input type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /><label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label>
</div> </div>
{% endfor %} {% endfor %}
</div>
</div> </div>

View File

@ -1,6 +1,5 @@
{% extends "default/base.html" %} {% extends "default/base.html" %}
{% block content %} {% block content %}
{% include 'default/github_ribbon.html' %}
<div class="center"> <div class="center">
<div class="title"><h1>searx</h1></div> <div class="title"><h1>searx</h1></div>
{% include 'default/search.html' %} {% include 'default/search.html' %}
@ -9,4 +8,6 @@
<a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a>
</p> </p>
</div> </div>
{% include 'default/github_ribbon.html' %}
{% endblock %} {% endblock %}

View File

@ -2,7 +2,7 @@
<h2>{{ infobox.infobox }}</h2> <h2>{{ infobox.infobox }}</h2>
{% if infobox.img_src %}<img src="{{ infobox.img_src }}" />{% endif %} {% if infobox.img_src %}<img src="{{ infobox.img_src }}" />{% endif %}
<p>{{ infobox.entity }}</p> <p>{{ infobox.entity }}</p>
<p>{{ infobox.content }}</p> <p>{{ infobox.content | safe }}</p>
{% if infobox.attributes %} {% if infobox.attributes %}
<div class="attributes"> <div class="attributes">
<table> <table>

View File

@ -1,13 +1,6 @@
<div class="result {{ result.class }}"> <div class="result {{ result.class }}">
<h3 class="result_title"> {% if result['favicon'] %}<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
{% if result['favicon'] %}
<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />
{% endif %}
<div>
<h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
<p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p> <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p>
{% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %} {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
<p class="content">{% if result.img_src %}<img src="{{ result.img_src }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p> <p class="content">{% if result.img_src %}<img src="{{ result.img_src }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>
</div>
</div> </div>

View File

@ -1,12 +1,8 @@
<div class="result"> <div class="result">
{% if result['favicon'] %}
<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />
{% endif %}
<p> <p>
<h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3> <h3 class="result_title"> {% if result['favicon'] %}<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
{% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %} {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
<a href="{{ result.url }}"><img width="400px" src="{{ result.thumbnail }}" title={{ result.title }} alt=" {{ result.title }}"/></a> <a href="{{ result.url }}"><img class="thumbnail" src="{{ result.thumbnail }}" title={{ result.title }} alt=" {{ result.title }}"/></a>
<p class="url">{{ result.url }}</p> <p class="url">{{ result.url }}</p>
</p> </p>
</div> </div>

View File

@ -1,7 +1,7 @@
{% extends "default/base.html" %} {% extends "default/base.html" %}
{% block title %}{{ q }} - {% endblock %} {% block title %}{{ q }} - {% endblock %}
{% block content %} {% block content %}
<div class="right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div> <div class="preferences_container right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div>
<div class="small search center"> <div class="small search center">
{% include 'default/search.html' %} {% include 'default/search.html' %}
</div> </div>
@ -80,7 +80,7 @@
</form> </form>
{% endif %} {% endif %}
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
<div class="left"> <div class="right">
{% for category in selected_categories %} {% for category in selected_categories %}
<input type="hidden" name="category_{{ category }}" value="1"/> <input type="hidden" name="category_{{ category }}" value="1"/>
{% endfor %} {% endfor %}
@ -89,6 +89,8 @@
<input type="submit" value="{{ _('next page') }} >>" /> <input type="submit" value="{{ _('next page') }} >>" />
</div> </div>
</form> </form>
<br />
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -1,6 +1,6 @@
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form">
<div id="search_wrapper"> <div id="search_wrapper">
<input type="text" placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" autocomplete="off" {% if q %}value="{{ q }}"{% endif %}/> <input type="text" placeholder="{{ _('Search for...') }}" id="q" class="q" name="q" tabindex="1" autocomplete="off" size="100" {% if q %}value="{{ q }}"{% endif %}/>
<input type="submit" value="search" id="search_submit" /> <input type="submit" value="search" id="search_submit" />
</div> </div>
{% include 'default/categories.html' %} {% include 'default/categories.html' %}