parent
8f132cfffb
commit
c4b88c3992
|
@ -16,8 +16,39 @@
|
|||
toggle();
|
||||
}
|
||||
|
||||
function setupRevealing() {
|
||||
var $button = $(this);
|
||||
|
||||
// Getting the field which should have the value:
|
||||
var $input = $('#' + $button.data('control'));
|
||||
|
||||
if (!$input.data('value')) {
|
||||
$button.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup button action
|
||||
var revealed = false;
|
||||
var text = $button.html();
|
||||
$button.click(function () {
|
||||
if (revealed) {
|
||||
$input.val('');
|
||||
$button.html(text);
|
||||
revealed = false;
|
||||
}
|
||||
else {
|
||||
$input.val($input.data('value'));
|
||||
$button.html($button.data('hide'));
|
||||
revealed = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
// Get the checkboxes making other fields being hidden:
|
||||
$('.h5p-visibility-toggler').each(setupHiding);
|
||||
|
||||
// Get the buttons making other fields have hidden values:
|
||||
$('.h5p-reveal-value').each(setupRevealing);
|
||||
});
|
||||
})(H5P.jQuery);
|
||||
|
|
Loading…
Reference in New Issue