Code samples: cleanup for publishing

This commit is contained in:
mDuo13
2022-04-20 14:03:36 -07:00
parent ff0bbfcffa
commit 383030359e
4 changed files with 64 additions and 69 deletions

18
assets/js/code-samples.js Normal file
View File

@@ -0,0 +1,18 @@
$(document).ready(() => {
$(".single_lang input").change((event) => {
const lang = $(event.target).val()
const lang_checked = $(event.target).prop("checked")
if (lang_checked) {
// Enabling a language
//$("#input_all").prop("checked", false)
$("#code_samples_list .card").hide()
$(`#code_samples_list .card.lang_${lang}`).show()
}
// Disabling a language? Let the other element's handler do it
})
$("#input_all").change((event) => {
const lang = $(event.target).val()
$("#code_samples_list .card").show()
})
})