mirror of
https://github.com/MeiK2333/github-style.git
synced 2025-10-07 01:54:06 +00:00
添加首页的文章
This commit is contained in:
@@ -2,6 +2,6 @@
|
|||||||
<main>
|
<main>
|
||||||
{{ partial "user-profile.html" . }}
|
{{ partial "user-profile.html" . }}
|
||||||
|
|
||||||
<!-- {{ partial "overview.html" .}} -->
|
{{ partial "overview.html" .}}
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
@@ -1,5 +1,4 @@
|
|||||||
{{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
|
{{ $section := where .Site.RegularPages "Section" "in" (slice "post") }}
|
||||||
{{ $section := where .Site.RegularPages "Section" "in" $mainSections }}
|
|
||||||
{{ $section_count := len $section }}
|
{{ $section_count := len $section }}
|
||||||
|
|
||||||
<div class="mt-4 position-sticky top-0 d-none d-md-block bg-white width-full border-bottom color-border-secondary"
|
<div class="mt-4 position-sticky top-0 d-none d-md-block bg-white width-full border-bottom color-border-secondary"
|
||||||
|
@@ -1,96 +1,137 @@
|
|||||||
{{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
|
{{ define "overview" }}
|
||||||
{{ $section := where .Site.RegularPages "Section" "in" $mainSections }}
|
{{ $pinned := where .Site.Pages "Params.pin" true }}
|
||||||
{{ $section_count := len $section }}
|
<div class="flex-shrink-0 col-12 col-md-9 mb-4 mb-md-0">
|
||||||
{{ $n_posts := $.Param "recent_posts_number" | default 6 }}
|
<div>
|
||||||
<div class="col-lg-9 col-md-8 col-12 float-md-left pl-md-2">
|
<div class="position-relative">
|
||||||
<div class="UnderlineNav width-full user-profile-nav js-sticky top-0">
|
<div class="mt-4">
|
||||||
<nav class="UnderlineNav-body" aria-label="User profile">
|
|
||||||
<a aria-current="page" class="UnderlineNav-item mr-0 mr-md-1 mr-lg-3 selected " href="{{ .Site.BaseURL }}">
|
|
||||||
Overview
|
|
||||||
</a>
|
|
||||||
<a class="UnderlineNav-item mr-0 mr-md-1 mr-lg-3 " href="{{ absURL "posts/" }}">
|
|
||||||
Posts
|
|
||||||
<span class="Counter hide-lg hide-md hide-sm">
|
|
||||||
{{ $section_count}}
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
<a class="UnderlineNav-item mr-0 mr-md-1 mr-lg-3 " href="{{ absURL "about/" }}">
|
|
||||||
About
|
|
||||||
</a>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
<div class="position-relative">
|
|
||||||
<div class="mt-4">
|
|
||||||
<div class="js-pinned-items-reorder-container">
|
|
||||||
<h2 class="f4 mb-2 text-normal">
|
|
||||||
Pinned
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<ol class="d-flex flex-wrap list-style-none gutter-condensed mb-4 js-pinned-items-reorder-list">
|
{{ if ne (len $pinned) 0 }}
|
||||||
{{ range (first $n_posts $section) }}
|
<div class="js-pinned-items-reorder-container">
|
||||||
<li class="col-12 col-md-6 col-lg-6 mb-3 d-flex flex-content-stretch">
|
<h2 class="f4 mb-2 text-normal">
|
||||||
<div
|
Pinned
|
||||||
class="Box pinned-item-list-item d-flex p-3 width-full js-pinned-item-list-item public source sortable-button-item">
|
</h2>
|
||||||
<div class="pinned-item-list-item-content" name="pinned-post">
|
|
||||||
<div class="d-flex width-full flex-items-center position-relative">
|
<ol class="d-flex flex-wrap list-style-none gutter-condensed mb-4 js-pinned-items-reorder-list">
|
||||||
<svg class="octicon octicon-repo mr-2 text-gray flex-shrink-0" viewBox="0 0 12 16" version="1.1"
|
{{ range (first 6 $pinned) }}
|
||||||
width="12" height="16">
|
<li class="col-12 col-md-6 col-lg-6 mb-3 d-flex flex-content-stretch">
|
||||||
<path fill-rule="evenodd"
|
<div
|
||||||
d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z" />
|
class="Box pinned-item-list-item d-flex p-3 width-full js-pinned-item-list-item public source reorderable sortable-button-item">
|
||||||
</svg>
|
<div class="pinned-item-list-item-content">
|
||||||
<a href="{{ .Permalink }}" class="text-bold flex-auto min-width-0 ">
|
<div class="d-flex width-full flex-items-center position-relative">
|
||||||
<span class="repo js-pinnable-item" title="{{ .Title }}">{{ .Title }}</span>
|
<svg class="octicon octicon-repo mr-2 text-gray flex-shrink-0" viewBox="0 0 16 16" version="1.1"
|
||||||
</a>
|
width="16" height="16">
|
||||||
</div>
|
<path fill-rule="evenodd"
|
||||||
<div class="pinned-item-desc text-gray text-small d-block mt-2 mb-3">
|
d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z">
|
||||||
{{ .Summary | safeHTML }}
|
</path>
|
||||||
</div>
|
</svg>
|
||||||
<div class="f6 text-gray mt-2">
|
<a class="text-bold flex-auto min-width-0" href="{{ .Permalink }}">
|
||||||
Updated <time-ago datetime="{{ .Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}" class="no-wrap">
|
<span class="repo" title="{{ .Title }}">{{ .Title }}</span>
|
||||||
Mon, 02 Jan 2006 15:04:05 -0700</time-ago>
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div name="summary" class="pinned-item-desc text-gray text-small d-block mt-2 mb-3">
|
||||||
|
{{ .Summary | safeHTML }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TODO: 文章标签 -->
|
||||||
|
<p class="mb-0 f6 text-gray">
|
||||||
|
<a href="{{ .Permalink }}" class="pinned-item-meta muted-link ">
|
||||||
|
<svg aria-label="stars" class="octicon octicon-star" viewBox="0 0 16 16" version="1.1" width="16"
|
||||||
|
height="16" role="img">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
999
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</li>
|
||||||
</li>
|
{{ end }}
|
||||||
{{ end }}
|
</ol>
|
||||||
</ol>
|
</div>
|
||||||
|
{{ else }}
|
||||||
|
<div class="js-pinned-items-reorder-container">
|
||||||
|
<h2 class="f4 mb-2 text-normal">
|
||||||
|
Popular posts
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<ol class="d-flex flex-wrap list-style-none gutter-condensed mb-4 js-pinned-items-reorder-list">
|
||||||
|
{{ range (first 6 (where .Site.RegularPages "Section" "in" (slice "post"))) }}
|
||||||
|
<li class="col-12 col-md-6 col-lg-6 mb-3 d-flex flex-content-stretch">
|
||||||
|
<div
|
||||||
|
class="Box pinned-item-list-item d-flex p-3 width-full js-pinned-item-list-item public source reorderable sortable-button-item">
|
||||||
|
<div class="pinned-item-list-item-content">
|
||||||
|
<div class="d-flex width-full flex-items-center position-relative">
|
||||||
|
<svg class="octicon octicon-repo mr-2 text-gray flex-shrink-0" viewBox="0 0 16 16" version="1.1"
|
||||||
|
width="16" height="16">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
<a class="text-bold flex-auto min-width-0" href="{{ .Permalink }}">
|
||||||
|
<span class="repo" title="{{ .Title }}">{{ .Title }}</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div name="summary" class="pinned-item-desc text-gray text-small d-block mt-2 mb-3">
|
||||||
|
{{ .Summary | safeHTML }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TODO: 文章标签 -->
|
||||||
|
<p class="mb-0 f6 text-gray">
|
||||||
|
<a href="{{ .Permalink }}" class="pinned-item-meta muted-link ">
|
||||||
|
<svg aria-label="stars" class="octicon octicon-star" viewBox="0 0 16 16" version="1.1" width="16"
|
||||||
|
height="16" role="img">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
999
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
|
{{ $section := where .Site.RegularPages "Section" "in" (slice "post") }}
|
||||||
{{ $section := where .Site.RegularPages "Section" "in" $mainSections }}
|
<div class="mt-4 position-relative" id="contributions" data='[{{ range $index, $elem := $section }}
|
||||||
<div id="contributions" data='[{{ range $index, $elem := $section }}
|
|
||||||
{
|
{
|
||||||
"title": "{{ .Title }}",
|
"title": "{{ .Title }}",
|
||||||
"link": "{{ .Permalink }}",
|
"link": "{{ .Permalink }}",
|
||||||
"publishDate": "{{ .PublishDate.Format "2006-01-02 15:04:05" }}"
|
"publishDate": "{{ .PublishDate.Format "2006-01-02 15:04:05" }}"
|
||||||
}{{ if ne $index (sub (len $section) 1) }},{{ end }}
|
}{{ if ne $index (sub (len $section) 1) }},{{ end }}
|
||||||
{{ end }}]'>
|
{{ end }}]'>
|
||||||
<div class="mt-4 position-relative">
|
|
||||||
<div class="js-yearly-contributions">
|
<div class="js-yearly-contributions">
|
||||||
<div class="position-relative">
|
<div class="position-relative">
|
||||||
<h2 class="f4 text-normal mb-2" id="posts-count">
|
<h2 class="f4 text-normal mb-2" id="posts-count"></h2>
|
||||||
</h2>
|
<div class="border py-2 graph-before-activity-overview">
|
||||||
<div class="js-profile-timeline-year-list">
|
|
||||||
<a class="js-year-link selected"></a>
|
|
||||||
</div>
|
|
||||||
<div class="border border-gray-dark py-2 graph-before-activity-overview">
|
|
||||||
<div
|
<div
|
||||||
class="js-calendar-graph mx-3 d-flex flex-column flex-items-end flex-xl-items-center overflow-hidden pt-1 is-graph-loading graph-canvas calendar-graph height-full text-center">
|
class="js-calendar-graph mx-md-2 mx-3 d-flex flex-column flex-items-end flex-xl-items-center overflow-hidden pt-1 is-graph-loading graph-canvas calendar-graph height-full text-center">
|
||||||
<svg width="828" height="128" class="js-calendar-graph-svg">
|
<svg width="828" height="128" class="js-calendar-graph-svg">
|
||||||
<g transform="translate(10, 20)" id="graph-svg">
|
<g transform="translate(10, 20)" id="graph-svg">
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div class="contrib-footer clearfix mt-1 mx-3 px-3 pb-1">
|
<div class="contrib-footer clearfix mt-1 mx-3 px-3 pb-1">
|
||||||
<div class="contrib-legend text-gray"
|
<div class="float-left text-gray">
|
||||||
title="A summary of pull requests, issues opened, and commits to the default and gh-pages branches.">
|
</div>
|
||||||
|
<div class="contrib-legend text-gray">
|
||||||
Less
|
Less
|
||||||
<ul class="legend">
|
<ul class="legend">
|
||||||
<li style="background-color: #ebedf0"></li>
|
<li style="background-color: var(--color-calendar-graph-day-bg)"></li>
|
||||||
<li style="background-color: #c6e48b"></li>
|
<li style="background-color: var(--color-calendar-graph-day-L1-bg)"></li>
|
||||||
<li style="background-color: #7bc96f"></li>
|
<li style="background-color: var(--color-calendar-graph-day-L2-bg)"></li>
|
||||||
<li style="background-color: #239a3b"></li>
|
<li style="background-color: var(--color-calendar-graph-day-L3-bg)"></li>
|
||||||
<li style="background-color: #196127"></li>
|
<li style="background-color: var(--color-calendar-graph-day-L4-bg)"></li>
|
||||||
</ul>
|
</ul>
|
||||||
More
|
More
|
||||||
</div>
|
</div>
|
||||||
@@ -98,41 +139,288 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="activity-listing contribution-activity">
|
<div class="activity-listing contribution-activity">
|
||||||
<div class="d-none d-lg-block">
|
<div class="d-none d-lg-block">
|
||||||
<div
|
<div class="js-profile-timeline-year-list bg-white float-right col-2 pl-5 is-placeholder"
|
||||||
class="profile-timeline-year-list js-profile-timeline-year-list bg-white float-right col-2 pl-5 is-placeholder"
|
|
||||||
style="visibility: hidden; display: none; height: 210px;"></div>
|
style="visibility: hidden; display: none; height: 210px;"></div>
|
||||||
<div
|
<div style="top: 74px; position: static;"
|
||||||
class="profile-timeline-year-list js-profile-timeline-year-list bg-white js-sticky float-right col-2 pl-5"
|
class="js-profile-timeline-year-list bg-white js-sticky float-right col-2 pl-5">
|
||||||
data-original-top="74px" style="position: static;">
|
|
||||||
<ul class="filter-list small" id="year-list">
|
<ul class="filter-list small" id="year-list">
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 class="f4 text-normal mb-2">
|
<h2 class="f4 text-normal mt-4 mb-3">
|
||||||
Post activity
|
Contribution activity
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div id="posts-activity">
|
<div class="contribution-activity-listing float-left col-12 col-lg-10" id="posts-activity">
|
||||||
|
<div class="width-full pb-4">
|
||||||
|
<h3 class="h6 pr-2 py-1 border-bottom mb-3" style="height: 14px;">
|
||||||
|
<span class="color-bg-canvas pl-2 pr-3">December <span class="text-gray">2020</span></span>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="TimelineItem ">
|
||||||
|
|
||||||
|
<div class="TimelineItem-badge ">
|
||||||
|
<svg class="octicon octicon-repo-push" viewBox="0 0 16 16" version="1.1" width="16" height="16">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M1 2.5A2.5 2.5 0 013.5 0h8.75a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0V1.5h-8a1 1 0 00-1 1v6.708A2.492 2.492 0 013.5 9h3.25a.75.75 0 010 1.5H3.5a1 1 0 100 2h5.75a.75.75 0 010 1.5H3.5A2.5 2.5 0 011 11.5v-9zm13.23 7.79a.75.75 0 001.06-1.06l-2.505-2.505a.75.75 0 00-1.06 0L9.22 9.229a.75.75 0 001.06 1.061l1.225-1.224v6.184a.75.75 0 001.5 0V9.066l1.224 1.224z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div class="TimelineItem-body ">
|
||||||
|
<details open="open" class="Details-element details-reset ">
|
||||||
|
<summary role="button" class="btn-link f4 muted-link no-underline lh-condensed width-full ">
|
||||||
|
<span class="color-text-primary ws-normal text-left">
|
||||||
|
Created 16
|
||||||
|
commits in
|
||||||
|
4
|
||||||
|
repositories
|
||||||
|
</span>
|
||||||
|
<span class="d-inline-block float-right color-icon-secondary">
|
||||||
|
<span class="Details-content--open float-right" aria_label="Collapse"
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_CATEGORY_ROLLUP_COLLAPSE","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="bdeed660aa78bbca7270cf764d76c37c70ecabd1c4cd251185d3d703e75452a0"><svg
|
||||||
|
class="octicon octicon-fold" viewBox="0 0 16 16" version="1.1" width="16" height="16">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M10.896 2H8.75V.75a.75.75 0 00-1.5 0V2H5.104a.25.25 0 00-.177.427l2.896 2.896a.25.25 0 00.354 0l2.896-2.896A.25.25 0 0010.896 2zM8.75 15.25a.75.75 0 01-1.5 0V14H5.104a.25.25 0 01-.177-.427l2.896-2.896a.25.25 0 01.354 0l2.896 2.896a.25.25 0 01-.177.427H8.75v1.25zm-6.5-6.5a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5zM6 8a.75.75 0 01-.75.75h-.5a.75.75 0 010-1.5h.5A.75.75 0 016 8zm2.25.75a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5zM12 8a.75.75 0 01-.75.75h-.5a.75.75 0 010-1.5h.5A.75.75 0 0112 8zm2.25.75a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5z">
|
||||||
|
</path>
|
||||||
|
</svg></span>
|
||||||
|
<span class="Details-content--closed float-right" aria_label="Expand"
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_CATEGORY_ROLLUP_EXPAND","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="5ee3975c95842d71a57199562f0d16dee03eda921b302871c87e69ec3a74343f"><svg
|
||||||
|
class="octicon octicon-unfold" viewBox="0 0 16 16" version="1.1" width="16" height="16">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M8.177.677l2.896 2.896a.25.25 0 01-.177.427H8.75v1.25a.75.75 0 01-1.5 0V4H5.104a.25.25 0 01-.177-.427L7.823.677a.25.25 0 01.354 0zM7.25 10.75a.75.75 0 011.5 0V12h2.146a.25.25 0 01.177.427l-2.896 2.896a.25.25 0 01-.354 0l-2.896-2.896A.25.25 0 015.104 12H7.25v-1.25zm-5-2a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5zM6 8a.75.75 0 01-.75.75h-.5a.75.75 0 010-1.5h.5A.75.75 0 016 8zm2.25.75a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5zM12 8a.75.75 0 01-.75.75h-.5a.75.75 0 010-1.5h.5A.75.75 0 0112 8zm2.25.75a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5z">
|
||||||
|
</path>
|
||||||
|
</svg></span>
|
||||||
|
</span>
|
||||||
|
</summary>
|
||||||
|
<div>
|
||||||
|
<ul class="list-style-none mt-1" data-repository-hovercards-enabled="">
|
||||||
|
|
||||||
|
<li class="ml-0 py-1 d-flex">
|
||||||
|
<div
|
||||||
|
class="col-8 css-truncate css-truncate-target lh-condensed width-fit flex-auto min-width-0">
|
||||||
|
<a data-hovercard-type="repository" data-hovercard-url="/MeiK2333/StepByStep/hovercard"
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_REPO_LINK","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="dcf816526950ba68b6598fc5956d41c491300d211ff6f51e9347a8b9c2fd1d66"
|
||||||
|
href="/MeiK2333/StepByStep">MeiK2333/StepByStep</a>
|
||||||
|
<a class="f6 muted-link ml-lg-1 mt-1 mt-lg-0 d-block d-lg-inline "
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_COMMIT_RANGE","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="810ade5d5ebd2b2b770839e68dfa40a4ae39aa49323f1c07f7f37d419e4c679f"
|
||||||
|
href="/MeiK2333/StepByStep/commits?author=MeiK2333&since=2020-11-30&until=2020-12-14">
|
||||||
|
10 commits
|
||||||
|
</a> </div>
|
||||||
|
|
||||||
|
<div class="col-3 flex-shrink-0">
|
||||||
|
<div class="Progress mt-1 tooltipped tooltipped-n color-bg-primary"
|
||||||
|
aria-label="63% of commits in December were made to MeiK2333/StepByStep ">
|
||||||
|
<span class="Progress-item rounded-2" style="width: 63%;background-color: #30a14e"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="ml-0 py-1 d-flex">
|
||||||
|
<div
|
||||||
|
class="col-8 css-truncate css-truncate-target lh-condensed width-fit flex-auto min-width-0">
|
||||||
|
<a data-hovercard-type="repository" data-hovercard-url="/MeiK2333/river/hovercard"
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_REPO_LINK","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="dcf816526950ba68b6598fc5956d41c491300d211ff6f51e9347a8b9c2fd1d66"
|
||||||
|
href="/MeiK2333/river">MeiK2333/river</a>
|
||||||
|
<a class="f6 muted-link ml-lg-1 mt-1 mt-lg-0 d-block d-lg-inline "
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_COMMIT_RANGE","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="810ade5d5ebd2b2b770839e68dfa40a4ae39aa49323f1c07f7f37d419e4c679f"
|
||||||
|
href="/MeiK2333/river/commits?author=MeiK2333&since=2020-11-30&until=2020-12-14">
|
||||||
|
3 commits
|
||||||
|
</a> </div>
|
||||||
|
|
||||||
|
<div class="col-3 flex-shrink-0">
|
||||||
|
<div class="Progress mt-1 tooltipped tooltipped-n color-bg-primary"
|
||||||
|
aria-label="19% of commits in December were made to MeiK2333/river ">
|
||||||
|
<span class="Progress-item rounded-2" style="width: 19%;background-color: #9be9a8"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="ml-0 py-1 d-flex">
|
||||||
|
<div
|
||||||
|
class="col-8 css-truncate css-truncate-target lh-condensed width-fit flex-auto min-width-0">
|
||||||
|
<a data-hovercard-type="repository"
|
||||||
|
data-hovercard-url="/MeiK2333/headful-chrome-launch/hovercard"
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_REPO_LINK","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="dcf816526950ba68b6598fc5956d41c491300d211ff6f51e9347a8b9c2fd1d66"
|
||||||
|
href="/MeiK2333/headful-chrome-launch">MeiK2333/headful-chrome-launch</a>
|
||||||
|
<a class="f6 muted-link ml-lg-1 mt-1 mt-lg-0 d-block d-lg-inline "
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_COMMIT_RANGE","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="810ade5d5ebd2b2b770839e68dfa40a4ae39aa49323f1c07f7f37d419e4c679f"
|
||||||
|
href="/MeiK2333/headful-chrome-launch/commits?author=MeiK2333&since=2020-11-30&until=2020-12-14">
|
||||||
|
2 commits
|
||||||
|
</a> </div>
|
||||||
|
|
||||||
|
<div class="col-3 flex-shrink-0">
|
||||||
|
<div class="Progress mt-1 tooltipped tooltipped-n color-bg-primary"
|
||||||
|
aria-label="13% of commits in December were made to MeiK2333/headful-chrome-launch ">
|
||||||
|
<span class="Progress-item rounded-2" style="width: 13%;background-color: #9be9a8"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="ml-0 py-1 d-flex">
|
||||||
|
<div
|
||||||
|
class="col-8 css-truncate css-truncate-target lh-condensed width-fit flex-auto min-width-0">
|
||||||
|
<a data-hovercard-type="repository" data-hovercard-url="/MeiK2333/github-style/hovercard"
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_REPO_LINK","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="dcf816526950ba68b6598fc5956d41c491300d211ff6f51e9347a8b9c2fd1d66"
|
||||||
|
href="/MeiK2333/github-style">MeiK2333/github-style</a>
|
||||||
|
<a class="f6 muted-link ml-lg-1 mt-1 mt-lg-0 d-block d-lg-inline "
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_COMMIT_RANGE","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="810ade5d5ebd2b2b770839e68dfa40a4ae39aa49323f1c07f7f37d419e4c679f"
|
||||||
|
href="/MeiK2333/github-style/commits?author=MeiK2333&since=2020-11-30&until=2020-12-14">
|
||||||
|
1 commit
|
||||||
|
</a> </div>
|
||||||
|
|
||||||
|
<div class="col-3 flex-shrink-0">
|
||||||
|
<div class="Progress mt-1 tooltipped tooltipped-n color-bg-primary"
|
||||||
|
aria-label="7% of commits in December were made to MeiK2333/github-style ">
|
||||||
|
<span class="Progress-item rounded-2" style="width: 7%;background-color: #9be9a8"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="TimelineItem ">
|
||||||
|
|
||||||
|
<div class="TimelineItem-badge ">
|
||||||
|
<svg class="octicon octicon-git-pull-request" viewBox="0 0 16 16" version="1.1" width="16"
|
||||||
|
height="16">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M7.177 3.073L9.573.677A.25.25 0 0110 .854v4.792a.25.25 0 01-.427.177L7.177 3.427a.25.25 0 010-.354zM3.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122v5.256a2.251 2.251 0 11-1.5 0V5.372A2.25 2.25 0 011.5 3.25zM11 2.5h-1V4h1a1 1 0 011 1v5.628a2.251 2.251 0 101.5 0V5A2.5 2.5 0 0011 2.5zm1 10.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0zM3.75 12a.75.75 0 100 1.5.75.75 0 000-1.5z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div class="TimelineItem-body ">
|
||||||
|
<details class="Details-element details-reset " open="">
|
||||||
|
<summary role="button" class="btn-link f4 muted-link no-underline lh-condensed width-full ">
|
||||||
|
<span class="float-left ws-normal text-left color-text-primary">
|
||||||
|
Opened 1
|
||||||
|
|
||||||
|
pull request in
|
||||||
|
1
|
||||||
|
repository
|
||||||
|
</span>
|
||||||
|
<span class="d-inline-block float-right">
|
||||||
|
<span class="Details-content--open float-right" aria_label="Collapse"
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_CATEGORY_ROLLUP_COLLAPSE","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="bdeed660aa78bbca7270cf764d76c37c70ecabd1c4cd251185d3d703e75452a0"><svg
|
||||||
|
class="octicon octicon-fold" viewBox="0 0 16 16" version="1.1" width="16" height="16">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M10.896 2H8.75V.75a.75.75 0 00-1.5 0V2H5.104a.25.25 0 00-.177.427l2.896 2.896a.25.25 0 00.354 0l2.896-2.896A.25.25 0 0010.896 2zM8.75 15.25a.75.75 0 01-1.5 0V14H5.104a.25.25 0 01-.177-.427l2.896-2.896a.25.25 0 01.354 0l2.896 2.896a.25.25 0 01-.177.427H8.75v1.25zm-6.5-6.5a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5zM6 8a.75.75 0 01-.75.75h-.5a.75.75 0 010-1.5h.5A.75.75 0 016 8zm2.25.75a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5zM12 8a.75.75 0 01-.75.75h-.5a.75.75 0 010-1.5h.5A.75.75 0 0112 8zm2.25.75a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5z">
|
||||||
|
</path>
|
||||||
|
</svg></span>
|
||||||
|
<span class="Details-content--closed float-right" aria_label="Expand"
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_CATEGORY_ROLLUP_EXPAND","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="5ee3975c95842d71a57199562f0d16dee03eda921b302871c87e69ec3a74343f"><svg
|
||||||
|
class="octicon octicon-unfold" viewBox="0 0 16 16" version="1.1" width="16" height="16">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M8.177.677l2.896 2.896a.25.25 0 01-.177.427H8.75v1.25a.75.75 0 01-1.5 0V4H5.104a.25.25 0 01-.177-.427L7.823.677a.25.25 0 01.354 0zM7.25 10.75a.75.75 0 011.5 0V12h2.146a.25.25 0 01.177.427l-2.896 2.896a.25.25 0 01-.354 0l-2.896-2.896A.25.25 0 015.104 12H7.25v-1.25zm-5-2a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5zM6 8a.75.75 0 01-.75.75h-.5a.75.75 0 010-1.5h.5A.75.75 0 016 8zm2.25.75a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5zM12 8a.75.75 0 01-.75.75h-.5a.75.75 0 010-1.5h.5A.75.75 0 0112 8zm2.25.75a.75.75 0 000-1.5h-.5a.75.75 0 000 1.5h.5z">
|
||||||
|
</path>
|
||||||
|
</svg></span>
|
||||||
|
</span>
|
||||||
|
</summary>
|
||||||
|
<div>
|
||||||
|
<details open="open" data-repository-hovercards-enabled="true"
|
||||||
|
data-issue-and-pr-hovercards-enabled="true" class="Details-element details-reset my-1">
|
||||||
|
<summary data-octo-click="profile_timeline_toggle_rollup_created_pull_requests" role="button"
|
||||||
|
class="flex-items-baseline btn-link no-underline lh-condensed d-flex text-left">
|
||||||
|
<div class="col-7">
|
||||||
|
<span class="css-truncate css-truncate-target width-fit" data-hovercard-type="repository"
|
||||||
|
data-hovercard-url="/MeiK2333/headful-chrome-launch/hovercard">MeiK2333/headful-chrome-launch</span>
|
||||||
|
</div>
|
||||||
|
<span class="col-5 f6 color-text-secondary text-right">
|
||||||
|
<span class="State--purple State ml-2 px-1 py-0 lh-condensed-ultra f6">1</span>
|
||||||
|
merged
|
||||||
|
</span>
|
||||||
|
</summary>
|
||||||
|
<div>
|
||||||
|
<ul class="mt-1 list-style-none">
|
||||||
|
<li class="py-1 ml-0 d-flex">
|
||||||
|
<span class="flex-auto min-width-0">
|
||||||
|
<span class="css-truncate css-truncate-target width-fit">
|
||||||
|
<svg class="octicon octicon-git-merge text-purple" title="Merged" viewBox="0 0 16 16"
|
||||||
|
version="1.1" width="16" height="16">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M5 3.254V3.25v.005a.75.75 0 110-.005v.004zm.45 1.9a2.25 2.25 0 10-1.95.218v5.256a2.25 2.25 0 101.5 0V7.123A5.735 5.735 0 009.25 9h1.378a2.251 2.251 0 100-1.5H9.25a4.25 4.25 0 01-3.8-2.346zM12.75 9a.75.75 0 100-1.5.75.75 0 000 1.5zm-8.5 4.5a.75.75 0 100-1.5.75.75 0 000 1.5z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
<a class="no-underline"
|
||||||
|
data-hydro-click="{"event_type":"user_profile.click","payload":{"profile_user_id":20951666,"target":"TIMELINE_PR_LINK","user_id":20951666,"originating_url":"https://github.com/MeiK2333"}}"
|
||||||
|
data-hydro-click-hmac="1a99e9f0dc5983133d88b8da217dcc90c864595d717fd084e481baf87728a4f6"
|
||||||
|
data-hovercard-type="pull_request"
|
||||||
|
data-hovercard-url="/MeiK2333/headful-chrome-launch/pull/1/hovercard"
|
||||||
|
href="/MeiK2333/headful-chrome-launch/pull/1">
|
||||||
|
<span class="link-gray-dark ">重构</span>
|
||||||
|
</a> </span>
|
||||||
|
</span>
|
||||||
|
<time title="This contribution was made on Dec 1"
|
||||||
|
class="float-right f6 text-gray-light pt-1 no-wrap flex-shrink-0">
|
||||||
|
Dec 1
|
||||||
|
</time>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- TODO -->
|
|
||||||
<!-- 默认只显示最新月的,点击按钮来显示全部数据 -->
|
|
||||||
<!-- <div class="ajax-pagination-form js-ajax-pagination js-show-more-timeline-form col-lg-10 col-12">
|
|
||||||
<img class="contribution-activity-spinner col-10 next" alt=""
|
|
||||||
src="https://github.githubassets.com/images/spinners/octocat-spinner-128.gif">
|
|
||||||
<button name="button"
|
|
||||||
class="ajax-pagination-btn btn btn-outline border-gray-dark width-full f6 mt-0 py-2 contribution-activity-show-more ">Show
|
|
||||||
more activity</button>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="pinned-items-modal-wrapper"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="pinned-items-modal-wrapper"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<div id="svg-tip" class="svg-tip svg-tip-one-line" style="pointer-events: none; display: none;">
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
@@ -1,7 +1,4 @@
|
|||||||
{{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
|
{{ define "posts" }}
|
||||||
{{ $section := where .Site.RegularPages "Section" "in" $mainSections }}
|
|
||||||
{{ $section_count := len $section }}
|
|
||||||
{{ $n_posts := $.Param "recent_posts_number" | default 6 }}
|
|
||||||
<div class="col-lg-9 col-md-8 col-12 float-md-left pl-md-2">
|
<div class="col-lg-9 col-md-8 col-12 float-md-left pl-md-2">
|
||||||
<div class="UnderlineNav width-full user-profile-nav top-0 is-placeholder"
|
<div class="UnderlineNav width-full user-profile-nav top-0 is-placeholder"
|
||||||
style="visibility: hidden; display: none; height: 56px;"></div>
|
style="visibility: hidden; display: none; height: 56px;"></div>
|
||||||
@@ -48,4 +45,5 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ end }}
|
@@ -103,5 +103,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ if .IsHome }}
|
||||||
|
{{ block "overview" . }}{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ block "posts" . }}{{ end }}
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@@ -1,2 +1,284 @@
|
|||||||
|
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||||
|
const now = new Date();
|
||||||
|
let contributions;
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
})();
|
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 += `<li class="d-flex mt-1 py-1 flex-row flex-nowrap flex-justify-between"><span class="flex-auto css-truncate css-truncate-target">
|
||||||
|
<span class="profile-rollup-icon">
|
||||||
|
<svg class="octicon octicon-repo v-align-middle text-gray-light mr-1" viewBox="0 0 12 16" version="1.1"
|
||||||
|
width="12" height="16" aria-hidden="true">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<a class="mr-2 " href="${post.link}">${post.title}</a>
|
||||||
|
</span>
|
||||||
|
<time title="This post was made on ${months[post.date.getMonth()]} ${post.date.getDate()}" class="f6 text-gray-light pt-1">
|
||||||
|
${months[post.date.getMonth()]} ${post.date.getDate()}
|
||||||
|
</time></li>`;
|
||||||
|
}
|
||||||
|
let html = `
|
||||||
|
<div class="contribution-activity-listing float-left col-12 col-lg-10">
|
||||||
|
<div class="profile-timeline discussion-timeline width-full pb-4">
|
||||||
|
<h3 class="profile-timeline-month-heading bg-white d-inline-block h6 pr-2 py-1">
|
||||||
|
${months[month]} <span class="text-gray">${monthPosts.length > 0 ? monthPosts[0].date.getFullYear() : year}</span>
|
||||||
|
</h3>
|
||||||
|
<div class="profile-rollup-wrapper py-4 pl-4 position-relative ml-3 js-details-container Details open">
|
||||||
|
<span class="discussion-item-icon"><svg class="octicon octicon-repo" viewBox="0 0 12 16" version="1.1" width="12"
|
||||||
|
height="16" aria-hidden="true">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z">
|
||||||
|
</path>
|
||||||
|
</svg></span>
|
||||||
|
<button type="button" class="btn-link f4 muted-link no-underline lh-condensed width-full js-details-target "
|
||||||
|
aria-expanded="false">
|
||||||
|
<span class="float-left ws-normal text-left">
|
||||||
|
Created ${monthPosts.length} post${monthPosts.length > 1 ? 's' : ''}
|
||||||
|
</span>
|
||||||
|
<span class="d-inline-block float-right">
|
||||||
|
<span class="profile-rollup-toggle-closed float-right" aria_label="Collapse"><svg class="octicon octicon-fold"
|
||||||
|
viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M7 9l3 3H8v3H6v-3H4l3-3zm3-6H8V0H6v3H4l3 3 3-3zm4 2c0-.55-.45-1-1-1h-2.5l-1 1h3l-2 2h-7l-2-2h3l-1-1H1c-.55 0-1 .45-1 1l2.5 2.5L0 10c0 .55.45 1 1 1h2.5l1-1h-3l2-2h7l2 2h-3l1 1H13c.55 0 1-.45 1-1l-2.5-2.5L14 5z">
|
||||||
|
</path>
|
||||||
|
</svg></span>
|
||||||
|
<span class="profile-rollup-toggle-open float-right" aria_label="Expand"><svg class="octicon octicon-unfold"
|
||||||
|
viewBox="0 0 14 16" version="1.1" width="14" height="16" aria-hidden="true">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M11.5 7.5L14 10c0 .55-.45 1-1 1H9v-1h3.5l-2-2h-7l-2 2H5v1H1c-.55 0-1-.45-1-1l2.5-2.5L0 5c0-.55.45-1 1-1h4v1H1.5l2 2h7l2-2H9V4h4c.55 0 1 .45 1 1l-2.5 2.5zM6 6h2V3h2L7 0 4 3h2v3zm2 3H6v3H4l3 3 3-3H8V9z">
|
||||||
|
</path>
|
||||||
|
</svg></span>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<ul class="profile-rollup-content mt-1" data-repository-hovercards-enabled="" id="posts-activity-ul">
|
||||||
|
${liHtml}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function yearList() {
|
||||||
|
const years = [];
|
||||||
|
for (const item of contributions) {
|
||||||
|
const year = item.date.getFullYear();
|
||||||
|
if (!years.includes(year)) {
|
||||||
|
years.push(year);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
years.sort((a, b) => { return b - a });
|
||||||
|
|
||||||
|
for (let i = 0; i < years.length; i++) {
|
||||||
|
const year = years[i];
|
||||||
|
const node = document.createElement('li');
|
||||||
|
node.innerHTML = `<li><a class="js-year-link filter-item px-3 mb-2 py-2" onclick="switchYear('${year}')">${year}</a></li>`;
|
||||||
|
document.querySelector('#year-list').appendChild(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function graph(year, posts, startDate, endDate) {
|
||||||
|
const postsStr = posts.length === 1 ? "post" : "posts";
|
||||||
|
if (year == now.getFullYear().toString()) {
|
||||||
|
document.querySelector('#posts-count').innerText = `${posts.length} ${postsStr} in the last year`;
|
||||||
|
} else {
|
||||||
|
document.querySelector('#posts-count').innerText = `${posts.length} ${postsStr} in ${year}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let html = ``;
|
||||||
|
const count = {};
|
||||||
|
for (const post of posts) {
|
||||||
|
const date = `${post.date.getFullYear()}-${(post.date.getMonth() + 1).toString().padStart(2, '0')}-${post.date.getDate().toString().padStart(2, '0')}`;
|
||||||
|
if (count[date] == undefined) {
|
||||||
|
count[date] = 1;
|
||||||
|
} else {
|
||||||
|
count[date]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const monthPos = [];
|
||||||
|
let startMonth = -1;
|
||||||
|
for (let i = 0; i < 53; i++) {
|
||||||
|
html += `<g transform="translate(${i * 16}, 0)">`;
|
||||||
|
for (let j = 0; j < 7; j++) {
|
||||||
|
const date = new Date(startDate.getTime() + (i * 7 + j) * 24 * 60 * 60 * 1000);
|
||||||
|
const dataDate = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
|
||||||
|
if (date > endDate) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j == 0) {
|
||||||
|
if (i <= 51) {
|
||||||
|
if (startMonth != date.getMonth()) {
|
||||||
|
monthPos.push(i);
|
||||||
|
startMonth = date.getMonth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let c;
|
||||||
|
if (count[dataDate] == undefined) {
|
||||||
|
c = 0;
|
||||||
|
} else {
|
||||||
|
c = count[dataDate];
|
||||||
|
}
|
||||||
|
let color;
|
||||||
|
switch (c) {
|
||||||
|
case 0:
|
||||||
|
color = "var(--color-calendar-graph-day-bg)";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
color = "var(--color-calendar-graph-day-L1-bg)";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
color = "var(--color-calendar-graph-day-L2-bg)";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
color = "var(--color-calendar-graph-day-L3-bg)";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
color = "var(--color-calendar-graph-day-L4-bg)";
|
||||||
|
}
|
||||||
|
html += `<rect class="day" width="11" height="11" x="${16 - i}" y="${j * 15}"
|
||||||
|
fill="${color}" onmouseover="svgTip(this, ${c}, '${dataDate}')" onmouseleave="hideTip()"></rect>`;
|
||||||
|
}
|
||||||
|
html += '</g>';
|
||||||
|
}
|
||||||
|
if (monthPos[1] - monthPos[0] < 2) {
|
||||||
|
monthPos[0] = -1;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < monthPos.length; i++) {
|
||||||
|
const month = monthPos[i];
|
||||||
|
if (month == -1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
html += `<text x="${15 * month + 16}" y="-9"
|
||||||
|
class="month">${months[(i + startDate.getMonth()) % 12]}</text>`;
|
||||||
|
}
|
||||||
|
html += `
|
||||||
|
<text text-anchor="start" class="wday" dx="-10" dy="8"
|
||||||
|
style="display: none;">Sun</text>
|
||||||
|
<text text-anchor="start" class="wday" dx="-10" dy="25">Mon</text>
|
||||||
|
<text text-anchor="start" class="wday" dx="-10" dy="32"
|
||||||
|
style="display: none;">Tue</text>
|
||||||
|
<text text-anchor="start" class="wday" dx="-10" dy="56">Wed</text>
|
||||||
|
<text text-anchor="start" class="wday" dx="-10" dy="57"
|
||||||
|
style="display: none;">Thu</text>
|
||||||
|
<text text-anchor="start" class="wday" dx="-10" dy="85">Fri</text>
|
||||||
|
<text text-anchor="start" class="wday" dx="-10" dy="81"
|
||||||
|
style="display: none;">Sat</text>
|
||||||
|
`;
|
||||||
|
document.querySelector('#graph-svg').innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
let svgElem;
|
||||||
|
|
||||||
|
function svgTip(elem, count, dateStr) {
|
||||||
|
svgElem = document.createElement('div');
|
||||||
|
svgElem.style.cssText = 'pointer-events: none; display: none;';
|
||||||
|
svgElem.classList.add(...["svg-tip", "svg-tip-one-line"]);
|
||||||
|
const rect = getCoords(elem);
|
||||||
|
const date = new Date(dateStr);
|
||||||
|
const dateFmt = `${months[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
|
||||||
|
if (count) {
|
||||||
|
svgElem.innerHTML = `<strong>${count} posts</strong> on ${dateFmt}`;
|
||||||
|
} else {
|
||||||
|
svgElem.innerHTML = `<strong>No posts</strong> on ${dateFmt}`;
|
||||||
|
}
|
||||||
|
svgElem.style.top = `${rect.top - 50}px`;
|
||||||
|
svgElem.style.left = `${rect.left - 78}px`;
|
||||||
|
svgElem.style.display = 'block';
|
||||||
|
document.body.appendChild(svgElem);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideTip() {
|
||||||
|
svgElem.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCoords(elem) {
|
||||||
|
var box = elem.getBoundingClientRect();
|
||||||
|
|
||||||
|
var body = document.body;
|
||||||
|
var docEl = document.documentElement;
|
||||||
|
|
||||||
|
var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop;
|
||||||
|
var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft;
|
||||||
|
|
||||||
|
var clientTop = docEl.clientTop || body.clientTop || 0;
|
||||||
|
var clientLeft = docEl.clientLeft || body.clientLeft || 0;
|
||||||
|
|
||||||
|
var top = box.top + scrollTop - clientTop;
|
||||||
|
var left = box.left + scrollLeft - clientLeft;
|
||||||
|
|
||||||
|
return { top: Math.round(top), left: Math.round(left) };
|
||||||
|
}
|
@@ -10,7 +10,6 @@ function switchTheme() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setTheme(style) {
|
function setTheme(style) {
|
||||||
console.log(`set theme ${style}`);
|
|
||||||
document.querySelectorAll('.isInitialToggle').forEach(elem => {
|
document.querySelectorAll('.isInitialToggle').forEach(elem => {
|
||||||
elem.classList.remove('isInitialToggle');
|
elem.classList.remove('isInitialToggle');
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user