-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoments.html
234 lines (207 loc) · 8.45 KB
/
coments.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="aboutus.css">
<title>About us</title>
<link rel="icon" href="logo.png">
<style>
/* Just come optional fonts and characters for styling */
@import url('https://fonts.googleapis.com/css?family=Josefin+Sans|Open+Sans|Pacifico|Source+Code+Pro');
/* FontAwesome cdn fonts */
@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
body {
font-family: 'Open Sans', sans-serif;
}
/* Sample styling for comments and commenting controls */
#allcomments {
width: 90%;
margin: 1em 0 4em 1em;
padding: 1%;
border: solid 1px gray;
border-radius: 3px;
box-shadow: 2px 2px 2px silver;
}
ul#pastcomments {
list-style-type: none;
}
ul#pastcomments li:before {
font-family: FontAwesome;
content: "\f086";
font-size: 24pt;
color: gray;
margin-left: -42px;
padding-right: 10px;
position: relative;
top: 8px;
}
ul#pastcomments li {
margin: 0 0 2em 0;
padding: 10px;
}
ul#pastcomments li span {
font-size: 80%;
color: gray;
font-style: italic;
}
form#newcomment textarea {
height: 72px;
}
form#newcomment label {
display: inline-block;
margin: 1em 0 0 0;
}
form#newcomment textarea,
form#newcomment input[type="text"] {
margin-top: 0;
}
</style>
</head>
<body>
<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="index.html">Home</a>
<a href="read.html">Read on!</a>
<a href="submissions.html">Submissions</a>
<a href="team.html">Team</a>
<a href="aboutus.html">About us</a>
</div>
<div id="main">
<span style="font-size:30px;cursor:pointer" onclick="openNav()">☰ Menu</span>
<h1>About us</h1>
<p>Hi readers
<br><br>
Philomath is a website which provides quality articles on a variety of topics for you guys who are passionate about learning.
<br><br>
This is the first stable build of our website which works on almost all devices. Please do feel free to give any feedback by mailing to [email protected]/[email protected] or by clicking on the link below to submit a form. Please do note that we are also not using any 3rd party source like Worpress to create our site, but we are actually writing this site from scratch. Please do follow us on all our social media channels to stay updated.
</p>
</div>
<div id="allcomments">
<h3>Comments</h3>
<!-- We will show past comments in the list below-->
<ul id="pastcomments"></ul>
<!-- This is the form for entering a new comment -->
<form id="newcomment">
<label for="tbName">First Name or Initials</label>
<br>
<input id="tbName" type="text" maxlength="20" required>
<br>
<label for="txComment">Your Comment / Question</label>
<br>
<textarea id="txComment" maxlength="4096" required style="width:96%"></textarea>
<br>
<input type="submit" id="btnSubmitComment" value="Submit Comment">
</form>
</div>
<!-- Connection to Firebase -->
<script src="https://www.gstatic.com/firebasejs/5.0.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/5.0.1/firebase-database.js"></script>
<script>
// Initialize Firebase - be sure to use your own code, this connects to my database.
// Initialize Firebase
var config = {
apiKey: "AIzaSyBVQQVVmeMr49HAKhaZj1950XhcTpCF_AM",
authDomain: "philomathcomments.firebaseapp.com",
databaseURL: "https://philomathcomments.firebaseio.com",
projectId: "philomathcomments",
storageBucket: "philomathcomments.appspot.com",
messagingSenderId: "629266890125",
};
firebase.initializeApp(config);
//Rootref is the whole database.
const rootRef = firebase.database().ref();
//commentsRef is just the pageCountsNode
const commentsRef = rootRef.child('comments');
//Listen for click on Submit Comment button, and post comment.
document.getElementById("btnSubmitComment").addEventListener("click", function () {
//Replace line breaks in comment with br tags.
var newcomment = document.getElementById('txComment').value.replace(/\n/g, "<br>");
//Define a new, keyed post.
var newPostRef = commentsRef.push();
//Fill tne new keyed post with data
newPostRef.set({
name: document.getElementById('tbName').value.trim(),
comment: newcomment.trim(),
frompage: location.pathname,
when: firebase.database.ServerValue.TIMESTAMP
});
});
function showpastcomments() {
var showat = document.getElementById('pastcomments');
//Get comments whose from page equals this page's pathname.
var commentsRef = firebase.database().ref('comments/').orderByChild('frompage').equalTo(location.pathname);
commentsRef.once('value', function (snapshot) {
snapshot.forEach(function (itemSnapshot) {
//Get the object for one snapshot
var itemData = itemSnapshot.val();
var comment = itemData.comment;
var name = itemData.name;
var when = new Date(itemData.when).toLocaleDateString("en-us");
showat.innerHTML += "<li>" + comment + "<span> -- " + name + " (" + when +
")</span></li>";
})
})
}
//Called when page first opens and also after Submit button click to show all comments for this page.
showpastcomments()
</script>
<script>
function openNav() {
document.getElementById("mySidenav").style.width = "150px";
document.getElementById("main").style.marginLeft = "150px";
document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
document.getElementById("main").style.marginLeft= "0";
document.body.style.backgroundColor = "white";
}
</script>
<div class"art">
<ul>
<li><a href="https://docs.google.com/forms/d/e/1FAIpQLSd38DqaS6BRfpyA7M1c2noOnnNh-9xajWHWkXAxhbegMoG3Sg/viewform?usp=sf_link">Click here to give feedback</a>
</ul>
</div>
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setCookieDomain", "*.philomathreadz.netlify.app"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://philomathreadznetlifyapp.matomo.cloud/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.src='//cdn.matomo.cloud/philomathreadznetlifyapp.matomo.cloud/matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
<!-- google code firebase -->
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/7.21.1/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/7.21.1/firebase-analytics.js"></script>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "AIzaSyBmjnD4oAzIuKK8tNJNHlr5JavhBFIO_vI",
authDomain: "philomath-c635d.firebaseapp.com",
databaseURL: "https://philomath-c635d.firebaseio.com",
projectId: "philomath-c635d",
storageBucket: "philomath-c635d.appspot.com",
messagingSenderId: "700006397957",
appId: "1:700006397957:web:cd0cdc551053ce66cfc46c",
measurementId: "G-PD1PGYTG69",
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
<!-- End google Code firebase-->
</body>
</html>