mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 15:13:21 +08:00
18 lines
528 B
JavaScript
18 lines
528 B
JavaScript
(function() {
|
|
'use strict';
|
|
|
|
function initToggleVisibilityListeners() {
|
|
$(document).on('change', 'input[data-action="toggle-visibility"]', function({ currentTarget }) {
|
|
let toggleId = currentTarget.getAttribute('data-target');
|
|
let element = document.getElementById(toggleId);
|
|
|
|
if (currentTarget.checked) {
|
|
element.classList.remove('hidden');
|
|
} else {
|
|
element.classList.add('hidden');
|
|
}
|
|
});
|
|
}
|
|
|
|
$(document).one('turbolinks:load', initToggleVisibilityListeners);
|
|
}());
|