Merge branch 'feature/improve-locale-datetime'
This commit is contained in:
commit
5de6f17754
37 changed files with 94 additions and 119 deletions
|
@ -12,8 +12,6 @@ baseurl: ''
|
||||||
# otherwise, the layout language will use the default value of 'en'.
|
# otherwise, the layout language will use the default value of 'en'.
|
||||||
lang: en
|
lang: en
|
||||||
|
|
||||||
# Additional parameters for datetime localization, optional. › https://github.com/iamkun/dayjs/tree/dev/src/locale
|
|
||||||
prefer_datetime_locale:
|
|
||||||
|
|
||||||
# Change to your timezone › http://www.timezoneconverter.com/cgi-bin/findzone/findzone
|
# Change to your timezone › http://www.timezoneconverter.com/cgi-bin/findzone/findzone
|
||||||
timezone: Asia/Shanghai
|
timezone: Asia/Shanghai
|
||||||
|
|
|
@ -73,6 +73,16 @@ post:
|
||||||
# pinned prompt of posts list on homepage
|
# pinned prompt of posts list on homepage
|
||||||
pin_prompt: Pinned
|
pin_prompt: Pinned
|
||||||
|
|
||||||
|
# Date time format.
|
||||||
|
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
|
||||||
|
df:
|
||||||
|
post:
|
||||||
|
strftime: '%b %e, %Y'
|
||||||
|
dayjs: 'll'
|
||||||
|
archives:
|
||||||
|
strftime: '%b'
|
||||||
|
dayjs: 'MMM'
|
||||||
|
|
||||||
# categories page
|
# categories page
|
||||||
categories:
|
categories:
|
||||||
category_measure:
|
category_measure:
|
||||||
|
|
|
@ -73,6 +73,13 @@ post:
|
||||||
# pinned prompt of posts list on homepage
|
# pinned prompt of posts list on homepage
|
||||||
pin_prompt: 핀
|
pin_prompt: 핀
|
||||||
|
|
||||||
|
# Date time format.
|
||||||
|
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
|
||||||
|
df:
|
||||||
|
post:
|
||||||
|
strftime: '%Y/%m/%d'
|
||||||
|
dayjs: 'YYYY/MM/DD'
|
||||||
|
|
||||||
# categories page
|
# categories page
|
||||||
categories:
|
categories:
|
||||||
category_measure: 카테고리
|
category_measure: 카테고리
|
||||||
|
|
|
@ -72,6 +72,13 @@ post:
|
||||||
# pinned prompt of posts list on homepage
|
# pinned prompt of posts list on homepage
|
||||||
pin_prompt: 顶置
|
pin_prompt: 顶置
|
||||||
|
|
||||||
|
# Date time format.
|
||||||
|
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
|
||||||
|
df:
|
||||||
|
post:
|
||||||
|
strftime: '%Y/%m/%d'
|
||||||
|
dayjs: 'YYYY/MM/DD'
|
||||||
|
|
||||||
# categories page
|
# categories page
|
||||||
categories:
|
categories:
|
||||||
category_measure: 个分类
|
category_measure: 个分类
|
||||||
|
|
|
@ -4,14 +4,8 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
{% assign wrap_elem = include.wrap | default: 'em' %}
|
{% assign wrap_elem = include.wrap | default: 'em' %}
|
||||||
|
{% assign df_strftime = site.data.locales[site.lang].df.post.strftime | default: '%d/%m/%Y' %}
|
||||||
{% if site.prefer_datetime_locale == 'en' or lang == 'en' %}
|
{% assign df_dayjs = site.data.locales[site.lang].df.post.dayjs | default: 'DD/MM/YYYY' %}
|
||||||
{% assign df_strftime = '%b %e, %Y' %}
|
|
||||||
{% assign df_dayjs = 'll' %}
|
|
||||||
{% else %}
|
|
||||||
{% assign df_strftime = '%F' %}
|
|
||||||
{% assign df_dayjs = 'YYYY-MM-DD' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<{{ wrap_elem }} class="{% if include.class %}{{ include.class }}{% endif %}"
|
<{{ wrap_elem }} class="{% if include.class %}{{ include.class }}{% endif %}"
|
||||||
data-ts="{{ include.date | date: '%s' }}"
|
data-ts="{{ include.date | date: '%s' }}"
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
<p class="mb-0">
|
<p class="mb-0">
|
||||||
© {{ 'now' | date: "%Y" }}
|
© {{ 'now' | date: "%Y" }}
|
||||||
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
|
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>.
|
||||||
{% if site.data.locales[lang].copyright.brief %}
|
{% if site.data.locales[site.lang].copyright.brief %}
|
||||||
<span data-toggle="tooltip" data-placement="top"
|
<span data-toggle="tooltip" data-placement="top"
|
||||||
title="{{ site.data.locales[lang].copyright.verbose }}">{{ site.data.locales[lang].copyright.brief }}</span>
|
title="{{ site.data.locales[site.lang].copyright.verbose }}">{{ site.data.locales[site.lang].copyright.brief }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
<a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
|
<a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
|
|
||||||
{{ site.data.locales[lang].meta
|
{{ site.data.locales[site.lang].meta
|
||||||
| default: 'Powered by :PLATFORM with :THEME theme.'
|
| default: 'Powered by :PLATFORM with :THEME theme.'
|
||||||
| replace: ':PLATFORM', _platform | replace: ':THEME', _theme
|
| replace: ':PLATFORM', _platform | replace: ':THEME', _theme
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -6,11 +6,6 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
<!-- Allow having a localized datetime different from the appearance language -->
|
|
||||||
{% if site.prefer_datetime_locale %}
|
|
||||||
<meta name="prefer-datetime-locale" content="{{ site.prefer_datetime_locale }}">
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if page.layout == 'home' or page.layout == 'post' %}
|
{% if page.layout == 'home' or page.layout == 'post' %}
|
||||||
|
|
||||||
{% if site.google_analytics.pv.proxy_endpoint %}
|
{% if site.google_analytics.pv.proxy_endpoint %}
|
||||||
|
|
|
@ -29,11 +29,7 @@
|
||||||
or page.layout == 'category'
|
or page.layout == 'category'
|
||||||
or page.layout == 'tag' %}
|
or page.layout == 'tag' %}
|
||||||
|
|
||||||
{% if site.prefer_datetime_locale %}
|
|
||||||
{% assign locale = site.prefer_datetime_locale | downcase %}
|
|
||||||
{% else %}
|
|
||||||
{% assign locale = site.lang | split: '-' | first %}
|
{% assign locale = site.lang | split: '-' | first %}
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% assign _urls = site.data.assets[origin].dayjs.js.common
|
{% assign _urls = site.data.assets[origin].dayjs.js.common
|
||||||
| append: ',' | append: site.data.assets[origin].dayjs.js.locale
|
| append: ',' | append: site.data.assets[origin].dayjs.js.locale
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
{% comment %}
|
|
||||||
Detect appearance language and return it through variable "lang"
|
|
||||||
{% endcomment %}
|
|
||||||
{% if site.data.locales[site.lang] %}
|
|
||||||
{% assign lang = site.lang %}
|
|
||||||
{% else %}
|
|
||||||
{% assign lang = 'en' %}
|
|
||||||
{% endif %}
|
|
|
@ -5,24 +5,24 @@
|
||||||
<div class="post-navigation d-flex justify-content-between">
|
<div class="post-navigation d-flex justify-content-between">
|
||||||
{% if page.previous.url %}
|
{% if page.previous.url %}
|
||||||
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary"
|
<a href="{{ site.baseurl }}{{ page.previous.url }}" class="btn btn-outline-primary"
|
||||||
prompt="{{ site.data.locales[lang].post.button.previous }}">
|
prompt="{{ site.data.locales[site.lang].post.button.previous }}">
|
||||||
<p>{{ page.previous.title }}</p>
|
<p>{{ page.previous.title }}</p>
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="btn btn-outline-primary disabled"
|
<div class="btn btn-outline-primary disabled"
|
||||||
prompt="{{ site.data.locales[lang].post.button.previous }}">
|
prompt="{{ site.data.locales[site.lang].post.button.previous }}">
|
||||||
<p>-</p>
|
<p>-</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if page.next.url %}
|
{% if page.next.url %}
|
||||||
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary"
|
<a href="{{ site.baseurl }}{{page.next.url}}" class="btn btn-outline-primary"
|
||||||
prompt="{{ site.data.locales[lang].post.button.next }}">
|
prompt="{{ site.data.locales[site.lang].post.button.next }}">
|
||||||
<p>{{ page.next.title }}</p>
|
<p>{{ page.next.title }}</p>
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="btn btn-outline-primary disabled"
|
<div class="btn btn-outline-primary disabled"
|
||||||
prompt="{{ site.data.locales[lang].post.button.next }}">
|
prompt="{{ site.data.locales[site.lang].post.button.next }}">
|
||||||
<p>-</p>
|
<p>-</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<div class="share-wrapper">
|
<div class="share-wrapper">
|
||||||
<span class="share-label text-muted mr-1">{{ site.data.locales[lang].post.share }}</span>
|
<span class="share-label text-muted mr-1">{{ site.data.locales[site.lang].post.share }}</span>
|
||||||
<span class="share-icons">
|
<span class="share-icons">
|
||||||
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
|
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
|
||||||
{% assign title = title | url_encode %}
|
{% assign title = title | url_encode %}
|
||||||
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
<i id="copy-link" class="fa-fw fas fa-link small"
|
<i id="copy-link" class="fa-fw fas fa-link small"
|
||||||
data-toggle="tooltip" data-placement="top"
|
data-toggle="tooltip" data-placement="top"
|
||||||
title="{{ site.data.locales[lang].post.button.share_link.title }}"
|
title="{{ site.data.locales[site.lang].post.button.share_link.title }}"
|
||||||
data-title-succeed="{{ site.data.locales[lang].post.button.share_link.succeed }}">
|
data-title-succeed="{{ site.data.locales[site.lang].post.button.share_link.succeed }}">
|
||||||
</i>
|
</i>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
{% endunless %}
|
{% endunless %}
|
||||||
|
|
||||||
{% capture read_prompt %}
|
{% capture read_prompt %}
|
||||||
{{- site.data.locales[lang].post.read_time.prompt -}}
|
{{- site.data.locales[site.lang].post.read_time.prompt -}}
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
|
|
||||||
<!-- return element -->
|
<!-- return element -->
|
||||||
<span class="readtime" data-toggle="tooltip" data-placement="bottom"
|
<span class="readtime" data-toggle="tooltip" data-placement="bottom"
|
||||||
title="{{ words }} {{ site.data.locales[lang].post.words }}">
|
title="{{ words }} {{ site.data.locales[site.lang].post.words }}">
|
||||||
<em>{{- read_time -}}{{" "}}{{- site.data.locales[lang].post.read_time.unit -}}</em>
|
<em>{{- read_time -}}{{" "}}{{- site.data.locales[site.lang].post.read_time.unit -}}</em>
|
||||||
{%- if include.prompt -%}
|
{%- if include.prompt -%}
|
||||||
{%- assign _prompt_words = read_prompt | number_of_words: 'auto' -%}
|
{%- assign _prompt_words = read_prompt | number_of_words: 'auto' -%}
|
||||||
{%- unless _prompt_words > 1 -%}{{ " " }}{%- endunless -%}{{ read_prompt }}
|
{%- unless _prompt_words > 1 -%}{{ " " }}{%- endunless -%}{{ read_prompt }}
|
||||||
|
|
|
@ -177,7 +177,7 @@
|
||||||
| append: '<div class="code-header">'
|
| append: '<div class="code-header">'
|
||||||
| append: _label
|
| append: _label
|
||||||
| append: '<button aria-label="copy" data-title-succeed="'
|
| append: '<button aria-label="copy" data-title-succeed="'
|
||||||
| append: site.data.locales[lang].post.button.copy_code.succeed
|
| append: site.data.locales[site.lang].post.button.copy_code.succeed
|
||||||
| append: '"><i class="far fa-clipboard"></i></button></div>'
|
| append: '"><i class="far fa-clipboard"></i></button></div>'
|
||||||
| append: '<div class="highlight"><code>'
|
| append: '<div class="highlight"><code>'
|
||||||
%}
|
%}
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
{% if index_list.size > 0 %}
|
{% if index_list.size > 0 %}
|
||||||
<div id="related-posts" class="mb-2 mb-sm-4">
|
<div id="related-posts" class="mb-2 mb-sm-4">
|
||||||
<h3 class="pt-2 mb-4 ml-1"
|
<h3 class="pt-2 mb-4 ml-1"
|
||||||
data-toc-skip>{{ site.data.locales[lang].post.relate_posts }}</h3>
|
data-toc-skip>{{ site.data.locales[site.lang].post.relate_posts }}</h3>
|
||||||
<div class="card-deck mb-4">
|
<div class="card-deck mb-4">
|
||||||
{% for entry in index_list %}
|
{% for entry in index_list %}
|
||||||
{% assign index = entry | plus: 0 %}
|
{% assign index = entry | plus: 0 %}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
|
|
||||||
{% capture not_found %}<p class="mt-5">{{ site.data.locales[lang].search.no_results }}</p>{% endcapture %}
|
{% capture not_found %}<p class="mt-5">{{ site.data.locales[site.lang].search.no_results }}</p>{% endcapture %}
|
||||||
|
|
||||||
<script src="{{ site.data.assets[origin].search.js | relative_url }}"></script>
|
<script src="{{ site.data.assets[origin].search.js | relative_url }}"></script>
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}">
|
<li class="nav-item{% if page.layout == 'home' %}{{ " active" }}{% endif %}">
|
||||||
<a href="{{ '/' | relative_url }}" class="nav-link">
|
<a href="{{ '/' | relative_url }}" class="nav-link">
|
||||||
<i class="fa-fw fas fa-home ml-xl-3 mr-xl-3 unloaded"></i>
|
<i class="fa-fw fas fa-home ml-xl-3 mr-xl-3 unloaded"></i>
|
||||||
<span>{{ site.data.locales[lang].tabs.home | upcase }}</span>
|
<span>{{ site.data.locales[site.lang].tabs.home | upcase }}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<!-- the real tabs -->
|
<!-- the real tabs -->
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
|
<i class="fa-fw {{ tab.icon }} ml-xl-3 mr-xl-3 unloaded"></i>
|
||||||
{% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %}
|
{% capture tab_name %}{{ tab.url | split: '/' }}{% endcapture %}
|
||||||
|
|
||||||
<span>{{ site.data.locales[lang].tabs.[tab_name] | default: tab.title | upcase }}</span>
|
<span>{{ site.data.locales[site.lang].tabs.[tab_name] | default: tab.title | upcase }}</span>
|
||||||
</a>
|
</a>
|
||||||
</li> <!-- .nav-item -->
|
</li> <!-- .nav-item -->
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<script src="{{ site.data.assets[origin].bootstrap-toc.js | relative_url }}"></script>
|
<script src="{{ site.data.assets[origin].bootstrap-toc.js | relative_url }}"></script>
|
||||||
|
|
||||||
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
|
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
|
||||||
<div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[lang].panel.toc -}}</div>
|
<div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[site.lang].panel.toc -}}</div>
|
||||||
<nav id="toc" data-toggle="toc"></nav>
|
<nav id="toc" data-toggle="toc"></nav>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
{% if paths.size == 0 or page.layout == 'home' %}
|
{% if paths.size == 0 or page.layout == 'home' %}
|
||||||
<!-- index page -->
|
<!-- index page -->
|
||||||
<span>{{ site.data.locales[lang].tabs.home | capitalize }}</span>
|
<span>{{ site.data.locales[site.lang].tabs.home | capitalize }}</span>
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
|
@ -19,14 +19,14 @@
|
||||||
{% if forloop.first %}
|
{% if forloop.first %}
|
||||||
<span>
|
<span>
|
||||||
<a href="{{ '/' | relative_url }}">
|
<a href="{{ '/' | relative_url }}">
|
||||||
{{ site.data.locales[lang].tabs.home | capitalize }}
|
{{ site.data.locales[site.lang].tabs.home | capitalize }}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{% elsif forloop.last %}
|
{% elsif forloop.last %}
|
||||||
|
|
||||||
{% if page.collection == 'tabs' %}
|
{% if page.collection == 'tabs' %}
|
||||||
<span>{{ site.data.locales[lang].tabs[item] | default: page.title }}</span>
|
<span>{{ site.data.locales[site.lang].tabs[item] | default: page.title }}</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span>{{ page.title }}</span>
|
<span>{{ page.title }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
{% elsif page.layout == 'category' or page.layout == 'tag' %}
|
{% elsif page.layout == 'category' or page.layout == 'tag' %}
|
||||||
<span>
|
<span>
|
||||||
<a href="{{ item | relative_url }}">
|
<a href="{{ item | relative_url }}">
|
||||||
{{ site.data.locales[lang].tabs[item] | default: page.title }}
|
{{ site.data.locales[site.lang].tabs[item] | default: page.title }}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -49,12 +49,12 @@
|
||||||
|
|
||||||
<div id="topbar-title">
|
<div id="topbar-title">
|
||||||
{% if page.layout == 'home' %}
|
{% if page.layout == 'home' %}
|
||||||
{{- site.data.locales[lang].title | default: site.title -}}
|
{{- site.data.locales[site.lang].title | default: site.title -}}
|
||||||
{% elsif page.collection == 'tabs' or page.layout == 'page' %}
|
{% elsif page.collection == 'tabs' or page.layout == 'page' %}
|
||||||
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
|
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
|
||||||
{{- site.data.locales[lang].tabs[tab_key] | default: page.title -}}
|
{{- site.data.locales[site.lang].tabs[tab_key] | default: page.title -}}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{- site.data.locales[lang].layout[page.layout] | default: page.layout | capitalize -}}
|
{{- site.data.locales[site.lang].layout[page.layout] | default: page.layout | capitalize -}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -62,9 +62,9 @@
|
||||||
<span id="search-wrapper" class="align-items-center">
|
<span id="search-wrapper" class="align-items-center">
|
||||||
<i class="fas fa-search fa-fw"></i>
|
<i class="fas fa-search fa-fw"></i>
|
||||||
<input class="form-control" id="search-input" type="search"
|
<input class="form-control" id="search-input" type="search"
|
||||||
aria-label="search" autocomplete="off" placeholder="{{ site.data.locales[lang].search.hint | capitalize }}...">
|
aria-label="search" autocomplete="off" placeholder="{{ site.data.locales[site.lang].search.hint | capitalize }}...">
|
||||||
</span>
|
</span>
|
||||||
<span id="search-cancel" >{{ site.data.locales[lang].search.cancel }}</span>
|
<span id="search-cancel" >{{ site.data.locales[site.lang].search.cancel }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
{% if trending_tags.size > 0 %}
|
{% if trending_tags.size > 0 %}
|
||||||
<div id="access-tags">
|
<div id="access-tags">
|
||||||
<div class="panel-heading">{{- site.data.locales[lang].panel.trending_tags -}}</div>
|
<div class="panel-heading">{{- site.data.locales[site.lang].panel.trending_tags -}}</div>
|
||||||
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
|
<div class="d-flex flex-wrap mt-3 mb-1 mr-3">
|
||||||
|
|
||||||
{% for tag_name in trending_tags %}
|
{% for tag_name in trending_tags %}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
{% if update_list.size > 0 %}
|
{% if update_list.size > 0 %}
|
||||||
|
|
||||||
<div id="access-lastmod" class="post">
|
<div id="access-lastmod" class="post">
|
||||||
<div class="panel-heading">{{- site.data.locales[lang].panel.lastmod -}}</div>
|
<div class="panel-heading">{{- site.data.locales[site.lang].panel.lastmod -}}</div>
|
||||||
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
|
<ul class="post-content pl-0 pb-1 ml-1 mt-2">
|
||||||
{% for item in update_list %}
|
{% for item in update_list %}
|
||||||
{% assign index = item | split: "::" | last | plus: 0 %}
|
{% assign index = item | split: "::" | last | plus: 0 %}
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
|
|
||||||
/* A tool for locale datetime */
|
/* A tool for locale datetime */
|
||||||
const LocaleHelper = (function () {
|
const LocaleHelper = (function () {
|
||||||
const $preferLocale = $('meta[name="prefer-datetime-locale"]');
|
const locale = $('html').attr('lang').substr(0, 2)
|
||||||
const locale = $preferLocale.length > 0 ?
|
|
||||||
$preferLocale.attr('content').toLowerCase() : $('html').attr('lang').substr(0, 2);
|
|
||||||
const attrTimestamp = 'data-ts';
|
const attrTimestamp = 'data-ts';
|
||||||
const attrDateFormat = 'data-df';
|
const attrDateFormat = 'data-df';
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,8 @@ layout: page
|
||||||
# The Archives of posts.
|
# The Archives of posts.
|
||||||
---
|
---
|
||||||
|
|
||||||
{% include lang.html %}
|
{% assign df_strftime_m = site.data.locales[site.lang].df.archives.strftime | default: '/ %m' %}
|
||||||
|
{% assign df_dayjs_m = site.data.locales[site.lang].df.archives.dayjs | default: '/ MM' %}
|
||||||
{% if site.prefer_datetime_locale == 'en' or lang == 'en' %}
|
|
||||||
{% assign df_strftime_m = '%b' %}
|
|
||||||
{% assign df_dayjs_m = 'MMM' %}
|
|
||||||
{% else %}
|
|
||||||
{% assign df_strftime_m = '/ %m' %}
|
|
||||||
{% assign df_dayjs_m = '/ MM' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div id="archives" class="pl-xl-3">
|
<div id="archives" class="pl-xl-3">
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@ layout: page
|
||||||
# All the Categories of posts
|
# All the Categories of posts
|
||||||
---
|
---
|
||||||
|
|
||||||
{% include lang.html %}
|
|
||||||
|
|
||||||
{% assign HEAD_PREFIX = "h_" %}
|
{% assign HEAD_PREFIX = "h_" %}
|
||||||
{% assign LIST_PREFIX = "l_" %}
|
{% assign LIST_PREFIX = "l_" %}
|
||||||
|
|
||||||
|
@ -48,22 +46,22 @@ layout: page
|
||||||
{% if sub_categories_size > 0 %}
|
{% if sub_categories_size > 0 %}
|
||||||
{{ sub_categories_size }}
|
{{ sub_categories_size }}
|
||||||
{% if sub_categories_size > 1 %}
|
{% if sub_categories_size > 1 %}
|
||||||
{{ site.data.locales[lang].categories.category_measure.plural
|
{{ site.data.locales[site.lang].categories.category_measure.plural
|
||||||
| default: site.data.locales[lang].categories.category_measure }}
|
| default: site.data.locales[site.lang].categories.category_measure }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ site.data.locales[lang].categories.category_measure.singular
|
{{ site.data.locales[site.lang].categories.category_measure.singular
|
||||||
| default: site.data.locales[lang].categories.category_measure }}
|
| default: site.data.locales[site.lang].categories.category_measure }}
|
||||||
{% endif %},
|
{% endif %},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ top_posts_size }}
|
{{ top_posts_size }}
|
||||||
|
|
||||||
{% if top_posts_size > 1 %}
|
{% if top_posts_size > 1 %}
|
||||||
{{ site.data.locales[lang].categories.post_measure.plural
|
{{ site.data.locales[site.lang].categories.post_measure.plural
|
||||||
| default: site.data.locales[lang].categories.post_measure }}
|
| default: site.data.locales[site.lang].categories.post_measure }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ site.data.locales[lang].categories.post_measure.singular
|
{{ site.data.locales[site.lang].categories.post_measure.singular
|
||||||
| default: site.data.locales[lang].categories.post_measure }}
|
| default: site.data.locales[site.lang].categories.post_measure }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
@ -99,11 +97,11 @@ layout: page
|
||||||
{{ posts_size }}
|
{{ posts_size }}
|
||||||
|
|
||||||
{% if posts_size > 1 %}
|
{% if posts_size > 1 %}
|
||||||
{{ site.data.locales[lang].categories.post_measure.plural
|
{{ site.data.locales[site.lang].categories.post_measure.plural
|
||||||
| default: site.data.locales[lang].categories.post_measure }}
|
| default: site.data.locales[site.lang].categories.post_measure }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ site.data.locales[lang].categories.post_measure.singular
|
{{ site.data.locales[site.lang].categories.post_measure.singular
|
||||||
| default: site.data.locales[lang].categories.post_measure }}
|
| default: site.data.locales[site.lang].categories.post_measure }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -3,8 +3,6 @@ layout: page
|
||||||
# The Category layout
|
# The Category layout
|
||||||
---
|
---
|
||||||
|
|
||||||
{% include lang.html %}
|
|
||||||
|
|
||||||
<div id="page-category">
|
<div id="page-category">
|
||||||
<h1 class="pl-lg-2">
|
<h1 class="pl-lg-2">
|
||||||
<i class="far fa-folder-open fa-fw text-muted"></i>
|
<i class="far fa-folder-open fa-fw text-muted"></i>
|
||||||
|
|
|
@ -5,8 +5,6 @@ layout: compress
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
{% include lang.html %}
|
|
||||||
|
|
||||||
{% include assets-origin.html %}
|
{% include assets-origin.html %}
|
||||||
|
|
||||||
{% capture prefer_mode %}
|
{% capture prefer_mode %}
|
||||||
|
@ -15,7 +13,8 @@ layout: compress
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
|
|
||||||
<html lang="{{ site.lang }}"{{ prefer_mode }}>
|
<!-- `site.alt_lang` can specify a language different from the UI -->
|
||||||
|
<html lang="{{ site.alt_lang | default: site.lang }}"{{ prefer_mode }}>
|
||||||
|
|
||||||
{% include head.html %}
|
{% include head.html %}
|
||||||
|
|
||||||
|
@ -55,9 +54,9 @@ layout: compress
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="toast-body text-center pt-0">
|
<div class="toast-body text-center pt-0">
|
||||||
<p class="pl-2 pr-2 mb-3">{{ site.data.locales[lang].notification.update_found }}</p>
|
<p class="pl-2 pr-2 mb-3">{{ site.data.locales[site.lang].notification.update_found }}</p>
|
||||||
<button type="button" class="btn btn-primary" aria-label="Update">
|
<button type="button" class="btn btn-primary" aria-label="Update">
|
||||||
{{ site.data.locales[lang].notification.update }}
|
{{ site.data.locales[site.lang].notification.update }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,8 +3,6 @@ layout: page
|
||||||
# The Home page layout
|
# The Home page layout
|
||||||
---
|
---
|
||||||
|
|
||||||
{% include lang.html %}
|
|
||||||
|
|
||||||
{% assign pinned = site.posts | where: "pin", "true" %}
|
{% assign pinned = site.posts | where: "pin", "true" %}
|
||||||
{% assign default = site.posts | where_exp: "item", "item.pin != true and item.hidden != true" %}
|
{% assign default = site.posts | where_exp: "item", "item.pin != true and item.hidden != true" %}
|
||||||
|
|
||||||
|
@ -79,7 +77,7 @@ layout: page
|
||||||
{% if post.pin %}
|
{% if post.pin %}
|
||||||
<div class="pin">
|
<div class="pin">
|
||||||
<i class="fas fa-thumbtack fa-fw"></i>
|
<i class="fas fa-thumbtack fa-fw"></i>
|
||||||
<span>{{ site.data.locales[lang].post.pin_prompt }}</span>
|
<span>{{ site.data.locales[site.lang].post.pin_prompt }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
layout: default
|
layout: default
|
||||||
---
|
---
|
||||||
|
|
||||||
{% include lang.html %}
|
|
||||||
|
|
||||||
{% include assets-origin.html %}
|
{% include assets-origin.html %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -22,7 +20,7 @@ layout: default
|
||||||
|
|
||||||
{% if page.layout == 'page' or page.collection == 'tabs' %}
|
{% if page.layout == 'page' or page.collection == 'tabs' %}
|
||||||
{% assign tab_key = page.title | downcase %}
|
{% assign tab_key = page.title | downcase %}
|
||||||
{% assign title = site.data.locales[lang].tabs[tab_key] | default: page.title %}
|
{% assign title = site.data.locales[site.lang].tabs[tab_key] | default: page.title %}
|
||||||
<h1 class="dynamic-title">
|
<h1 class="dynamic-title">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
|
@ -9,21 +9,19 @@ tail_includes:
|
||||||
- comments
|
- comments
|
||||||
---
|
---
|
||||||
|
|
||||||
{% include lang.html %}
|
|
||||||
|
|
||||||
<h1 data-toc-skip>{{ page.title }}</h1>
|
<h1 data-toc-skip>{{ page.title }}</h1>
|
||||||
|
|
||||||
<div class="post-meta text-muted">
|
<div class="post-meta text-muted">
|
||||||
<!-- published date -->
|
<!-- published date -->
|
||||||
<span>
|
<span>
|
||||||
{{ site.data.locales[lang].post.posted }}
|
{{ site.data.locales[site.lang].post.posted }}
|
||||||
{% include datetime.html date=page.date tooltip=true %}
|
{% include datetime.html date=page.date tooltip=true %}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<!-- lastmod date -->
|
<!-- lastmod date -->
|
||||||
{% if page.last_modified_at %}
|
{% if page.last_modified_at %}
|
||||||
<span>
|
<span>
|
||||||
{{ site.data.locales[lang].post.updated }}
|
{{ site.data.locales[site.lang].post.updated }}
|
||||||
{% include datetime.html date=page.last_modified_at tooltip=true %}
|
{% include datetime.html date=page.last_modified_at tooltip=true %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -65,7 +63,7 @@ tail_includes:
|
||||||
{% assign authors = page.authors %}
|
{% assign authors = page.authors %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ site.data.locales[lang].post.written_by }}
|
{{ site.data.locales[site.lang].post.written_by }}
|
||||||
|
|
||||||
<em>
|
<em>
|
||||||
{% if authors %}
|
{% if authors %}
|
||||||
|
@ -86,7 +84,7 @@ tail_includes:
|
||||||
<em id="pv" class="pageviews">
|
<em id="pv" class="pageviews">
|
||||||
<i class="fas fa-spinner fa-spin fa-fw"></i>
|
<i class="fas fa-spinner fa-spin fa-fw"></i>
|
||||||
</em>
|
</em>
|
||||||
{{ site.data.locales[lang].post.pageview_measure }}
|
{{ site.data.locales[site.lang].post.pageview_measure }}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -132,15 +130,15 @@ tail_includes:
|
||||||
d-flex justify-content-between align-items-center mt-3 pt-5 pb-2">
|
d-flex justify-content-between align-items-center mt-3 pt-5 pb-2">
|
||||||
<div class="license-wrapper">
|
<div class="license-wrapper">
|
||||||
|
|
||||||
{% if site.data.locales[lang].copyright.license.template %}
|
{% if site.data.locales[site.lang].copyright.license.template %}
|
||||||
|
|
||||||
{% capture _replacement %}
|
{% capture _replacement %}
|
||||||
<a href="{{ site.data.locales[lang].copyright.license.link }}">
|
<a href="{{ site.data.locales[site.lang].copyright.license.link }}">
|
||||||
{{ site.data.locales[lang].copyright.license.name }}
|
{{ site.data.locales[site.lang].copyright.license.name }}
|
||||||
</a>
|
</a>
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
|
|
||||||
{{ site.data.locales[lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
|
{{ site.data.locales[site.lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,8 +3,6 @@ layout: page
|
||||||
# The layout for Tag page
|
# The layout for Tag page
|
||||||
---
|
---
|
||||||
|
|
||||||
{% include lang.html %}
|
|
||||||
|
|
||||||
<div id="page-tag">
|
<div id="page-tag">
|
||||||
<h1 class="pl-lg-2">
|
<h1 class="pl-lg-2">
|
||||||
<i class="fa fa-tag fa-fw text-muted"></i>
|
<i class="fa fa-tag fa-fw text-muted"></i>
|
||||||
|
|
|
@ -9,8 +9,6 @@ redirect_from:
|
||||||
- /posts/
|
- /posts/
|
||||||
---
|
---
|
||||||
|
|
||||||
{% include lang.html %}
|
|
||||||
|
|
||||||
<div class="lead">
|
<div class="lead">
|
||||||
<p>{{site.data.locales[lang].not_found.statment }}</p>
|
<p>{{site.data.locales[site.lang].not_found.statment }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
2
assets/js/dist/categories.min.js
vendored
2
assets/js/dist/categories.min.js
vendored
|
@ -3,4 +3,4 @@
|
||||||
* © 2019 Cotes Chung
|
* © 2019 Cotes Chung
|
||||||
* MIT Licensed
|
* MIT Licensed
|
||||||
*/
|
*/
|
||||||
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"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(){$(".mode-toggle").click(o=>{o=$(o.target);(o.prop("tagName")==="button".toUpperCase()?o:o.parent()).blur(),flipMode()})});const ScrollHelper=function(){const o=$("body"),e="data-topbar-visible",t=$("#topbar-wrapper").outerHeight();let a=0,r=!1,l=!1;return{hideTopbar:()=>o.attr(e,!1),showTopbar:()=>o.attr(e,!0),addScrollUpTask:()=>{a+=1,r=r||!0},popScrollUpTask:()=>--a,hasScrollUpTask:()=>0<a,topbarLocked:()=>!0===r,unlockTopbar:()=>r=!1,getTopbarHeight:()=>t,orientationLocked:()=>!0===l,lockOrientation:()=>l=!0,unLockOrientation:()=>l=!1}}();$(function(){const o=$("#sidebar-trigger"),e=$("#search-trigger"),t=$("#search-cancel"),a=$("#main"),r=$("#topbar-title"),l=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),d=function(){let o=0;return{block(){o=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(o)},getOffset(){return o}}}(),p={on(){o.addClass("unloaded"),r.addClass("unloaded"),e.addClass("unloaded"),l.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),l.removeClass("d-flex"),o.removeClass("unloaded"),r.removeClass("unloaded"),e.removeClass("unloaded")}},f=function(){let o=!1;return{on(){o||(d.block(),n.removeClass("unloaded"),a.addClass("unloaded"),o=!0)},off(){o&&(s.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("unloaded"),d.release(),i.val(""),o=!1)},isVisible(){return o}}}();function u(){return t.hasClass("loaded")}e.click(function(){p.on(),f.on(),i.focus()}),t.click(function(){p.off(),f.off()}),i.focus(function(){l.addClass("input-focus")}),i.focusout(function(){l.removeClass("input-focus")}),i.on("input",()=>{""===i.val()?u()?c.removeClass("unloaded"):f.off():(f.on(),u()&&c.addClass("unloaded"))})}),$(function(){var o=function(){const o="sidebar-display";let e=!1;const t=$("body");return{toggle(){!1===e?t.attr(o,""):t.removeAttr(o),e=!e}}}();$("#sidebar-trigger").click(o.toggle),$("#mask").click(o.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#search-input"),t=ScrollHelper.getTopbarHeight();let o,a=0;function r(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var o=screen.orientation.type;"landscape-primary"!==o&&"landscape-secondary"!==o||r()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&r()}),$(window).scroll(()=>{o=o||!0}),setInterval(()=>{o&&(!function(){var o=$(this).scrollTop();if(!(Math.abs(a-o)<=t)){if(o>a)ScrollHelper.hideTopbar(),e.is(":focus")&&e.blur();else if(o+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}a=o}}(),o=!1)},250)}),$(function(){var o="div.post>h1:first-of-type",e=$(o);const n=$("#topbar-title");if(0!==e.length&&!e.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let a=e.text().trim(),r=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),e.offset().top<$(window).scrollTop()&&n.text(a);new IntersectionObserver(o=>{var e,t;r?(t=$(window).scrollTop(),e=l<t,l=t,t=o[0],e?0===t.intersectionRatio&&n.text(a):1===t.intersectionRatio&&n.text(s)):r=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]}).observe(document.querySelector(o)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),$(function(){var o=$(".collapse");o.on("hide.bs.collapse",function(){var o="h_"+$(this).attr("id").substring("l_".length);o&&($(`#${o} .far.fa-folder-open`).attr("class","far fa-folder fa-fw"),$(`#${o} i.fas`).addClass("rotate"),$("#"+o).removeClass("hide-border-bottom"))}),o.on("show.bs.collapse",function(){var o="h_"+$(this).attr("id").substring("l_".length);o&&($(`#${o} .far.fa-folder`).attr("class","far fa-folder-open fa-fw"),$(`#${o} i.fas`).removeClass("rotate"),$("#"+o).addClass("hide-border-bottom"))})});
|
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"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(){$(".mode-toggle").click(o=>{const e=$(o.target);let t=e.prop("tagName")==="button".toUpperCase()?e:e.parent();t.blur(),flipMode()})});const ScrollHelper=function(){const o=$("body"),e="data-topbar-visible",t=$("#topbar-wrapper").outerHeight();let l=0,a=!1,r=!1;return{hideTopbar:()=>o.attr(e,!1),showTopbar:()=>o.attr(e,!0),addScrollUpTask:()=>{l+=1,a=a||!0},popScrollUpTask:()=>--l,hasScrollUpTask:()=>0<l,topbarLocked:()=>!0===a,unlockTopbar:()=>a=!1,getTopbarHeight:()=>t,orientationLocked:()=>!0===r,lockOrientation:()=>r=!0,unLockOrientation:()=>r=!1}}();$(function(){const o=$("#sidebar-trigger"),e=$("#search-trigger"),t=$("#search-cancel"),l=$("#main"),a=$("#topbar-title"),r=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),d=function(){let o=0;return{block(){o=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(o)},getOffset(){return o}}}(),p={on(){o.addClass("unloaded"),a.addClass("unloaded"),e.addClass("unloaded"),r.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),r.removeClass("d-flex"),o.removeClass("unloaded"),a.removeClass("unloaded"),e.removeClass("unloaded")}},f=function(){let o=!1;return{on(){o||(d.block(),n.removeClass("unloaded"),l.addClass("unloaded"),o=!0)},off(){o&&(s.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),l.removeClass("unloaded"),d.release(),i.val(""),o=!1)},isVisible(){return o}}}();function u(){return t.hasClass("loaded")}e.click(function(){p.on(),f.on(),i.focus()}),t.click(function(){p.off(),f.off()}),i.focus(function(){r.addClass("input-focus")}),i.focusout(function(){r.removeClass("input-focus")}),i.on("input",()=>{""===i.val()?u()?c.removeClass("unloaded"):f.off():(f.on(),u()&&c.addClass("unloaded"))})}),$(function(){var o=function(){const o="sidebar-display";let e=!1;const t=$("body");return{toggle(){!1===e?t.attr(o,""):t.removeAttr(o),e=!e}}}();$("#sidebar-trigger").click(o.toggle),$("#mask").click(o.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#search-input"),t=ScrollHelper.getTopbarHeight();let o,l=0;function a(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var o=screen.orientation.type;"landscape-primary"!==o&&"landscape-secondary"!==o||a()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&a()}),$(window).scroll(()=>{o=o||!0}),setInterval(()=>{o&&(!function(){var o=$(this).scrollTop();if(!(Math.abs(l-o)<=t)){if(o>l)ScrollHelper.hideTopbar(),e.is(":focus")&&e.blur();else if(o+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}l=o}}(),o=!1)},250)}),$(function(){var e="div.post>h1:first-of-type";const t=$(e),n=$("#topbar-title");if(0!==t.length&&!t.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let l=t.text().trim(),a=!1,r=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(l)&&(l=l.replace(/[0-9]/g,"").trim()),t.offset().top<$(window).scrollTop()&&n.text(l);let o=new IntersectionObserver(o=>{var e,t;a?(t=$(window).scrollTop(),e=r<t,r=t,t=o[0],e?0===t.intersectionRatio&&n.text(l):1===t.intersectionRatio&&n.text(s)):a=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});o.observe(document.querySelector(e)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),$(function(){const o=$(".collapse");o.on("hide.bs.collapse",function(){var o="h_"+$(this).attr("id").substring("l_".length);o&&($(`#${o} .far.fa-folder-open`).attr("class","far fa-folder fa-fw"),$(`#${o} i.fas`).addClass("rotate"),$("#"+o).removeClass("hide-border-bottom"))}),o.on("show.bs.collapse",function(){var o="h_"+$(this).attr("id").substring("l_".length);o&&($(`#${o} .far.fa-folder`).attr("class","far fa-folder-open fa-fw"),$(`#${o} i.fas`).removeClass("rotate"),$("#"+o).addClass("hide-border-bottom"))})});
|
||||||
|
|
2
assets/js/dist/commons.min.js
vendored
2
assets/js/dist/commons.min.js
vendored
|
@ -3,4 +3,4 @@
|
||||||
* © 2019 Cotes Chung
|
* © 2019 Cotes Chung
|
||||||
* MIT Licensed
|
* MIT Licensed
|
||||||
*/
|
*/
|
||||||
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"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(){$(".mode-toggle").click(o=>{o=$(o.target);(o.prop("tagName")==="button".toUpperCase()?o:o.parent()).blur(),flipMode()})});const ScrollHelper=function(){const o=$("body"),e="data-topbar-visible",t=$("#topbar-wrapper").outerHeight();let l=0,r=!1,a=!1;return{hideTopbar:()=>o.attr(e,!1),showTopbar:()=>o.attr(e,!0),addScrollUpTask:()=>{l+=1,r=r||!0},popScrollUpTask:()=>--l,hasScrollUpTask:()=>0<l,topbarLocked:()=>!0===r,unlockTopbar:()=>r=!1,getTopbarHeight:()=>t,orientationLocked:()=>!0===a,lockOrientation:()=>a=!0,unLockOrientation:()=>a=!1}}();$(function(){const o=$("#sidebar-trigger"),e=$("#search-trigger"),t=$("#search-cancel"),l=$("#main"),r=$("#topbar-title"),a=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),d=function(){let o=0;return{block(){o=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(o)},getOffset(){return o}}}(),p={on(){o.addClass("unloaded"),r.addClass("unloaded"),e.addClass("unloaded"),a.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),a.removeClass("d-flex"),o.removeClass("unloaded"),r.removeClass("unloaded"),e.removeClass("unloaded")}},u=function(){let o=!1;return{on(){o||(d.block(),n.removeClass("unloaded"),l.addClass("unloaded"),o=!0)},off(){o&&(s.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),l.removeClass("unloaded"),d.release(),i.val(""),o=!1)},isVisible(){return o}}}();function f(){return t.hasClass("loaded")}e.click(function(){p.on(),u.on(),i.focus()}),t.click(function(){p.off(),u.off()}),i.focus(function(){a.addClass("input-focus")}),i.focusout(function(){a.removeClass("input-focus")}),i.on("input",()=>{""===i.val()?f()?c.removeClass("unloaded"):u.off():(u.on(),f()&&c.addClass("unloaded"))})}),$(function(){var o=function(){const o="sidebar-display";let e=!1;const t=$("body");return{toggle(){!1===e?t.attr(o,""):t.removeAttr(o),e=!e}}}();$("#sidebar-trigger").click(o.toggle),$("#mask").click(o.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#search-input"),t=ScrollHelper.getTopbarHeight();let o,l=0;function r(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var o=screen.orientation.type;"landscape-primary"!==o&&"landscape-secondary"!==o||r()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&r()}),$(window).scroll(()=>{o=o||!0}),setInterval(()=>{o&&(!function(){var o=$(this).scrollTop();if(!(Math.abs(l-o)<=t)){if(o>l)ScrollHelper.hideTopbar(),e.is(":focus")&&e.blur();else if(o+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}l=o}}(),o=!1)},250)}),$(function(){var o="div.post>h1:first-of-type",e=$(o);const n=$("#topbar-title");if(0!==e.length&&!e.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let l=e.text().trim(),r=!1,a=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(l)&&(l=l.replace(/[0-9]/g,"").trim()),e.offset().top<$(window).scrollTop()&&n.text(l);new IntersectionObserver(o=>{var e,t;r?(t=$(window).scrollTop(),e=a<t,a=t,t=o[0],e?0===t.intersectionRatio&&n.text(l):1===t.intersectionRatio&&n.text(s)):r=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]}).observe(document.querySelector(o)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}});
|
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"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(){$(".mode-toggle").click(o=>{const e=$(o.target);let t=e.prop("tagName")==="button".toUpperCase()?e:e.parent();t.blur(),flipMode()})});const ScrollHelper=function(){const o=$("body"),e="data-topbar-visible",t=$("#topbar-wrapper").outerHeight();let l=0,r=!1,a=!1;return{hideTopbar:()=>o.attr(e,!1),showTopbar:()=>o.attr(e,!0),addScrollUpTask:()=>{l+=1,r=r||!0},popScrollUpTask:()=>--l,hasScrollUpTask:()=>0<l,topbarLocked:()=>!0===r,unlockTopbar:()=>r=!1,getTopbarHeight:()=>t,orientationLocked:()=>!0===a,lockOrientation:()=>a=!0,unLockOrientation:()=>a=!1}}();$(function(){const o=$("#sidebar-trigger"),e=$("#search-trigger"),t=$("#search-cancel"),l=$("#main"),r=$("#topbar-title"),a=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),d=function(){let o=0;return{block(){o=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(o)},getOffset(){return o}}}(),p={on(){o.addClass("unloaded"),r.addClass("unloaded"),e.addClass("unloaded"),a.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),a.removeClass("d-flex"),o.removeClass("unloaded"),r.removeClass("unloaded"),e.removeClass("unloaded")}},u=function(){let o=!1;return{on(){o||(d.block(),n.removeClass("unloaded"),l.addClass("unloaded"),o=!0)},off(){o&&(s.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),l.removeClass("unloaded"),d.release(),i.val(""),o=!1)},isVisible(){return o}}}();function f(){return t.hasClass("loaded")}e.click(function(){p.on(),u.on(),i.focus()}),t.click(function(){p.off(),u.off()}),i.focus(function(){a.addClass("input-focus")}),i.focusout(function(){a.removeClass("input-focus")}),i.on("input",()=>{""===i.val()?f()?c.removeClass("unloaded"):u.off():(u.on(),f()&&c.addClass("unloaded"))})}),$(function(){var o=function(){const o="sidebar-display";let e=!1;const t=$("body");return{toggle(){!1===e?t.attr(o,""):t.removeAttr(o),e=!e}}}();$("#sidebar-trigger").click(o.toggle),$("#mask").click(o.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#search-input"),t=ScrollHelper.getTopbarHeight();let o,l=0;function r(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var o=screen.orientation.type;"landscape-primary"!==o&&"landscape-secondary"!==o||r()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&r()}),$(window).scroll(()=>{o=o||!0}),setInterval(()=>{o&&(!function(){var o=$(this).scrollTop();if(!(Math.abs(l-o)<=t)){if(o>l)ScrollHelper.hideTopbar(),e.is(":focus")&&e.blur();else if(o+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}l=o}}(),o=!1)},250)}),$(function(){var e="div.post>h1:first-of-type";const t=$(e),n=$("#topbar-title");if(0!==t.length&&!t.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let l=t.text().trim(),r=!1,a=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(l)&&(l=l.replace(/[0-9]/g,"").trim()),t.offset().top<$(window).scrollTop()&&n.text(l);let o=new IntersectionObserver(o=>{var e,t;r?(t=$(window).scrollTop(),e=a<t,a=t,t=o[0],e?0===t.intersectionRatio&&n.text(l):1===t.intersectionRatio&&n.text(s)):r=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});o.observe(document.querySelector(e)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}});
|
||||||
|
|
2
assets/js/dist/home.min.js
vendored
2
assets/js/dist/home.min.js
vendored
|
@ -3,4 +3,4 @@
|
||||||
* © 2019 Cotes Chung
|
* © 2019 Cotes Chung
|
||||||
* MIT Licensed
|
* MIT Licensed
|
||||||
*/
|
*/
|
||||||
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"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(){$(".mode-toggle").click(e=>{e=$(e.target);(e.prop("tagName")==="button".toUpperCase()?e:e.parent()).blur(),flipMode()})});const ScrollHelper=function(){const e=$("body"),t="data-topbar-visible",o=$("#topbar-wrapper").outerHeight();let a=0,l=!1,r=!1;return{hideTopbar:()=>e.attr(t,!1),showTopbar:()=>e.attr(t,!0),addScrollUpTask:()=>{a+=1,l=l||!0},popScrollUpTask:()=>--a,hasScrollUpTask:()=>0<a,topbarLocked:()=>!0===l,unlockTopbar:()=>l=!1,getTopbarHeight:()=>o,orientationLocked:()=>!0===r,lockOrientation:()=>r=!0,unLockOrientation:()=>r=!1}}(),LocaleHelper=($(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#main"),l=$("#topbar-title"),r=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),d=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),p={on(){e.addClass("unloaded"),l.addClass("unloaded"),t.addClass("unloaded"),r.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),r.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),t.removeClass("unloaded")}},u=function(){let e=!1;return{on(){e||(d.block(),n.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(s.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("unloaded"),d.release(),i.val(""),e=!1)},isVisible(){return e}}}();function f(){return o.hasClass("loaded")}t.click(function(){p.on(),u.on(),i.focus()}),o.click(function(){p.off(),u.off()}),i.focus(function(){r.addClass("input-focus")}),i.focusout(function(){r.removeClass("input-focus")}),i.on("input",()=>{""===i.val()?f()?c.removeClass("unloaded"):u.off():(u.on(),f()&&c.addClass("unloaded"))})}),$(function(){var e=function(){const e="sidebar-display";let t=!1;const o=$("body");return{toggle(){!1===t?o.attr(e,""):o.removeAttr(e),t=!t}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const t=$("#search-input"),o=ScrollHelper.getTopbarHeight();let e,a=0;function l(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var e=screen.orientation.type;"landscape-primary"!==e&&"landscape-secondary"!==e||l()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&l()}),$(window).scroll(()=>{e=e||!0}),setInterval(()=>{e&&(!function(){var e=$(this).scrollTop();if(!(Math.abs(a-e)<=o)){if(e>a)ScrollHelper.hideTopbar(),t.is(":focus")&&t.blur();else if(e+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}a=e}}(),e=!1)},250)}),$(function(){var e="div.post>h1:first-of-type",t=$(e);const n=$("#topbar-title");if(0!==t.length&&!t.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let a=t.text().trim(),l=!1,r=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),t.offset().top<$(window).scrollTop()&&n.text(a);new IntersectionObserver(e=>{var t,o;l?(o=$(window).scrollTop(),t=r<o,r=o,o=e[0],t?0===o.intersectionRatio&&n.text(a):1===o.intersectionRatio&&n.text(s)):l=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]}).observe(document.querySelector(e)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),function(){var e=$('meta[name="prefer-datetime-locale"]');const t=0<e.length?e.attr("content").toLowerCase():$("html").attr("lang").substr(0,2),o="data-ts",a="data-df";return{locale:()=>t,attrTimestamp:()=>o,attrDateFormat:()=>a,getTimestamp:e=>Number(e.attr(o)),getDateFormat:e=>e.attr(a)}}());$(function(){dayjs.locale(LocaleHelper.locale()),dayjs.extend(window.dayjs_plugin_localizedFormat),$(`[${LocaleHelper.attrTimestamp()}]`).each(function(){var e=dayjs.unix(LocaleHelper.getTimestamp($(this))),t=e.format(LocaleHelper.getDateFormat($(this))),t=($(this).text(t),$(this).removeAttr(LocaleHelper.attrTimestamp()),$(this).removeAttr(LocaleHelper.attrDateFormat()),$(this).attr("data-toggle"));void 0!==t&&"tooltip"===t&&(t=e.format("llll"),$(this).attr("data-original-title",t))})});
|
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"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(){$(".mode-toggle").click(e=>{const t=$(e.target);let o=t.prop("tagName")==="button".toUpperCase()?t:t.parent();o.blur(),flipMode()})});const ScrollHelper=function(){const e=$("body"),t="data-topbar-visible",o=$("#topbar-wrapper").outerHeight();let a=0,l=!1,r=!1;return{hideTopbar:()=>e.attr(t,!1),showTopbar:()=>e.attr(t,!0),addScrollUpTask:()=>{a+=1,l=l||!0},popScrollUpTask:()=>--a,hasScrollUpTask:()=>0<a,topbarLocked:()=>!0===l,unlockTopbar:()=>l=!1,getTopbarHeight:()=>o,orientationLocked:()=>!0===r,lockOrientation:()=>r=!0,unLockOrientation:()=>r=!1}}(),LocaleHelper=($(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#main"),l=$("#topbar-title"),r=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),d=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),p={on(){e.addClass("unloaded"),l.addClass("unloaded"),t.addClass("unloaded"),r.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),r.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),t.removeClass("unloaded")}},u=function(){let e=!1;return{on(){e||(d.block(),n.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(s.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("unloaded"),d.release(),i.val(""),e=!1)},isVisible(){return e}}}();function f(){return o.hasClass("loaded")}t.click(function(){p.on(),u.on(),i.focus()}),o.click(function(){p.off(),u.off()}),i.focus(function(){r.addClass("input-focus")}),i.focusout(function(){r.removeClass("input-focus")}),i.on("input",()=>{""===i.val()?f()?c.removeClass("unloaded"):u.off():(u.on(),f()&&c.addClass("unloaded"))})}),$(function(){var e=function(){const e="sidebar-display";let t=!1;const o=$("body");return{toggle(){!1===t?o.attr(e,""):o.removeAttr(e),t=!t}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const t=$("#search-input"),o=ScrollHelper.getTopbarHeight();let e,a=0;function l(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var e=screen.orientation.type;"landscape-primary"!==e&&"landscape-secondary"!==e||l()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&l()}),$(window).scroll(()=>{e=e||!0}),setInterval(()=>{e&&(!function(){var e=$(this).scrollTop();if(!(Math.abs(a-e)<=o)){if(e>a)ScrollHelper.hideTopbar(),t.is(":focus")&&t.blur();else if(e+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}a=e}}(),e=!1)},250)}),$(function(){var t="div.post>h1:first-of-type";const o=$(t),n=$("#topbar-title");if(0!==o.length&&!o.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let a=o.text().trim(),l=!1,r=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),o.offset().top<$(window).scrollTop()&&n.text(a);let e=new IntersectionObserver(e=>{var t,o;l?(o=$(window).scrollTop(),t=r<o,r=o,o=e[0],t?0===o.intersectionRatio&&n.text(a):1===o.intersectionRatio&&n.text(s)):l=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});e.observe(document.querySelector(t)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),function(){const e=$("html").attr("lang").substr(0,2),t="data-ts",o="data-df";return{locale:()=>e,attrTimestamp:()=>t,attrDateFormat:()=>o,getTimestamp:e=>Number(e.attr(t)),getDateFormat:e=>e.attr(o)}}());$(function(){dayjs.locale(LocaleHelper.locale()),dayjs.extend(window.dayjs_plugin_localizedFormat),$(`[${LocaleHelper.attrTimestamp()}]`).each(function(){const e=dayjs.unix(LocaleHelper.getTimestamp($(this)));var t=e.format(LocaleHelper.getDateFormat($(this))),t=($(this).text(t),$(this).removeAttr(LocaleHelper.attrTimestamp()),$(this).removeAttr(LocaleHelper.attrDateFormat()),$(this).attr("data-toggle"));void 0!==t&&"tooltip"===t&&(t=e.format("llll"),$(this).attr("data-original-title",t))})});
|
||||||
|
|
2
assets/js/dist/misc.min.js
vendored
2
assets/js/dist/misc.min.js
vendored
|
@ -3,4 +3,4 @@
|
||||||
* © 2019 Cotes Chung
|
* © 2019 Cotes Chung
|
||||||
* MIT Licensed
|
* MIT Licensed
|
||||||
*/
|
*/
|
||||||
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"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(){$(".mode-toggle").click(e=>{e=$(e.target);(e.prop("tagName")==="button".toUpperCase()?e:e.parent()).blur(),flipMode()})});const ScrollHelper=function(){const e=$("body"),t="data-topbar-visible",o=$("#topbar-wrapper").outerHeight();let a=0,l=!1,r=!1;return{hideTopbar:()=>e.attr(t,!1),showTopbar:()=>e.attr(t,!0),addScrollUpTask:()=>{a+=1,l=l||!0},popScrollUpTask:()=>--a,hasScrollUpTask:()=>0<a,topbarLocked:()=>!0===l,unlockTopbar:()=>l=!1,getTopbarHeight:()=>o,orientationLocked:()=>!0===r,lockOrientation:()=>r=!0,unLockOrientation:()=>r=!1}}(),LocaleHelper=($(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#main"),l=$("#topbar-title"),r=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),d=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),p={on(){e.addClass("unloaded"),l.addClass("unloaded"),t.addClass("unloaded"),r.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),r.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),t.removeClass("unloaded")}},u=function(){let e=!1;return{on(){e||(d.block(),n.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(s.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("unloaded"),d.release(),i.val(""),e=!1)},isVisible(){return e}}}();function f(){return o.hasClass("loaded")}t.click(function(){p.on(),u.on(),i.focus()}),o.click(function(){p.off(),u.off()}),i.focus(function(){r.addClass("input-focus")}),i.focusout(function(){r.removeClass("input-focus")}),i.on("input",()=>{""===i.val()?f()?c.removeClass("unloaded"):u.off():(u.on(),f()&&c.addClass("unloaded"))})}),$(function(){var e=function(){const e="sidebar-display";let t=!1;const o=$("body");return{toggle(){!1===t?o.attr(e,""):o.removeAttr(e),t=!t}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const t=$("#search-input"),o=ScrollHelper.getTopbarHeight();let e,a=0;function l(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var e=screen.orientation.type;"landscape-primary"!==e&&"landscape-secondary"!==e||l()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&l()}),$(window).scroll(()=>{e=e||!0}),setInterval(()=>{e&&(!function(){var e=$(this).scrollTop();if(!(Math.abs(a-e)<=o)){if(e>a)ScrollHelper.hideTopbar(),t.is(":focus")&&t.blur();else if(e+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}a=e}}(),e=!1)},250)}),$(function(){var e="div.post>h1:first-of-type",t=$(e);const n=$("#topbar-title");if(0!==t.length&&!t.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let a=t.text().trim(),l=!1,r=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),t.offset().top<$(window).scrollTop()&&n.text(a);new IntersectionObserver(e=>{var t,o;l?(o=$(window).scrollTop(),t=r<o,r=o,o=e[0],t?0===o.intersectionRatio&&n.text(a):1===o.intersectionRatio&&n.text(s)):l=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]}).observe(document.querySelector(e)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),function(){var e=$('meta[name="prefer-datetime-locale"]');const t=0<e.length?e.attr("content").toLowerCase():$("html").attr("lang").substr(0,2),o="data-ts",a="data-df";return{locale:()=>t,attrTimestamp:()=>o,attrDateFormat:()=>a,getTimestamp:e=>Number(e.attr(o)),getDateFormat:e=>e.attr(a)}}());$(function(){dayjs.locale(LocaleHelper.locale()),dayjs.extend(window.dayjs_plugin_localizedFormat),$(`[${LocaleHelper.attrTimestamp()}]`).each(function(){var e=dayjs.unix(LocaleHelper.getTimestamp($(this))),t=e.format(LocaleHelper.getDateFormat($(this))),t=($(this).text(t),$(this).removeAttr(LocaleHelper.attrTimestamp()),$(this).removeAttr(LocaleHelper.attrDateFormat()),$(this).attr("data-toggle"));void 0!==t&&"tooltip"===t&&(t=e.format("llll"),$(this).attr("data-original-title",t))})});
|
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"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(){$(".mode-toggle").click(e=>{const t=$(e.target);let o=t.prop("tagName")==="button".toUpperCase()?t:t.parent();o.blur(),flipMode()})});const ScrollHelper=function(){const e=$("body"),t="data-topbar-visible",o=$("#topbar-wrapper").outerHeight();let a=0,l=!1,r=!1;return{hideTopbar:()=>e.attr(t,!1),showTopbar:()=>e.attr(t,!0),addScrollUpTask:()=>{a+=1,l=l||!0},popScrollUpTask:()=>--a,hasScrollUpTask:()=>0<a,topbarLocked:()=>!0===l,unlockTopbar:()=>l=!1,getTopbarHeight:()=>o,orientationLocked:()=>!0===r,lockOrientation:()=>r=!0,unLockOrientation:()=>r=!1}}(),LocaleHelper=($(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#main"),l=$("#topbar-title"),r=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),d=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),p={on(){e.addClass("unloaded"),l.addClass("unloaded"),t.addClass("unloaded"),r.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),r.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),t.removeClass("unloaded")}},u=function(){let e=!1;return{on(){e||(d.block(),n.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(s.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),a.removeClass("unloaded"),d.release(),i.val(""),e=!1)},isVisible(){return e}}}();function f(){return o.hasClass("loaded")}t.click(function(){p.on(),u.on(),i.focus()}),o.click(function(){p.off(),u.off()}),i.focus(function(){r.addClass("input-focus")}),i.focusout(function(){r.removeClass("input-focus")}),i.on("input",()=>{""===i.val()?f()?c.removeClass("unloaded"):u.off():(u.on(),f()&&c.addClass("unloaded"))})}),$(function(){var e=function(){const e="sidebar-display";let t=!1;const o=$("body");return{toggle(){!1===t?o.attr(e,""):o.removeAttr(e),t=!t}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const t=$("#search-input"),o=ScrollHelper.getTopbarHeight();let e,a=0;function l(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var e=screen.orientation.type;"landscape-primary"!==e&&"landscape-secondary"!==e||l()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&l()}),$(window).scroll(()=>{e=e||!0}),setInterval(()=>{e&&(!function(){var e=$(this).scrollTop();if(!(Math.abs(a-e)<=o)){if(e>a)ScrollHelper.hideTopbar(),t.is(":focus")&&t.blur();else if(e+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}a=e}}(),e=!1)},250)}),$(function(){var t="div.post>h1:first-of-type";const o=$(t),n=$("#topbar-title");if(0!==o.length&&!o.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let a=o.text().trim(),l=!1,r=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),o.offset().top<$(window).scrollTop()&&n.text(a);let e=new IntersectionObserver(e=>{var t,o;l?(o=$(window).scrollTop(),t=r<o,r=o,o=e[0],t?0===o.intersectionRatio&&n.text(a):1===o.intersectionRatio&&n.text(s)):l=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});e.observe(document.querySelector(t)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}),function(){const e=$("html").attr("lang").substr(0,2),t="data-ts",o="data-df";return{locale:()=>e,attrTimestamp:()=>t,attrDateFormat:()=>o,getTimestamp:e=>Number(e.attr(t)),getDateFormat:e=>e.attr(o)}}());$(function(){dayjs.locale(LocaleHelper.locale()),dayjs.extend(window.dayjs_plugin_localizedFormat),$(`[${LocaleHelper.attrTimestamp()}]`).each(function(){const e=dayjs.unix(LocaleHelper.getTimestamp($(this)));var t=e.format(LocaleHelper.getDateFormat($(this))),t=($(this).text(t),$(this).removeAttr(LocaleHelper.attrTimestamp()),$(this).removeAttr(LocaleHelper.attrDateFormat()),$(this).attr("data-toggle"));void 0!==t&&"tooltip"===t&&(t=e.format("llll"),$(this).attr("data-original-title",t))})});
|
||||||
|
|
2
assets/js/dist/page.min.js
vendored
2
assets/js/dist/page.min.js
vendored
File diff suppressed because one or more lines are too long
2
assets/js/dist/post.min.js
vendored
2
assets/js/dist/post.min.js
vendored
File diff suppressed because one or more lines are too long
2
assets/js/dist/pvreport.min.js
vendored
2
assets/js/dist/pvreport.min.js
vendored
|
@ -3,4 +3,4 @@
|
||||||
* © 2019 Cotes Chung
|
* © 2019 Cotes Chung
|
||||||
* MIT Licensed
|
* MIT Licensed
|
||||||
*/
|
*/
|
||||||
const getInitStatus=function(){let t=!1;return()=>{var e=t;return t=t||!0,e}}(),PvOpts=function(){function t(e){return $(e).attr("content")}function e(e){e=t(e);return void 0!==e&&!1!==e}return{getProxyMeta(){return t("meta[name=pv-proxy-endpoint]")},getLocalMeta(){return t("meta[name=pv-cache-path]")},hasProxyMeta(){return e("meta[name=pv-proxy-endpoint]")},hasLocalMeta(){return e("meta[name=pv-cache-path]")}}}(),PvStorage=function(){const a={KEY_PV:"pv",KEY_PV_SRC:"pv_src",KEY_CREATION:"pv_created_date"},t={LOCAL:"same-origin",PROXY:"cors"};function r(e){return localStorage.getItem(e)}function o(e,t){localStorage.setItem(e,t)}function n(e,t){o(a.KEY_PV,e),o(a.KEY_PV_SRC,t),o(a.KEY_CREATION,(new Date).toJSON())}return{keysCount(){return Object.keys(a).length},hasCache(){return null!==localStorage.getItem(a.KEY_PV)},getCache(){return JSON.parse(localStorage.getItem(a.KEY_PV))},saveLocalCache(e){n(e,t.LOCAL)},saveProxyCache(e){n(e,t.PROXY)},isExpired(){var e=new Date(r(a.KEY_CREATION));return e.setHours(e.getHours()+1),Date.now()>=e.getTime()},isFromLocal(){return r(a.KEY_PV_SRC)===t.LOCAL},isFromProxy(){return r(a.KEY_PV_SRC)===t.PROXY},newerThan(e){return PvStorage.getCache().totalsForAllResults["ga:pageviews"]>e.totalsForAllResults["ga:pageviews"]},inspectKeys(){if(localStorage.length!==PvStorage.keysCount())localStorage.clear();else for(let e=0;e<localStorage.length;e++)switch(localStorage.key(e)){case a.KEY_PV:case a.KEY_PV_SRC:case a.KEY_CREATION:break;default:return void localStorage.clear()}}}}();function countUp(e,t,a){e<t&&((a=new CountUp(a,e,t)).error?console.error(a.error):a.start())}function countPV(t,a){let r=0;if(void 0!==a)for(let e=0;e<a.length;++e)if(a[parseInt(e,10)][0]===t){r+=parseInt(a[parseInt(e,10)][1],10);break}return r}function tacklePV(e,t,a,r){t=0===(t=countPV(t,e))?1:t;r?(e=parseInt(a.text().replace(/,/g,""),10))<t&&countUp(e,t,a.attr("id")):a.text((new Intl.NumberFormat).format(t))}function displayPageviews(e){if(void 0!==e){let t=getInitStatus();const a=e.rows;0<$("#post-list").length?$(".post-preview").each(function(){var e=$(this).find("a").attr("href");tacklePV(a,e,$(this).find(".pageviews"),t)}):0<$(".post").length&&(e=window.location.pathname,tacklePV(a,e,$("#pv"),t))}}function fetchProxyPageviews(){PvOpts.hasProxyMeta()&&$.ajax({type:"GET",url:PvOpts.getProxyMeta(),dataType:"jsonp",jsonpCallback:"displayPageviews",success:e=>{PvStorage.saveProxyCache(JSON.stringify(e))},error:(e,t,a)=>{console.log("Failed to load pageviews from proxy server: "+a)}})}function fetchLocalPageviews(t=!1){return fetch(PvOpts.getLocalMeta()).then(e=>e.json()).then(e=>{t&&PvStorage.isFromProxy()&&PvStorage.newerThan(e)||(displayPageviews(e),PvStorage.saveLocalCache(JSON.stringify(e)))})}$(function(){$(".pageviews").length<=0||(PvStorage.inspectKeys(),PvStorage.hasCache()?(displayPageviews(PvStorage.getCache()),PvStorage.isExpired()?PvOpts.hasLocalMeta()?fetchLocalPageviews(!0).then(fetchProxyPageviews):fetchProxyPageviews():PvStorage.isFromLocal()&&fetchProxyPageviews()):PvOpts.hasLocalMeta()?fetchLocalPageviews().then(fetchProxyPageviews):fetchProxyPageviews())});
|
const getInitStatus=function(){let t=!1;return()=>{var e=t;return t=t||!0,e}}(),PvOpts=function(){function t(e){return $(e).attr("content")}function e(e){e=t(e);return void 0!==e&&!1!==e}return{getProxyMeta(){return t("meta[name=pv-proxy-endpoint]")},getLocalMeta(){return t("meta[name=pv-cache-path]")},hasProxyMeta(){return e("meta[name=pv-proxy-endpoint]")},hasLocalMeta(){return e("meta[name=pv-cache-path]")}}}(),PvStorage=function(){const a={KEY_PV:"pv",KEY_PV_SRC:"pv_src",KEY_CREATION:"pv_created_date"},t={LOCAL:"same-origin",PROXY:"cors"};function r(e){return localStorage.getItem(e)}function o(e,t){localStorage.setItem(e,t)}function n(e,t){o(a.KEY_PV,e),o(a.KEY_PV_SRC,t),o(a.KEY_CREATION,(new Date).toJSON())}return{keysCount(){return Object.keys(a).length},hasCache(){return null!==localStorage.getItem(a.KEY_PV)},getCache(){return JSON.parse(localStorage.getItem(a.KEY_PV))},saveLocalCache(e){n(e,t.LOCAL)},saveProxyCache(e){n(e,t.PROXY)},isExpired(){let e=new Date(r(a.KEY_CREATION));return e.setHours(e.getHours()+1),Date.now()>=e.getTime()},isFromLocal(){return r(a.KEY_PV_SRC)===t.LOCAL},isFromProxy(){return r(a.KEY_PV_SRC)===t.PROXY},newerThan(e){return PvStorage.getCache().totalsForAllResults["ga:pageviews"]>e.totalsForAllResults["ga:pageviews"]},inspectKeys(){if(localStorage.length!==PvStorage.keysCount())localStorage.clear();else for(let e=0;e<localStorage.length;e++)switch(localStorage.key(e)){case a.KEY_PV:case a.KEY_PV_SRC:case a.KEY_CREATION:break;default:return void localStorage.clear()}}}}();function countUp(t,a,r){if(t<a){let e=new CountUp(r,t,a);e.error?console.error(e.error):e.start()}}function countPV(t,a){let r=0;if(void 0!==a)for(let e=0;e<a.length;++e)if(a[parseInt(e,10)][0]===t){r+=parseInt(a[parseInt(e,10)][1],10);break}return r}function tacklePV(e,t,a,r){let o=countPV(t,e);o=0===o?1:o,r?(t=parseInt(a.text().replace(/,/g,""),10),o>t&&countUp(t,o,a.attr("id"))):a.text((new Intl.NumberFormat).format(o))}function displayPageviews(e){if(void 0!==e){let t=getInitStatus();const a=e.rows;0<$("#post-list").length?$(".post-preview").each(function(){var e=$(this).find("a").attr("href");tacklePV(a,e,$(this).find(".pageviews"),t)}):0<$(".post").length&&(e=window.location.pathname,tacklePV(a,e,$("#pv"),t))}}function fetchProxyPageviews(){PvOpts.hasProxyMeta()&&$.ajax({type:"GET",url:PvOpts.getProxyMeta(),dataType:"jsonp",jsonpCallback:"displayPageviews",success:e=>{PvStorage.saveProxyCache(JSON.stringify(e))},error:(e,t,a)=>{console.log("Failed to load pageviews from proxy server: "+a)}})}function fetchLocalPageviews(t=!1){return fetch(PvOpts.getLocalMeta()).then(e=>e.json()).then(e=>{t&&PvStorage.isFromProxy()&&PvStorage.newerThan(e)||(displayPageviews(e),PvStorage.saveLocalCache(JSON.stringify(e)))})}$(function(){$(".pageviews").length<=0||(PvStorage.inspectKeys(),PvStorage.hasCache()?(displayPageviews(PvStorage.getCache()),PvStorage.isExpired()?PvOpts.hasLocalMeta()?fetchLocalPageviews(!0).then(fetchProxyPageviews):fetchProxyPageviews():PvStorage.isFromLocal()&&fetchProxyPageviews()):PvOpts.hasLocalMeta()?fetchLocalPageviews().then(fetchProxyPageviews):fetchProxyPageviews())});
|
||||||
|
|
Loading…
Reference in a new issue