wrap select/deselect funcs in try/catch block

This commit is contained in:
Tyler Bean 2022-06-27 18:50:07 -05:00
parent d53a714ad2
commit 01b8d12979
2 changed files with 30 additions and 10 deletions

View File

@ -6,7 +6,7 @@
// @require http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js
// @grant GM_addStyle
// @grant GM_setClipboard
// @version 0.0.12
// @version 0.0.13
// ==/UserScript==
// draw frame
@ -1768,12 +1768,22 @@ function checkButtonColor(buttonName) {
return color;
};
function selectCheckbox(box) {
box.filter("A")[0].classList.add("checked");
box.filter("INPUT")[0].checked = true;
try {
box.filter("A")[0].classList.add("checked");
box.filter("INPUT")[0].checked = true;
} catch (e) {
console.log(box + " does not appear to exist");
}
};
function deselectCheckbox(box) {
box.filter("A")[0].classList.remove("checked");
box.filter("INPUT")[0].checked = false;
try {
box.filter("A")[0].classList.remove("checked");
box.filter("INPUT")[0].checked = false;
} catch (e) {
console.log(box + " does not appear to exist");
}
};
function apply() {
if (debugFlag == true) {

View File

@ -4,7 +4,7 @@
// @description Effort to simplify configuration of incidents/maintenance windows
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
// @require http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js
// @version 0.0.12
// @version 0.0.13
// @downloadUrl https://gitea.frijole.lol/o0beaner/js-statusio-selector/raw/branch/main/statusio-selector.user.js
// @updateURL https://gitea.frijole.lol/o0beaner/js-statusio-selector/raw/branch/main/statusio-selector.user.js
// @include /^https?://app\.status\.io/dashboard/.*/?(maintenance|incident)/create$/
@ -1804,12 +1804,22 @@ function checkButtonColor(buttonName) {
return color;
};
function selectCheckbox(box) {
box.filter("A")[0].classList.add("checked");
box.filter("INPUT")[0].checked = true;
try {
box.filter("A")[0].classList.add("checked");
box.filter("INPUT")[0].checked = true;
} catch (e) {
console.log(box + " does not appear to exist");
}
};
function deselectCheckbox(box) {
box.filter("A")[0].classList.remove("checked");
box.filter("INPUT")[0].checked = false;
try {
box.filter("A")[0].classList.remove("checked");
box.filter("INPUT")[0].checked = false;
} catch (e) {
console.log(box + " does not appear to exist");
}
};
function apply() {
if (debugFlag == true) {