Refactor to reduce lines
This commit is contained in:
@@ -833,8 +833,14 @@
|
||||
syncTargetInputs();
|
||||
});
|
||||
|
||||
if (typeof window.giaMitigationShowTab !== "function") {
|
||||
window.giaMitigationShowTab = function(pid, tabName) {
|
||||
const defineGlobal = function(name, handler) {
|
||||
if (typeof window[name] === "function") {
|
||||
return;
|
||||
}
|
||||
window[name] = handler;
|
||||
};
|
||||
|
||||
defineGlobal("giaMitigationShowTab", function(pid, tabName) {
|
||||
const names = ["plan_board", "corrections", "engage", "fundamentals", "ask_ai"];
|
||||
names.forEach(function(name) {
|
||||
const pane = document.getElementById("mitigation-tab-" + pid + "-" + name);
|
||||
@@ -855,11 +861,9 @@
|
||||
shell.querySelectorAll('input[name="active_tab"]').forEach(function(input) {
|
||||
input.value = tabName;
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof window.giaMitigationToggleEdit !== "function") {
|
||||
window.giaMitigationToggleEdit = function(button) {
|
||||
defineGlobal("giaMitigationToggleEdit", function(button) {
|
||||
const form = button ? button.closest("form") : null;
|
||||
if (!form) {
|
||||
return;
|
||||
@@ -885,31 +889,25 @@
|
||||
} else {
|
||||
form.requestSubmit();
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof window.giaEngageSetAction !== "function") {
|
||||
window.giaEngageSetAction = function(pid, action) {
|
||||
defineGlobal("giaEngageSetAction", function(pid, action) {
|
||||
const actionInput = document.getElementById("engage-action-input-" + pid);
|
||||
if (actionInput) {
|
||||
actionInput.value = action;
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof window.giaEngageAutoPreview !== "function") {
|
||||
window.giaEngageAutoPreview = function(pid) {
|
||||
defineGlobal("giaEngageAutoPreview", function(pid) {
|
||||
const form = document.getElementById("engage-form-" + pid);
|
||||
if (!form) {
|
||||
return;
|
||||
}
|
||||
window.giaEngageSetAction(pid, "preview");
|
||||
form.requestSubmit();
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof window.giaEngageSelect !== "function") {
|
||||
window.giaEngageSelect = function(pid, kind, value, node) {
|
||||
defineGlobal("giaEngageSelect", function(pid, kind, value, node) {
|
||||
let inputId = "";
|
||||
if (kind === "share") {
|
||||
inputId = "engage-share-input-" + pid;
|
||||
@@ -928,8 +926,7 @@
|
||||
li.classList.add("is-active");
|
||||
}
|
||||
window.giaEngageAutoPreview(pid);
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
window.giaWorkspaceOpenTab(personId, "plan_board", false);
|
||||
syncTargetInputs();
|
||||
|
||||
Reference in New Issue
Block a user