PluginProbe
Auto Alt Text / 1.3.2
Auto Alt Text v1.3.2
3.0.3 2.8.2 1.3.1 1.3.2 2.0.0 2.1.0 2.1.1 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.7.0 2.8.0 2.8.1 All 28 releases
auto-alt-text / resources / js / admin.js

admin.js in Auto Alt Text 1.3.2, at resources/js/admin.js

32 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import '../css/admin.css';
2
3 document.addEventListener('DOMContentLoaded', function() {
4
5 const typologyField = document.getElementById('aatxt_typology');
6 const filterFields = (typology) => {
7 let optionFields = document.querySelectorAll('.plugin-option');
8
9 optionFields.forEach((pluginOption) => {
10 let inputs = pluginOption.querySelectorAll('input, select, textarea');
11 if (pluginOption.classList.contains('type-' + typology)) {
12 pluginOption.style.display = 'block';
13 inputs.forEach(input => {
14 if (!input.classList.contains('notRequired')) {
15 input.setAttribute('required', '');
16 }
17 });
18 } else {
19 pluginOption.style.display = 'none';
20 inputs.forEach(input => input.removeAttribute('required'));
21 }
22 });
23 };
24
25 filterFields(typologyField.value);
26
27 typologyField.addEventListener('change', function (event) {
28 let typology = event.target.value;
29 filterFields(typology);
30 });
31 });
32