feat: add a wait before a notice can be accepted
This commit is contained in:
@@ -72,6 +72,11 @@
|
||||
</label>
|
||||
<div class="fieldDescription checkboxFieldDescription">The notice can only be closed with an "Accept" button.</div>
|
||||
</div>
|
||||
<div class="inputContainer" id="heraldDelayField">
|
||||
<label class="inputLabel inputLabelUnfocused" for="heraldAcceptDelay">Wait before "Accept" can be clicked (seconds)</label>
|
||||
<input id="heraldAcceptDelay" type="number" is="emby-input" min="0" max="600" step="1" value="0" />
|
||||
<div class="fieldDescription">The button stays locked and counts down while the notice is on screen. 0 means no wait.</div>
|
||||
</div>
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label class="emby-checkbox-label">
|
||||
<input id="heraldEnabled" type="checkbox" is="emby-checkbox" checked />
|
||||
@@ -310,7 +315,7 @@
|
||||
text.appendChild(el('h3', 'listItemBodyText', notice.Title));
|
||||
var meta = [describeTarget(notice)];
|
||||
if (notice.RequireAccept) {
|
||||
meta.push('must be accepted');
|
||||
meta.push(notice.AcceptDelaySeconds > 0 ? 'must be accepted after ' + notice.AcceptDelaySeconds + ' s' : 'must be accepted');
|
||||
}
|
||||
if (notice.Revision > 1) {
|
||||
meta.push('shown ' + notice.Revision + ' times');
|
||||
@@ -342,6 +347,7 @@
|
||||
Title: notice.Title,
|
||||
Body: notice.Body,
|
||||
RequireAccept: notice.RequireAccept,
|
||||
AcceptDelaySeconds: notice.AcceptDelaySeconds || 0,
|
||||
Enabled: notice.Enabled,
|
||||
Target: { AllUsers: notice.Target.AllUsers, UserIds: notice.Target.UserIds }
|
||||
};
|
||||
@@ -413,6 +419,8 @@
|
||||
byId('heraldTitle').value = notice ? notice.Title : '';
|
||||
byId('heraldBody').value = notice ? notice.Body : '';
|
||||
byId('heraldRequireAccept').checked = notice ? notice.RequireAccept : false;
|
||||
byId('heraldAcceptDelay').value = notice ? (notice.AcceptDelaySeconds || 0) : 0;
|
||||
toggle(byId('heraldDelayField'), byId('heraldRequireAccept').checked);
|
||||
byId('heraldEnabled').checked = notice ? notice.Enabled : true;
|
||||
byId('heraldTarget').value = notice && !notice.Target.AllUsers ? 'selected' : 'all';
|
||||
renderUserPicker(notice ? notice.Target.UserIds : []);
|
||||
@@ -448,6 +456,7 @@
|
||||
Title: byId('heraldTitle').value,
|
||||
Body: byId('heraldBody').value,
|
||||
RequireAccept: byId('heraldRequireAccept').checked,
|
||||
AcceptDelaySeconds: byId('heraldRequireAccept').checked ? (parseInt(byId('heraldAcceptDelay').value, 10) || 0) : 0,
|
||||
Enabled: byId('heraldEnabled').checked,
|
||||
Target: { AllUsers: allUsers, UserIds: userIds }
|
||||
};
|
||||
@@ -617,6 +626,9 @@
|
||||
byId('heraldAcksClose').addEventListener('click', closeAcks);
|
||||
byId('heraldStatsRefresh').addEventListener('click', loadStats);
|
||||
byId('heraldNoticeForm').addEventListener('submit', submitForm);
|
||||
byId('heraldRequireAccept').addEventListener('change', function () {
|
||||
toggle(byId('heraldDelayField'), this.checked);
|
||||
});
|
||||
byId('heraldTarget').addEventListener('change', function () {
|
||||
toggle(byId('heraldUsers'), byId('heraldTarget').value === 'selected');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user