From b2291ac9dc24756646031e3ff19c04f66e27c322 Mon Sep 17 00:00:00 2001
From: Aryan Ramesh Jain <138214350+jainaryan04@users.noreply.github.com>
Date: Sun, 10 Nov 2024 18:40:48 +0530
Subject: [PATCH] Feat: random book recommendation #4993
---
book.js | 39 +++++++++++++++++++
bookrec.html | 26 +++++++++++++
index.html | 3 ++
styles.css | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 174 insertions(+)
create mode 100644 book.js
create mode 100644 bookrec.html
create mode 100644 styles.css
diff --git a/book.js b/book.js
new file mode 100644
index 00000000..8e3b0dcd
--- /dev/null
+++ b/book.js
@@ -0,0 +1,39 @@
+const books = [
+ {
+ title: "To Kill a Mockingbird",
+ author: "Harper Lee",
+ genre: "Fiction",
+ description: "A novel about racial injustice in the Deep South."
+ },
+ {
+ title: "1984",
+ author: "George Orwell",
+ genre: "Dystopian",
+ description: "A totalitarian regime uses surveillance to control its citizens."
+ },
+ {
+ title: "The Great Gatsby",
+ author: "F. Scott Fitzgerald",
+ genre: "Classic",
+ description: "A story of love, wealth, and social change in the 1920s."
+ },
+ {
+ title: "The Catcher in the Rye",
+ author: "J.D. Salinger",
+ genre: "Fiction",
+ description: "A young man struggles with the pressures of adulthood."
+ }
+ ];
+
+ document.getElementById("recommend-btn").addEventListener("click", function() {
+ const randomIndex = Math.floor(Math.random() * books.length);
+ const book = books[randomIndex];
+
+ document.getElementById("book-title").textContent = book.title;
+ document.getElementById("book-author").textContent = `Author: ${book.author}`;
+ document.getElementById("book-genre").textContent = `Genre: ${book.genre}`;
+ document.getElementById("book-description").textContent = book.description;
+
+ document.getElementById("book-info").style.display = "block";
+ });
+
\ No newline at end of file
diff --git a/bookrec.html b/bookrec.html
new file mode 100644
index 00000000..b63b2d04
--- /dev/null
+++ b/bookrec.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+ Book Recommendations
+
+
+
+
+
+
+
+
+
+
+
Title
+
Author
+
Genre
+
Description
+
+
+
+
+
+
diff --git a/index.html b/index.html
index 15f65e8a..9c5cfc9a 100644
--- a/index.html
+++ b/index.html
@@ -4200,6 +4200,9 @@
+