File size: 5,305 Bytes
84b66f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79524cf
84b66f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79524cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84b66f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!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>