Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding AI book recommendation generator which would give book recommendations based on the questions asked #4718

Closed
wants to merge 3 commits into from
Closed
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
92 changes: 91 additions & 1 deletion assets/html/book_recommend.html
Original file line number Diff line number Diff line change
Expand Up @@ -931,9 +931,99 @@ <h1 class="trending"><center>Trending Books </center></h1>
</div>
</div>
</div>
<div class="book-generator">
<h2>AI Book Generator</h2>
<p>Get book recommendations based on your interests!</p>

<label for="genre">Preferred Genre:</label>
<select id="genre">
<option value="Science Fiction">Science Fiction</option>
<option value="Fantasy">Fantasy</option>
<option value="Mystery">Mystery</option>
<option value="Romance">Romance</option>
<option value="Non-fiction">Non-fiction</option>
</select>

<label for="author">Favorite Author:</label>
<input type="text" id="author" placeholder="Enter an author name">

<label for="keywords">Keywords (e.g., adventure, love, detective):</label>
<input type="text" id="keywords" placeholder="Enter keywords">

<button onclick="generateRecommendations()">Generate Recommendations</button>

<div class="recommendations" id="recommendations"></div>
</div>

<script>
function generateRecommendations() {
// Retrieve user input
const genre = document.getElementById('genre').value;
const author = document.getElementById('author').value;
const keywords = document.getElementById('keywords').value;

// Clear previous recommendations
const recommendationsDiv = document.getElementById('recommendations');
recommendationsDiv.innerHTML = '';

// Dummy data for recommendations based on user input
const recommendations = [
`${genre} novel by ${author || "a famous author"} with themes of ${keywords || "intrigue and drama"}.`,
`${genre} book featuring ${keywords || "unique themes"} and inspired by ${author || "classic writers"}.`,
`${genre} story exploring ${keywords || "deep emotions"} similar to works by ${author || "renowned authors"}.`
];

// Display recommendations
recommendations.forEach(rec => {
const p = document.createElement('p');
p.textContent = rec;
recommendationsDiv.appendChild(p);
});
}
</script>
<style>
.book-generator {
font-family: Arial, sans-serif;
background-color: #f7f7f7;
padding: 2rem;
border-radius: 8px;
max-width: 600px;
margin: 2rem auto;
text-align: center;
color: #333;
}
.book-generator h2 {
color: #444;
}
.book-generator label {
display: block;
margin-top: 1rem;
font-weight: bold;
}
.book-generator input,
.book-generator select,
.book-generator button {
width: 100%;
padding: 0.5rem;
margin-top: 0.5rem;
border-radius: 4px;
border: 1px solid #ccc;
}
.recommendations {
margin-top: 1.5rem;
text-align: left;
}
.recommendations p {
background-color: #e0e0e0;
padding: 0.75rem;
border-radius: 4px;
margin: 0.5rem 0;
}
</style>





<script>
const coords = { x: 0, y: 0 };
const circles = document.querySelectorAll(".circle");
Expand Down
163 changes: 44 additions & 119 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6847,126 +6847,51 @@ <h4>What if I receive a damaged book?</h4>

<script type="text/javascript" src="https://translate.google.com/translate_a/element.js?
cb=googleTranslateElementInit">
</script>
<div class="SwapReads" style="margin-right: 120px;"><a href="#" class="logo">SwapReads</a></div>
<div>
<p style="text-align: justify;" class="description">SwapReads.com is the ultimate destination for book
lovers seeking to swap and discover new literary gems. Connect with fellow enthusiasts, exchange your
favorite reads, and embark on exciting new adventures in the
world of literature—all on one convenient platform. Join us and dive into a universe of endless
possibilities!
</p>
<div class="foot-middle">
<h2 style="margin-left: 0rem; margin-top: 0rem;">Quick Links</h2>

<div id="quicklinks">
<a href="#home" onclick="lenis.scrollTo('#home')">
<div class="quicklink-item">
<i class="fas fa-home"></i>
<h4 class="flinks">Home</h4>
</div>
</a>
<a href="#benefits" onclick="lenis.scrollTo('#benefits')">
<div class="quicklink-item">
<i class="fas fa-book"></i>
<h4 class="flinks">Benefits</h4>
</div>
</a>
<a href="#pricing" onclick="lenis.scrollTo('#pricing')">
<div class="quicklink-item">
<i class="fas fa-dollar-sign"></i>
<h4 class="flinks">Pricing</h4>
</div>
</a>
<a href="#contact" onclick="lenis.scrollTo('#contact')">
<div class="quicklink-item">
<i class="fas fa-envelope"></i>
<h4 class="flinks">Contact</h4>
</div>
</a>
<a href="#chapters" onclick="lenis.scrollTo('#chapters')">
<div class="quicklink-item">
<i class="fas fa-globe"></i>
<h4 class="flinks">Literary</h4>
</div>
</a>
<a href="#faqq" onclick="lenis.scrollTo('#faqq')">
<div class="quicklink-item">
<i class="fas fa-question-circle"></i>
<h4 class="flinks">FAQ</h4>
</div>
</a>
<a href="./assets/html/booklistswap.html" onclick="lenis.scrollTo('#contact')">
<div class="quicklink-item">
<i class="fas fa-exchange-alt"></i>
<h4 class="flinks">Swap</h4>
</div>
</a>
<a href="./assets/html/freeBooks.html" onclick="lenis.scrollTo('#contact')">
<div class="quicklink-item">
<i class="fas fa-file-pdf"></i>
<h4 class="flinks">E-Book</h4>
</div>
</a>
<a href="./assets/html/about.html" onclick="lenis.scrollTo('#contact')">
<div class="quicklink-item">
<i class="fas fa-info-circle"></i>
<h4 class="flinks">About</h4>
</div>
</a>
<a href="./assets/html/book_recommend.html" onclick="lenis.scrollTo('#contact')">
<div class="quicklink-item">
<i class="fas fa-bookmark"></i>
<h4 class="flinks">Recommend</h4>
</div>
</a>
<a href="/sitemap.html" onclick="lenis.scrollTo('#contact')">
<div class="quicklink-item">
<i class="fa-solid fa-sitemap"></i>
<h4 class="flinks">Site Map</h4>
</div>
</a>
<a href="./terms&cond.html">
<div class="quicklink-item">
<i class="fas fa-file-alt"></i>
<h4 class="flinks">T & C</h4>
</div>
</a>
<a href="/chatt.html">
<div class="quicklink-item">
<i class="fa-solid fa-message"></i>
<h4 class="flinks">Community Chat</h4>
</div>
</a>
<a href="assets/html/read_later.html">
<div class="quicklink-item">
<i class="fa-solid fa-book-open-reader"></i>
<h4 class="flinks">Read Later</h4>
</div>
</a>
<a href="assets/html/ConnReader.html">
<div class="quicklink-item">
<i class="fa-solid fa-users"></i>
<h4 class="flinks">Reader Connection</h4>
</div>
</a>
<a href="assets/html/blog.html">
<div class="quicklink-item">
<i class="fas fa-book"></i>
<h4 class="flinks">Blogs</h4>
</div>
</a>
<a href="assets/html/bookpref.html">
<div class="quicklink-item">
<i class="fas fa-book"></i>
<h4 class="flinks">Book Quiz</h4>
</div>
</a>
</div>

</div>
</div>

</script>
<div class="SwapReads" style="margin-right: 120px;"><a href="#" class="logo">SwapReads</a></div>
<div>
<p style="text-align: justify;" class="description">SwapReads.com is the ultimate destination for book lovers seeking to swap and discover new literary gems. Connect with fellow enthusiasts, exchange your favorite reads, and embark on exciting new adventures in the
world of literature—all on one convenient platform. Join us and dive into a universe of endless
possibilities!
</p>
<div class="foot-middle">
<h2 style="margin-left: 0rem; margin-top: 0rem;">Quick Links</h2>
<div id="quicklinks" class="row">
<div class="col-md-2">
<ul>
<li class="foot-quick"><a href="#home" onclick="lenis.scrollTo('#home')"><i class="fas fa-home"></i><h4 class="flinks">Home</h4></a></li>
<li class="foot-quick"><a href="#benefits" onclick="lenis.scrollTo('#benefits')"><i class="fas fa-book"></i> <h4 class="flinks">Benefits</h4></a></li>
</ul>
</div>
<div class="col-md-2">
<ul>
<li class="foot-quick"><a href="#pricing" onclick="lenis.scrollTo('#pricing')"><i class="fas fa-dollar-sign"></i><h4 class="flinks">Pricing</h4> </a></li>
<li class="foot-quick"><a href="#contact" onclick="lenis.scrollTo('#contact')"><i class="fas fa-envelope"></i><h4 class="flinks">Contact</h4> </a></li>
</ul>
</div>
<div class="col-md-2">
<ul>
<li class="foot-quick"><a href="#chapters" onclick="lenis.scrollTo('#chapters')"><i class="fas fa-globe"></i> <h4 class="flinks">Literary</h4></a></li>
<li class="foot-quick"><a href="#faqq" onclick="lenis.scrollTo('#faqq')"><i class="fas fa-question-circle"></i> <h4 class="flinks">FAQ</h4></a></li>
</ul>
</div>
<div class="col-md-2">
<ul>
<li class="foot-quick"><a href="./assets/html/booklistswap.html" onclick="lenis.scrollTo('#contact')"><i class="fas fa-exchange-alt"></i><h4 class="flinks">Swap</h4> </a></li>
<li class="foot-quick"><a href="./assets/html/freeBooks.html" onclick="lenis.scrollTo('#contact')"><i class="fas fa-file-pdf"></i> <h4 class="flinks">E-Book</h4></a></li>
</ul>
</div>
<div class="col-md-2">
<ul>
<li class="foot-quick"><a href="./assets/html/about.html" onclick="lenis.scrollTo('#contact')"><i class="fas fa-info-circle"></i> <h4 class="flinks">About</h4></a></li>
<li class="foot-quick"><a href="./assets/html/book_recommend.html" onclick="lenis.scrollTo('#contact')"><i class="fas fa-bookmark"></i><h4 class="flinks">Recommend</h4></a></li>
</ul>
</div>
<div>
<ul>
<li class="foot-quick"><a href="/terms&cond.html"> <i class="fas fa-file-alt"></i><h4 class="flinks">Terms and<br>Conditions</h4></a></li>
</ul>
</div>
</div>
<style>
Expand Down
Loading