[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);

View File

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

View File

@ -13,10 +13,6 @@
{% block head %}
<link title="searx" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
{% endblock %}
<script type="text/javascript">
searx = {};
searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
</script>
</head>
<body>
<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-autocompleter-1.1.2-min.js') }}" ></script>
{% 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>
</div>
</body>

View File

@ -1,7 +1,9 @@
<div id="categories">
<div id="categories_container">
{% for category in categories %}
<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>
</div>
<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>
</div>
{% endfor %}
</div>
</div>

View File

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

View File

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

View File

@ -1,13 +1,6 @@
<div class="result {{ result.class }}">
{% 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>
<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>
<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>
</div>
</div>

View File

@ -1,12 +1,8 @@
<div class="result">
{% if result['favicon'] %}
<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />
{% endif %}
<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 %}
<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>
</div>

View File

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

View File

@ -1,6 +1,6 @@
<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form">
<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" />
</div>
{% include 'default/categories.html' %}