+{{ end }}
\ No newline at end of file
diff --git a/layouts/partials/posts.html b/layouts/partials/posts.html
index 904b033..883b0d1 100644
--- a/layouts/partials/posts.html
+++ b/layouts/partials/posts.html
@@ -1,7 +1,4 @@
-{{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
-{{ $section := where .Site.RegularPages "Section" "in" $mainSections }}
-{{ $section_count := len $section }}
-{{ $n_posts := $.Param "recent_posts_number" | default 6 }}
+{{ define "posts" }}
@@ -48,4 +45,5 @@
{{ end }}
-
\ No newline at end of file
+
+{{ end }}
\ No newline at end of file
diff --git a/layouts/partials/user-profile.html b/layouts/partials/user-profile.html
index 63e76d0..00e4636 100644
--- a/layouts/partials/user-profile.html
+++ b/layouts/partials/user-profile.html
@@ -103,5 +103,10 @@
+ {{ if .IsHome }}
+ {{ block "overview" . }}{{ end }}
+ {{ else }}
+ {{ block "posts" . }}{{ end }}
+ {{ end }}
\ No newline at end of file
diff --git a/static/js/github-style.js b/static/js/github-style.js
index f1eeb03..c440c67 100644
--- a/static/js/github-style.js
+++ b/static/js/github-style.js
@@ -1,2 +1,284 @@
+const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+const now = new Date();
+let contributions;
+
(() => {
-})();
\ No newline at end of file
+ const dom = document.querySelector('#contributions');
+ if (!dom) {
+ return;
+ }
+
+ contributions = JSON.parse(dom.getAttribute('data'));
+ let year = 0;
+ for (const item of contributions) {
+ item.publishDate = decodeURI(item.publishDate).replace(' ', 'T');
+ item.date = new Date(item.publishDate);
+ if (item.date.getFullYear() > year) {
+ year = item.date.getFullYear();
+ }
+ item.title = decodeURI(item.title);
+ }
+
+ yearList();
+ switchYear(year.toString());
+})();
+
+function switchYear(year) {
+ let startDate;
+ let endDate;
+ if (year != now.getFullYear().toString()) {
+ const date = new Date(year);
+ startDate = new Date(date.getTime() - date.getDay() * 24 * 60 * 60 * 1000);
+ endDate = new Date(date.getFullYear(), 11, 31);
+ } else {
+ endDate = now;
+ startDate = new Date(endDate.getTime() - 364 * 24 * 60 * 60 * 1000 - endDate.getDay() * 24 * 60 * 60 * 1000);
+ }
+ startDate.setHours(0, 0, 0, 0);
+ endDate.setHours(23, 59, 59, 999);
+ const posts = [];
+ const ms = [];
+ for (const item of contributions) {
+ if (item.date >= startDate && item.date <= endDate) {
+ posts.push(item);
+ if (!ms.includes(item.date.getMonth())) {
+ ms.push(item.date.getMonth());
+ }
+ }
+ }
+ posts.sort((a, b) => { return b - a });
+ document.querySelector('#posts-activity').innerHTML = '';
+ for (const month of ms) {
+ const node = document.createElement('div');
+ node.innerHTML = monthly(year, month, posts);
+ document.querySelector('#posts-activity').appendChild(node);
+ }
+
+ graph(year, posts, startDate, endDate);
+
+ const yearList = document.querySelectorAll('.js-year-link');
+ for (const elem of yearList) {
+ if (elem.innerText == year) {
+ elem.classList.add('selected');
+ } else {
+ elem.classList.remove('selected');
+ }
+ }
+}
+
+function monthly(year, month, posts) {
+ const monthPosts = posts.filter(post =>
+ post.date.getFullYear().toString() === year && post.date.getMonth() === month
+ );
+ let liHtml = '';
+ for (const post of monthPosts) {
+ liHtml += `