showAiFieldBadge function infrastructure

Last updated: 2026-03-04T23:21:38.398Z

Metrics

LOC: 45 Complexity: 1 Params: 1

Signature

showAiFieldBadge(element: HTMLElement): : void

Source Code

function showAiFieldBadge(element: HTMLElement): void {
  // Remove any existing AI badge on this element
  const existingBadge = element.parentElement?.querySelector(
    "[data-fill-all-ai-badge]",
  );
  existingBadge?.remove();

  const badge = document.createElement("span");
  badge.setAttribute("data-fill-all-ai-badge", "1");
  badge.title = "Preenchido por IA (Fill All) — clique para remover";
  badge.style.cssText = `
    display: inline-flex;
    align-items: center;
    gap: 3px;
    position: absolute;
    font-size: 10px;
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 700;
    padding: 2px 6px 2px 5px;
    border-radius: 4px;
    z-index: 2147483646;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 1px 4px rgba(99,102,241,0.45);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    pointer-events: auto;
    line-height: 1.4;
    letter-spacing: 0.1px;
  `;
  badge.innerHTML = `<span style="font-size:11px">✨</span>AI<span style="opacity:0.7;font-size:9px;margin-left:2px">×</span>`;

  function positionBadge(): void {
    const rect = element.getBoundingClientRect();
    badge.style.top = `${rect.top + window.scrollY - 20}px`;
    badge.style.left = `${rect.right + window.scrollX - 42}px`;
  }

  positionBadge();
  badge.style.position = "absolute";
  document.body.appendChild(badge);

  badge.addEventListener("click", () => badge.remove());
}

Members

Name Kind Visibility Status Signature
positionBadge function - positionBadge(): : void

Dependencies (Outgoing)

graph LR showAiFieldBadge["showAiFieldBadge"] positionBadge["positionBadge"] showAiFieldBadge -->|calls| positionBadge style showAiFieldBadge fill:#dbeafe,stroke:#2563eb,stroke-width:2px click showAiFieldBadge "91a8abe473f9bccf.html" click positionBadge "15eeba24240cdb49.html"
TargetType
positionBadge calls
click dynamic_call

Impact (Incoming)

graph LR showAiFieldBadge["showAiFieldBadge"] doFillAllFields["doFillAllFields"] fillContextualAI["fillContextualAI"] doFillAllFields -->|calls| showAiFieldBadge fillContextualAI -->|calls| showAiFieldBadge style showAiFieldBadge fill:#dbeafe,stroke:#2563eb,stroke-width:2px click showAiFieldBadge "91a8abe473f9bccf.html" click doFillAllFields "23fe5c1a0125e335.html" click fillContextualAI "854e1a4562eb49e4.html"
SourceType
doFillAllFields calls
fillContextualAI calls