-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharticle.js
35 lines (30 loc) · 1.21 KB
/
article.js
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
/*
Emux Website
Copyright (C) Emux Technologies. All Rights Reserved.
https://emux.app
Licenced by the Emux Closed-Source Licence, which can be found at LICENCE.md.
*/
$(function() {
if (core.getURLParameter("id") == null) {
window.location.replace("/blog.html");
} else {
firebaseEmux.database().ref("blog/" + core.getURLParameter("id")).once("value", function(snapshot) {
if (snapshot.val() != null) {
$(".articleTitle").text(snapshot.val().title);
$(".articleDate").text(lang.format(new Date(snapshot.val().date), lang.language, {
weekday: "long",
day: "numeric",
month: "long",
year: "numeric"
}) + " · " + _("By {0} ({1})", [snapshot.val().authorName, _(snapshot.val().authorJobTitle)]));
$(".articleThumbnail")
.attr("src", snapshot.val().thumbnailSrc)
.attr("alt", snapshot.val().thumbnailAlt)
;
$(".articleContents").html(snapshot.val().contents);
} else {
window.location.replace("/404.html");
}
});
}
});