Quellcode durchsuchen

[fix] apply changes in infobox's styles

changes were made for wolframalpha infobox:

    - wrap text inside infobox.
      for example, there's a hill in New Zealand called
      Taumatawhakatangihangakoauauotamateapokaiwhenuakitanatahu
      (don't blame me, blame the Kiwis)
      and now it doesn't break the infobox.

    - add an optional image field for infobox's attributes.
      (doesn't affect ddg infobox at all)

    - table is now always split in half.
      needed so that images stay inside infobox.
      (max-width doesn't work for inline elements, it's the table
      that has to set the width.

if you don't like how the table width looks now in ddg/wiki's infobox,
i can change that code so that the style only applies when using
wolframalpha.
a01200356 vor 9 Jahren
Ursprung
Commit
4267b11a45

+ 1
- 1
searx/static/themes/default/css/style.css
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 3
- 2
searx/static/themes/default/less/style.less Datei anzeigen

@@ -476,6 +476,7 @@ color: @color-font-light;
476 476
 	   margin: 0px 2px 5px 5px;
477 477
 	   padding: 0px 2px 2px;
478 478
 	   max-width: 21em;
479
+       word-wrap: break-word;
479 480
 
480 481
 	   .infobox {
481 482
 	   	    margin: 10px 0 10px;
@@ -485,7 +486,7 @@ color: @color-font-light;
485 486
                     /* box-shadow: 0px 0px 5px #CCC; */
486 487
 
487 488
 	   	    img {
488
-		    	max-width: 20em;
489
+		    	max-width: 90%;
489 490
 			max-heigt: 12em;
490 491
 			display: block;
491 492
 			margin: 5px;
@@ -497,7 +498,7 @@ color: @color-font-light;
497 498
 		    }
498 499
 
499 500
 		    table {
500
-		    	  width: auto;
501
+                  table-layout: fixed;
501 502
 
502 503
 			  td {
503 504
 		       	     vertical-align: top;

+ 1
- 1
searx/static/themes/oscar/css/oscar.min.css Datei anzeigen

@@ -17,7 +17,7 @@ input[type=checkbox]:not(:checked)+.label_hide_if_not_checked,input[type=checkbo
17 17
 .result_download{margin-right:5px}
18 18
 #pagination{margin-top:30px;padding-bottom:50px}
19 19
 .label-default{color:#aaa;background:#fff}
20
-.infobox .infobox_part{margin-bottom:20px;word-wrap:break-word}
20
+.infobox .infobox_part{margin-bottom:20px;word-wrap:break-word;table-layout:fixed}
21 21
 .infobox .infobox_part:last-child{margin-bottom:0}
22 22
 .search_categories{margin:10px 0;text-transform:capitalize}
23 23
 .cursor-text{cursor:text !important}

+ 2
- 1
searx/static/themes/oscar/less/oscar/infobox.less Datei anzeigen

@@ -1,7 +1,8 @@
1 1
 .infobox {
2 2
     .infobox_part {
3 3
         margin-bottom: 20px;
4
-         word-wrap: break-word;
4
+        word-wrap: break-word;
5
+        table-layout: fixed;
5 6
     }
6 7
     
7 8
     .infobox_part:last-child {

+ 8
- 1
searx/templates/default/infobox.html Datei anzeigen

@@ -7,7 +7,14 @@
7 7
     <div class="attributes">
8 8
         <table>
9 9
             {% for attribute in infobox.attributes %}
10
-            <tr><td>{{ attribute.label }}</td><td>{{ attribute.value }}</td></tr>
10
+            <tr>
11
+                <td>{{ attribute.label }}</td>
12
+                {% if attribute.image %}
13
+                <td><img src="{{ image_proxify(attribute.image.src) }}" alt="{{ attribute.image.alt }}" /></td>
14
+                {% else %}
15
+                <td>{{ attribute.value }}</td>
16
+                {% endif %}
17
+            </tr>
11 18
             {% endfor %}
12 19
         </table>
13 20
     </div>

+ 5
- 1
searx/templates/oscar/infobox.html Datei anzeigen

@@ -1,6 +1,6 @@
1 1
 <div class="panel panel-default infobox">
2 2
     <div class="panel-heading">
3
-        <h4 class="panel-title">{{ infobox.infobox }}</h4>
3
+        <h4 class="panel-title infobox_part">{{ infobox.infobox }}</h4>
4 4
     </div>
5 5
     <div class="panel-body">
6 6
         {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ image_proxify(infobox.img_src) }}" alt="{{ infobox.infobox }}" />{% endif %}
@@ -11,7 +11,11 @@
11 11
             {% for attribute in infobox.attributes %}
12 12
             <tr>
13 13
                 <td>{{ attribute.label }}</td>
14
+                {% if attribute.image %}
15
+                <td><img class="img-responsive" src="{{ image_proxify(attribute.image.src) }}" alt="{{ attribute.image.alt }}" /></td>
16
+                {% else %}
14 17
                 <td>{{ attribute.value }}</td>
18
+                {% endif %}
15 19
             </tr>
16 20
             {% endfor %}
17 21
         </table>