Skip to content

Commit

Permalink
Create main.min.js
Browse files Browse the repository at this point in the history
  • Loading branch information
crotel authored Sep 16, 2020
1 parent c409323 commit e913ccf
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions main.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const cryear = (new Date).getFullYear();
document.querySelector("section.footers p").innerHTML = `© Copyright ${cryear} CROTEL - All Rights Reserved <br> Powered by JSON + Github + jsDelivr + Cloudflare Workers`, document.getElementById("readMoreBtn").addEventListener("click", function() {
document.getElementById("header").setAttribute("style", "display:none;"), document.getElementById("content").setAttribute("style", "display:block;padding-top:10vh;"), document.getElementById("footer").setAttribute("style", "display:block;")
}), fetch("data.json").then(function(e) {
if (!e.ok)
throw new Error("HTTP error, status = " + e.status);
return e.json()
}).then(e => {
const t = e;
return t.posts.sort(function(e, t) {
return Date.parse(t.published_at) - Date.parse(e.published_at)
}), t
}).then(function(e) {
for (var t = 0; t < e.posts.length; t++) {
var n = document.querySelector(".timeline ul");
var s,
a,
o = (h = e.posts[t].published_at, v = void 0, g = void 0, y = void 0, b = void 0, v = new Date(h), g = "" + (v.getMonth() + 1), y = "" + v.getDate(), b = v.getFullYear(), g.length < 2 && (g = "0" + g), y.length < 2 && (y = "0" + y), [b, g, y].join("-")),
i = /((www\.)?[a-zA-Z0-9_]{1,}(\-)?[a-zA-Z0-9_]{1,}\.[a-z]{2,}\b([a-zA-Z0-9@:%_\+.~#?&//=]*)|(www\.)?[a-zA-Z0-9_]{1,}\.[a-z]{2,}\b([a-zA-Z0-9@:%_\+.~#?&//=]*))/g,
r = e.posts[t].plaintext.replace(/\?+\?/g, '<span class="todo"></span>').replace(/\++\+/g, '<span class="update"></span>').replace(/\!+\!/g, '<span class="attention"></span>').replace(/\n+\n/g, "<br><br>"),
l = new RegExp(i);
d = void 0, p = void 0, c = void 0, u = void 0, d = r, p = r.match(l), c = s, u = a, null != p ? (c = d.replace(i, ""), u = p.toString(), n.innerHTML += `\n <li><div class="content"><h3><a href="https://${u}">${e.posts[t].title}<span>i</span></a></h3><p>${c}</p></div><div class="point"></div><div class="date"><h4>${o} </h4></div></li>`) : (c = d, n.innerHTML += `\n <li><div class="content"><h3>${e.posts[t].title}</h3><p>${c}</p></div><div class="point"></div><div class="date"><h4>${o} </h4></div></li>`)
}
var d,
p,
c,
u,
h,
v,
g,
y,
b
});

0 comments on commit e913ccf

Please sign in to comment.