Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions SynonymsGenerator/Vidhanvyrs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Synonyms Generator</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1 class="heading">Synonyms Generator</h1>
<input
class="inputword"
type="text"
id="wordInput"
placeholder="Enter a word"
/>
<button class="btn" onclick="getSynonyms()">Generate Synonyms</button>
<p class="para">Synonyms: <span id="synonyms"></span></p>
<p id="loading" class="loading-message"></p>
<script>
function getSynonyms() {
const uid = "12119";
const tokenid = "XHHMiMr0MLSf4Co6";
const wordInput = document.getElementById("wordInput").value;
const synonymsElement = document.getElementById("synonyms");
const loadingMessage = document.getElementById("loading");
loadingMessage.textContent = "Loading...";
loadingMessage.style.display = "block";
fetch(
`https://www.stands4.com/services/v2/syno.php?uid=${uid}&tokenid=${tokenid}&word=${wordInput}&format=json`,
{
method: "GET",
}
)
.then((response) => response.json())
.then((data) => {
const results = data.result;
if (results.length > 0) {
const result = results[0];
const synonyms = result.synonyms.split(", ");
if (synonyms.length > 0) {
synonymsElement.textContent = synonyms.join(", ");
} else {
synonymsElement.textContent = "No synonyms found.";
}
} else {
synonymsElement.textContent = "No results found.";
}
loadingMessage.style.display = "none";
})
.catch((error) => {
console.error("Error:", error);
synonymsElement.textContent = "An error occurred: " + error.message;
loadingMessage.style.display = "none";
});
}
</script>
</body>
</html>
56 changes: 56 additions & 0 deletions SynonymsGenerator/Vidhanvyrs/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}

.heading {
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
color: #333;
}

.inputword {
padding: 10px;
width: 30%;
border: 1px solid #ccc;
border-radius: 5px;
margin-bottom: 10px;
font-family: Arial, sans-serif;
}

.btn {
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}

.btn:hover {
background-color: #0056b3;
}

.para {
font-size: 18px;
margin-top: 10px;
color: #555;
}

#synonyms {
font-weight: bold;
color: #333;
}
.loading-message {
display: none;
margin-top: 10px;
color: #555;
}