Przeglądaj źródła

Merge pull request #118 from dalf/master

default theme : small modifications
Adam Tauber 10 lat temu
rodzic
commit
58cc03351a

+ 1
- 81
searx/static/default/css/style.css
Plik diff jest za duży
Wyświetl plik


BIN
searx/static/default/img/favicon.png Wyświetl plik


BIN
searx/static/default/img/preference-icon.png Wyświetl plik


BIN
searx/static/default/img/search-icon.png Wyświetl plik


BIN
searx/static/default/img/searx.png Wyświetl plik


+ 4
- 0
searx/static/default/js/searx.js Wyświetl plik

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

+ 107
- 35
searx/static/default/less/style.less Wyświetl plik

@@ -97,6 +97,7 @@ h1 {
97 97
 div.title {
98 98
 	background: url('../img/searx.png') no-repeat;
99 99
 	width: 100%;
100
+        min-height: 80px;
100 101
 	background-position: center;
101 102
 
102 103
 	h1 {
@@ -126,6 +127,7 @@ fieldset {
126 127
 
127 128
 #categories {
128 129
 	margin: 0 10px;
130
+	.user-select;
129 131
 }
130 132
 
131 133
 .checkbox_container {
@@ -260,8 +262,12 @@ a {
260 262
 	.published_date {
261 263
 		font-size: 0.8em;
262 264
 		color: @color-result-publishdate-font;
263
-    	margin: 5px 20px;
265
+                Margin: 5px 20px;
264 266
 	}
267
+
268
+        .thumbnail {
269
+                width: 400px; 
270
+        }
265 271
 }
266 272
 
267 273
 .engines {
@@ -297,14 +303,14 @@ a {
297 303
 }
298 304
 
299 305
 .image_result {
300
-	float: left;
306
+	display: inline-block;
301 307
 	margin: 10px 10px;
302 308
 	position: relative;
303
-	height: 160px;
309
+	max-height: 160px;
304 310
 
305 311
 	img {
306 312
 		border: 0;
307
-		height: 160px;
313
+		max-height: 160px;
308 314
 	}
309 315
 
310 316
 	p {
@@ -369,17 +375,17 @@ tr {
369 375
 #results {
370 376
 	margin: auto;
371 377
 	padding: 0;
372
-    width: @results-width;
378
+	width: @results-width;
373 379
 	margin-bottom: 20px;
374 380
 }
375 381
 
376 382
 #sidebar {
377 383
 	position: fixed;
378
-    bottom: 10px;
379
-    left: 10px;
384
+	bottom: 10px;
385
+	left: 10px;
380 386
 	margin: 0 2px 5px 5px;
381 387
 	padding: 0 2px 2px 2px;
382
-    width: 14em;
388
+	width: 14em;
383 389
 
384 390
 	input {
385 391
 		padding: 0;
@@ -390,9 +396,17 @@ tr {
390 396
         color: @color-result-search-url-font;
391 397
 		cursor: pointer;
392 398
 	}
393
-    input[type="submit"] {
399
+	input[type="submit"] {
394 400
 		text-decoration: underline;
395
-    }
401
+	}
402
+}
403
+
404
+#suggestions {
405
+
406
+        span {
407
+                display: block;
408
+        }
409
+
396 410
 }
397 411
 
398 412
 #suggestions, #answers {
@@ -418,7 +432,8 @@ tr {
418 432
     	}
419 433
 
420 434
 	form {
421
-		display: inline;
435
+		display: inline-block;
436
+                min-width: 210px;
422 437
 	}
423 438
 }
424 439
 
@@ -436,6 +451,7 @@ tr {
436 451
 	   	    border: 1px solid #ddd;
437 452
 		    padding: 5px;
438 453
 	   	    font-size: 0.8em;
454
+                    /* box-shadow: 0px 0px 5px #CCC; */
439 455
 
440 456
 	   	    img {
441 457
 		    	max-width: 20em;
@@ -501,7 +517,10 @@ tr {
501 517
 
502 518
 #pagination {
503 519
 	clear: both;
504
-    width: 40em;
520
+
521
+        br {
522
+        	clear: both;
523
+        }
505 524
 }
506 525
 
507 526
 #apis {
@@ -511,18 +530,19 @@ tr {
511 530
 
512 531
 @media screen and (max-width: @results-width) {
513 532
 
514
-    #results {
515
-        margin: auto;
516
-        padding: 0;
517
-        width: 90%;
518
-    }
533
+	#results {
534
+	        margin: auto;
535
+	        padding: 0;
536
+	        width: 90%;
537
+	}
538
+
519 539
 	.github {
520 540
 		display: none;
521 541
 	}
522 542
 
523 543
 	.checkbox_container {
524 544
 		display: block;
525
-        width: 90%;
545
+        	width: 90%;
526 546
 		//float: left;
527 547
 
528 548
 		label {
@@ -530,7 +550,7 @@ tr {
530 550
 		}
531 551
 	}
532 552
 
533
-	.right {
553
+	.preferences_container {
534 554
 		display: none;
535 555
 		postion: fixed !important;
536 556
 		top: 100px;
@@ -541,20 +561,61 @@ tr {
541 561
 
542 562
 @media screen and (max-width: 75em) {
543 563
 
544
-       #infoboxes {
545
-	   position: inherit;
546
-	   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;
547 609
 	   
548
-	   .infobox {
549
-	   	    clear:both;
610
+                .infobox {
611
+                        clear:both;
550 612
 	   
551
-	   	   img {
552
-	   	       float: left;
553
-	       	       max-width: 10em;
554
-	   	   }
555
-	   }
556
-
557
-       }
613
+                        img {
614
+                                float: left;
615
+                                max-width: 10em;
616
+                        }
617
+                }
618
+        }
558 619
 
559 620
 	#categories {
560 621
 		font-size: 90%;
@@ -583,13 +644,24 @@ tr {
583 644
 		display: none;
584 645
 	}
585 646
 
586
-    #search_url {
587
-        display: none;
588
-    }
647
+    	#search_url {
648
+        	display: none;
649
+    	}
589 650
 
590 651
 	.result {
591 652
 		border-top: 1px solid @color-result-top-border;
592
-		margin: 7px 0 6px 0;
653
+		margin: 8px 0 8px 0;
654
+
655
+                .thumbnail {
656
+                        max-width: 98%;
657
+                }
658
+	}
659
+
660
+	.image_result {
661
+		max-width: 98%;
662
+		img {
663
+			max-width: 98%;
664
+		}
593 665
 	}
594 666
 }
595 667
 

+ 4
- 4
searx/templates/default/base.html Wyświetl plik

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

+ 5
- 3
searx/templates/default/categories.html Wyświetl plik

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

+ 2
- 1
searx/templates/default/index.html Wyświetl plik

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

+ 1
- 1
searx/templates/default/infobox.html Wyświetl plik

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

+ 2
- 9
searx/templates/default/result_templates/default.html Wyświetl plik

@@ -1,13 +1,6 @@
1 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 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 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 6
 </div>

+ 2
- 6
searx/templates/default/result_templates/videos.html Wyświetl plik

@@ -1,12 +1,8 @@
1 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 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 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 6
       <p class="url">{{ result.url }}</p>
11 7
     </p>
12 8
 </div>

+ 4
- 2
searx/templates/default/results.html Wyświetl plik

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

+ 1
- 1
searx/templates/default/search.html Wyświetl plik

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

+ 1
- 1
searx/tests/test_webapp.py Wyświetl plik

@@ -49,7 +49,7 @@ class ViewsTestCase(SearxTestCase):
49 49
         )
50 50
         result = self.app.post('/', data={'q': 'test'})
51 51
         self.assertIn(
52
-            '<h3 class="result_title"><a href="http://first.test.xyz">First <span class="highlight">Test</span></a></h3>',  # noqa
52
+            '<h3 class="result_title"> <img width="14" height="14" class="favicon" src="static/default/img/icon_youtube.ico" /><a href="http://first.test.xyz">First <span class="highlight">Test</span></a></h3>',  # noqa
53 53
             result.data
54 54
         )
55 55
         self.assertIn(