PluginProbe
404 Solution / 4.1.19
404 Solution v4.1.19
4.3.5 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.2.0 4.1.19 4.1.18 4.1.17 4.1.16 4.1.15 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.1.7 4.1.6 4.1.5 4.1.4 4.1.3 trunk 2.30.0 All 109 releases
404-solution / includes / js / enableDisableApplyButton.js

enableDisableApplyButton.js in 404 Solution 4.1.19, at includes/js/enableDisableApplyButton.js

36 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1
2 /* Here we disable the "Apply" button if there are no checkboxes selected.
3 We enable it if there is at least one selected. */
4 function enableDisableApplyButton() {
5 var shouldBeEnabled = false;
6 var inputs = document.getElementsByTagName("input");
7 for(var i = 0; i < inputs.length; i++) {
8 if(inputs[i].type === "checkbox") {
9 if (inputs[i].checked === true) {
10 shouldBeEnabled = true;
11 break;
12 }
13 }
14 }
15
16 var button = document.getElementById("captured_404s_bulk_apply");
17 var selector = document.getElementById("bulkCaptured404select");
18
19 // This can be null because we're on the trash page.
20 if (button === null) {
21 return;
22 }
23
24 button.disabled = !shouldBeEnabled;
25 selector.disabled = !shouldBeEnabled;
26 if (shouldBeEnabled) {
27 button.setAttribute("title", '');
28 button.removeAttribute("aria-describedby");
29 selector.setAttribute("title", '');
30 } else {
31 button.setAttribute("title", "{altText}");
32 selector.setAttribute("title", "{altText}");
33 }
34 }
35 enableDisableApplyButton();
36