Add layout localization

This commit is contained in:
Cotes Chung 2021-07-21 01:01:09 +08:00
parent 2e76300d04
commit 0b29c0321f
35 changed files with 394 additions and 193 deletions

View file

@ -7,14 +7,21 @@ theme: jekyll-theme-chirpy
# change below value to '/projectname'.
baseurl: ''
# the HTML language tag https://www.w3.org/International/questions/qa-choosing-language-tags
lang: en-US
# The language of the site layout http://www.lingoes.net/en/translator/langcode.htm
# Go to folder '_data/locales' to check the available language options
lang: en
# The lang attribute of HTML http://www.lingoes.net/en/translator/langcode.htm
# We can specify a language different from the layout of the content.
# If it is not assigned, the site will use the value of 'lang' instead.
content_lang: ''
# Change to your timezone http://www.timezoneconverter.com/cgi-bin/findzone/findzone
timezone: Asia/Shanghai
# jekyll-seo-tag settings https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
# --------------------------
# ↓ --------------------------
title: Chirpy # the main title
tagline: A text-focused Jekyll theme # it will display as the sub-title
@ -47,7 +54,9 @@ social:
# - https://www.linkedin.com/in/username
google_site_verification: google_meta_tag_verification # change to your verification string
# --------------------------
# ↑ --------------------------
google_analytics:
id: '' # fill in your Google Analytics ID
@ -164,3 +173,6 @@ jekyll-archives:
permalinks:
tag: /tags/:name/
category: /categories/:name/
# Outdated configuration warning
outdated: '-- Missing configuration options! --'

View file

@ -1,7 +0,0 @@
# The date format
tooltip: "%a, %b %e, %Y, %l:%M %p %z"
post:
long: "%b %e, %Y"
short: "%b %e"

View file

@ -1,19 +0,0 @@
# The label text of site.
panel:
lastmod: Recent Update
trending_tags: Trending Tags
toc: Contents
post:
relate_posts: Further Reading
share: Share
button:
next: Newer
previous: Older
search_hint: Search # text show on search bar
pin_prompt: Pinned # pinned prompt
read_time_unit: min # see posts' time to read

87
_data/locales/en.yml Normal file
View file

@ -0,0 +1,87 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Post
category: Category
tag: Tag
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Home
categories: Categories
tags: Tags
archives: Archives
about: About
# text displayed in the search bar
search:
hint: search
cancel: Cancel
panel:
lastmod: Recent Update
trending_tags: Trending Tags
toc: Contents
# The liquid date format http://strftime.net/
date_format:
tooltip: '%a, %b %e, %Y, %l:%M %p %z'
post:
long: '%b %e, %Y'
short: '%b %e'
archive_month: '%b'
copyright:
# Shown at the bottom of the post
license:
template: This post is licensed under :LICENSE_NAME by the author.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Some rights reserved.
verbose: >-
Except where otherwise noted, the blog posts on this site are licensed
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.
meta: Powered by :PLATFORM with :THEME theme.
not_found:
statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.
hint_template: :HEAD_BAK to try finding it again, or search for it on the :ARCHIVES_PAGE.
head_back: Head back Home
archives_page: Archives page
# ----- Posts related labels -----
post:
published: 'on'
updated: Updated
timeago:
day: d ago
hour: hr ago
minute: min ago
just_now: just now
words: words
pageview_measure: views
read_time:
unit: min
prompt: read
relate_posts: Further Reading
share: Share
button:
next: Newer
previous: Older
copy:
title: Copy link
succeed: Link copied successfully!
# pinned prompt of posts list on homepage
pin_prompt: Pinned
# categories page
categories:
category_measure: categories
post_measure: posts

86
_data/locales/zh-CN.yml Normal file
View file

@ -0,0 +1,86 @@
# The layout text of site
# ----- Commons label -----
layout:
post: 文章
category: 分类
tag: 标签
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: 首页
categories: 分类
tags: 标签
archives: 归档
about: 关于
# text displayed in the search bar
search:
hint: 搜索
cancel: 取消
panel:
lastmod: 最近更新
trending_tags: 热门标签
toc: 目录
# The liquid date format http://strftime.net/
date_format:
tooltip: '%a, %F, %R %z'
post:
long: '%F'
short: '%m-%d'
archive_month: '%m月'
copyright:
# Shown at the bottom of the post
license:
template: 本文由作者按照 :LICENSE_NAME 进行授权
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: 保留部分权利。
verbose: >-
除非另有说明,本网站上的博客文章均由作者按照知识共享署名 4.0 国际 (CC BY 4.0) 许可协议进行授权。
meta: 本站由 :PLATFORM 生成,采用 :THEME 主题。
not_found:
statment: 抱歉,我们放错了该 URL或者它指向了不存在的内容。
hint_template: :HEAD_BAK尝试再次查找它或在:ARCHIVES_PAGE上搜索它。
head_back: 返回主页
archives_page: 归档页面
# ----- Posts related labels -----
post:
published: 发表于
updated: 更新于
timeago:
day: 天前
hour: 小时前
minute: 分钟前
just_now: 刚刚
words:
pageview_measure: 次浏览
read_time:
unit: 分钟
prompt: 阅读
relate_posts: 相关文章
share: 分享
button:
next: 下一篇
previous: 上一篇
copy:
title: 分享链接
succeed: 链接已复制!
# pinned prompt of posts list on homepage
pin_prompt: 顶置
# categories page
categories:
category_measure: 个分类
post_measure: 篇文章

View file

@ -1,11 +0,0 @@
# License data
license:
name: CC BY 4.0
link: "https://creativecommons.org/licenses/by/4.0/"
brief: Some rights reserved.
verbose: >-
Except where otherwise noted, the blog posts on this site are licensed
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.

View file

@ -8,21 +8,30 @@
<p class="mb-0">
© {{ 'now' | date: "%Y" }}
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
{% if site.data.rights.brief %}
{% if site.data.locales[site.lang].copyright.brief %}
<span data-toggle="tooltip" data-placement="top"
title="{{ site.data.rights.verbose }}">{{ site.data.rights.brief }}</span>
title="{{ site.data.locales[site.lang].copyright.verbose }}">{{ site.data.locales[site.lang].copyright.brief }}</span>
{% else %}
<span class="text-muted">{{ site.outdated }}</span>
{% endif %}
</p>
</div>
<div class="footer-right">
<p class="mb-0">
Powered by
{% capture _platform %}
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
with
<a href="https://github.com/cotes2020/jekyll-theme-chirpy"
target="_blank" rel="noopener">Chirpy</a>
theme.
{% endcapture %}
{% capture _theme %}
<a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
{% endcapture %}
{{ site.data.locales[site.lang].meta
| default: 'Powered by :PLATFORM with :THEME theme.'
| replace: ':PLATFORM', _platform | replace: ':THEME', _theme
}}
</p>
</div>

View file

@ -8,6 +8,13 @@
{% if page.layout == 'home' or page.layout == 'post' %}
<!-- i18n for timeago.js -->
<meta name="layout-lang" content="{{ site.lang | default: "en" }}">
<meta name="day-prompt" content="{{ site.data.locales[site.lang].post.timeago.day | default: "d ago" }}">
<meta name="hour-prompt" content="{{ site.data.locales[site.lang].post.timeago.hour | default: "hr ago" }}">
<meta name="minute-prompt" content="{{ site.data.locales[site.lang].post.timeago.minute | default: "min ago" }}">
<meta name="justnow-prompt" content="{{ site.data.locales[site.lang].post.timeago.just_now | default: "just now" }}">
{% if site.google_analytics.pv.proxy_endpoint %}
<meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}">
{% endif %}

View file

@ -0,0 +1,13 @@
{% comment %}
Remove the zero padding from a month/day string
{% endcomment %}
{% assign ret = include.date_str %}
{% assign _first_chat = ret | slice: 0 %}
{% if _first_chat == '0' %}
{% assign _last_idx = ret.size | minus: 1 %}
{% assign ret = ret | slice: 1, _last_idx %}
{% endif %}
{{ ret | replace: ' 0', ' ' }}

View file

@ -11,7 +11,7 @@
{% if update_list.size > 0 %}
<div id="access-lastmod" class="post">
<span>{{- site.data.label.panel.lastmod | default: 'Recent Update' -}}</span>
<span>{{- site.data.locales[site.lang].panel.lastmod | default: 'Recent Update' -}}</span>
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
{% for item in update_list %}
@ -30,7 +30,7 @@
{% if trending_tags.size > 0 %}
<div id="access-tags">
<span>{{- site.data.label.panel.trending_tags | default: 'Trending Tags' -}}</span>
<span>{{- site.data.locales[site.lang].panel.trending_tags | default: 'Trending Tags' -}}</span>
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
{% for tag_name in trending_tags %}
@ -48,7 +48,7 @@
<script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"></script>
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<span class="pl-3 pt-2 mb-2">
{{- site.data.label.panel.toc | default: 'Contents' -}}
{{- site.data.locales[site.lang].panel.toc | default: 'Contents' -}}
</span>
<nav id="toc" data-toggle="toc"></nav>
</div>

View file

@ -5,24 +5,24 @@
<div class="post-navigation d-flex justify-content-between">
{% if page.previous.url %}
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary"
prompt="{{ site.data.label.post.button.previous | default: 'previous' }}">
prompt="{{ site.data.locales[site.lang].post.button.previous | default: 'previous' }}">
<p>{{ page.previous.title }}</p>
</a>
{% else %}
<span class="btn btn-outline-primary disabled"
prompt="{{ site.data.label.post.button.previous | default: 'previous' }}">
prompt="{{ site.data.locales[site.lang].post.button.previous | default: 'previous' }}">
<p>-</p>
</span>
{% endif %}
{% if page.next.url %}
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary"
prompt="{{ site.data.label.post.button.next | default: 'next' }}">
prompt="{{ site.data.locales[site.lang].post.button.next | default: 'next' }}">
<p>{{ page.next.title }}</p>
</a>
{% else %}
<span class="btn btn-outline-primary disabled"
prompt="{{ site.data.label.post.button.next | default: 'next' }}">
prompt="{{ site.data.locales[site.lang].post.button.next | default: 'next' }}">
<p>-</p>
</span>
{% endif %}

View file

@ -3,7 +3,7 @@
-->
<div class="share-wrapper">
<span class="share-label text-muted mr-1">{{ site.data.label.post.share | default: 'Share' }}</span>
<span class="share-label text-muted mr-1">{{ site.data.locales[site.lang].post.share | default: 'Share' }}</span>
<span class="share-icons">
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
{% assign url = page.url | absolute_url %}
@ -16,8 +16,10 @@
</a>
{% endfor %}
<i class="fa-fw fas fa-link small" onclick="copyLink()"
data-toggle="tooltip" data-placement="top" title="Copy link"></i>
<i class="fa-fw fas fa-link small" onclick="copyLink('', '{{ site.data.locales[site.lang].post.button.copy.succeed }}')"
data-toggle="tooltip" data-placement="top"
title="{{ site.data.locales[site.lang].post.button.copy.title }}">
</i>
</span>
</div>

View file

@ -1,9 +1,11 @@
<!--
Calculate the post's reading time, and display the word count in tooltip
-->
{% assign words = include.content | strip_html | number_of_words: "auto" %}
<!-- words per minute -->
{% assign wpm = 180 %}
{% assign min_time = 1 %}
@ -13,7 +15,15 @@
{% assign read_time = min_time %}
{% endunless %}
{% capture read_prompt %}
{{- site.data.locales[site.lang].post.read_time.prompt | default: "read" -}}
{% endcapture %}
<!-- return element -->
<span class="readtime" data-toggle="tooltip" data-placement="bottom" title="{{ words }} words">
{{- read_time -}}{{" "}}{{- site.data.label.read_time_unit | default: "min" -}}
<span class="readtime" data-toggle="tooltip" data-placement="bottom"
title="{{ words }} {{ site.data.locales[site.lang].post.words | default: "words" }}">
{{- read_time -}}{{" "}}{{- site.data.locales[site.lang].post.read_time.unit | default: "min" -}}
{%- if include.prompt -%}
{% unless site.lang contains 'zh' %}{{" "}}{% endunless %}{{ read_prompt }}
{%- endif -%}
</span>

View file

@ -81,7 +81,7 @@
{% if index_list.size > 0 %}
<div id="related-posts" class="mt-5 mb-2 mb-sm-4">
<h3 class="pt-2 mt-1 mb-4 ml-1"
data-toc-skip>{{ site.data.label.post.relate_posts | default: 'Further Reading' }}</h3>
data-toc-skip>{{ site.data.locales[site.lang].post.relate_posts | default: 'Further Reading' }}</h3>
<div class="card-deck mb-4">
{% for entry in index_list %}
{% assign index = entry | plus: 0 %}

View file

@ -4,7 +4,7 @@
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
<div class="col-12 col-sm-11 post-content">
<div id="search-hints">
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags | default: 'Trending Tags' }}</h4>
<h4 class="text-muted mb-4">{{ site.data.locales[site.lang].panel.trending_tags | default: 'Trending Tags' }}</h4>
{% include trending-tags.html %}

View file

@ -2,8 +2,7 @@
The Side Bar
-->
<div id="sidebar" class="d-flex flex-column align-items-end">
<div id="sidebar" class="d-flex flex-column align-items-end" lang="{{lang}}">
<div class="profile-wrapper text-center">
<div id="avatar">
<a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto">
@ -21,19 +20,19 @@
</div>
<div class="site-title mt-3">
<a href="{{ '/' | relative_url }}">{{- site.title -}}</a>
<a href="{{ '/' | relative_url }}">{{ site.title }}</a>
</div>
<div class="site-subtitle font-italic">{{- site.tagline -}}</div>
<div class="site-subtitle font-italic">{{ site.tagline }}</div>
</div><!-- .profile-wrapper -->
<ul class="w-100">
<!-- home -->
<li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}">
<a href="{{ '/' | relative_url }}" class="nav-link">
<i class="fa-fw fas fa-home ml-xl-3 mr-xl-3 unloaded"></i>
<span>{{ "HOME" }}</span>
<span>{{ site.data.locales[site.lang].tabs.home | default: "home" | upcase }}</span>
</a>
</li>
<!-- the real tabs -->
@ -41,7 +40,9 @@
<li class="nav-item{% if tab.url == page.url %}{{ " active" }}{% endif %}">
<a href="{{ tab.url | relative_url }}" class="nav-link">
<i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
<span>{{ tab.title | upcase }}</span>
{% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %}
<span>{{ site.data.locales[site.lang].tabs.[tab_name] | default: tab_name | upcase }}</span>
</a>
</li> <!-- .nav-item -->
{% endfor %}

View file

@ -3,9 +3,9 @@
See: /assets/js/_utils/timeage.js
-->
{% assign tooltip_df = site.data.date_format.tooltip | default: '%a, %b %e, %Y, %l:%M %p %z' %}
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
{% assign post_short_df = site.data.date_format.post.short | default: '%b %e' %}
{% assign tooltip_df = site.data.locales[site.lang].date_format.tooltip | default: '%a, %b %e, %Y, %l:%M %p %z' %}
{% assign post_long_df = site.data.locales[site.lang].date_format.post.long | default: '%b %e, %Y' %}
{% assign post_short_df = site.data.locales[site.lang].date_format.post.short | default: '%b %e' %}
{% if include.preposition %}
{{ include.preposition }}
@ -15,18 +15,13 @@
data-toggle="tooltip"
data-placement="bottom"
title="{{ include.date | date: tooltip_df }}"
{% endif %}
{% if include.prefix %}prefix="{{ include.prefix }} "{% endif%}>
{% assign this_year = site.time | date: "%Y" %}
{% assign post_year = include.date | date: "%Y" %}
{% if post_year == this_year %}
{% endif %}>
{%- assign this_year = site.time | date: "%Y" -%}
{%- assign post_year = include.date | date: "%Y" -%}
{%- if post_year == this_year -%}
{{ include.date | date: post_short_df }}
{% else %}
{%- else -%}
{{ include.date | date: post_long_df }}
{% endif %}
{%- endif -%}
<i class="unloaded">{{ include.date | date_to_xmlschema }}</i>
</span>

View file

@ -10,32 +10,37 @@
{% if paths.size == 0 or page.layout == 'home' %}
<!-- index page -->
<span>{{ 'Posts' }}</span>
<span>{{ site.data.locales[site.lang].tabs.home | default: 'home' | capitalize }}</span>
{% else %}
{% for item in paths %}
{% if forloop.first %}
{% unless page.layout == 'post' %}
<span>
<a href="{{ '/' | relative_url }}">{{ 'Home' }}</a>
</span>
{% endunless %}
{% elsif forloop.last %}
<span>{{ page.title }}</span>
{% else %}
<span>
{% assign url = item %}
{% if item == 'posts' and page.layout == 'post' %}
{% assign url = '/' %}
{% endif %}
<a href="{{ url | relative_url }}">
{{ item | capitalize }}
<a href="{{ '/' | relative_url }}">
{{ site.data.locales[site.lang].tabs.home | default: 'home' | capitalize }}
</a>
</span>
{% elsif forloop.last %}
{% if page.collection == 'tabs' %}
<span>{{ site.data.locales[site.lang].tabs[item] | default: page.title }}</span>
{% else %}
<span>{{ page.title }}</span>
{% endif %}
{% else %}
{% unless page.layout == 'post' %}
<span>
<a href="{{ item | relative_url }}">
{{ site.data.locales[site.lang].tabs[item] | default: page.title }}
</a>
</span>
{% endunless %}
{% endif %}
{% endfor %}
@ -48,11 +53,12 @@
<div id="topbar-title">
{% if page.layout == 'home' %}
{{- site.title -}}
{% elsif page.dynamic_title %}
{{- page.title -}}
{{- site.data.locales[site.lang].title | default: site.title -}}
{% elsif page.collection == 'tabs' %}
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
{{- site.data.locales[site.lang].tabs[tab_key] | default: page.title -}}
{% else %}
{{- page.layout | capitalize -}}
{{- site.data.locales[site.lang].layout[page.layout] | default: page.layout | capitalize -}}
{% endif %}
</div>
@ -60,10 +66,10 @@
<span id="search-wrapper" class="align-items-center">
<i class="fas fa-search fa-fw"></i>
<input class="form-control" id="search-input" type="search"
aria-label="search" autocomplete="off" placeholder="{{ site.data.label.search_hint | default: 'Search' }}...">
aria-label="search" autocomplete="off" placeholder="{{ site.data.locales[site.lang].search.hint | default: 'Search' | capitalize }}...">
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
</span>
<span id="search-cancel" >Cancel</span>
<span id="search-cancel" >{{ site.data.locales[site.lang].search.cancel | default: 'Cancel' }}</span>
</div>
</div>

View file

@ -2,7 +2,7 @@
* Copy current page url to clipboard.
*/
function copyLink(url) {
function copyLink(url, msg) {
if (!url || 0 === url.length) {
url = window.location.href;
}
@ -13,6 +13,10 @@ function copyLink(url) {
document.execCommand("copy");
$temp.remove();
alert("Link copied successfully!");
let feedback = "Link copied successfully!";
if (msg && msg.length > 0) {
feedback = msg;
}
alert(feedback);
}

View file

@ -10,25 +10,19 @@ $(function() {
let intervalId = void 0;
function timeago(iso) {
const locale = $("meta[name=layout-lang]").attr("content");
const dPrompt = $("meta[name=day-prompt]").attr("content");
const hrPrompt = $("meta[name=hour-prompt]").attr("content");
const minPrompt = $("meta[name=minute-prompt]").attr("content");
const justnowPrompt = $("meta[name=justnow-prompt]").attr("content");
function timeago(isoDate, dateStr) {
let now = new Date();
let past = new Date(iso);
let past = new Date(isoDate);
if (past.getFullYear() !== now.getFullYear()) {
toRefresh -= 1;
return past.toLocaleString("en-US", {
year: "numeric",
month: "short",
day: "numeric"
});
}
if (past.getMonth() !== now.getMonth()) {
toRefresh -= 1;
return past.toLocaleString("en-US", {
month: "short",
day: "numeric"
});
if (past.getFullYear() !== now.getFullYear()
|| past.getMonth() !== now.getMonth()) {
return dateStr;
}
let seconds = Math.floor((now - past) / 1000);
@ -36,28 +30,29 @@ $(function() {
let day = Math.floor(seconds / 86400);
if (day >= 1) {
toRefresh -= 1;
return day + " day" + (day > 1 ? "s" : "") + " ago";
return ` ${day} ${dPrompt}`;
}
let hour = Math.floor(seconds / 3600);
if (hour >= 1) {
return hour + " hour" + (hour > 1 ? "s" : "") + " ago";
return ` ${hour} ${hrPrompt}`;
}
let minute = Math.floor(seconds / 60);
if (minute >= 1) {
return minute + " minute" + (minute > 1 ? "s" : "") + " ago";
return ` ${minute} ${minPrompt}`;
}
return "just now";
return justnowPrompt;
}
function updateTimeago() {
$(".timeago").each(function() {
if ($(this).children("i").length > 0) {
let dateStr = $(this).clone().children().remove().end().text();
let node = $(this).children("i");
let date = node.text(); /* ISO Date: "YYYY-MM-DDTHH:MM:SSZ" */
$(this).text(timeago(date, $(this).attr("prep")));
let iosDate = node.text(); /* ISO Date: "YYYY-MM-DDTHH:MM:SSZ" */
$(this).text(timeago(iosDate, dateStr));
$(this).append(node);
}
});

View file

@ -3,8 +3,8 @@ layout: page
# The Archives of posts.
---
<div id="archives" class="pl-xl-2">
{% for post in site.posts %}
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% capture pre_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
@ -17,9 +17,10 @@ layout: page
<li>
<div>
{% capture this_day %}{{ post.date | date: "%d" }}{% endcapture %}
{% capture this_month %}{{ post.date | date: "%b" }}{% endcapture %}
{% capture _mth_df %}{{ site.data.locales[site.lang].date_format.post.archive_month | default: "%b" }}{% endcapture %}
{% capture this_month %}{{ post.date | date: _mth_df }}{% endcapture %}
<span class="date day">{{ this_day }}</span>
<span class="date month small text-muted">{{ this_month }}</span>
<span class="date month small text-muted">{% include no-zero-date.html date_str=this_month %}</span>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</div>
</li>

View file

@ -3,7 +3,6 @@ layout: page
# All the Categories of posts
---
{% assign HEAD_PREFIX = "h_" %}
{% assign LIST_PREFIX = "l_" %}
@ -33,28 +32,23 @@ layout: page
<div class="card categories">
<!-- top-category -->
<div class="card-header d-flex justify-content-between hide-border-bottom"
id="{{ HEAD_PREFIX }}{{ group_index }}">
<div id="{{ HEAD_PREFIX }}{{ group_index }}"
class="card-header d-flex justify-content-between hide-border-bottom">
<span>
{% if sub_categories_size > 0 %}
<i class="far fa-folder-open fa-fw"></i>
{% else %}
<i class="far fa-folder fa-fw"></i>
{% endif %}
<a href="{{ site.baseurl }}/categories/{{ category_name | slugify | url_encode }}/"
class="ml-1 mr-2">
{{ category_name }}
</a>
<i class="far fa-folder{% if sub_categories_size > 0 %}-open{% endif %} fa-fw"></i>
{% capture _category_url %}/categories/{{ category_name | slugify | url_encode }}/{% endcapture %}
<a href="{{ _category_url | relative_url }}" class="ml-1 mr-2">{{ category_name }}</a>
<!-- content count -->
{% assign top_posts_size = site.categories[category_name] | size %}
<span class="text-muted small font-weight-light">
{% if sub_categories_size > 0 %}
{{ sub_categories_size }}
{% if sub_categories_size > 1 %}categories{% else %}category{% endif %},
{{ site.data.locales[site.lang].categories.category_measure | default: 'categories' }},
{% endif %}
{{ top_posts_size }}
post{% if top_posts_size > 1 %}s{% endif %}
{{ site.data.locales[site.lang].categories.post_measure | default: 'posts' }}
</span>
</span>
@ -80,11 +74,14 @@ layout: page
{% for sub_category in sub_categories %}
<li class="list-group-item">
<i class="far fa-folder fa-fw"></i>
<a href="{{ site.baseurl }}/categories/{{ sub_category | slugify | url_encode }}/"
class="ml-1 mr-2">{{ sub_category }}</a>
{% capture _sub_ctg_url %}/categories/{{ sub_category | slugify | url_encode }}/{% endcapture %}
<a href="{{ _sub_ctg_url | relative_url }}" class="ml-1 mr-2">{{ sub_category }}</a>
{% assign posts_size = site.categories[sub_category] | size %}
<span class="text-muted small font-weight-light">{{ posts_size }}
post{% if posts_size > 1 %}s{% endif %}
<span class="text-muted small font-weight-light">
{{ posts_size }}
{{ site.data.locales[site.lang].categories.post_measure | default: 'posts' }}
</span>
</li>
{% endfor %}

View file

@ -11,13 +11,13 @@ layout: page
</h1>
<ul class="post-content pl-0">
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
{% assign post_df = site.data.locales[site.lang].date_format.post.long | default: '%b %e, %Y' %}
{% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: post_long_df }}</span>
<span class="text-muted small">{{ post.date | date: post_df }}</span>
</li>
{% endfor %}
</ul>

View file

@ -11,7 +11,7 @@ layout: compress
{% endif %}
{% endcapture %}
<html lang="{{ site.lang | default: "en-US" }}" {{ prefer_mode }}>
<html lang="{{ site.content_lang | default: site.lang }}" {{ prefer_mode }}>
{% include head.html %}

View file

@ -3,9 +3,9 @@ layout: page
# The Home page layout
---
{% assign pinned = site.posts | where_exp: "item", "item.pin == true" %}
{% assign pinned = site.posts | where: "pin", "true" %}
{% assign default = site.posts | where_exp: "item", "item.pin != true" %}
{% assign posts = "" | split: "" %}
<!-- Get pinned posts -->
@ -39,7 +39,6 @@ layout: page
{% endfor %}
{% endif %}
<div id="post-list">
{% for post in posts %}
@ -79,7 +78,7 @@ layout: page
{% if post.pin %}
<div class="pin">
<i class="fas fa-thumbtack fa-fw"></i>
<span>{{ site.data.label.pin_prompt | default: 'Pinned' }}</span>
<span>{{ site.data.locales[site.lang].post.pin_prompt | default: 'Pinned' }}</span>
</div>
{% endif %}

View file

@ -7,7 +7,14 @@ layout: default
<div class="col-12 col-lg-11 col-xl-8">
<div id="page" class="post pb-5 pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4 mb-md-4">
{% if page.dynamic_title %}
<h1 class="dynamic-title">{{ page.title }}</h1>
<h1 class="dynamic-title">
{% if page.collection == 'tabs' %}
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
{{- site.data.locales[site.lang].tabs[tab_key] | default: page.title -}}
{% else %}
{{- page.title -}}
{% endif %}
</h1>
<div class="post-content">
{{ content }}
</div>

View file

@ -17,24 +17,28 @@ layout: default
<span class="semi-bold">
{{ page.author | default: site.social.name }}
</span>
{% include timeago.html date=page.date preposition="on" tooltip=true %}
{% capture _preposition %}{{ site.data.locales[site.lang].post.published | default: 'on' }}{% endcapture %}
{% include timeago.html date=page.date tooltip=true preposition=_preposition %}
</div>
<div>
<!-- lastmod -->
{% if page.last_modified_at %}
<span>
{% include timeago.html date=page.last_modified_at
class="lastmod" prefix="Updated" tooltip=true %}
{{ site.data.locales[site.lang].post.updated | default: 'Updated' }}
{% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
</span>
{% endif %}
<!-- read time -->
{% include read-time.html content=content %}
{% include read-time.html content=content prompt=true %}
<!-- page views -->
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<span id="pv" class="pageviews"><i class="fas fa-spinner fa-spin fa-fw"></i></span>
<span id="pv" class="pageviews">
<i class="fas fa-spinner fa-spin fa-fw"></i>
</span>
{{ site.data.locales[site.lang].post.pageview_measure | default: "views" }}
{% endif %}
</div>
@ -59,6 +63,7 @@ layout: default
<!-- categories -->
{% if page.categories.size > 0 %}
<div class="post-meta mb-3">
<i class="far fa-folder-open fa-fw mr-1"></i>
{% for category in page.categories %}
@ -83,13 +88,18 @@ layout: default
<div class="post-tail-bottom
d-flex justify-content-between align-items-center mt-3 pt-5 pb-2">
{% if site.data.rights.license %}
<div class="license-wrapper">
This post is licensed under
<a href="{{ site.data.rights.license.link }}">{{ site.data.rights.license.name }}</a>
by the author.
</div>
{% if site.data.locales[site.lang].copyright.license.template %}
{% capture _replacement %}
<a href="{{ site.data.locales[site.lang].copyright.license.link }}">
{{ site.data.locales[site.lang].copyright.license.name }}
</a>
{% endcapture %}
{{ site.data.locales[site.lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
{% else %}
<span class="text-muted small">{{ site.outdated }}</span>
{% endif %}
</div>
{% include post-sharing.html %}

View file

@ -3,7 +3,6 @@ layout: page
# The layout for Tag page
---
<div id="page-tag">
<h1 class="pl-lg-2">
<i class="fa fa-tag fa-fw text-muted"></i>
@ -11,13 +10,13 @@ layout: page
<span class="lead text-muted pl-2">{{ page.posts | size }}</span>
</h1>
<ul class="post-content pl-0">
{% assign post_long_df = site.data.date_format.post.long | default: '%b %e, %Y' %}
{% assign post_df = site.data.locales[site.lang].date_format.post.long | default: '%b %e, %Y' %}
{% for post in page.posts %}
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="dash flex-grow-1"></span>
<span class="text-muted small">{{ post.date | date: post_long_df }}</span>
<span class="text-muted small">{{ post.date | date: post_df }}</span>
</li>
{% endfor %}
</ul>

View file

@ -893,7 +893,7 @@ $sidebar-display: "sidebar-display";
#search-wrapper {
display: flex;
width: 95%;
width: 85%;
border-radius: 1rem;
border: 1px solid var(--search-wrapper-bg);
background: var(--search-wrapper-bg);

View file

@ -23,24 +23,12 @@
padding-right: $pr;
}
.timeago::before {
content: attr(prefix);
}
#post-wrapper .post-meta {
> div:nth-child(2) {
> span:not(:first-child)::before {
@include dot;
}
}
#pv::after {
content: " views";
}
.readtime::after {
content: " read";
}
}
.post-content {

View file

@ -12,10 +12,20 @@ dynamic_title: true
---
<div class="lead">
<p>Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. </p>
<p>
<a href="{{ '/' | relative_url }}">Head back Home</a>
to try finding it again, or search for it on the
<a href="{{ 'archives' | relative_url }}">Archives page</a>.
{%- capture _head_back -%}
<a href="{{ '/' | relative_url }}">{{ site.data.locales[site.lang].not_found.head_back }}</a>
{%- endcapture -%}
{%- capture _archives_page -%}
<a href="{{ 'archives' | relative_url }}">{{ site.data.locales[site.lang].not_found.archives_page }}</a>
{%- endcapture -%}
<p>{{site.data.locales[site.lang].not_found.statment }}</p>
<p>{{ site.data.locales[site.lang].not_found.hint_template
| replace: ':HEAD_BAK', _head_back
| replace: ':ARCHIVES_PAGE', _archives_page }}
</p>
</div>

View file

@ -15,7 +15,7 @@ permalink: /feed.xml
<uri>{{ "/" | absolute_url }}</uri>
</author>
<link rel="self" type="application/atom+xml" href="{{ page.url | absolute_url }}"/>
<link rel="alternate" type="text/html" hreflang="{{ site.lang | default: 'en' }}"
<link rel="alternate" type="text/html" hreflang="{{ site.content_lang | default: site.lang }}"
href="{{ '/' | absolute_url }}"/>
<generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator>
<rights> © {{ 'now' | date: '%Y' }} {{ site.social.name }} </rights>

View file

@ -3,4 +3,4 @@
* © 2019 Cotes Chung
* MIT Licensed
*/
$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),s=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),r=$("#search-result-wrapper"),i=$("#search-results"),d=$("#search-input"),c=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),h={on(){e.addClass("unloaded"),l.addClass("unloaded"),t.addClass("unloaded"),n.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),t.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),r.removeClass("unloaded"),s.addClass("unloaded"),e=!0)},off(){e&&(i.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),a.removeClass("visible"),s.removeClass("unloaded"),u.release(),d.val(""),e=!1)},isVisible:()=>e}}();function p(){return o.hasClass("loaded")}t.click(function(){h.on(),f.on(),d.focus()}),o.click(function(){h.off(),f.off()}),d.focus(function(){n.addClass("input-focus")}),d.focusout(function(){n.removeClass("input-focus")}),d.on("keyup",function(e){8===e.keyCode&&""===d.val()?p()?c.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),p()&&c.addClass("unloaded"))}),a.on("click",function(){d.val(""),p()?(c.removeClass("unloaded"),i.empty()):f.off(),d.focus(),a.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const t=$("body");return{toggle(){!1===e?t.attr("sidebar-display",""):t.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),t=$("#toc-wrapper"),o=$(".access"),a=$("#search-input");let s,l=0;const n=5,r=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(s=!0)}),setInterval(function(){s&&(!function(){var s=$(this).scrollTop();Math.abs(l-s)<=n||(s>l&&s>r?(e.removeClass("topbar-down").addClass("topbar-up"),t.length>0&&t.removeClass("topbar-down"),o.length>0&&o.removeClass("topbar-down"),a.is(":focus")&&a.blur()):s+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),t.length>0&&t.addClass("topbar-down"),o.length>0&&o.addClass("topbar-down")),l=s)}(),s=!1)},250)}),$(function(){const e=$("#topbar-title"),t=$("div.post>h1"),o=e.text().trim();let a=t.length>0?t.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||t.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==a&&e.text(a):e.text()!==o&&e.text(o)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){let e=$(".timeago").length,t=void 0;function o(){return $(".timeago").each(function(){if($(this).children("i").length>0){let t=$(this).children("i"),o=t.text();$(this).text(function(t){let o=new Date,a=new Date(t);if(a.getFullYear()!==o.getFullYear())return e-=1,a.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric"});if(a.getMonth()!==o.getMonth())return e-=1,a.toLocaleString("en-US",{month:"short",day:"numeric"});let s=Math.floor((o-a)/1e3),l=Math.floor(s/86400);if(l>=1)return e-=1,l+" day"+(l>1?"s":"")+" ago";let n=Math.floor(s/3600);if(n>=1)return n+" hour"+(n>1?"s":"")+" ago";let r=Math.floor(s/60);return r>=1?r+" minute"+(r>1?"s":"")+" ago":"just now"}(o,$(this).attr("prep"))),$(this).append(t)}}),0===e&&void 0!==t&&clearInterval(t),e}0!==e&&o()>0&&(t=setInterval(o,6e4))});
$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){const t=$("#sidebar-trigger"),e=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),n=$("#main"),l=$("#topbar-title"),s=$("#search-wrapper"),r=$("#search-result-wrapper"),i=$("#search-results"),d=$("#search-input"),c=$("#search-hints"),u=function(){let t=0;return{block(){t=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(t)},getOffset:()=>t}}(),p={on(){t.addClass("unloaded"),l.addClass("unloaded"),e.addClass("unloaded"),s.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),s.removeClass("d-flex"),t.removeClass("unloaded"),l.removeClass("unloaded"),e.removeClass("unloaded")}},f=function(){let t=!1;return{on(){t||(u.block(),r.removeClass("unloaded"),n.addClass("unloaded"),t=!0)},off(){t&&(i.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),a.removeClass("visible"),n.removeClass("unloaded"),u.release(),d.val(""),t=!1)},isVisible:()=>t}}();function h(){return o.hasClass("loaded")}e.click(function(){p.on(),f.on(),d.focus()}),o.click(function(){p.off(),f.off()}),d.focus(function(){s.addClass("input-focus")}),d.focusout(function(){s.removeClass("input-focus")}),d.on("keyup",function(t){8===t.keyCode&&""===d.val()?h()?c.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),h()&&c.addClass("unloaded"))}),a.on("click",function(){d.val(""),h()?(c.removeClass("unloaded"),i.empty()):f.off(),d.focus(),a.removeClass("visible")})}),$(function(){const t=function(){let t=!1;const e=$("body");return{toggle(){!1===t?e.attr("sidebar-display",""):e.removeAttr("sidebar-display"),t=!t}}}();$("#sidebar-trigger").click(t.toggle),$("#mask").click(t.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const t=$("#topbar-wrapper"),e=$("#toc-wrapper"),o=$(".access"),a=$("#search-input");let n,l=0;const s=5,r=t.outerHeight();$(window).scroll(function(t){$("#topbar-title").is(":hidden")&&(n=!0)}),setInterval(function(){n&&(!function(){var n=$(this).scrollTop();Math.abs(l-n)<=s||(n>l&&n>r?(t.removeClass("topbar-down").addClass("topbar-up"),e.length>0&&e.removeClass("topbar-down"),o.length>0&&o.removeClass("topbar-down"),a.is(":focus")&&a.blur()):n+$(window).height()<$(document).height()&&(t.removeClass("topbar-up").addClass("topbar-down"),e.length>0&&e.addClass("topbar-down"),o.length>0&&o.addClass("topbar-down")),l=n)}(),n=!1)},250)}),$(function(){const t=$("#topbar-title"),e=$("div.post>h1"),o=t.text().trim();let a=e.length>0?e.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||e.is(":hidden")||t.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?t.text()!==a&&t.text(a):t.text()!==o&&t.text(o)}),t.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){let t=$(".timeago").length,e=void 0;$("meta[name=layout-lang]").attr("content");const o=$("meta[name=day-prompt]").attr("content"),a=$("meta[name=hour-prompt]").attr("content"),n=$("meta[name=minute-prompt]").attr("content"),l=$("meta[name=justnow-prompt]").attr("content");function s(){return $(".timeago").each(function(){if($(this).children("i").length>0){let e=$(this).clone().children().remove().end().text(),s=$(this).children("i"),r=s.text();$(this).text(function(e,s){let r=new Date,i=new Date(e);if(i.getFullYear()!==r.getFullYear()||i.getMonth()!==r.getMonth())return s;let d=Math.floor((r-i)/1e3),c=Math.floor(d/86400);if(c>=1)return t-=1,` ${c} ${o}`;let u=Math.floor(d/3600);if(u>=1)return` ${u} ${a}`;let $=Math.floor(d/60);return $>=1?` ${$} ${n}`:l}(r,e)),$(this).append(s)}}),0===t&&void 0!==e&&clearInterval(e),t}0!==t&&s()>0&&(e=setInterval(s,6e4))});

View file

@ -3,4 +3,4 @@
* © 2019 Cotes Chung
* MIT Licensed
*/
function copyLink(e){e&&0!==e.length||(e=window.location.href);const o=$("<input>");$("body").append(o),o.val(e).select(),document.execCommand("copy"),o.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),t=$("#search-cancel"),s=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),i=$("#search-result-wrapper"),c=$("#search-results"),d=$("#search-input"),r=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),p={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),i.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(c.empty(),r.hasClass("unloaded")&&r.removeClass("unloaded"),i.addClass("unloaded"),s.removeClass("visible"),a.removeClass("unloaded"),u.release(),d.val(""),e=!1)},isVisible:()=>e}}();function h(){return t.hasClass("loaded")}o.click(function(){p.on(),f.on(),d.focus()}),t.click(function(){p.off(),f.off()}),d.focus(function(){n.addClass("input-focus")}),d.focusout(function(){n.removeClass("input-focus")}),d.on("keyup",function(e){8===e.keyCode&&""===d.val()?h()?r.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),s.hasClass("visible")||s.addClass("visible"),h()&&r.addClass("unloaded"))}),s.on("click",function(){d.val(""),h()?(r.removeClass("unloaded"),c.empty()):f.off(),d.focus(),s.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const o=$("body");return{toggle(){!1===e?o.attr("sidebar-display",""):o.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),o=$("#toc-wrapper"),t=$(".access"),s=$("#search-input");let a,l=0;const n=5,i=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(a=!0)}),setInterval(function(){a&&(!function(){var a=$(this).scrollTop();Math.abs(l-a)<=n||(a>l&&a>i?(e.removeClass("topbar-down").addClass("topbar-up"),o.length>0&&o.removeClass("topbar-down"),t.length>0&&t.removeClass("topbar-down"),s.is(":focus")&&s.blur()):a+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),o.length>0&&o.addClass("topbar-down"),t.length>0&&t.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),t=e.text().trim();let s=o.length>0?o.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(s)&&(s=s.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==s&&e.text(s):e.text()!==t&&e.text(t)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e="#main > div.row:first-child > div:first-child";if($(`${e} img`).length<=0)return;const o=document.querySelectorAll(`${e} img[data-src]`);lozad(o).observe(),$(`${e} p > img[data-src],${e} img[data-src].preview-img`).each(function(){let e=$(this).next();const o="EM"===e.prop("tagName")?e.text():"",t=$(this).attr("data-src");$(this).wrap(`<a href="${t}" title="${o}" class="popup"></a>`)}),$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),$(`${e} a`).has("img").addClass("img-link")});
function copyLink(e,o){e&&0!==e.length||(e=window.location.href);const t=$("<input>");$("body").append(t),t.val(e).select(),document.execCommand("copy"),t.remove();let s="Link copied successfully!";o&&o.length>0&&(s=o),alert(s)}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),t=$("#search-cancel"),s=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),i=$("#search-result-wrapper"),c=$("#search-results"),d=$("#search-input"),r=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),p={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),i.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(c.empty(),r.hasClass("unloaded")&&r.removeClass("unloaded"),i.addClass("unloaded"),s.removeClass("visible"),a.removeClass("unloaded"),u.release(),d.val(""),e=!1)},isVisible:()=>e}}();function h(){return t.hasClass("loaded")}o.click(function(){p.on(),f.on(),d.focus()}),t.click(function(){p.off(),f.off()}),d.focus(function(){n.addClass("input-focus")}),d.focusout(function(){n.removeClass("input-focus")}),d.on("keyup",function(e){8===e.keyCode&&""===d.val()?h()?r.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),s.hasClass("visible")||s.addClass("visible"),h()&&r.addClass("unloaded"))}),s.on("click",function(){d.val(""),h()?(r.removeClass("unloaded"),c.empty()):f.off(),d.focus(),s.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const o=$("body");return{toggle(){!1===e?o.attr("sidebar-display",""):o.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),o=$("#toc-wrapper"),t=$(".access"),s=$("#search-input");let a,l=0;const n=5,i=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(a=!0)}),setInterval(function(){a&&(!function(){var a=$(this).scrollTop();Math.abs(l-a)<=n||(a>l&&a>i?(e.removeClass("topbar-down").addClass("topbar-up"),o.length>0&&o.removeClass("topbar-down"),t.length>0&&t.removeClass("topbar-down"),s.is(":focus")&&s.blur()):a+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),o.length>0&&o.addClass("topbar-down"),t.length>0&&t.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),t=e.text().trim();let s=o.length>0?o.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(s)&&(s=s.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==s&&e.text(s):e.text()!==t&&e.text(t)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e="#main > div.row:first-child > div:first-child";if($(`${e} img`).length<=0)return;const o=document.querySelectorAll(`${e} img[data-src]`);lozad(o).observe(),$(`${e} p > img[data-src],${e} img[data-src].preview-img`).each(function(){let e=$(this).next();const o="EM"===e.prop("tagName")?e.text():"",t=$(this).attr("data-src");$(this).wrap(`<a href="${t}" title="${o}" class="popup"></a>`)}),$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),$(`${e} a`).has("img").addClass("img-link")});

File diff suppressed because one or more lines are too long