diff --git a/searx/search.py b/searx/search.py index 427da3b..0324d4a 100644 --- a/searx/search.py +++ b/searx/search.py @@ -384,12 +384,17 @@ class Search(object): for pd_name, pd in self.request_data.items(): if pd_name.startswith('category_'): category = pd_name[9:] + # if category is not found in list, skip if category not in categories: continue - # add category to list - self.categories.append(category) + if pd != 'off': + # add category to list + self.categories.append(category) + elif category in self.categories: + # remove category from list if property is set to 'off' + self.categories.remove(category) # if no category is specified for this search, # using user-defined default-configuration which diff --git a/searx/static/themes/oscar/css/oscar.min.css b/searx/static/themes/oscar/css/oscar.min.css index b8d6fba..72be92c 100644 --- a/searx/static/themes/oscar/css/oscar.min.css +++ b/searx/static/themes/oscar/css/oscar.min.css @@ -1,11 +1,14 @@ html{position:relative;min-height:100%} body{margin-bottom:80px} .footer{position:absolute;bottom:0;width:100%;height:60px} -input[type=checkbox]:checked~.label_hide_if_checked{display:none} -input[type=checkbox]:not(:checked)~.label_hide_if_not_checked{display:none} -.result_header{margin-bottom:5px;margin-top:20px}.result_header .favicon{margin-bottom:-3px} -.result_header a{vertical-align:bottom}.result_header a .highlight{font-weight:bold} -.result-content{margin-top:5px}.result-content .highlight{font-weight:bold} +input[type=checkbox]:checked+.label_hide_if_checked,input[type=checkbox]:checked+.label_hide_if_not_checked+.label_hide_if_checked{display:none} +input[type=checkbox]:not(:checked)+.label_hide_if_not_checked,input[type=checkbox]:not(:checked)+.label_hide_if_checked+.label_hide_if_not_checked{display:none} +.result_header{margin-bottom:5px;margin-top:20px} +.result_header .favicon{margin-bottom:-3px} +.result_header a{vertical-align:bottom} +.result_header a .highlight{font-weight:bold} +.result-content{margin-top:5px} +.result-content .highlight{font-weight:bold} .result-default{clear:both} .result-images{float:left !important} .img-thumbnail{margin:5px;max-height:128px;min-height:128px} @@ -20,3 +23,4 @@ input[type=checkbox]:not(:checked)~.label_hide_if_not_checked{display:none} .search_categories{margin:10px 0;text-transform:capitalize} .cursor-text{cursor:text !important} .cursor-pointer{cursor:pointer !important} + diff --git a/searx/static/themes/oscar/less/oscar/checkbox.less b/searx/static/themes/oscar/less/oscar/checkbox.less index 712e53d..6428b36 100644 --- a/searx/static/themes/oscar/less/oscar/checkbox.less +++ b/searx/static/themes/oscar/less/oscar/checkbox.less @@ -1,9 +1,9 @@ // Hide element if checkbox is checked -input[type=checkbox]:checked ~ .label_hide_if_checked { +input[type=checkbox]:checked + .label_hide_if_checked, input[type=checkbox]:checked + .label_hide_if_not_checked + .label_hide_if_checked { display:none; } // Hide element if checkbox is not checked -input[type=checkbox]:not(:checked) ~ .label_hide_if_not_checked { +input[type=checkbox]:not(:checked) + .label_hide_if_not_checked, input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not_checked { display:none; } diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html index 466756b..42cd4e9 100644 --- a/searx/templates/oscar/base.html +++ b/searx/templates/oscar/base.html @@ -36,8 +36,10 @@ diff --git a/searx/templates/oscar/categories.html b/searx/templates/oscar/categories.html index 82ddcf6..f38cce5 100644 --- a/searx/templates/oscar/categories.html +++ b/searx/templates/oscar/categories.html @@ -1,6 +1,22 @@ -
+ + + +
{% for category in categories %} {% endfor %}
+ + diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html index b2430ed..23af61f 100644 --- a/searx/templates/oscar/result_templates/default.html +++ b/searx/templates/oscar/result_templates/default.html @@ -6,7 +6,7 @@ {{ icon('link') }} {{ _('cached') }} {% if result.embedded %} - + {% endif %} {% if result.embedded %} diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html index c08e2e7..fd33952 100644 --- a/searx/templates/oscar/result_templates/map.html +++ b/searx/templates/oscar/result_templates/map.html @@ -7,15 +7,15 @@ {{ icon('link') }} {{ _('cached') }} {% if (result.latitude and result.longitude) or result.boundingbox %} - + {% endif %} {% if result.osm and (result.osm.type and result.osm.id) %} - + {% endif %} {# {% if (result.latitude and result.longitude) %} - + {% endif %} #}
diff --git a/searx/templates/oscar/result_templates/videos.html b/searx/templates/oscar/result_templates/videos.html index c3d02c1..7e773c6 100644 --- a/searx/templates/oscar/result_templates/videos.html +++ b/searx/templates/oscar/result_templates/videos.html @@ -6,7 +6,7 @@ {{ icon('link') }} {{ _('cached') }} {% if result.embedded %} - + {% endif %} {% if result.embedded %} diff --git a/searx/templates/oscar/search.html b/searx/templates/oscar/search.html index 4b1f8b6..e48c80f 100644 --- a/searx/templates/oscar/search.html +++ b/searx/templates/oscar/search.html @@ -3,7 +3,7 @@
- +
diff --git a/searx/templates/oscar/search_full.html b/searx/templates/oscar/search_full.html index 673f239..b1fe39e 100644 --- a/searx/templates/oscar/search_full.html +++ b/searx/templates/oscar/search_full.html @@ -4,12 +4,12 @@
- +
- -
+ +
{% include 'oscar/categories.html' %}