From a985b2769f6c3dc907b57841134a293842c06fa6 Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 12 Dec 2021 15:17:06 +0100 Subject: Add answers --- assets/instant.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'assets') diff --git a/assets/instant.js b/assets/instant.js index 439daab..bc643ab 100644 --- a/assets/instant.js +++ b/assets/instant.js @@ -8,9 +8,25 @@ )); document.getElementById("details").innerHTML = "from DuckDuckGo:

" + instant.Abstract + "

" + instant.AbstractSource + "

"; - if (instant.Abstract.trim() !== "") document.getElementById("details").style.display = "block"; - if (instant.Abstract.trim() !== "") document.getElementById("results").classList.add("with-details"); - if (instant.Abstract.trim() !== "") try {document.getElementsByClassName("dym-section")[0].outerHTML = ""; } catch (e) {} + + if (instant.Abstract.trim() !== "") { + document.getElementById("details").style.display = "block"; + document.getElementById("results").classList.add("with-details"); + try {document.getElementsByClassName("dym-section")[0].outerHTML = ""; } catch (e) {} + } else { + answer = (await ( + await ( + await window.fetch("/ratelimited/answer.php?q=" + query) + ).blob() + ).text() + ) + if (answer.trim() !== "Wolfram|Alpha did not understand your input" && answer.trim() !== "No short answer available") { + document.getElementById("details").innerHTML = "from Wolfram|Alpha:

" + answer + "

DisclaimerThis information is provided by Wolfram|Alpha. Results and information from this site are not a certified or definitive source of information that can be relied on for legal, financial, medical, life-safety or any other critical purposes.

"; + document.getElementById("details").style.display = "block"; + document.getElementById("results").classList.add("with-details"); + try {document.getElementsByClassName("dym-section")[0].outerHTML = ""; } catch (e) {} + } + } if (!instant._WolfEye_External) { try { document.getElementById("details-source").innerHTML = " " } catch (e) {} -- cgit