You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
4.7 KiB
HTML

5 months ago
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Search engine that crawls IPv4 addresses, written in Golang.">
<meta name="keywords"
content="Go search engine, Golang web crawler, search indexing, information retrieval, scalable search engine, concurrent indexing">
<meta property="og:title" content="Googet - Search engine">
<meta property="og:description" content="Search engine that crawls IPv4 addresses, written in Golang.">
<meta property="og:url" content="https://googet.nazev.eu">
<meta property="og:image" content="https://googet.nazev.eu/googeticon.png">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Googet">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@googet">
<meta name="twitter:title" content="Googet">
<meta name="twitter:description" content="Search engine that crawls IPv4 addresses, written in Golang.">
<meta name="twitter:image" content="https://googet.nazev.eu/googeticon.png">
<title>Googet - Search Engine</title>
<link rel="icon" type="image/png" href="https://googet.nazev.eu/googeticon.png">
<!-- <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap"> -->
<link rel="stylesheet" href="pico.css">
</head>
<body>
<div class="topbar">
<img src="goget_logo.png" class="logo" alt="Googet Logo">
<input class="searchbar" type="text" id="keywords" name="keywords" placeholder="" list="keywordList">
</div>
<div id="results">
<!-- Results will be displayed here -->
</div>
<script>
document.getElementById('searchForm').addEventListener('submit', function (event) {
event.preventDefault();
const keywords = document.getElementById('keywords').value.trim().split(',');
fetch('https://api.nazev.eu/search', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ keywords: keywords })
})
.then(response => response.json())
.then(data => {
const resultsDiv = document.getElementById('results');
resultsDiv.innerHTML = ''; // Clear previous results
data.forEach(item => {
const url = item.url;
const keywords = item.keywords;
const resultItem = document.createElement('div');
resultItem.innerHTML = `<p><strong>URL:</strong> <a href=${url}>${url}</a></p><p><strong>Keywords:</strong> ${keywords}</p>`;
resultsDiv.appendChild(resultItem);
});
})
.catch(error => console.error('Error fetching search results:', error));
});
document.getElementById('random').addEventListener('submit', function (event) {
event.preventDefault();
const keywords = document.getElementById('keywords').value.trim().split(',');
const startTime = Date.now(); // Start the timer
fetch('https://api.nazev.eu/random', {
method: 'GET',
})
.then(response => response.json())
.then(data => {
const endTime = Date.now(); // End the timer
const timeTaken = endTime - startTime; // Calculate the time taken
console.log(timeTaken)
document.getElementById("timetaken").innerHTML = "Time taken: " + stringify(timeTaken)
const resultsDiv = document.getElementById('results');
resultsDiv.innerHTML = ''; // Clear previous results
const timeTakenDiv = document.createElement('div');
timeTakenDiv.innerHTML = `<p><strong>Time taken:</strong> ${timeTaken} ms</p>`;
resultsDiv.appendChild(timeTakenDiv); // Display the time taken
data.forEach(item => {
const url = item.url;
const keywords = item.keywords;
const resultItem = document.createElement('div');
resultItem.innerHTML = `<p><strong>URL:</strong> <a href=${url}>${url}</a></p><p><strong>Keywords:</strong> ${keywords}</p>`;
resultsDiv.appendChild(resultItem);
});
})
.catch(error => console.error('Error fetching search results:', error));
});
</script>
</body>
</html>