HashCraft / templates /index.html
Atharva
update: minor UI update
79524cf
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>HashCraft</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap"
rel="stylesheet"
/>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN"
crossorigin="anonymous"
/>
<style>
.custom-font {
font-family: "Pacifico", cursive;
font-weight: 400;
font-style: normal;
}
</style>
</head>
<body>
<div class="container my-3">
<h1 class="custom-font text-center display-1 mt-5 mb-1">HashCraft</h1>
<p class="custom-font text-center mb-5">Powered by Hashnode</p>
<form method="post" action="/">
<div class="mb-3">
<label for="blog_link" class="form-label fw-bold mt-3"
>Enter Hashnode Blog Link</label
>
<input
type="text"
class="form-control"
name="blog_link"
id="blog_link"
required
/>
</div>
<div class="row">
<div class="col-6">
<button type="submit" class="btn btn-dark btn-block mb-3">
Load Blog
</button>
</div>
</div>
</form>
{% if title %}
<h2>{{ title }}</h2>
<p class="fw-bold">Author : {{ author_name }}</p>
<div class="d-flex flex-row mb-3">
<div class="p2 my-3 mb-3">
<form method="post" id="pdfform" action="/convert_pdf">
<input type="hidden" name="host" value="{{ host }}" />
<input type="hidden" name="slug" value="{{ slug }}" />
<button type="submit" class="btn btn-dark mb-3" id="pdfformBtn">
Download PDF
</button>
</form>
</div>
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="liveToast1" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<strong class="me-auto">Generating File</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body">
PDF File is getting Generated...
</div>
</div>
</div>
<div class="p2 mx-3 my-3 mb-3">
<form method="post" action="/convert_epub">
<input type="hidden" name="host" value="{{ host }}" />
<input type="hidden" name="slug" value="{{ slug }}" />
<button type="submit" class="btn btn-dark mb-3" id="ebookformBtn">
Download Ebook
</button>
</form>
</div>
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="liveToast2" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<strong class="me-auto">Generating File</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body">
Ebook is getting Generated...
</div>
</div>
</div>
</div>
<div class="accordion" id="contentAccordion">
<div class="accordion-item">
<h2 class="accordion-header">
<button
class="accordion-button"
type="button"
data-bs-toggle="collapse"
data-bs-target="#contentCollapse"
aria-expanded="true"
aria-controls="contentCollapse"
>
Blog Preview
</button>
</h2>
<div id="contentCollapse" class="accordion-collapse collapse show">
<div class="accordion-body">{{ html_content|safe }}</div>
</div>
</div>
</div>
{% endif %}
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
<script>
const toastTrigger1 = document.getElementById('pdfformBtn')
const toastLiveExample1 = document.getElementById('liveToast1')
if (toastTrigger1) {
const toastBootstrap1 = new bootstrap.Toast(toastLiveExample1)
toastTrigger1.addEventListener('click', () => {
toastBootstrap1.show()
})
}
const toastTrigger2 = document.getElementById('ebookformBtn')
const toastLiveExample2 = document.getElementById('liveToast2')
if (toastTrigger2) {
const toastBootstrap2 = new bootstrap.Toast(toastLiveExample2)
toastTrigger2.addEventListener('click', () => {
toastBootstrap2.show()
})
}
</script>
</body>
</html>