| 870 | } |
| 871 | |
| 872 | function wireIgnoreRegexPresetButton(scope = document) { |
| 873 | const btn = scope.querySelector('#ignoreRegexSnapshotsPreset'); |
| 874 | const input = scope.querySelector('#ignoreRegex'); |
| 875 | if (!btn || !input || btn.__wired) return; |
| 876 | |
| 877 | btn.__wired = true; |
| 878 | |
| 879 | const preset = '(^|/)(@?snapshots?)(/|$)'; |
| 880 | |
| 881 | btn.addEventListener('click', (e) => { |
| 882 | e.preventDefault(); |
| 883 | if (input.disabled) return; |
| 884 | |
| 885 | const current = String(input.value || ''); |
| 886 | const hasPreset = current |
| 887 | .replace(/\r\n/g, '\n') |
| 888 | .split('\n') |
| 889 | .some(line => line.trim() === preset); |
| 890 | if (hasPreset) { |
| 891 | input.focus(); |
| 892 | return; |
| 893 | } |
| 894 | |
| 895 | if (current.trim() === '') { |
| 896 | input.value = preset; |
| 897 | } else { |
| 898 | const suffix = current.endsWith('\n') ? '' : '\n'; |
| 899 | input.value = current + suffix + preset; |
| 900 | } |
| 901 | |
| 902 | input.focus(); |
| 903 | }); |
| 904 | } |
| 905 | |
| 906 | function renderAdminEncryptionSection({ config, dark }) { |
| 907 | const host = document.getElementById("encryptionContent"); |