Could not reach the server. Please check your connection.
" + dpSimilarCta(output, -1); }) .then(function(){ submit.disabled = false; output.removeAttribute("aria-busy"); }); } function dpAskGrokSend(block) { var input = block.querySelector(".dp-ask-grok-input"); var result = block.querySelector(".dp-ask-grok-result"); var send = block.querySelector(".dp-ask-grok-send"); var form = block.querySelector(".dp-ask-grok-form"); var button = block.querySelector(".dp-ask-grok-button"); var intro = block.querySelector(".dp-ask-grok-intro"); var question = (input.value || "").trim(); if (question.length Please ask a question of at least 10 characters."; return; } if (question.length > 500) { result.innerHTML = "
Question is too long. Please keep it under 500 characters.
Session expired. Please refresh the page and try again.
"; return; } if (resp.status === 200 && resp.data && resp.data.success) { var safeAnswer = dpSimilarEscape(resp.data.answer || ""); var safeDisclaimer = dpSimilarEscape(resp.data.disclaimer || ""); var answerHtml = "
"; answerHtml += "
" + safeAnswer + "
"; answerHtml += "
\u26a0\ufe0f " + safeDisclaimer + "
"; answerHtml += "
"; result.innerHTML = answerHtml; if (form) form.style.display = "none"; if (intro) intro.style.display = ""; if (button) { button.style.display = ""; button.disabled = true; button.setAttribute("title", "Daily limit reached. Try again tomorrow."); button.textContent = "Daily limit reached"; } return; } if (resp.status === 200 && resp.data && !resp.data.success) { var msg = dpSimilarEscape(resp.data.message || "Could not process your question right now."); result.innerHTML = "
" + msg + "
"; return; } result.innerHTML = "
Could not process your question right now. Please try again later.
"; }) .catch(function(){ result.innerHTML = "
Could not reach the server. Please check your connection and try again.
"; }) .then(function(){ if (send) send.disabled = false; result.removeAttribute("aria-busy"); }); } function dpSimilarRender(output, keyword, data) { var html = ""; if (data.count === 0) { html += "
No matches found for “" + dpSimilarEscape(keyword) + "”.
"; html += "" + r.title + ""; html += "" + r.date + ""; html += "
"; }); html += "
"; } html += dpSimilarCta(output, data.count); output.innerHTML = html; } function dpSimilarCta(output, count) { var block = output.closest(".dp-similar-block"); var contactUrl = block ? block.dataset.contactUrl : ""; if (!contactUrl) { return ""; } var ctaText; if (count === -1) { ctaText = "While you wait, here are some other ways to get help:"; } else if (count === 0) { ctaText = "Couldn\u2019t find what you needed? Speak with a professional for personalized help."; } else { ctaText = "Need more help with this topic? Speak with a professional."; } var html = "
"; html += "
" + ctaText + "
"; html += "Talk to a Professional"; html += "
"; var isFullApi = block && block.dataset.isFullApi === "1"; html += "
Or ask our AI assistant a quick question about this topic.
"; html += ""; html += "
"; html += ""; html += ""; html += ""; html += ""; html += "
"; html += ""; html += "
"; html += "
"; return html; } function dpSimilarEscape(s) { var div = document.createElement("div"); div.textContent = s; return div.innerHTML; }})();