Browse Source

[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
dalf 10 years ago
parent
commit
a71b326d9e

+ 1
- 1
searx/static/default/css/style.css
File diff suppressed because it is too large
View File


+ 4
- 0
searx/static/default/js/searx.js View File

41
         }
41
         }
42
     });
42
     });
43
 
43
 
44
+    if (!!('ontouchstart' in window)) {
45
+        document.getElementsByTagName("html")[0].className += " touch";
46
+    }
47
+
44
 })(window, document);
48
 })(window, document);
45
 
49
 

+ 83
- 19
searx/static/default/less/style.less View File

97
 div.title {
97
 div.title {
98
 	background: url('../img/searx.png') no-repeat;
98
 	background: url('../img/searx.png') no-repeat;
99
 	width: 100%;
99
 	width: 100%;
100
+        min-height: 80px;
100
 	background-position: center;
101
 	background-position: center;
101
 
102
 
102
 	h1 {
103
 	h1 {
261
 	.published_date {
262
 	.published_date {
262
 		font-size: 0.8em;
263
 		font-size: 0.8em;
263
 		color: @color-result-publishdate-font;
264
 		color: @color-result-publishdate-font;
264
-    	margin: 5px 20px;
265
+                Margin: 5px 20px;
265
 	}
266
 	}
267
+
268
+        .thumbnail {
269
+                width: 400px; 
270
+        }
266
 }
271
 }
267
 
272
 
268
 .engines {
273
 .engines {
396
 	}
401
 	}
397
 }
402
 }
398
 
403
 
404
+#suggestions {
405
+
406
+        span {
407
+                display: block;
408
+        }
409
+
410
+}
411
+
399
 #suggestions, #answers {
412
 #suggestions, #answers {
400
 
413
 
401
     	margin-top: 20px;
414
     	margin-top: 20px;
419
     	}
432
     	}
420
 
433
 
421
 	form {
434
 	form {
422
-		display: inline;
435
+		display: inline-block;
436
+                min-width: 210px;
423
 	}
437
 	}
424
 }
438
 }
425
 
439
 
437
 	   	    border: 1px solid #ddd;
451
 	   	    border: 1px solid #ddd;
438
 		    padding: 5px;
452
 		    padding: 5px;
439
 	   	    font-size: 0.8em;
453
 	   	    font-size: 0.8em;
454
+                    /* box-shadow: 0px 0px 5px #CCC; */
440
 
455
 
441
 	   	    img {
456
 	   	    img {
442
 		    	max-width: 20em;
457
 		    	max-width: 20em;
502
 
517
 
503
 #pagination {
518
 #pagination {
504
 	clear: both;
519
 	clear: both;
520
+
521
+        br {
522
+        	clear: both;
523
+        }
505
 }
524
 }
506
 
525
 
507
 #apis {
526
 #apis {
531
 		}
550
 		}
532
 	}
551
 	}
533
 
552
 
534
-	.right {
553
+	.preferences_container {
535
 		display: none;
554
 		display: none;
536
 		postion: fixed !important;
555
 		postion: fixed !important;
537
 		top: 100px;
556
 		top: 100px;
542
 
561
 
543
 @media screen and (max-width: 75em) {
562
 @media screen and (max-width: 75em) {
544
 
563
 
545
-       #infoboxes {
546
-	   position: inherit;
547
-	   max-width: inherit;
564
+        div.title {
565
+
566
+        	h1 {
567
+                        font-size: 1em;
568
+        	}
569
+        }
570
+
571
+        html.touch #categories {
572
+                width: 95%;
573
+                height: 30px;
574
+                text-align: left;
575
+                overflow-x: scroll;
576
+                overflow-y: hidden;
577
+                -webkit-overflow-scrolling: touch;
578
+                
579
+                #categories_container {
580
+                        width: 1000px;
581
+                        width: -moz-max-content;
582
+                        width: -webkit-max-content;
583
+                        width: max-content;
584
+
585
+                        .checkbox_container {
586
+                                display: inline-block;
587
+                                width: auto;
588
+                        }
589
+                }
590
+        }
591
+
592
+	#categories {
593
+                font-size: 90%;
594
+                clear: both;
595
+
596
+                .checkbox_container {
597
+                        margin-top: 2px;
598
+                        margin: auto;
599
+                }
600
+        }
601
+
602
+        #suggestions, #answers {
603
+                margin-top: 5px;
604
+        }
605
+
606
+        #infoboxes {
607
+                position: inherit;
608
+                max-width: inherit;
548
 	   
609
 	   
549
-	   .infobox {
550
-	   	    clear:both;
610
+                .infobox {
611
+                        clear:both;
551
 	   
612
 	   
552
-	   	   img {
553
-	   	       float: left;
554
-	       	       max-width: 10em;
555
-	   	   }
556
-	   }
557
-
558
-       }
613
+                        img {
614
+                                float: left;
615
+                                max-width: 10em;
616
+                        }
617
+                }
618
+        }
559
 
619
 
560
 	#categories {
620
 	#categories {
561
 		font-size: 90%;
621
 		font-size: 90%;
584
 		display: none;
644
 		display: none;
585
 	}
645
 	}
586
 
646
 
587
-    #search_url {
588
-        display: none;
589
-    }
647
+    	#search_url {
648
+        	display: none;
649
+    	}
590
 
650
 
591
 	.result {
651
 	.result {
592
 		border-top: 1px solid @color-result-top-border;
652
 		border-top: 1px solid @color-result-top-border;
593
-		margin: 7px 0 6px 0;
653
+		margin: 8px 0 8px 0;
654
+
655
+                .thumbnail {
656
+                        max-width: 98%;
657
+                }
594
 	}
658
 	}
595
 
659
 
596
 	.image_result {
660
 	.image_result {

+ 4
- 4
searx/templates/default/base.html View File

13
     {% block head %}
13
     {% block head %}
14
     <link title="searx" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
14
     <link title="searx" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
15
     {% endblock %}
15
     {% endblock %}
16
-    <script type="text/javascript">
17
-        searx = {};
18
-        searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
19
-    </script>
20
 </head>
16
 </head>
21
 <body>
17
 <body>
22
 <div id="container">
18
 <div id="container">
26
 <script src="{{ url_for('static', filename='js/mootools-core-1.4.5-min.js') }}" ></script>
22
 <script src="{{ url_for('static', filename='js/mootools-core-1.4.5-min.js') }}" ></script>
27
 <script src="{{ url_for('static', filename='js/mootools-autocompleter-1.1.2-min.js') }}" ></script>
23
 <script src="{{ url_for('static', filename='js/mootools-autocompleter-1.1.2-min.js') }}" ></script>
28
 {% endif %}
24
 {% endif %}
25
+<script type="text/javascript">
26
+        searx = {};
27
+        searx.autocompleter = {% if autocomplete %}true{% else %}false{% endif %};
28
+</script>
29
 <script src="{{ url_for('static', filename='js/searx.js') }}" ></script>
29
 <script src="{{ url_for('static', filename='js/searx.js') }}" ></script>
30
 </div>
30
 </div>
31
 </body>
31
 </body>

+ 5
- 3
searx/templates/default/categories.html View File

1
 <div id="categories">
1
 <div id="categories">
2
+    <div id="categories_container">
2
 {% for category in categories %}
3
 {% for category in categories %}
3
-    <div class="checkbox_container">
4
-        <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>
5
-    </div>
4
+        <div class="checkbox_container">
5
+             <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>
6
+        </div>
6
 {% endfor %}
7
 {% endfor %}
8
+    </div>
7
 </div>
9
 </div>

+ 2
- 1
searx/templates/default/index.html View File

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

+ 1
- 1
searx/templates/default/infobox.html View File

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

+ 2
- 9
searx/templates/default/result_templates/default.html View File

1
 <div class="result {{ result.class }}">
1
 <div class="result {{ result.class }}">
2
-
3
-  {% if result['favicon'] %}
4
-    <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />
5
-  {% endif %}
6
-
7
-  <div>
8
-    <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
2
+    <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>
9
     <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p>
3
     <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p>
10
-	{% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
4
+    {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
11
     <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>
5
     <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>
12
-  </div>
13
 </div>
6
 </div>

+ 2
- 6
searx/templates/default/result_templates/videos.html View File

1
 <div class="result">
1
 <div class="result">
2
-  {% if result['favicon'] %}
3
-    <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />
4
-  {% endif %}
5
-
6
     <p>
2
     <p>
7
-      <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
3
+      <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>
8
       {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
4
       {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
9
-      <a href="{{ result.url }}"><img width="400px" src="{{ result.thumbnail }}" title={{ result.title }} alt=" {{ result.title }}"/></a>
5
+      <a href="{{ result.url }}"><img class="thumbnail" src="{{ result.thumbnail }}" title={{ result.title }} alt=" {{ result.title }}"/></a>
10
       <p class="url">{{ result.url }}</p>
6
       <p class="url">{{ result.url }}</p>
11
     </p>
7
     </p>
12
 </div>
8
 </div>

+ 4
- 2
searx/templates/default/results.html View File

1
 {% extends "default/base.html" %}
1
 {% extends "default/base.html" %}
2
 {% block title %}{{ q }} - {% endblock %}
2
 {% block title %}{{ q }} - {% endblock %}
3
 {% block content %}
3
 {% block content %}
4
-<div class="right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div>
4
+<div class="preferences_container right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div>
5
 <div class="small search center">
5
 <div class="small search center">
6
     {% include 'default/search.html' %}
6
     {% include 'default/search.html' %}
7
 </div>
7
 </div>
80
             </form>
80
             </form>
81
         {% endif %}
81
         {% endif %}
82
         <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
82
         <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
83
-            <div class="left">
83
+            <div class="right">
84
             {% for category in selected_categories %}
84
             {% for category in selected_categories %}
85
             <input type="hidden" name="category_{{ category }}" value="1"/>
85
             <input type="hidden" name="category_{{ category }}" value="1"/>
86
             {% endfor %}
86
             {% endfor %}
89
             <input type="submit" value="{{ _('next page') }} >>" />
89
             <input type="submit" value="{{ _('next page') }} >>" />
90
             </div>
90
             </div>
91
         </form>
91
         </form>
92
+
93
+        <br />
92
     </div>
94
     </div>
93
     {% endif %}
95
     {% endif %}
94
 </div>
96
 </div>

+ 1
- 1
searx/templates/default/search.html View File

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