Merge pull request #174 from pointhi/nojs_fix
add no javascript support to oscar-template
This commit is contained in:
		
						commit
						c5599e3c7c
					
				@ -384,12 +384,17 @@ class Search(object):
 | 
				
			|||||||
            for pd_name, pd in self.request_data.items():
 | 
					            for pd_name, pd in self.request_data.items():
 | 
				
			||||||
                if pd_name.startswith('category_'):
 | 
					                if pd_name.startswith('category_'):
 | 
				
			||||||
                    category = pd_name[9:]
 | 
					                    category = pd_name[9:]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    # if category is not found in list, skip
 | 
					                    # if category is not found in list, skip
 | 
				
			||||||
                    if category not in categories:
 | 
					                    if category not in categories:
 | 
				
			||||||
                        continue
 | 
					                        continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if pd != 'off':
 | 
				
			||||||
                        # add category to list
 | 
					                        # add category to list
 | 
				
			||||||
                        self.categories.append(category)
 | 
					                        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,
 | 
					            # if no category is specified for this search,
 | 
				
			||||||
            # using user-defined default-configuration which
 | 
					            # using user-defined default-configuration which
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								searx/static/themes/oscar/css/oscar.min.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								searx/static/themes/oscar/css/oscar.min.css
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							@ -1,9 +1,9 @@
 | 
				
			|||||||
// Hide element if checkbox is checked
 | 
					// 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;
 | 
					  display:none;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Hide element if checkbox is not checked
 | 
					// 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;
 | 
					  display:none;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -36,8 +36,10 @@
 | 
				
			|||||||
    </script>
 | 
					    </script>
 | 
				
			||||||
    <noscript>
 | 
					    <noscript>
 | 
				
			||||||
        <style type="text/css">
 | 
					        <style type="text/css">
 | 
				
			||||||
            .tab-content > .active_if_nojs {display: block;}
 | 
					            .tab-content > .active_if_nojs, .active_if_nojs {display: block !important; visibility: visible !important;}
 | 
				
			||||||
 | 
					            .margin_top_if_nojs {margin-top: 20px;}
 | 
				
			||||||
            .hide_if_nojs {display: none !important;overflow:none !important;}
 | 
					            .hide_if_nojs {display: none !important;overflow:none !important;}
 | 
				
			||||||
 | 
					            .disabled_if_nojs {pointer-events: none; cursor: default; text-decoration: line-through;}
 | 
				
			||||||
        </style>
 | 
					        </style>
 | 
				
			||||||
    </noscript>
 | 
					    </noscript>
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,22 @@
 | 
				
			|||||||
<div id="categories" class="btn-group btn-toggle" data-toggle="buttons">
 | 
					<!-- used if scripts are disabled -->
 | 
				
			||||||
 | 
					<noscript>
 | 
				
			||||||
 | 
					<div id="categories" class="btn-group btn-toggle">
 | 
				
			||||||
 | 
					{% for category in categories %}
 | 
				
			||||||
 | 
					    <!--<div class="checkbox">-->
 | 
				
			||||||
 | 
					        <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_nojs" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />
 | 
				
			||||||
 | 
					        <label class="btn btn-sm btn-primary active label_hide_if_not_checked" for="checkbox_{{ category|replace(' ', '_') }}_nojs">{{ _(category) }}</label>
 | 
				
			||||||
 | 
					        <label class="btn btn-sm btn-default label_hide_if_checked" for="checkbox_{{ category|replace(' ', '_') }}_nojs">{{ _(category) }}</label>
 | 
				
			||||||
 | 
					    <!--</div>-->
 | 
				
			||||||
 | 
					    {% if category in selected_categories %}<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_dis_activation" name="category_{{ category }}" value="off" checked="checked"/>{% endif %}
 | 
				
			||||||
 | 
					{% endfor %}
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					</noscript>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<div id="categories" class="btn-group btn-toggle hide_if_nojs" data-toggle="buttons">
 | 
				
			||||||
{% for category in categories %}
 | 
					{% for category in categories %}
 | 
				
			||||||
    <label class="btn btn-sm {% if category in selected_categories %}btn-primary active{% else %}btn-default{% endif %}" data-btn-class="primary">
 | 
					    <label class="btn btn-sm {% if category in selected_categories %}btn-primary active{% else %}btn-default{% endif %}" data-btn-class="primary">
 | 
				
			||||||
        <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{ _(category) }}</label>
 | 
					        <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{ _(category) }}</label>
 | 
				
			||||||
{% endfor %}
 | 
					{% endfor %}
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
 | 
					<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% if result.embedded %}
 | 
					{% if result.embedded %}
 | 
				
			||||||
    <small> • <a class="text-info btn-collapse collapsed cursor-pointer media-loader" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}">{{ icon('music') }} {{ _('show media') }}</a></small>
 | 
					    <small> • <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}">{{ icon('music') }} {{ _('show media') }}</a></small>
 | 
				
			||||||
{% endif %}
 | 
					{% endif %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% if result.embedded %}
 | 
					{% if result.embedded %}
 | 
				
			||||||
 | 
				
			|||||||
@ -7,15 +7,15 @@
 | 
				
			|||||||
<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
 | 
					<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% if (result.latitude and result.longitude) or result.boundingbox %}
 | 
					{% if (result.latitude and result.longitude) or result.boundingbox %}
 | 
				
			||||||
    <small> • <a class="text-info btn-collapse collapsed searx_init_map cursor-pointer" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}">{{ icon('globe') }} {{ _('show map') }}</a></small>
 | 
					    <small> • <a class="text-info btn-collapse collapsed searx_init_map cursor-pointer disabled_if_nojs" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}">{{ icon('globe') }} {{ _('show map') }}</a></small>
 | 
				
			||||||
{% endif %}
 | 
					{% endif %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% if result.osm and (result.osm.type and result.osm.id) %}
 | 
					{% if result.osm and (result.osm.type and result.osm.id) %}
 | 
				
			||||||
    <small> • <a class="text-info btn-collapse collapsed cursor-pointer searx_overpass_request" data-toggle="collapse" data-target="#result-overpass-{{ index }}" data-osm-type="{{ result.osm.type }}" data-osm-id="{{ result.osm.id }}" data-result-table="result-overpass-table-{{ index }}" data-result-table-loadicon="result-overpass-table-loading-{{ index }}" data-btn-text-collapsed="{{ _('show details') }}" data-btn-text-not-collapsed="{{ _('hide details') }}">{{ icon('map-marker') }} {{ _('show details') }}</a></small>
 | 
					    <small> • <a class="text-info btn-collapse collapsed cursor-pointer searx_overpass_request disabled_if_nojs" data-toggle="collapse" data-target="#result-overpass-{{ index }}" data-osm-type="{{ result.osm.type }}" data-osm-id="{{ result.osm.id }}" data-result-table="result-overpass-table-{{ index }}" data-result-table-loadicon="result-overpass-table-loading-{{ index }}" data-btn-text-collapsed="{{ _('show details') }}" data-btn-text-not-collapsed="{{ _('hide details') }}">{{ icon('map-marker') }} {{ _('show details') }}</a></small>
 | 
				
			||||||
{% endif %}
 | 
					{% endif %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{# {% if (result.latitude and result.longitude) %}
 | 
					{# {% if (result.latitude and result.longitude) %}
 | 
				
			||||||
    <small> • <a class="text-info btn-collapse collapsed cursor-pointer" data-toggle="collapse" data-target="#result-geodata-{{ index }}" data-btn-text-collapsed="{{ _('show geodata') }}" data-btn-text-not-collapsed="{{ _('hide geodata') }}">{{ icon('map-marker') }} {{ _('show geodata') }}</a></small>
 | 
					    <small> • <a class="text-info btn-collapse collapsed cursor-pointer disabled_if_nojs" data-toggle="collapse" data-target="#result-geodata-{{ index }}" data-btn-text-collapsed="{{ _('show geodata') }}" data-btn-text-not-collapsed="{{ _('hide geodata') }}">{{ icon('map-marker') }} {{ _('show geodata') }}</a></small>
 | 
				
			||||||
{% endif %} #}
 | 
					{% endif %} #}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="container-fluid">
 | 
					<div class="container-fluid">
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
 | 
					<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% if result.embedded %}
 | 
					{% if result.embedded %}
 | 
				
			||||||
    <small> • <a class="text-info btn-collapse collapsed cursor-pointer media-loader" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}">{{ icon('film') }} {{ _('show video') }}</a></small>
 | 
					    <small> • <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}">{{ icon('film') }} {{ _('show video') }}</a></small>
 | 
				
			||||||
{% endif %}
 | 
					{% endif %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{% if result.embedded %}
 | 
					{% if result.embedded %}
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@
 | 
				
			|||||||
    <div class="input-group col-sm-12">
 | 
					    <div class="input-group col-sm-12">
 | 
				
			||||||
        <input type="search" name="q" class="form-control" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
 | 
					        <input type="search" name="q" class="form-control" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
 | 
				
			||||||
        <span class="input-group-btn">
 | 
					        <span class="input-group-btn">
 | 
				
			||||||
            <button type="submit" class="btn btn-default">{{ icon('search') }}<span class="sr-only">{{ _('Start search') }}</span></button>
 | 
					            <button type="submit" class="btn btn-default"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>
 | 
				
			||||||
        </span>
 | 
					        </span>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <div class="search_categories">
 | 
					    <div class="search_categories">
 | 
				
			||||||
 | 
				
			|||||||
@ -4,12 +4,12 @@
 | 
				
			|||||||
    <div class="input-group col-md-8 col-md-offset-2">
 | 
					    <div class="input-group col-md-8 col-md-offset-2">
 | 
				
			||||||
        <input type="search" name="q" class="form-control input-lg autofocus" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
 | 
					        <input type="search" name="q" class="form-control input-lg autofocus" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
 | 
				
			||||||
        <span class="input-group-btn">
 | 
					        <span class="input-group-btn">
 | 
				
			||||||
            <button type="submit" class="btn btn-default input-lg">{{ icon('search') }}<span class="sr-only">{{ _('Start search') }}</span></button>
 | 
					            <button type="submit" class="btn btn-default input-lg"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>
 | 
				
			||||||
        </span>
 | 
					        </span>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <button type="button" class="btn btn-link btn-collapse center-block collapsed" data-toggle="collapse" data-target="#search_categories" data-btn-text-collapsed="{{ _('Show search filters') }}" data-btn-text-not-collapsed="{{ _('Hide search filters') }}">{{ _('Show search filters') }}</button>
 | 
					    <button type="button" class="btn btn-link btn-collapse center-block collapsed hide_if_nojs" data-toggle="collapse" data-target="#search_categories" data-btn-text-collapsed="{{ _('Show search filters') }}" data-btn-text-not-collapsed="{{ _('Hide search filters') }}">{{ _('Show search filters') }}</button>
 | 
				
			||||||
    <div class="row collapse" id="search_categories">
 | 
					    <div class="row collapse active_if_nojs margin_top_if_nojs" id="search_categories">
 | 
				
			||||||
        <div class="col-md-12 text-center">
 | 
					        <div class="col-md-12 text-center">
 | 
				
			||||||
            {% include 'oscar/categories.html' %}
 | 
					            {% include 'oscar/categories.html' %}
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user