-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathview.html
239 lines (220 loc) · 8.87 KB
/
view.html
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<!DOCTYPE html5>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="This is a blogging website, use it for creating your blogs and share your ideas to the world">
<link rel="icon" href="static/img/logo.jpg" type="image/png">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
.avatar{
border-radius: 20px;
height: 30px;
width: 30px;
}
.profile-drop{
text-decoration: none;
color: aliceblue;
}
/* .blog-box{
margin: 20%;
margin-top: 1%;
margin-bottom: 2%;
background-color: gainsboro;
padding: 4%;
border-radius: 5%;
} */
/* Styles for desktop screens */
@media screen and (min-width: 768px) {
.blog-box {
margin: 0%;
margin-top: 0%;
margin-bottom: 0%;
margin-right: 15%;
margin-left: 15%;
background-color: gainsboro;
padding: 4%;
border-radius: 7px;
overflow: hidden;
}
iframe{
width: 100%;
height: 100%;
border: 0;
}
.file{
width: auto;
height: auto;
overflow: hidden;
}
}
/* Styles for mobile screens */
@media screen and (max-width: 767px) {
.blog-box {
margin: 0%;
margin-top: 0%;
margin-bottom: 0%;
background-color: gainsboro;
padding: 4%;
border-radius: 1px;
overflow: hidden;
}
iframe{
width: 100%;
height: 100%;
border: 0;
overflow: hidden;
}
.file{
width: auto;
height: auto;
}
#frame-img{
max-width: 100%;
max-height: 100%;
display: block;
}
}
footer{
margin-bottom: 0px;
}
/* .date-of-post{
font-family:fantasy;
float: left;
} */
.author{
font-family:Verdana, Geneva, Tahoma, sans-serif;
float: left;
}
.detail{
font-family:system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
letter-spacing: 1px;
font-size: 16px;
word-spacing: 2.5px;
line-height: normal;
}
.title{
font-family:Georgia, 'Times New Roman', Times, serif;
}
.info-blog{
/* display:contents; */
justify-content: space-between;
align-items: center;
font-size: 14px;
}
/* .file{
width: auto;
height: auto;
overflow: hidden;
} */
/* iframe{
width: 100%;
height: 100%;
} */
</style>
<script type="module" src="src/view.js"></script>
<title> View the Post | MercyKKnight</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="/dashboard">MercyKKnight</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/dashboard">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/newpost">Create new Post</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/mypost">
My Post
</a>
</li>
</ul>
<li class="nav-item dropdown">
<a class="profile-drop" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<img class="avatar" id="avatar" src="/img/team.jpg"> <span id='user'"></span>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="/profile">Profile</a></li>
<li><a class="dropdown-item" href="/account">Account</a></li>
<li><input class="dropdown-item" type="submit" id="Logout" name="Logout" value="Logout"></li>
</ul>
</li>
</div>
</div>
</nav>
<div class="blog-box">
<b><span id="alert-info" role="alert" style="color: red;"></span></b>
<b><h2 class="title" id ="title"></h2></b><br>
<div class="info-blog">
By: <a id="author-profile" href=""><img class="avatar" id="author-image" src="/img/avatar.jpg">@<span id="author"></span></a><br><span id="date-of-post"></span></div>
<hr><br>
<h6 class="detail" id="detail"></h6>
<!-- <span class="downloadfile" id="downloadfile"></span><br> --><br>
<div class="file" id="file"></div>
<div class="file1" id="pdf-canvas"></div>
<!-- <form>
Comment on this topic
<label for="name">Name: </label>
<input type="text">
<label for="comment"></label>
<textarea name="comment" id="comment" cols="30" rows="10"></textarea>
</form> -->
<footer><hr><center>All Copyright goes to @Pratham Upadhyay.</center>
</footer>
</div>
<script>
function getmetadata(fileUrl){
var storage = firebase.storage();
var fileRef = storage.refFromURL(fileUrl);
fileRef.getMetadata().then(function(metadata) {
// Access the contentType property to get the file type
console.log('File type:', metadata['contentType']);
return (metadata['contentType']);
}).catch(function(error) {
console.log('Error getting file metadata:', error);
});
}
</script>
<!-- <script>
$(document).ready(function(){
$('.profile-drop').dropdown();
});
</script> -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.min.js"></script>
<script>
function loadPdf(url, elementId) {
// Load the PDF document
pdfjsLib.getDocument(url).promise.then(function(pdf) {
// Get the first page of the PDF
pdf.getPage(1).then(function(page) {
// Set the scale of the PDF
var scale = 1.5;
// Get the viewport of the PDF page
var viewport = page.getViewport({scale: scale});
// Prepare the canvas element
var canvas = document.getElementById(elementId);
var context = canvas.getContext('2d');
canvas.height = viewport.height;
canvas.width = viewport.width;
// Render the PDF page on the canvas
var renderContext = {
canvasContext: context,
viewport: viewport
};
page.render(renderContext);
});
});
}
</script>
</body>
</html>