forked from h5p/moodle-mod_hvp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings-hide-key.js
33 lines (30 loc) · 1018 Bytes
/
settings-hide-key.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* global HVPSettingsHideKey */
/**
* Prepares for hiding of the Site Key setting since you cannot modify attributes and such in Moodle.
*/
(function($) {
$(document).ready(function() {
if (!window.HVPSettingsHideKey) {
return;
}
var $input = $('#' + HVPSettingsHideKey.input);
if (!$input.length) {
return;
}
var placeHolder = $input.val() || HVPSettingsHideKey.value ? HVPSettingsHideKey.placeholder : HVPSettingsHideKey.empty;
$input.attr('maxlength', 36)
.attr('placeholder', placeHolder)
.data('value', HVPSettingsHideKey.value)
.val('');
$('<button/>', {
'type': 'button',
'class': 'h5p-reveal-value',
'text': HVPSettingsHideKey.reveal,
'data': {
'control': HVPSettingsHideKey.input,
'hide': HVPSettingsHideKey.hide
},
insertAfter: $input
});
});
})(H5P.jQuery);