()
| 145 | } |
| 146 | |
| 147 | function getSettingsFromForm() { |
| 148 | const settings = {}; |
| 149 | for (const [optionName, optionType] of Object.entries(options)) { |
| 150 | const el = getOptionEl(optionName); |
| 151 | let value; |
| 152 | switch (optionType) { |
| 153 | case "boolean": |
| 154 | value = el.checked; |
| 155 | break; |
| 156 | case "number": |
| 157 | value = parseFloat(el.value); |
| 158 | break; |
| 159 | case "string": |
| 160 | value = el.value.trim(); |
| 161 | break; |
| 162 | case "option": |
| 163 | const optionEl = document.querySelector(`input[name="${optionName}"]:checked`); |
| 164 | value = optionEl.value; |
| 165 | break; |
| 166 | default: |
| 167 | throw new Error(`Unrecognized option type ${optionType}`); |
| 168 | } |
| 169 | if (value !== null) { |
| 170 | settings[optionName] = value; |
| 171 | } |
| 172 | } |
| 173 | if (settings["linkHintCharacters"] != null) { |
| 174 | settings["linkHintCharacters"] = settings["linkHintCharacters"].toLowerCase(); |
| 175 | } |
| 176 | settings["exclusionRules"] = ExclusionRulesEditor.getRules(); |
| 177 | return settings; |
| 178 | } |
| 179 | |
| 180 | function getValidationErrors() { |
| 181 | const results = {}; |
no test coverage detected