Skip to content

Commit

Permalink
表示するボタンのクラス配列の作成と表示部分を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
jun68ykt committed Jul 15, 2019
1 parent 0ab8a80 commit 7a52495
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
$('input[name="check"]:checked').each(function() {
_tmp.push($(this).parents('li').attr('class').split(' '));
});

_tmp = Array.prototype.concat.apply([], _tmp);

var data={};
Expand All @@ -22,15 +23,12 @@
data[key]++;
}

var showClass = data.filter(function(value){ return ( value >= 3);} );


if (showClass) {
$('.' + showClass).show();
} else {
$('button').hide();
}
var showClasses = Object.entries(data).filter(([_, value]) => value >= 3).map(e => e[0]);

$('.button').hide();
showClasses.forEach(clazz => {
$(`.button.${clazz}`).show();
});
};
});
});
Expand Down

0 comments on commit 7a52495

Please sign in to comment.