| 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 |
|