aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/instant.js115
-rw-r--r--assets/loader.svg52
-rw-r--r--assets/main.css17
-rw-r--r--assets/search-v2.svg42
-rw-r--r--ratelimited/answer.php2
-rw-r--r--search/index.php6
6 files changed, 141 insertions, 93 deletions
diff --git a/assets/instant.js b/assets/instant.js
index bc643ab..3dbc0ac 100644
--- a/assets/instant.js
+++ b/assets/instant.js
@@ -1,66 +1,85 @@
(async () => {
- instant = JSON.parse(
- (await (
- await (
- await window.fetch("/ratelimited/instant.php?q=" + query)
- ).blob()
- ).text()
- ));
+ try {
+ instant = JSON.parse(
+ (await (
+ await (
+ await window.fetch("/ratelimited/instant.php?q=" + query)
+ ).blob()
+ ).text()
+ ));
- document.getElementById("details").innerHTML = "<small id='details-source'>from <a id='details-source-link' href='https://duckduckgo.com' target='_blank'>DuckDuckGo</a>:</small><p>" + instant.Abstract + "</p><p><i>— <a href='" + instant.AbstractURL + "' id='details-data-link' target='_blank'>" + instant.AbstractSource + "</a></i></p>";
+ 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) {}
- 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 (
+ document.getElementById("details-inner").innerHTML = "<small id='details-source'>from <a id='details-source-link' href='https://duckduckgo.com' target='_blank'>DuckDuckGo</a>:</small><p>" + instant.Abstract + "</p><p><i>— <a href='" + instant.AbstractURL + "' id='details-data-link' target='_blank'>" + instant.AbstractSource + "</a></i></p>";
+ } 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 = "<small id='details-source'>from <a id='details-source-link' href='https://www.wolframalpha.com/input/?i=" + encodeURI(query) + "' target='_blank'>Wolfram|Alpha</a>:</small><p>" + answer + "</p><p><details><summary style='cursor:pointer;'>Disclaimer</summary>This 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.</details></p>";
- document.getElementById("details").style.display = "block";
- document.getElementById("results").classList.add("with-details");
- try {document.getElementsByClassName("dym-section")[0].outerHTML = ""; } catch (e) {}
+ if (answer.trim() !== "Wolfram|Alpha did not understand your input" && answer.trim() !== "No short answer available" && answer.trim() !== "") {
+ document.getElementById("details-inner").innerHTML = "<small id='details-source'>from <a id='details-source-link' href='https://www.wolframalpha.com/input/?i=" + encodeURI(query) + "' target='_blank'>Wolfram|Alpha</a>:</small><p>" + answer + "</p><p><details><summary style='cursor:pointer;'>Disclaimer</summary>This 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.</details></p>";
+ document.getElementById("details").style.display = "block";
+ document.getElementById("results").classList.add("with-details");
+ try {document.getElementsByClassName("dym-section")[0].outerHTML = ""; } catch (e) {}
+ } else {
+ document.getElementById("details").style.display = "none";
+ }
}
- }
- if (!instant._WolfEye_External) {
- try { document.getElementById("details-source").innerHTML = "&nbsp;" } catch (e) {}
- try { document.getElementById("details-data-link").target = "" } catch (e) {}
- }
+ if (!instant._WolfEye_External) {
+ try { document.getElementById("details-source").innerHTML = "&nbsp;" } catch (e) {}
+ try { document.getElementById("details-data-link").target = "" } catch (e) {}
+ }
+
+ if (instant.Results[0]) {
+ if (!document.getElementsByClassName("result-official")[0]) {
+ document.getElementById("results").innerHTML = '<div class="result result-official"><a href="https://example.com"><div class="result-name" style="font-size: 18px;"><img alt="" class="result-icon" src="about:blank"> <b>Example</b> <img class="result-relevant" src="/assets/relevant.svg" alt=""></div><div class="result-url"><small>https://example.com/</small></div></a></div>' + document.getElementById("results").innerHTML;
+ }
- if (instant.Results[0]) {
- if (!document.getElementsByClassName("result-official")[0]) {
- document.getElementById("results").innerHTML = '<div class="result result-official"><a href="https://example.com"><div class="result-name" style="font-size: 18px;"><img alt="" class="result-icon" src="about:blank"> <b>Example</b> <img class="result-relevant" src="/assets/relevant.svg" alt=""></div><div class="result-url"><small>https://example.com/</small></div></a></div>' + document.getElementById("results").innerHTML;
+ document.getElementsByClassName("result-official")[0].classList.add("result-verified");
+ document.getElementsByClassName("result-official")[0].children[0].href = instant.Results[0].FirstURL;
+ document.getElementsByClassName("result-official")[0].children[0].children[0].children[2].src = "/assets/verified.svg";
+ document.getElementsByClassName("result-official")[0].children[0].children[0].children[2].title = "Verified Website";
+ document.getElementsByClassName("result-official")[0].children[0].children[0].children[0].src = "https://duckduckgo.com" + instant.Results[0].Icon.URL;
+ document.getElementsByClassName("result-official")[0].children[0].children[0].children[1].innerText = instant.Heading;
+ document.getElementsByClassName("result-official")[0].children[0].children[1].children[0].innerText = instant.Results[0].FirstURL;
}
- document.getElementsByClassName("result-official")[0].classList.add("result-verified");
- document.getElementsByClassName("result-official")[0].children[0].href = instant.Results[0].FirstURL;
- document.getElementsByClassName("result-official")[0].children[0].children[0].children[2].src = "/assets/verified.svg";
- document.getElementsByClassName("result-official")[0].children[0].children[0].children[2].title = "Verified Website";
- document.getElementsByClassName("result-official")[0].children[0].children[0].children[0].src = "https://duckduckgo.com" + instant.Results[0].Icon.URL;
- document.getElementsByClassName("result-official")[0].children[0].children[0].children[1].innerText = instant.Heading;
- document.getElementsByClassName("result-official")[0].children[0].children[1].children[0].innerText = instant.Results[0].FirstURL;
- }
+ if (query === "wolfeye" || query === "wolf eye") {
+ document.getElementById("details-inner").innerHTML = "<h3>Hold tight! Let's go home...</h3><p>You are already using WolfEye; but you seem lost. Use the search bar at the top of this page to search for something on the Web.</p>"
+ document.getElementById("details-inner").style.display = "block";
- if (query === "wolfeye" || query === "wolf eye") {
- document.getElementById("details").innerHTML = "<h3>Hold tight! Let's go home...</h3><p>You are already using WolfEye; but you seem lost. Use the search bar at the top of this page to search for something on the Web.</p>"
- document.getElementById("details").style.display = "block";
+ if (!document.getElementsByClassName("result-official")[0]) {
+ document.getElementById("results").innerHTML = '<div class="result result-official"><a href="https://example.com"><div class="result-name" style="font-size: 18px;"><img alt="" class="result-icon" src="about:blank"> <b>Example</b> <img class="result-relevant" src="/assets/relevant.svg" alt=""></div><div class="result-url"><small>https://example.com/</small></div></a></div>' + document.getElementById("results").innerHTML;
+ }
- if (!document.getElementsByClassName("result-official")[0]) {
- document.getElementById("results").innerHTML = '<div class="result result-official"><a href="https://example.com"><div class="result-name" style="font-size: 18px;"><img alt="" class="result-icon" src="about:blank"> <b>Example</b> <img class="result-relevant" src="/assets/relevant.svg" alt=""></div><div class="result-url"><small>https://example.com/</small></div></a></div>' + document.getElementById("results").innerHTML;
+ document.getElementsByClassName("result-official")[0].classList.add("result-verified");
+ document.getElementsByClassName("result-official")[0].children[0].href = "https://wolfeye.minteck.org";
+ document.getElementsByClassName("result-official")[0].children[0].children[0].children[2].src = "/assets/verified.svg";
+ document.getElementsByClassName("result-official")[0].children[0].children[0].children[2].title = "Verified Website";
+ document.getElementsByClassName("result-official")[0].children[0].children[0].children[0].src = "/logo.svg";
+ document.getElementsByClassName("result-official")[0].children[0].children[0].children[1].innerText = "WolfEye";
+ document.getElementsByClassName("result-official")[0].children[0].children[1].children[0].innerText = "https://wolfeye.minteck.org";
+ }
+ } catch (e) {
+ 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" && answer.trim() !== "") {
+ document.getElementById("details-inner").innerHTML = "<small id='details-source'>from <a id='details-source-link' href='https://www.wolframalpha.com/input/?i=" + encodeURI(query) + "' target='_blank'>Wolfram|Alpha</a>:</small><p>" + answer + "</p><p><details><summary style='cursor:pointer;'>Disclaimer</summary>This 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.</details></p>";
+ document.getElementById("details").style.display = "block";
+ document.getElementById("results").classList.add("with-details");
+ try {document.getElementsByClassName("dym-section")[0].outerHTML = ""; } catch (e) {}
+ } else {
+ document.getElementById("details").style.display = "none";
}
-
- document.getElementsByClassName("result-official")[0].classList.add("result-verified");
- document.getElementsByClassName("result-official")[0].children[0].href = "https://wolfeye.minteck.org";
- document.getElementsByClassName("result-official")[0].children[0].children[0].children[2].src = "/assets/verified.svg";
- document.getElementsByClassName("result-official")[0].children[0].children[0].children[2].title = "Verified Website";
- document.getElementsByClassName("result-official")[0].children[0].children[0].children[0].src = "/logo.svg";
- document.getElementsByClassName("result-official")[0].children[0].children[0].children[1].innerText = "WolfEye";
- document.getElementsByClassName("result-official")[0].children[0].children[1].children[0].innerText = "https://wolfeye.minteck.org";
}
})() \ No newline at end of file
diff --git a/assets/loader.svg b/assets/loader.svg
new file mode 100644
index 0000000..4063eb1
--- /dev/null
+++ b/assets/loader.svg
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; display: block; shape-rendering: auto;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
+<g transform="rotate(0 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.9166666666666666s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(30 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.8333333333333334s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(60 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.75s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(90 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.6666666666666666s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(120 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5833333333333334s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(150 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(180 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.4166666666666667s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(210 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.3333333333333333s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(240 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.25s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(270 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.16666666666666666s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(300 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.08333333333333333s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(330 50 50)">
+ <rect x="48.5" y="24" rx="0" ry="0" width="3" height="12" fill="#eeeeee">
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite"></animate>
+ </rect>
+</g>
+<!-- [ldio] generated by https://loading.io/ --></svg> \ No newline at end of file
diff --git a/assets/main.css b/assets/main.css
index a89ea8e..76ee40f 100644
--- a/assets/main.css
+++ b/assets/main.css
@@ -152,7 +152,6 @@ body, html {
#details {
padding-top: 10px !important;
padding-bottom: 10px !important;
- display: none;
}
#results-intro-bar-submit {
@@ -283,4 +282,20 @@ div.searchbtn input {
.home-btn:active {
border-color: #777;
background: #353535;
+}
+
+#details-inner {
+ padding: 10px 20px;
+ background: #151515;
+ border-radius: 5px;
+}
+
+#details-loader {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+#details-loader img {
+ width: 64px;
} \ No newline at end of file
diff --git a/assets/search-v2.svg b/assets/search-v2.svg
deleted file mode 100644
index 8e1d231..0000000
--- a/assets/search-v2.svg
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- viewBox="0 0 487.95 487.95" style="enable-background:new 0 0 487.95 487.95;" xml:space="preserve">
-<g>
- <g>
- <path d="M481.8,453l-140-140.1c27.6-33.1,44.2-75.4,44.2-121.6C386,85.9,299.5,0.2,193.1,0.2S0,86,0,191.4s86.5,191.1,192.9,191.1
- c45.2,0,86.8-15.5,119.8-41.4l140.5,140.5c8.2,8.2,20.4,8.2,28.6,0C490,473.4,490,461.2,481.8,453z M41,191.4
- c0-82.8,68.2-150.1,151.9-150.1s151.9,67.3,151.9,150.1s-68.2,150.1-151.9,150.1S41,274.1,41,191.4z"/>
- </g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-<g>
-</g>
-</svg>
diff --git a/ratelimited/answer.php b/ratelimited/answer.php
index 8bc9707..d44b978 100644
--- a/ratelimited/answer.php
+++ b/ratelimited/answer.php
@@ -88,7 +88,7 @@ if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/private/answers/" . str_replace("
} else {
$ds = "online";
$ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://api.wolframalpha.com/v1/result?appid=" . urlencode(trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/private/keys/wolfram"))) . "&i=" . urlencode($query));
+ curl_setopt($ch, CURLOPT_URL, "https://api.wolframalpha.com/v1/result?appid=" . urlencode(trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/private/keys/wolfram"))) . "&i=" . urlencode($query) . "&units=metric&timeout=10");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$data = curl_exec($ch);
curl_close($ch);
diff --git a/search/index.php b/search/index.php
index 709a239..f2da683 100644
--- a/search/index.php
+++ b/search/index.php
@@ -218,7 +218,11 @@ $elapsed_io = microtime(true) - $start_io;
?>
<p id="results-debug"><small id="results-debug-inner"><?= count($entriesdom) ?> results</small></p>
- <div id="details"></div>
+ <div id="details">
+ <div id="details-inner">
+ <div id="details-loader"><img alt="Loading..." src="/assets/loader.svg"></div>
+ </div>
+ </div>
<script>query = "<?= $query ?>";</script>
<script src="/assets/instant.js"></script>