Components: Hide non-featured component on page load

This commit is contained in:
Paulus Schoutsen 2016-03-07 14:14:54 -08:00
parent e93682035f
commit 9b20f0523a

View File

@ -36,7 +36,9 @@ Support for these components is provided by the Home Assistant community.
<div id="componentContainer">
{% for component in components %}
{% if component.ha_category %}
<a href='{{ component.url }}' class='{{ component.ha_category | slugify }}{% if component.featured %} featured{% endif %}'>
<a href='{{ component.url }}'
class='{{ component.ha_category | slugify }}{% if component.featured %} featured{% endif %}'
{% unless component.featured %}style='display: none'{% endunless %}>
<div class='img-container'>
{% if component.logo %}
<img src='/images/supported_brands/{{ component.logo }}'>
@ -60,8 +62,19 @@ Support for these components is provided by the Home Assistant community.
{% endcomment %}
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.2.2/isotope.pkgd.js"></script>
<script type="text/javascript">
<script>
// undo initial hiding of non-featured cards
if (location.hash !== '') {
if (location.hash === '#all') {
jQuery('#componentContainer a').show();
} else {
jQuery('#componentContainer .featured').hide();
jQuery('#componentContainer .' + location.hash.substr(1)).show();
}
}
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.2.2/isotope.pkgd.min.js"></script>
<script>
$(window).load(function(){
var $container = $('#componentContainer');