MCPcopy Create free account
hub / github.com/SKVNDR/FastDork / highlightInvalidTab1Inputs

Function highlightInvalidTab1Inputs

Script/FastDork.js:1093–1135  ·  view source on GitHub ↗
(elements = null)

Source from the content-addressed store, hash-verified

1091 }
1092
1093 function highlightInvalidTab1Inputs(elements = null) {
1094 const elementsToCheck = Array.isArray(elements)
1095 ? elements
1096 : elements
1097 ? [elements]
1098 : [UI.targetTab1, UI.listTab1, UI.searchengineSelect];
1099 hideErrorTab1(elementsToCheck);
1100 elementsToCheck.forEach((el) => {
1101 if (el) {
1102 let isProblematic = false;
1103 if (el === UI.targetTab1 && !el.value.trim()) isProblematic = true;
1104 else if (
1105 (el === UI.listTab1 || el === UI.searchengineSelect) &&
1106 el.value === "0"
1107 )
1108 isProblematic = true;
1109 else if (
1110 el === UI.targetTab1 &&
1111 UI.selectModTab1?.value === "1" &&
1112 !el.value.includes("$target") &&
1113 !el.value.includes("$t")
1114 )
1115 isProblematic = true;
1116 else if (
1117 el === UI.listTab1 &&
1118 parseInt(UI.nbrCounter?.textContent || "0") <= 0
1119 )
1120 isProblematic = true;
1121 else if (
1122 el === UI.listTab1 &&
1123 parseInt(UI.nbrCounter?.textContent || "0") > CONSTANTS.TAB_LIMIT
1124 )
1125 isProblematic = true;
1126 if (isProblematic) {
1127 setFieldError(el, true);
1128 const clearBorder = () => hideErrorTab1(el);
1129 el.addEventListener("input", clearBorder, { once: true });
1130 el.addEventListener("change", clearBorder, { once: true });
1131 el.addEventListener("focus", clearBorder, { once: true });
1132 }
1133 }
1134 });
1135 }
1136 function hideErrorTab1(element = null) {
1137 const elementsToReset = element
1138 ? Array.isArray(element)

Callers 3

handleGoButtonClickFunction · 0.85
handleProceedDorkOptionsFunction · 0.85
areTab1InputsValidFunction · 0.85

Calls 2

hideErrorTab1Function · 0.85
setFieldErrorFunction · 0.85

Tested by

no test coverage detected