1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-19 06:06:54 +00:00

Compare commits

..

2 Commits

Author SHA1 Message Date
Cotes Chung
d098ddb5f0 Merge branch 'hotfix/5.0.1' 2022-01-05 03:14:57 +08:00
Cotes Chung
209b175f25 Merge branch 'feature/docs' 2022-01-05 00:53:49 +08:00
106 changed files with 1383 additions and 2576 deletions

View File

@@ -1,5 +0,0 @@
{
"rules": {
"body-max-line-length": [0, "always"]
}
}

View File

@@ -1,6 +1,6 @@
# How to Contribute # How to Contribute
We'd like to thank you for sparing time to improve this project! Here are some guidelines for contributing We want to thank you for sparing time to improve this project! Here are some guidelines for contributing
To ensure that the blog design is not confused, this project does not accept suggestions for design changes, such as color scheme, fonts, typography, etc. If your request is about an enhancement, it is recommended to first submit a [_Feature Request_](https://github.com/cotes2020/jekyll-theme-chirpy/issues/new?labels=enhancement&template=feature_request.md) issue to discuss whether your idea fits the project. To ensure that the blog design is not confused, this project does not accept suggestions for design changes, such as color scheme, fonts, typography, etc. If your request is about an enhancement, it is recommended to first submit a [_Feature Request_](https://github.com/cotes2020/jekyll-theme-chirpy/issues/new?labels=enhancement&template=feature_request.md) issue to discuss whether your idea fits the project.
@@ -9,57 +9,34 @@ To ensure that the blog design is not confused, this project does not accept sug
Generally, contribute to the project by: Generally, contribute to the project by:
1. Fork this project on GitHub and clone it locally. 1. Fork this project on GitHub and clone it locally.
2. Create a new branch from the default branch and give it a descriptive name (format: `feature/<add-new-feat>` / `fix/<fix-a-bug>`). 2. Create a new branch from the default branch and give it a descriptive name (e.g., `my-new-feature`, `fix-a-bug`).
3. After completing the development, submit a new _Pull Request_. Note that the commit message must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), otherwise it will fail the PR check. 3. After completing the development, submit a new _Pull Request_.
## Modifying JavaScript ## Modifying JavaScript
If your contribution involves JavaScript modification, please read the following sections. If your contribution involves JS modification, please read the following sections.
### Inline Scripts ### Inline Scripts
If you need to add comments to the inline JavaScript (the code between the HTML tags `<script>` and `</script>`), please use `/* */` instead of two slashes `//`. Because the HTML will be compressed by [jekyll-compress-html](https://github.com/penibelst/jekyll-compress-html) during deployment, but it cannot handle the `//` properly, which will disrupt the structure of the compressed HTML. If you need to add comments to the inline JS (the JS code between the tags `<script>` and `</script>`), please use `/**/` instead of two slashes `//`. Because the HTML will be compressed by [jekyll-compress-html](https://github.com/penibelst/jekyll-compress-html) during deployment, but it cannot handle the `//` properly. And this will disrupt the structure of the compressed HTML.
### External Scripts ### External Scripts
If you need to add/change/delete the JavaScript in the directory `_javascript/`, setting up [`Node.js`](https://nodejs.org/) and [`npx`](https://www.npmjs.com/package/npx) is a requirement. And then install the development dependencies: If you need to add or modify JavaScripts in the directory `_javascript`, you need to install [Gulp.js](https://gulpjs.com/docs/en/getting-started/quick-start).
```console During development, real-time debugging can be performed through the following commands:
$ npm i
```
During JavaScript development, real-time debugging can be performed through the following commands:
Firstly, start a Jekyll server:
```console ```console
$ bash tools/run.sh $ bash tools/run.sh
``` ```
And then open a new terminal tab and run: Open another terminal tab and run:
```console ```console
# Type 'Ctrl + C' to stop $ gulp dev # Type 'Ctrl + C' to stop
$ npx gulp dev
``` ```
After debugging, run the command `npx gulp` (without any argument) will automatically output the compressed files to the directory `assets/js/dist/`. After debugging, run the command `gulp` (without any argument) will automatically output the compressed files to the directory `assests/js/dist/`.
## Verify the commit messages
If you want to make sure your commits pass the CI check, you can refer to the following steps.
Install `commitlint` & `husky`:
```console
$ npm i -g @commitlint/{cli,config-conventional} husky
```
And then enable `husky`:
```console
$ husky install
```
--- ---

View File

@@ -35,15 +35,14 @@ Steps to reproduce the behavior:
<!-- If applicable, add screenshots to help explain your problem. --> <!-- If applicable, add screenshots to help explain your problem. -->
### Environment ### Software
| Command | Version | <!-- Please complete the following information -->
|-----------------------------------|---------| - Ruby version: <!-- by running: `ruby -v` -->
| `ruby -v` | | - Gem version: <!-- by running: `gem -v`-->
| `gem -v` | | - Bundler version: <!-- by running: `bundle -v`-->
| `bundle -v` | | - Jekyll version: <!-- by running: `bundle list | grep " jekyll "` -->
| `bundle exec jekyll -v` | | - Theme version: <!-- by running: `gem list | grep jekyll-theme-chirpy` -->
| `bundle info jekyll-theme-chirpy` | |
### Desktop ### Desktop

View File

@@ -1,16 +1,16 @@
name: 'CI' name: 'Continuous Integration'
on: on:
push: push:
branches-ignore: branches-ignore:
- 'release/**' - 'production'
- 'docs'
tags-ignore: tags-ignore:
- '**' - '*'
paths-ignore: paths-ignore:
- '.github/**' - '.github/**'
- '!.github/workflows/ci.yml' - '!.github/workflows/ci.yml'
- '.travis.yml' - '.travis.yml'
- '.gitignore' - '.gitignore'
- 'docs/**'
- 'README.md' - 'README.md'
- 'LICENSE' - 'LICENSE'
pull_request: pull_request:
@@ -18,20 +18,23 @@ on:
- '**' - '**'
jobs: jobs:
build: ci:
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
ruby: [2.5, 2.6, 2.7, 3] os: [ubuntu-latest, macos-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 # for posts's lastmod fetch-depth: 0 # for posts's lastmod
- name: Setup Ruby - name: Setup Ruby
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: ${{ matrix.ruby }} ruby-version: 2.7
bundler-cache: true bundler-cache: true
- name: Test Site - name: Test Site
run: bash tools/deploy.sh --dry-run run: bash tools/deploy.sh --dry-run

View File

@@ -1,11 +0,0 @@
name: Lint Commit Messages
on: pull_request
jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v4

3
.gitignore vendored
View File

@@ -4,9 +4,6 @@
!.editorconfig !.editorconfig
!.nojekyll !.nojekyll
!.travis.yml !.travis.yml
!.husky
!.commitlintrc.json
!.versionrc.json
# bundler cache # bundler cache
_site _site

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "assets/lib"]
path = assets/lib
url = https://github.com/cotes2020/chirpy-static-assets.git

View File

@@ -1,4 +0,0 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no -- commitlint -x $(npm root -g)/@commitlint/config-conventional --edit

View File

@@ -1,41 +1,42 @@
os: linux os: linux
dist: bionic dist: bionic
language: ruby
rvm: 2.7.0
addons: language: minimal
apt:
packages:
- libcurl4-openssl-dev # to avoid SSL error (for htmlproofer)
# Overriding to drop the `--development` flag which requires the Gemfile.lock at build branches:
install: bundle install --jobs=3 --retry=3 --path=vendor/bundle only:
- /^release\/(\d)+(\.(\d)+){1}$/
before_script: git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q
jobs: jobs:
include: include:
- stage: Upgrade - name: Deploy
language: ruby
rvm: 2.7.0
addons:
apt:
packages:
# required to avoid SSL error (for htmlproofer)
- libcurl4-openssl-dev
cache:
directories:
- $TRAVIS_BUILD_DIR/vendor/bundle
before_install:
# match the Gemfile.lock, travis' bundler is 2.1.2
- gem install bundler:2.2.4
- bundle config path 'vendor/bundle'
install:
# overriding to drop the travis `--development` flag
- bundle install --jobs=3 --retry=3
script:
- eval "$BUILD_CMD"
git: git:
depth: false # for posts' lastmod depth: false # for posts' lastmod
script: eval "$BUILD_CMD"
- stage: Starter
language: minimal
install: true # skip install step
script: eval "$FLUSH_STARTER"
- stage: Docs
cache: bundler
git:
depth: false # for posts' lastmod
script: eval "$DOCS_CMD"
stages: - name: Flush Starter
- name: Upgrade script: eval "$FLUSH_STARTER"
if: branch = production
- name: Starter before_script:
if: branch = production - git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q
- name: Docs
if: branch = docs
notifications: notifications:
email: email:

View File

@@ -1,20 +0,0 @@
{
"skip": {
"commit": true,
"tag": true
},
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Improvements"
}
]
}

View File

@@ -1,52 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [5.2.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.2.0...v5.2.1) (2022-06-17)
### Bug Fixes
* exclude CHANGELOG from output ([971fe03](https://github.com/cotes2020/jekyll-theme-chirpy/commit/971fe03ec329ae49e7d60fe3af6101cfbd1acd6c))
* **PWA:** sometimes update notification is not triggered ([96af729](https://github.com/cotes2020/jekyll-theme-chirpy/commit/96af7291ea5b2c5ed6372e7b6f7725e67c69f1ba))
## [5.2.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.1.0...v5.2.0) (2022-06-09)
### Features
* add es-ES support to locales ([#533](https://github.com/cotes2020/jekyll-theme-chirpy/issues/533)) ([efe75ad](https://github.com/cotes2020/jekyll-theme-chirpy/commit/efe75adf2784956afb7a0b67f6634b146d9cb03b))
* add fr-FR support to locales ([#582](https://github.com/cotes2020/jekyll-theme-chirpy/issues/582)) ([94e8144](https://github.com/cotes2020/jekyll-theme-chirpy/commit/94e81447afa457b1a6b7e8f487c47502803556d7))
* add Vietnamese locale ([#517](https://github.com/cotes2020/jekyll-theme-chirpy/issues/517)) ([171463d](https://github.com/cotes2020/jekyll-theme-chirpy/commit/171463d76da9b7bc25dd327b8f0a868ea79e388b))
* add pt-BR support to locales ([c2c503f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/c2c503f63336884282b6bda4ec0703d6ae76771b))
* add option to turn off PWA ([#527](https://github.com/cotes2020/jekyll-theme-chirpy/issues/527)) ([106c981](https://github.com/cotes2020/jekyll-theme-chirpy/commit/106c981bac71e7434204a77e1f0c9c61d6eb1509))
* **PWA:** add Service Worker update notification ([d127183](https://github.com/cotes2020/jekyll-theme-chirpy/commit/d127183b9774f6321e409acdb66bf8a85d8814be))
* support showing description of preview image ([2bd6efa](https://github.com/cotes2020/jekyll-theme-chirpy/commit/2bd6efa95a174ac44e30a3af1e57e6f40d6e0e3a))
### Bug Fixes
* alt is not a valid attribute for 'a' tag ([58928db](https://github.com/cotes2020/jekyll-theme-chirpy/commit/58928dbc9068db4e4cda4371eeae1865920dce6a))
* assets URL is missing `baseurl` in self-hosted mode ([#591](https://github.com/cotes2020/jekyll-theme-chirpy/issues/591)) ([54124d5](https://github.com/cotes2020/jekyll-theme-chirpy/commit/54124d5134995fce52e4c2fc0a5d4d1743d6264d))
* correct the `twitter:creator` of Twitter summary card ([96a16c8](https://github.com/cotes2020/jekyll-theme-chirpy/commit/96a16c868ede51e7dfa412de63ffa1e5a49add7f))
* correctly URL encode share links ([4c1c8d8](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4c1c8d8b0eacecbbaa2d522bbdd6430f350ff760)), closes [#496](https://github.com/cotes2020/jekyll-theme-chirpy/issues/496)
* follow paginate_path config for pagination ([6900d9f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/6900d9f2bc9380cbda4babf611c6eeff345291af))
* force checkout of `gh-pages` branch ([#544](https://github.com/cotes2020/jekyll-theme-chirpy/issues/544)) ([5402523](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5402523ae52a3740bcc15df0b226b2612644945d))
* horizontal scroll for long equations ([#545](https://github.com/cotes2020/jekyll-theme-chirpy/issues/545)) ([30787fc](https://github.com/cotes2020/jekyll-theme-chirpy/commit/30787fc4cf151e955bb7afc26dfd859f1a06fce6))
* p is not allowed in span ([4f590e2](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4f590e2bba0639751771211bc0d357828ae70404))
* remove whitespace from avatar URL ([#537](https://github.com/cotes2020/jekyll-theme-chirpy/issues/537)) ([0542b51](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0542b5149c8287dca60e37f46ee36f31b43455e4))
* resume the preview image SEO tag ([#529](https://github.com/cotes2020/jekyll-theme-chirpy/issues/529)) ([b8d1bcd](https://github.com/cotes2020/jekyll-theme-chirpy/commit/b8d1bcd3dea0abd1afef7ef154a4501fbb18938d))
* script code should be in head or body, not in between ([2103191](https://github.com/cotes2020/jekyll-theme-chirpy/commit/2103191b2faf714a8e4418c7c347a1f942b51af8))
* spurious header closing tags ([59e9557](https://github.com/cotes2020/jekyll-theme-chirpy/commit/59e955745f02f9b57c65af70b0979cd4a98bf53f))
* table bypass refactoring when it contains IAL ([#519](https://github.com/cotes2020/jekyll-theme-chirpy/issues/519)) ([5d85ccb](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5d85ccb9943aac88dbbefebe1c2234cdcbae5c53))
* **theme mode:** `SCSS` syntax error ([#588](https://github.com/cotes2020/jekyll-theme-chirpy/issues/588)) ([76a1b6a](https://github.com/cotes2020/jekyll-theme-chirpy/commit/76a1b6a068c369138422dcd18ba08ec8cc3749a6))
* use `jsonify` to generate valid json ([#521](https://github.com/cotes2020/jekyll-theme-chirpy/issues/521)) ([dd9d5a7](https://github.com/cotes2020/jekyll-theme-chirpy/commit/dd9d5a7207b746342d07176d8969dc4f2c380bf2))
* when the `site.img_cdn` is set to the local path, the preview-image path loses the `baseurl` ([9cefe58](https://github.com/cotes2020/jekyll-theme-chirpy/commit/9cefe58993d9ea3a3a28424e7ffd8e0911567c5c))
### Improvements
* avoid post pageviews from shifting while loading ([135a16f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/135a16f13ee783d9308669ff9a824847a73c951c))
* avoid the layout shift for post datetime ([6d35f5f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/6d35f5f8da044cfad071628bb53776de03efaae4))
* **categories:** support singular and plural forms of locale ([#595](https://github.com/cotes2020/jekyll-theme-chirpy/issues/595)) ([35cadf9](https://github.com/cotes2020/jekyll-theme-chirpy/commit/35cadf969dd0161ee62503e242c545f006f7072b))
* improve the responsive design for ultrawide screens ([#540](https://github.com/cotes2020/jekyll-theme-chirpy/issues/540)) ([5d6e8c5](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5d6e8c5ef6aa71b4d2600c5305f6e8ba540557f7))

View File

@@ -12,7 +12,7 @@
[**Live Demo →**](https://cotes2020.github.io/chirpy-demo) [**Live Demo →**](https://cotes2020.github.io/chirpy-demo)
[![Devices Mockup](https://raw.githubusercontent.com/cotes2020/chirpy-images/main/commons/devices-mockup.png)](https://cotes2020.github.io/chirpy-demo) [![Devices Mockup](https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images@f4e0354b674f65a53b8917f0f786ed2956898cc1/commons/devices-mockup.png)](https://cotes2020.github.io/chirpy-demo)
</div> </div>
@@ -28,7 +28,7 @@
- Syntax Highlighting - Syntax Highlighting
- Mathematical Expressions - Mathematical Expressions
- Mermaid Diagram & Flowchart - Mermaid Diagram & Flowchart
- Disqus/Utterances/Giscus Comments - Disqus/Utterances Comments
- Search - Search
- Atom Feeds - Atom Feeds
- Google Analytics - Google Analytics
@@ -38,7 +38,7 @@
## Quick Start ## Quick Start
Before starting, please follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll`, and `Bundler`. In addition, [Git](https://git-scm.com/) is also required to be installed. Before starting, please follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll`, and `Bundler`.
### Step 1. Creating a New Site ### Step 1. Creating a New Site
@@ -69,11 +69,11 @@ $ docker run -it --rm \
jekyll serve jekyll serve
``` ```
After a while, navigate to the site at <http://localhost:4000>. After a while, the local service will be published at _<http://127.0.0.1:4000>_.
## Documentation ## Documentation
For more details on usage, please refer to the tutorial on the [demo website](https://cotes2020.github.io/chirpy-demo/) / [wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). Note that the tutorial is based on the [latest tag](https://github.com/cotes2020/jekyll-theme-chirpy/tags), and the features of the default branch are usually ahead of the documentation. For more details on usage, please refer to the tutorial on the [demo website](https://cotes2020.github.io/chirpy-demo/). At the same time, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). Please note that the tutorial is based on the [latest release](https://github.com/cotes2020/jekyll-theme-chirpy/releases), and the features of the default branch are usually ahead of the documentation.
## Contributing ## Contributing
@@ -83,9 +83,9 @@ Welcome to report bugs, improve code quality or submit a new feature. For more i
This theme is mainly built with [Jekyll](https://jekyllrb.com/) ecosystem, [Bootstrap](https://getbootstrap.com/), [Font Awesome](https://fontawesome.com/) and some other wonderful tools (their copyright information can be found in the relevant files). The avatar and favicon design come from [Clipart Max](https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/). This theme is mainly built with [Jekyll](https://jekyllrb.com/) ecosystem, [Bootstrap](https://getbootstrap.com/), [Font Awesome](https://fontawesome.com/) and some other wonderful tools (their copyright information can be found in the relevant files). The avatar and favicon design come from [Clipart Max](https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/).
:tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas, or inspired me to write more readable documentation. :tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas or inspired me to write more readable documentation.
Last but not least, thank [JetBrains][jb] for providing the OSS development license. Last but not least, thank [JetBrains][jb] for providing the open source license.
## Sponsoring ## Sponsoring

View File

@@ -12,9 +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
@@ -26,7 +23,9 @@ title: Chirpy # the main title
tagline: A text-focused Jekyll theme # it will display as the sub-title tagline: A text-focused Jekyll theme # it will display as the sub-title
description: >- # used by seo meta and the atom feed description: >- # used by seo meta and the atom feed
A minimal, responsive, and powerful Jekyll theme for presenting professional writing. A minimal, portfolio, sidebar,
bootstrap Jekyll theme with responsive web design
and focuses on text presentation.
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io' # fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
url: '' url: ''
@@ -50,13 +49,13 @@ social:
# - https://www.facebook.com/username # - https://www.facebook.com/username
# - https://www.linkedin.com/in/username # - https://www.linkedin.com/in/username
google_site_verification: # fill in to your verification string google_site_verification: google_meta_tag_verification # change to your verification string
# ↑ -------------------------- # ↑ --------------------------
# The end of `jekyll-seo-tag` settings
google_analytics: google_analytics:
id: # fill in your Google Analytics ID id: '' # fill in your Google Analytics ID
# Google Analytics pageviews report settings # Google Analytics pageviews report settings
pv: pv:
proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine
@@ -80,7 +79,7 @@ theme_mode: # [light|dark]
# will be added to all image (site avatar & posts' images) paths starting with '/' # will be added to all image (site avatar & posts' images) paths starting with '/'
# #
# e.g. 'https://cdn.com' # e.g. 'https://cdn.com'
img_cdn: 'https://raw.githubusercontent.com/cotes2020/chirpy-images/main' img_cdn: 'https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images@f4e0354b674f65a53b8917f0f786ed2956898cc1'
# the avatar on sidebar, support local or CORS resources # the avatar on sidebar, support local or CORS resources
avatar: '/commons/avatar.jpg' avatar: '/commons/avatar.jpg'
@@ -97,26 +96,6 @@ comments:
utterances: utterances:
repo: # <gh-username>/<repo> repo: # <gh-username>/<repo>
issue_term: # < url | pathname | title | ...> issue_term: # < url | pathname | title | ...>
# Giscus options https://giscus.app
giscus:
repo: # <gh-username>/<repo>
repo_id:
category:
category_id:
mapping: # optional, default to 'pathname'
input_position: # optional, default to 'bottom'
lang: # optional, default to the value of `site.lang`
# Self-hosted static assets, optional https://github.com/cotes2020/chirpy-static-assets
assets:
self_host:
enabled: # boolean, keep empty means false
# specify the Jekyll environment, empty means both
# only works if `assets.self_host.enabled` is 'true'
env: # [development|production]
pwa:
enabled: true # the option for PWA feature
paginate: 10 paginate: 10
@@ -139,7 +118,8 @@ collections:
sort_by: order sort_by: order
defaults: defaults:
- scope: -
scope:
path: '' # An empty string here means all files in the project path: '' # An empty string here means all files in the project
type: posts type: posts
values: values:
@@ -149,24 +129,18 @@ defaults:
# DO NOT modify the following parameter unless you are confident enough # DO NOT modify the following parameter unless you are confident enough
# to update the code of all other post links in this project. # to update the code of all other post links in this project.
permalink: /posts/:title/ permalink: /posts/:title/
- scope: -
scope:
path: _drafts path: _drafts
values: values:
comments: false comments: false
- scope: -
scope:
path: '' path: ''
type: tabs # see `site.collections` type: tabs # see `site.collections`
values: values:
layout: page layout: page
permalink: /:title/ permalink: /:title/
- scope:
path: assets/img/favicons
values:
swcache: true
- scope:
path: assets/js/dist
values:
swcache: true
sass: sass:
style: compressed style: compressed
@@ -184,8 +158,8 @@ exclude:
- '*.gem' - '*.gem'
- '*.gemspec' - '*.gemspec'
- tools - tools
- docs
- README.md - README.md
- CHANGELOG.md
- LICENSE - LICENSE
- gulpfile.js - gulpfile.js
- node_modules - node_modules

View File

@@ -1,62 +0,0 @@
# CDNs
cdns:
# Google Fonts
- url: https://fonts.googleapis.com
- url: https://fonts.gstatic.com
args: crossorigin
- url: https://fonts.googleapis.com
# jsDelivr CDN
- url: https://cdn.jsdelivr.net
# fonts
webfonts: https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:wght@400;600;700;900&display=swap
# Libraries
jquery:
js: https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
bootstrap:
css: https://cdn.jsdelivr.net/npm/bootstrap@4/dist/css/bootstrap.min.css
js: https://cdn.jsdelivr.net/npm/bootstrap@4/dist/js/bootstrap.bundle.min.js
bootstrap-toc:
css: https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.css
js: https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js
fontawesome:
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css
search:
js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js
mermaid:
js: https://cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js
dayjs:
js:
common: https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js
locale: https://cdn.jsdelivr.net/npm/dayjs@1/locale/:LOCALE.min.js
relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1/plugin/relativeTime.min.js
localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1/plugin/localizedFormat.min.js
countup:
js: https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js
magnific-popup:
css: https://cdn.jsdelivr.net/npm/magnific-popup@1/dist/magnific-popup.min.css
js: https://cdn.jsdelivr.net/npm/magnific-popup@1/dist/jquery.magnific-popup.min.js
lozad:
js: https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js
clipboard:
js: https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js
polyfill:
js: https://polyfill.io/v3/polyfill.min.js?features=es6
mathjax:
js: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js

View File

@@ -1,51 +0,0 @@
# fonts
webfonts: /assets/lib/fonts/main.css
# Libraries
jquery:
js: /assets/lib/jquery-3.6.0/jquery.min.js
bootstrap:
css: /assets/lib/bootstrap-4.6.1/bootstrap.min.css
js: /assets/lib/bootstrap-4.6.1/bootstrap.bundle.min.js
bootstrap-toc:
css: /assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.css
js: /assets/lib/bootstrap-toc-1.0.1/bootstrap-toc.min.js
fontawesome:
css: /assets/lib/fontawesome-free-5.15.4/css/all.min.css
search:
js: /assets/lib/simple-jekyll-search-1.10.0/simple-jekyll-search.min.js
mermaid:
js: /assets/lib/mermaid-8.13.10/mermaid.min.js
dayjs:
js:
common: /assets/lib/dayjs-1.10.7/dayjs.min.js
locale: /assets/lib/dayjs-1.10.7/locale/en.min.js
relativeTime: /assets/lib/dayjs-1.10.7/plugin/relativeTime.min.js
localizedFormat: /assets/lib/dayjs-1.10.7/plugin/localizedFormat.min.js
countup:
js: /assets/lib/countup.js-1.9.3/countUp.min.js
magnific-popup:
css: /assets/lib/magnific-popup-1.1.0/magnific-popup.css
js: /assets/lib/magnific-popup-1.1.0/jquery.magnific-popup.min.js
lozad:
js: /assets/lib/lozad-1.16.0/lozad.min.js
clipboard:
js: /assets/lib/clipboard-2.0.9/clipboard.min.js
polyfill:
js: /assets/lib/polyfill-v3-es6/polyfill.min.js
mathjax:
js: /assets/lib/mathjax-3.2.0/tex-chtml.js

View File

@@ -1,17 +0,0 @@
## Template https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/advanced-usage.md#setting-author-url
# -------------------------------------
# {author_id}:
# name: {full name}
# twitter: {twitter_of_author}
# url: {homepage_of_author}
# -------------------------------------
cotes:
name: Cotes Chung
twitter: cotes2020
url: https://github.com/cotes2020/
sille_bille:
name: Dinesh Prasanth Moluguwan Krishnamoorthy
twitter: dinesh_MKD
url: https://github.com/SilleBille/

View File

@@ -20,13 +20,21 @@ tabs:
search: search:
hint: search hint: search
cancel: Cancel cancel: Cancel
no_results: Oops! No results found. no_results: Oops! No result founds.
panel: panel:
lastmod: Recently Updated lastmod: Recent Update
trending_tags: Trending Tags trending_tags: Trending Tags
toc: Contents 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: copyright:
# Shown at the bottom of the post # Shown at the bottom of the post
license: license:
@@ -44,10 +52,9 @@ meta: Powered by :PLATFORM with :THEME theme.
not_found: not_found:
statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. 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.
notification: head_back: Head back Home
update_found: A new version of content is available. archives_page: Archives page
update: Update
# ----- Posts related labels ----- # ----- Posts related labels -----
@@ -55,6 +62,11 @@ post:
written_by: By written_by: By
posted: Posted posted: Posted
updated: Updated updated: Updated
timeago:
day: days ago
hour: hours ago
minute: minutes ago
just_now: just now
words: words words: words
pageview_measure: views pageview_measure: views
read_time: read_time:
@@ -75,9 +87,5 @@ post:
# categories page # categories page
categories: categories:
category_measure: category_measure: categories
singular: category post_measure: posts
plural: categories
post_measure:
singular: post
plural: posts

View File

@@ -1,79 +0,0 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Entrada
category: Categoría
tag: Etiqueta
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Inicio
categories: Categorías
tags: Etiquetas
archives: Archivo
about: Acerca de
# the text displayed in the search bar & search results
search:
hint: Buscar
cancel: Cancelar
no_results: ¡Oops! No se encuentran resultados.
panel:
lastmod: Actualizado recientemente
trending_tags: Etiquetas populares
toc: Contenido
copyright:
# Shown at the bottom of the post
license:
template: Esta entrada está licenciada bajo :LICENSE_NAME por el autor.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Algunos derechos reservados.
verbose: >-
Salvo que se indique explícitamente, las entradas de este blog están licenciadas
bajo la Creative Commons Attribution 4.0 International (CC BY 4.0) License por el autor.
meta: Hecho con :PLATFORM usando el tema :THEME.
not_found:
statment: Lo sentimos, hemos perdido esa URL o apunta a algo que no existe.
notification:
update_found: Hay una nueva versión de contenido disponible.
update: Actualizar
# ----- Posts related labels -----
post:
written_by: Por
posted: Publicado
updated: Actualizado
words: palabras
pageview_measure: visitas
read_time:
unit: min
prompt: ' de lectura'
relate_posts: Lecturas adicionales
share: Compartir
button:
next: Nuevo
previous: Anterior
copy_code:
succeed: ¡Copiado!
share_link:
title: Copiar enlace
succeed: ¡Enlace copiado!
# pinned prompt of posts list on homepage
pin_prompt: Fijado
# categories page
categories:
category_measure: categorias
post_measure: entradas

View File

@@ -1,79 +0,0 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Post
category: Catégorie
tag: Tag
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Accueil
categories: Catégories
tags: Tags
archives: Archives
about: A propos de
# the text displayed in the search bar & search results
search:
hint: recherche
cancel: Annuler
no_results: Oups ! Aucun résultat trouvé.
panel:
lastmod: Récemment mis à jour
trending_tags: Tags tendance
toc: Contenu
copyright:
# Shown at the bottom of the post
license:
template: Cet article est sous licence :LICENSE_NAME par l'auteur.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Certains droits réservés.
verbose: >-
Sauf mention contraire, les articles de ce site sont publiés sous licence
sous la licence Creative Commons Attribution 4.0 International (CC BY 4.0) par l'auteur.
meta: Propulsé par :PLATFORM avec le thème :THEME
not_found:
statment: Désolé, nous avons égaré cette URL ou elle pointe vers quelque chose qui n'existe pas.
notification:
update_found: Une nouvelle version du contenu est disponible.
update: Mise à jour
# ----- Posts related labels -----
post:
written_by: Par
posted: Posté
updated: Mis à jour
words: mots
pageview_measure: vues
read_time:
unit: min
prompt: lire
relate_posts: Autres lectures
share: Partager
button:
next: Plus récent
previous: Plus ancien
copy_code:
succeed: Copié !
share_link:
title: Copier le lien
succeed: Lien copié avec succès !
# pinned prompt of posts list on homepage
pin_prompt: Épinglé
# categories page
categories:
category_measure: catégories
post_measure: posts

View File

@@ -27,6 +27,14 @@ panel:
trending_tags: Tagar Terpopuler trending_tags: Tagar Terpopuler
toc: Konten toc: Konten
# The liquid date format http://strftime.net/
date_format:
tooltip: "%a, %e %b, %Y, %l:%M %p"
post:
long: "%e %b, %Y"
short: "%e %b"
archive_month: "%b"
copyright: copyright:
# Shown at the bottom of the post # Shown at the bottom of the post
license: license:
@@ -44,10 +52,9 @@ meta: Didukung oleh :PLATFORM dengan tema :THEME.
not_found: not_found:
statment: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada. statment: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada.
hint_template: :HEAD_BAK untuk mencoba mencari kembali, atau cari di :ARCHIVES_PAGE.
notification: head_back: Kembali ke Beranda
update_found: Versi konten baru tersedia. archives_page: Halaman Arsip
update: Perbarui
# ----- Posts related labels ----- # ----- Posts related labels -----
@@ -55,6 +62,11 @@ post:
written_by: Oleh written_by: Oleh
posted: Diterbitkan posted: Diterbitkan
updated: Diperbarui updated: Diperbarui
timeago:
day: hari yang lalu
hour: jam yang lalu
minute: menit yang lalu
just_now: baru saja
words: kata words: kata
pageview_measure: dilihat pageview_measure: dilihat
read_time: read_time:

View File

@@ -27,6 +27,14 @@ panel:
trending_tags: 인기 태그 trending_tags: 인기 태그
toc: 바로가기 toc: 바로가기
# The liquid date format http://strftime.net/
date_format:
tooltip: '%F, %R %z'
post:
long: '%Y년 %m월 %d일'
short: '%m월 %d일'
archive_month: '%b월'
copyright: copyright:
# Shown at the bottom of the post # Shown at the bottom of the post
license: license:
@@ -44,10 +52,9 @@ meta: Powered by :PLATFORM with :THEME theme.
not_found: not_found:
statment: 해당 URL은 존재하지 않습니다. statment: 해당 URL은 존재하지 않습니다.
hint_template: :HEAD_BAK을 눌러 다시 찾거나 :ARCHIVES_PAGE에서 검색해 주세요.
notification: head_back: 홈으로 돌아가기
update_found: 새 버전의 콘텐츠를 사용할 수 있습니다. archives_page: 아카이브 페이지
update: 업데이트
# ----- Posts related labels ----- # ----- Posts related labels -----
@@ -55,6 +62,11 @@ post:
written_by: By written_by: By
posted: 게시 posted: 게시
updated: 업데이트 updated: 업데이트
timeago:
day: 일 전
hour: 시간 전
minute: 분 전
just_now: 방금
words: 단어 words: 단어
pageview_measure: 조회 pageview_measure: 조회
read_time: read_time:

View File

@@ -1,79 +0,0 @@
# 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: အကြောင်းအရာ
# the text displayed in the search bar & search results
search:
hint: ရှာဖွေမည်
cancel: ဖျက်သိမ်းမည်
no_results: အိုး! ဘာမှမရှိပါ
panel:
lastmod: မကြာသေးမီကမွမ်းမံထားသည်
trending_tags: ခေတ်စားနေသည့်တက်ဂ်များ
toc: အကြောင်းအရာများ
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: >-
အခြားမှတ်သားထားချက်များမှလွဲ၍ ဤဆိုက်ရှိ ဘလော့ဂ်ပို့စ်များသည် စာရေးသူ၏
Creative Commons Attribution 4.0 International (CC BY 4.0) အောက်တွင် လိုင်စင်ရထားပါသည်။
meta: Powered by :PLATFORM with :THEME theme.
not_found:
statment: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။
notification:
update_found: အကြောင်းအရာဗားရှင်းအသစ်ကို ရနိုင်ပါပြီ။
update: အပ်ဒိတ်
# ----- Posts related labels -----
post:
written_by: ကရေးသားခဲ့သည်။
posted: တင်ထားခဲ့သည်။
updated: မွမ်းမံထားခဲ့သည်။
words: စကားလုံးများ
pageview_measure: အမြင်များ
read_time:
unit: မိနစ်
prompt: ဖတ်ပါမည်
relate_posts: နောက်ထပ်ဖတ်ရန်
share: မျှဝေရန်
button:
next: အသစ်များ
previous: အဟောင်းများ
copy_code:
succeed: ကူးယူလိုက်ပြီ။
share_link:
title: လင့်ခ်ကို ကူးယူရန်
succeed: လင့်ခ်ကို ကူးယူလိုက်ပြီ။
# pinned prompt of posts list on homepage
pin_prompt: ချိတ်ထားသည်။
# categories page
categories:
category_measure: ကဏ္ဍများ
post_measure: ပို့စ်များ

View File

@@ -1,79 +0,0 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Post
category: Categoria
tag: Tag
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Home
categories: Categorias
tags: Tags
archives: Arquivos
about: Sobre
# the text displayed in the search bar & search results
search:
hint: Buscar
cancel: Cancelar
no_results: Oops! Nenhum resultado encontrado.
panel:
lastmod: Atualizados recentemente
trending_tags: Trending Tags
toc: Conteúdo
copyright:
# Shown at the bottom of the post
license:
template: Esta postagem está licenciada sob :LICENSE_NAME pelo autor.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Alguns direitos reservados.
verbose: >-
Exceto onde indicado de outra forma, as postagens do blog neste site são licenciadas sob a
Creative Commons Attribution 4.0 International (CC BY 4.0) License pelo autor.
meta: Feito com :PLATFORM usando o tema :THEME.
not_found:
statment: Desculpe, a página não foi encontrada.
notification:
update_found: Uma nova versão do conteúdo está disponível.
update: atualização
# ----- Posts related labels -----
post:
written_by: Por
posted: Postado em
updated: Atualizado
words: palavras
pageview_measure: visualizações
read_time:
unit: min
prompt: " de leitura"
relate_posts: Leia também
share: Compartilhar
button:
next: Próximo
previous: Anterior
copy_code:
succeed: Copiado!
share_link:
title: Copie o link
succeed: Link copiado com sucesso!
# pinned prompt of posts list on homepage
pin_prompt: Fixado
# categories page
categories:
category_measure: categorias
post_measure: posts

View File

@@ -1,79 +0,0 @@
# 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: О сайте
# the text displayed in the search bar & search results
search:
hint: поиск
cancel: Отменить
no_results: Ох! Ничего не найдено.
panel:
lastmod: Недавно обновлено
trending_tags: Популярные теги
toc: Содержание
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: >-
Публикации на сайте защищены лицензией Creative Commons Attribution 4.0 International (CC BY 4.0),
если в тексте публикации не указано иное.
meta: Powered by :PLATFORM with :THEME theme.
not_found:
statment: Извините, эта ссылка указывает на ресурс который не существует.
notification:
update_found: Доступна новая версия контента.
update: Обновлять
# ----- Posts related labels -----
post:
written_by: Автор
posted: Время публикации
updated: Обновлено
words: слов
pageview_measure: просмотров
read_time:
unit: минут
prompt: чтения
relate_posts: Вам также может быть интересно
share: Поделиться
button:
next: Предыдущая публикация
previous: Следующая публикация
copy_code:
succeed: Скопировано успешно!
share_link:
title: Скопировать ссылку
succeed: Ссылка успешно скопирована!
# pinned prompt of posts list on homepage
pin_prompt: Закреплено
# categories page
categories:
category_measure: категории
post_measure: публикации

View File

@@ -1,79 +0,0 @@
# 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: Про сайт
# the text displayed in the search bar & search results
search:
hint: пошук
cancel: Скасувати
no_results: Ох! Нічого не знайдено.
panel:
lastmod: Нещодавно оновлено
trending_tags: Популярні теги
toc: Зміст
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: >-
Публікації на сайті захищено ліцензією Creative Commons Attribution 4.0 International (CC BY 4.0),
якщо інше не вказано в тексті.
meta: Powered by :PLATFORM with :THEME theme.
not_found:
statment: Вибачте, це посилання вказує на ресурс, що не існує.
notification:
update_found: Доступна нова версія вмісту.
update: Оновлення
# ----- Posts related labels -----
post:
written_by: Автор
posted: Час публікації
updated: Оновлено
words: слів
pageview_measure: переглядів
read_time:
unit: хвилин
prompt: читання
relate_posts: Вас також може зацікавити
share: Поділитися
button:
next: Попередня публікація
previous: Наступна публікація
copy_code:
succeed: Успішно скопійовано!
share_link:
title: Скопіювати посилання
succeed: Посилання успішно скопійовано!
# pinned prompt of posts list on homepage
pin_prompt: Закріплено
# categories page
categories:
category_measure: категорії
post_measure: публікації

View File

@@ -1,77 +0,0 @@
# The layout text of site
# ----- Commons label -----
layout:
post: Bài viết
category: Danh mục
tag: Thẻ
# The tabs of sidebar
tabs:
# format: <filename_without_extension>: <value>
home: Trang chủ
categories: Các danh mục
tags: Các thẻ
archives: Lưu trữ
about: Giới thiệu
# the text displayed in the search bar & search results
search:
hint: tìm kiếm
cancel: Hủy
no_results: Không có kết quả tìm kiếm.
panel:
lastmod: Mới cập nhật
trending_tags: Các thẻ thịnh hành
toc: Mục lục
copyright:
# Shown at the bottom of the post
license:
template: Bài viết này được cấp phép bởi tác giả theo giấy phép :LICENSE_NAME.
name: CC BY 4.0
link: https://creativecommons.org/licenses/by/4.0/
# Displayed in the footer
brief: Một số quyền được bảo lưu.
verbose: >-
Trừ khi có ghi chú khác, các bài viết đăng trên trang này được cấp phép bởi tác giả theo giấy phép Creative Commons Attribution 4.0 International (CC BY 4.0).
meta: Trang web này được tạo bởi :PLATFORM với chủ đề :THEME.
not_found:
statment: Xin lỗi, chúng tôi đã đặt nhầm URL hoặc đường dẫn trỏ đến một trang nào đó không tồn tại.
notification:
update_found: Đã có phiên bản mới của nội dung.
update: Cập nhật
# ----- Posts related labels -----
post:
written_by: Viết bởi
posted: Đăng lúc
updated: Cập nhật lúc
words: từ
pageview_measure: lượt xem
read_time:
unit: phút
prompt: đọc
relate_posts: Bài viết liên quan
share: Chia sẻ
button:
next: Mới hơn
previous: Cũ hơn
copy_code:
succeed: Đã sao chép!
share_link:
title: Sao chép đường dẫn
succeed: Đã sao chép đường dẫn thành công!
# pinned prompt of posts list on homepage
pin_prompt: Bài ghim
# categories page
categories:
category_measure: danh mục
post_measure: bài viết

View File

@@ -27,6 +27,14 @@ panel:
trending_tags: 热门标签 trending_tags: 热门标签
toc: 文章内容 toc: 文章内容
# The liquid date format http://strftime.net/
date_format:
tooltip: '%F, %R %z'
post:
long: '%F'
short: '%m-%d'
archive_month: '%m月'
copyright: copyright:
# Shown at the bottom of the post # Shown at the bottom of the post
license: license:
@@ -43,10 +51,9 @@ meta: 本站由 :PLATFORM 生成,采用 :THEME 主题。
not_found: not_found:
statment: 抱歉,我们放错了该 URL或者它指向了不存在的内容。 statment: 抱歉,我们放错了该 URL或者它指向了不存在的内容。
hint_template: :HEAD_BAK尝试再次查找它或在:ARCHIVES_PAGE上搜索它。
notification: head_back: 返回主页
update_found: 发现新版本的内容。 archives_page: 归档页面
update: 更新
# ----- Posts related labels ----- # ----- Posts related labels -----
@@ -54,6 +61,11 @@ post:
written_by: 作者 written_by: 作者
posted: 发表于 posted: 发表于
updated: 更新于 updated: 更新于
timeago:
day: 天前
hour: 小时前
minute: 分钟前
just_now: 刚刚
words: words:
pageview_measure: 次浏览 pageview_measure: 次浏览
read_time: read_time:

View File

@@ -13,7 +13,7 @@ platforms:
- -
type: Telegram type: Telegram
icon: "fab fa-telegram" icon: "fab fa-telegram"
link: "https://t.me/share/url?url=URL&text=TITLE" link: "https://telegram.me/share?text=TITLE&url=URL"
# Uncomment below if you need to. # Uncomment below if you need to.
# - # -

View File

@@ -1,12 +0,0 @@
{% comment %} Site static assets origin {% endcomment %}
{% assign origin = 'cross_origin' %}
{% if site.assets.self_host.enabled %}
{% if site.assets.self_host.env %}
{% if site.assets.self_host.env == jekyll.environment %}
{% assign origin = 'self_host' %}
{% endif %}
{% else %}
{% assign origin = 'self_host' %}
{% endif %}
{% endif %}

View File

@@ -1,56 +0,0 @@
<!-- https://giscus.app/ -->
<script type="text/javascript">
$(function () {
const origin = "https://giscus.app";
const iframe = "iframe.giscus-frame";
const lightTheme = "light";
const darkTheme = "dark_dimmed";
let initTheme = lightTheme;
if ($("html[data-mode=dark]").length > 0
|| ($("html[data-mode]").length == 0
&& window.matchMedia("(prefers-color-scheme: dark)").matches)) {
initTheme = darkTheme;
}
let giscusAttributes = {
"src": "https://giscus.app/client.js",
"data-repo": "{{ site.comments.giscus.repo}}",
"data-repo-id": "{{ site.comments.giscus.repo_id }}",
"data-category": "{{ site.comments.giscus.category }}",
"data-category-id": "{{ site.comments.giscus.category_id }}",
"data-mapping": "{{ site.comments.giscus.mapping | default: 'pathname' }}",
"data-reactions-enabled": "1",
"data-emit-metadata": "0",
"data-theme": initTheme,
"data-input-position": "{{ site.comments.giscus.input_position | default: 'bottom' }}",
"data-lang": "{{ site.comments.giscus.lang | default: lang }}",
"crossorigin": "anonymous",
"async": ""
};
let giscusScript = document.createElement("script");
Object.entries(giscusAttributes).forEach(([key, value]) => giscusScript.setAttribute(key, value));
document.getElementById("tail-wrapper").appendChild(giscusScript);
addEventListener("message", (event) => {
if (event.source === window && event.data &&
event.data.direction === ModeToggle.ID) {
/* global theme mode changed */
const mode = event.data.message;
const theme = (mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme);
const message = {
setConfig: {
theme: theme
}
};
const giscus = document.querySelector(iframe).contentWindow;
giscus.postMessage({ giscus: message }, origin);
}
});
});
</script>

View File

@@ -14,8 +14,8 @@
const darkTheme = "github-dark"; const darkTheme = "github-dark";
let initTheme = lightTheme; let initTheme = lightTheme;
if ($("html[data-mode=dark]").length > 0 if ($("html[mode=dark]").length > 0
|| ($("html[data-mode]").length == 0 || ($("html[mode]").length == 0
&& window.matchMedia("(prefers-color-scheme: dark)").matches)) { && window.matchMedia("(prefers-color-scheme: dark)").matches)) {
initTheme = darkTheme; initTheme = darkTheme;
} }

View File

@@ -0,0 +1,15 @@
<!--
CSS selector for site.
-->
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
{% if site.toc and page.toc %}
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.css">
{% endif %}
{% if page.layout == 'page' or page.layout == 'post' %}
<!-- Manific Popup -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/magnific-popup.min.css">
{% endif %}

View File

@@ -1,21 +0,0 @@
<!--
Date format snippet
See: ${JS_ROOT}/utils/locale-dateime.js
-->
{% assign wrap_elem = include.wrap | default: 'em' %}
{% if site.prefer_datetime_locale == 'en' or lang == 'en' %}
{% 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 %}"
data-ts="{{ include.date | date: '%s' }}"
data-df="{{ df_dayjs }}"
{% if include.tooltip %}data-toggle="tooltip" data-placement="bottom"{% endif %}>
{{ include.date | date: df_strftime }}
</{{ wrap_elem }}>

View File

@@ -1,7 +1,9 @@
<!-- The Footer --> <!--
The Footer
-->
<footer class="row pl-3 pr-3"> <footer class="d-flex w-100 justify-content-center">
<div class="col-12 d-flex justify-content-between align-items-center text-muted pl-0 pr-0"> <div class="d-flex justify-content-between align-items-center text-muted">
<div class="footer-left"> <div class="footer-left">
<p class="mb-0"> <p class="mb-0">
© {{ 'now' | date: "%Y" }} © {{ 'now' | date: "%Y" }}
@@ -31,6 +33,5 @@
</p> </p>
</div> </div>
</div> </div> <!-- div.d-flex -->
</footer> </footer>

View File

@@ -6,13 +6,14 @@
<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' %}
<!-- i18n for `_javascript/utils/timeago.js` -->
<meta name="day-prompt" content="{{ site.data.locales[lang].post.timeago.day }}">
<meta name="hour-prompt" content="{{ site.data.locales[lang].post.timeago.hour }}">
<meta name="minute-prompt" content="{{ site.data.locales[lang].post.timeago.minute }}">
<meta name="justnow-prompt" content="{{ site.data.locales[lang].post.timeago.just_now }}">
{% if site.google_analytics.pv.proxy_endpoint %} {% if site.google_analytics.pv.proxy_endpoint %}
<meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}"> <meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}">
{% endif %} {% endif %}
@@ -23,30 +24,7 @@
{% endif %} {% endif %}
{% capture seo_tags %}
{% seo title=false %} {% seo title=false %}
{% endcapture %}
{% if site.img_cdn and seo_tags contains 'og:image' %}
{% assign properties = 'og:image,twitter:image' | split: ',' %}
{% for prop in properties %}
{% if site.img_cdn contains '//' %}
<!-- `site.img_cdn` is a cross-origin URL -->
{% capture target %}<meta property="{{ prop }}" content="{{ site.url }}{% endcapture %}
{% capture replacement %}<meta property="{{ prop }}" content="{{ site.img_cdn }}{% endcapture %}
{% else %}
<!-- `site.img_cdn` is a local file path -->
{% capture target %}<meta property="{{ prop }}" content="{{ site.url }}{{ site.baseurl }}{% endcapture %}
{% assign replacement = target | append: site.img_cdn %}
{% endif %}
{% assign seo_tags = seo_tags | replace: target, replacement %}
{% endfor %}
{% endif %}
{{ seo_tags }}
<title> <title>
{%- unless page.layout == "home" -%} {%- unless page.layout == "home" -%}
@@ -57,24 +35,12 @@
{% include favicons.html %} {% include favicons.html %}
{% if site.resources.ignore_env != jekyll.environment and site.resources.self_hosted %} <!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous">
<link href="{{ site.data.assets[origin].webfonts | relative_url }}" rel="stylesheet"> <link rel="dns-prefetch" href="https://fonts.gstatic.com">
{% else %}
{% for cdn in site.data.assets[origin].cdns %}
<link rel="preconnect" href="{{ cdn.url }}" {{ cdn.args }}>
<link rel="dns-prefetch" href="{{ cdn.url }}" {{ cdn.args }}>
{% endfor %}
<link rel="stylesheet" href="{{ site.data.assets[origin].webfonts | relative_url }}">
{% endif %}
<!-- GA --> <!-- GA -->
{% if jekyll.environment == 'production' {% if jekyll.environment == 'production' %}
and site.google_analytics.id != empty and site.google_analytics.id %}
<link rel="preconnect" href="https://www.google-analytics.com" crossorigin="use-credentials"> <link rel="preconnect" href="https://www.google-analytics.com" crossorigin="use-credentials">
<link rel="dns-prefetch" href="https://www.google-analytics.com"> <link rel="dns-prefetch" href="https://www.google-analytics.com">
@@ -84,33 +50,26 @@
{% if site.google_analytics.pv.proxy_endpoint %} {% if site.google_analytics.pv.proxy_endpoint %}
{% assign proxy_url = site.google_analytics.pv.proxy_endpoint {% assign proxy_url = site.google_analytics.pv.proxy_endpoint
| replace: "https://", "" | split: "/" | first | prepend: "https://" %} | replace: "https://", "" | split: "/" | first | prepend: "https://" %}
<link rel="preconnect" href="{{ proxy_url }}" crossorigin="use-credentials"> <link rel="preconnect" href="{{ proxy_url }}" crossorigin="use-credentials">
<link rel="dns-prefetch" href="{{ proxy_url }}"> <link rel="dns-prefetch" href="{{ proxy_url }}">
{% endif %} {% endif %}
{% endif %} {% endif %}
<!-- jsDelivr CDN -->
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">
<!-- Bootstrap --> <!-- Bootstrap -->
<link rel="stylesheet" href="{{ site.data.assets[origin].bootstrap.css | relative_url}}"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css">
<!-- Font Awesome --> <!-- Font Awesome -->
<link rel="stylesheet" href="{{ site.data.assets[origin].fontawesome.css | relative_url }}"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css">
<link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}"> {% include css-selector.html %}
{% if site.toc and page.toc %}
<link rel="stylesheet" href="{{ site.data.assets[origin].bootstrap-toc.css | relative_url }}">
{% endif %}
{% if page.layout == 'page' or page.layout == 'post' %}
<!-- Manific Popup -->
<link rel="stylesheet" href="{{ site.data.assets[origin].magnific-popup.css | relative_url }}">
{% endif %}
<!-- JavaScript --> <!-- JavaScript -->
<script src="{{ site.data.assets[origin].jquery.js | relative_url }}"></script> <script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
{% unless site.theme_mode %}
{% include mode-toggle.html %}
{% endunless %}
</head> </head>

View File

@@ -7,43 +7,14 @@
{% if page.layout == 'post' %} {% if page.layout == 'post' %}
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<!-- pv-report needs countup.js --> <!-- pv-report needs countup.js -->
<script async src="{{ site.data.assets[origin].countup.js | relative_url }}"></script> <script async src="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script>
<script defer src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script> <script defer src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if page.layout == 'post' or page.layout == 'page' %} {% if page.layout == 'post' or page.layout == 'page' %}
<!-- image lazy-loading & popup & clipboard --> <!-- image lazy-loading & popup -->
{% assign _urls = site.data.assets[origin].magnific-popup.js <script src="https://cdn.jsdelivr.net/combine/npm/lozad/dist/lozad.min.js,npm/magnific-popup@1/dist/jquery.magnific-popup.min.js,npm/clipboard@2/dist/clipboard.min.js"></script>
| append: ',' | append: site.data.assets[origin].lozad.js
| append: ',' | append: site.data.assets[origin].clipboard.js
%}
{% include jsdelivr-combine.html urls=_urls %}
{% endif %}
{% if page.layout == 'home'
or page.layout == 'post'
or page.layout == 'archives'
or page.layout == 'category'
or page.layout == 'tag' %}
{% if site.prefer_datetime_locale %}
{% assign locale = site.prefer_datetime_locale | downcase %}
{% else %}
{% assign locale = site.lang | split: '-' | first %}
{% endif %}
{% assign _urls = site.data.assets[origin].dayjs.js.common
| append: ',' | append: site.data.assets[origin].dayjs.js.locale
| replace: ':LOCALE', locale
| append: ',' | append: site.data.assets[origin].dayjs.js.relativeTime
| append: ',' | append: site.data.assets[origin].dayjs.js.localizedFormat
%}
{% include jsdelivr-combine.html urls=_urls %}
{% endif %} {% endif %}
{% if page.layout == 'home' {% if page.layout == 'home'
@@ -51,16 +22,12 @@
or page.layout == 'post' or page.layout == 'post'
or page.layout == 'page' %} or page.layout == 'page' %}
{% assign type = page.layout %} {% assign type = page.layout %}
{% elsif page.layout == 'archives'
or page.layout == 'category'
or page.layout == 'tag' %}
{% assign type = "misc" %}
{% else %} {% else %}
{% assign type = "commons" %} {% assign type = "commons" %}
{% endif %} {% endif %}
{% capture script %}/assets/js/dist/{{ type }}.min.js{% endcapture %} {% assign js = type | prepend: '/assets/js/dist/' | append: '.min.js' %}
<script defer src="{{ script | relative_url }}"></script> <script defer src="{{ js | relative_url }}"></script>
{% if page.math %} {% if page.math %}
<!-- MathJax --> <!-- MathJax -->
@@ -79,25 +46,22 @@
} }
}; };
</script> </script>
<script src="{{ site.data.assets[origin].polyfill.js | relative_url }}"></script> <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="{{ site.data.assets[origin].mathjax.js | relative_url }}"> <script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script> </script>
{% endif %} {% endif %}
<!-- commons --> <!-- commons -->
<script src="{{ site.data.assets[origin].bootstrap.js | relative_url }}"></script> <script src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.16.1,npm/bootstrap@4/dist/js/bootstrap.min.js"></script>
{% if jekyll.environment == 'production' %} {% if jekyll.environment == 'production' %}
<!-- PWA --> <!-- PWA -->
{% if site.pwa.enabled %}
<script defer src="{{ '/app.js' | relative_url }}"></script> <script defer src="{{ '/app.js' | relative_url }}"></script>
{% else %}
<script defer src="{{ '/unregister.js' | relative_url }}"></script>
{% endif %}
<!-- GA --> <!-- GA -->
{% if site.google_analytics.id != empty and site.google_analytics.id %} {% if site.google_analytics.id %}
{% include google-analytics.html %} {% include google-analytics.html %}
{% endif %} {% endif %}

View File

@@ -1,32 +0,0 @@
{% assign urls = include.urls | split: ',' %}
{% assign combined_urls = nil %}
{% assign domain = 'https://cdn.jsdelivr.net/' %}
{% for url in urls %}
{% if url contains domain %}
{% assign url_snippet = url | slice: domain.size, url.size %}
{% if combined_urls %}
{% assign combined_urls = combined_urls | append: ',' | append: url_snippet %}
{% else %}
{% assign combined_urls = domain | append: 'combine/' | append: url_snippet %}
{% endif %}
{% elsif url contains '//' %}
<script src="{{ url }}"></script>
{% else %}
<script src="{{ url | relative_url }}"></script>
{% endif %}
{% endfor %}
{% if combined_urls %}
<script src="{{ combined_urls }}"></script>
{% endif %}

View File

@@ -2,7 +2,7 @@
mermaid-js loader mermaid-js loader
--> -->
<script src="{{ site.data.assets[origin].mermaid.js | relative_url }}"></script> <script src="https://cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js"></script>
<script> <script>
$(function() { $(function() {
@@ -33,8 +33,8 @@
let initTheme = "default"; let initTheme = "default";
if ($("html[data-mode=dark]").length > 0 if ($("html[mode=dark]").length > 0
|| ($("html[data-mode]").length == 0 || ($("html[mode]").length == 0
&& window.matchMedia("(prefers-color-scheme: dark)").matches ) ) { && window.matchMedia("(prefers-color-scheme: dark)").matches ) ) {
initTheme = "dark"; initTheme = "dark";
} }

View File

@@ -5,7 +5,6 @@
<script type="text/javascript"> <script type="text/javascript">
class ModeToggle { class ModeToggle {
static get MODE_KEY() { return "mode"; } static get MODE_KEY() { return "mode"; }
static get MODE_ATTR() { return "data-mode"; }
static get DARK_MODE() { return "dark"; } static get DARK_MODE() { return "dark"; }
static get LIGHT_MODE() { return "light"; } static get LIGHT_MODE() { return "light"; }
static get ID() { return "mode-toggle"; } static get ID() { return "mode-toggle"; }
@@ -71,17 +70,17 @@
} }
setDark() { setDark() {
$('html').attr(ModeToggle.MODE_ATTR, ModeToggle.DARK_MODE); $('html').attr(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE); sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE);
} }
setLight() { setLight() {
$('html').attr(ModeToggle.MODE_ATTR, ModeToggle.LIGHT_MODE); $('html').attr(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE); sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
} }
clearMode() { clearMode() {
$('html').removeAttr(ModeToggle.MODE_ATTR); $('html').removeAttr(ModeToggle.MODE_KEY);
sessionStorage.removeItem(ModeToggle.MODE_KEY); sessionStorage.removeItem(ModeToggle.MODE_KEY);
} }

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

@@ -9,10 +9,10 @@
<p>{{ page.previous.title }}</p> <p>{{ page.previous.title }}</p>
</a> </a>
{% else %} {% else %}
<div class="btn btn-outline-primary disabled" <span class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[lang].post.button.previous }}"> prompt="{{ site.data.locales[lang].post.button.previous }}">
<p>-</p> <p>-</p>
</div> </span>
{% endif %} {% endif %}
{% if page.next.url %} {% if page.next.url %}
@@ -21,10 +21,10 @@
<p>{{ page.next.title }}</p> <p>{{ page.next.title }}</p>
</a> </a>
{% else %} {% else %}
<div class="btn btn-outline-primary disabled" <span class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[lang].post.button.next }}"> prompt="{{ site.data.locales[lang].post.button.next }}">
<p>-</p> <p>-</p>
</div> </span>
{% endif %} {% endif %}
</div> </div>

View File

@@ -2,7 +2,7 @@
The paginator for post list on HomgPage. The paginator for post list on HomgPage.
--> -->
<ul class="pagination align-items-center mt-4 mb-5 pl-lg-2"> <ul class="pagination align-items-center mt-4 mb-0 pl-lg-2">
<!-- left arrow --> <!-- left arrow -->
{% if paginator.previous_page %} {% if paginator.previous_page %}
{% assign prev_url = paginator.previous_page_path | relative_url %} {% assign prev_url = paginator.previous_page_path | relative_url %}
@@ -47,7 +47,7 @@
{% if show %} {% if show %}
<!-- show number --> <!-- show number -->
<li class="page-item {% if i == paginator.page %} active{% endif %}"> <li class="page-item {% if i == paginator.page %} active{% endif %}">
<a class="page-link btn-box-shadow" href="{% if i > 1 %}{{ site.paginate_path | replace: ':num', i | relative_url }}{% else %}{{ '/' | relative_url }}{% endif %}">{{ i }}</a> <a class="page-link btn-box-shadow" href="{{ site.baseurl }}/{% if i > 1%}page{{ i }}/{% endif %}">{{ i }}</a>
</li> </li>
{% else %} {% else %}
<!-- hide number --> <!-- hide number -->

View File

@@ -6,8 +6,7 @@
<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[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 url = page.url | absolute_url %}
{% assign url = page.url | absolute_url | url_encode %}
{% for share in site.data.share.platforms %} {% for share in site.data.share.platforms %}
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %} {% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
@@ -20,7 +19,7 @@
<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[lang].post.button.share_link.title }}"
data-title-succeed="{{ site.data.locales[lang].post.button.share_link.succeed }}"> title-succeed="{{ site.data.locales[lang].post.button.share_link.succeed }}">
</i> </i>
</span> </span>

View File

@@ -9,11 +9,10 @@
we suround the markdown table with `<div class="table-wrapper">` and `</div>` we suround the markdown table with `<div class="table-wrapper">` and `</div>`
--> -->
{% if _content contains '<table' %} {% if _content contains '<table>' %}
{% assign _content = _content {% assign _content = _content
| replace: '<table', '<div class="table-wrapper"><table' | replace: '<table>', '<div class="table-wrapper"><table>'
| replace: '</table>', '</table></div>' | replace: '</table>', '</table></div>'
| replace: '<code><div class="table-wrapper">', '<code>'
| replace: '</table></div></code>', '</table></code>' | replace: '</table></div></code>', '</table></code>'
%} %}
{% endif %} {% endif %}
@@ -92,11 +91,7 @@
<!-- Add CDN URL --> <!-- Add CDN URL -->
{% if site.img_cdn %} {% if site.img_cdn %}
{% if site.img_cdn contains '//' %}
{% assign _src_prefix = site.img_cdn %} {% assign _src_prefix = site.img_cdn %}
{% else %}
{% assign _src_prefix = site.img_cdn | relative_url %}
{% endif %}
{% else %} {% else %}
{% assign _src_prefix = site.baseurl %} {% assign _src_prefix = site.baseurl %}
{% endif %} {% endif %}
@@ -170,13 +165,13 @@
{% endif %} {% endif %}
{% capture _label %} {% capture _label %}
<span data-label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span> <span label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span>
{% endcapture %} {% endcapture %}
{% assign _new_content = _new_content | append: _snippet {% assign _new_content = _new_content | append: _snippet
| 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" title-succeed="'
| append: site.data.locales[lang].post.button.copy_code.succeed | append: site.data.locales[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>'
@@ -210,14 +205,15 @@
{% endif %} {% endif %}
{% assign id = snippet | split: '"' | first %} {% assign id = snippet | split: '"' | first %}
{% capture anchor %}<a href="#{{ id }}" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>{% endcapture %} {% capture anchor %}<a href="#{{ id }}" class="anchor"><i class="fas fa-hashtag"></i></a>{% endcapture %}
{% assign left = snippet | split: mark_end | first %} {% assign left = snippet | split: mark_end | first %}
{% assign right = snippet | slice: left.size, snippet.size %} {% assign _start_index = left | size %}
{% assign left = left | replace: '">', '"><span class="mr-2">' | append: '</span>' %} {% assign _end_index = snippet | size | minus: 1 %}
{% assign right = snippet | slice: _start_index, _end_index %}
{% assign _new_content = _new_content | append: mark_start {% assign _new_content = _new_content | append: mark_start
| append: left | append: anchor | append: right | append: left | append: anchor | append: mark_end | append: right
%} %}
{% endfor %} {% endfor %}
@@ -229,54 +225,6 @@
{% assign _content = _heading_content %} {% assign _content = _heading_content %}
<!-- Wrap prompt element of blockquote with the <div> tag -->
{% assign blockquote_start = '<blockquote class=' %}
{% assign blockquote_end = '</blockquote>' %}
{% assign cls_prefix = 'prompt-' %}
{% if _content contains blockquote_start %}
{% assign _prompt_content = nil %}
{% assign _prompt_snippets = _content | split: blockquote_start %}
{% for _snippet in _prompt_snippets %}
{% if forloop.first %}
{% assign _prompt_content = _snippet %}
{% continue %}
{% endif %}
{% assign left = _snippet | split: blockquote_end | first %}
{% assign right = _snippet | slice: left.size, _snippet.size %}
{% assign cls_str = left | split: '>' | first %}
{% assign cls_array = cls_str | remove: '"' | split: ' ' %}
{% assign is_prompt = false %}
{% for cls in cls_array %}
{% if cls contains cls_prefix %}
{% assign is_prompt = true %}
{% break %}
{% endif %}
{% endfor %}
{% unless is_prompt %}
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: _snippet %}
{% continue %}
{% endunless %}
{% assign left = left | slice: cls_str.size, left.size %}
{% assign left = cls_str | append: '><div' | append: left | append: '</div>' %}
{% assign _prompt_content = _prompt_content | append: blockquote_start | append: left | append: right %}
{% endfor %}
{% assign _content = _prompt_content %}
{% endif %}
<!-- return --> <!-- return -->
{{ _content }} {{ _content }}

View File

@@ -60,6 +60,7 @@
{% assign less = TOTAL_SIZE | minus: index_list.size %} {% assign less = TOTAL_SIZE | minus: index_list.size %}
{% if less > 0 %} {% if less > 0 %}
{% for i in (0..last_index) %} {% for i in (0..last_index) %}
{% assign post = site.posts[i] %} {% assign post = site.posts[i] %}
{% if post.url != page.url %} {% if post.url != page.url %}
@@ -73,8 +74,10 @@
{% endunless %} {% endunless %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if index_list.size > 0 %} {% if index_list.size > 0 %}
<div id="related-posts" class="mt-5 mb-2 mb-sm-4"> <div id="related-posts" class="mt-5 mb-2 mb-sm-4">
<h3 class="pt-2 mt-1 mb-4 ml-1" <h3 class="pt-2 mt-1 mb-4 ml-1"
@@ -86,7 +89,7 @@
<div class="card"> <div class="card">
<a href="{{ post.url | relative_url }}"> <a href="{{ post.url | relative_url }}">
<div class="card-body"> <div class="card-body">
{% include datetime.html date=post.date class="small" %} {% include timeago.html date=post.date class="small" %}
<h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3> <h3 class="pt-0 mt-1 mb-3" data-toc-skip>{{ post.title }}</h3>
<div class="text-muted small"> <div class="text-muted small">
<p> <p>

View File

@@ -16,7 +16,7 @@
{% 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[lang].search.no_results }}</p>{% endcapture %}
<script src="{{ site.data.assets[origin].search.js | relative_url }}"></script> <script src="https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js"></script>
<script> <script>
SimpleJekyllSearch({ SimpleJekyllSearch({

View File

@@ -2,21 +2,21 @@
The Side Bar 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 class="profile-wrapper text-center">
<div id="avatar"> <div id="avatar">
<a href="{{ '/' | relative_url }}" class="mx-auto"> <a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto">
{% if site.avatar != empty and site.avatar %} {% if site.avatar != '' and site.avatar %}
{% capture avatar_url %} {% capture avatar_url %}
{% if site.avatar contains '://' %} {%- if site.avatar contains '://' -%}
{{ site.avatar }} {{ site.avatar }}
{% elsif site.img_cdn != empty and site.img_cdn %} {%- elsif site.img_cdn != '' and site.img_cdn -%}
{{ site.avatar | prepend: site.img_cdn }} {{ site.avatar | prepend: site.img_cdn }}
{% else %} {%- else -%}
{{ site.avatar | relative_url }} {{ site.avatar | relative_url }}
{% endif %} {%- endif -%}
{% endcapture %} {% endcapture %}
<img src="{{ avatar_url | strip }}" alt="avatar" onerror="this.style.display='none'"> <img src="{{ avatar_url }}" alt="avatar" onerror="this.style.display='none'">
{% endif %} {% endif %}
</a> </a>
</div> </div>

26
_includes/timeago.html Normal file
View File

@@ -0,0 +1,26 @@
<!--
Date format snippet
See: ${JS_ROOT}/utils/timeago.js
-->
{% assign tooltip_df = site.data.locales[lang].date_format.tooltip %}
{% assign post_long_df = site.data.locales[lang].date_format.post.long %}
{% assign post_short_df = site.data.locales[lang].date_format.post.short %}
<em class="timeago{% if include.class %} {{ include.class }}{% endif %}"
date="{{ include.date }}"
{% if include.tooltip %}
data-toggle="tooltip"
data-placement="bottom"
title="{{ include.date | date: tooltip_df }}"
{% 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 -%}
{{ include.date | date: post_long_df }}
{%- endif -%}
</em>

View File

@@ -7,7 +7,7 @@
{% if enable_toc %} {% if enable_toc %}
<!-- BS-toc.js will be loaded at medium priority --> <!-- BS-toc.js will be loaded at medium priority -->
<script src="{{ site.data.assets[origin].bootstrap-toc.js | relative_url }}"></script> <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"> <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[lang].panel.toc -}}</div>

View File

@@ -2,8 +2,8 @@
The Top Bar The Top Bar
--> -->
<div id="topbar-wrapper"> <div id="topbar-wrapper" class="row justify-content-center topbar-down">
<div id="topbar" class="container d-flex align-items-center justify-content-between h-100 pl-3 pr-3 pl-md-4 pr-md-4"> <div id="topbar" class="col-11 d-flex h-100 align-items-center justify-content-between">
<span id="breadcrumb"> <span id="breadcrumb">
{% assign paths = page.url | split: '/' %} {% assign paths = page.url | split: '/' %}
@@ -50,7 +50,7 @@
<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[lang].title | default: site.title -}}
{% elsif page.collection == 'tabs' or page.layout == 'page' %} {% elsif page.collection == 'tabs' or page.dynamic_title %}
{%- 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[lang].tabs[tab_key] | default: page.title -}}
{% else %} {% else %}
@@ -63,6 +63,7 @@
<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[lang].search.hint | capitalize }}...">
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
</span> </span>
<span id="search-cancel" >{{ site.data.locales[lang].search.cancel }}</span> <span id="search-cancel" >{{ site.data.locales[lang].search.cancel }}</span>
</div> </div>

View File

@@ -1,36 +0,0 @@
/**
* A tool for smooth scrolling and topbar switcher
*/
const ScrollHelper = (function () {
const $body = $("body");
const ATTR_TOPBAR_VISIBLE = "data-topbar-visible";
const topbarHeight = $("#topbar-wrapper").outerHeight();
let scrollUpCount = 0; // the number of times the scroll up was triggered by ToC or anchor
let topbarLocked = false;
let orientationLocked = false;
return {
hideTopbar: () => $body.attr(ATTR_TOPBAR_VISIBLE, false),
showTopbar: () => $body.attr(ATTR_TOPBAR_VISIBLE, true),
// scroll up
addScrollUpTask: () => {
scrollUpCount += 1;
if (!topbarLocked) { topbarLocked = true; }
},
popScrollUpTask: () => scrollUpCount -= 1,
hasScrollUpTask: () => scrollUpCount > 0,
topbarLocked: () => topbarLocked === true,
unlockTopbar: () => topbarLocked = false,
getTopbarHeight: () => topbarHeight,
// orientation change
orientationLocked: () => orientationLocked === true,
lockOrientation: () => orientationLocked = true,
unLockOrientation: () => orientationLocked = false
};
}());

View File

@@ -3,9 +3,12 @@
*/ */
$(function() { $(function() {
const btnSbTrigger = $("#sidebar-trigger"); const btnSbTrigger = $("#sidebar-trigger");
const btnSearchTrigger = $("#search-trigger"); const btnSearchTrigger = $("#search-trigger");
const btnCancel = $("#search-cancel"); const btnCancel = $("#search-cancel");
const btnClear = $("#search-cleaner");
const main = $("#main"); const main = $("#main");
const topbarTitle = $("#topbar-title"); const topbarTitle = $("#topbar-title");
const searchWrapper = $("#search-wrapper"); const searchWrapper = $("#search-wrapper");
@@ -30,7 +33,8 @@ $(function() {
}; };
}()); }());
/*--- Actions in mobile screens (Sidebar hidden) ---*/
/*--- Actions in small screens (Sidebar unloaded) ---*/
const mobileSearchBar = (function () { const mobileSearchBar = (function () {
return { return {
@@ -71,6 +75,7 @@ $(function() {
hints.removeClass("unloaded"); hints.removeClass("unloaded");
} }
resultWrapper.addClass("unloaded"); resultWrapper.addClass("unloaded");
btnClear.removeClass("visible");
main.removeClass("unloaded"); main.removeClass("unloaded");
// now the release method must be called after $(#main) display // now the release method must be called after $(#main) display
@@ -87,6 +92,7 @@ $(function() {
}()); }());
function isMobileView() { function isMobileView() {
return btnCancel.hasClass("loaded"); return btnCancel.hasClass("loaded");
} }
@@ -110,20 +116,38 @@ $(function() {
searchWrapper.removeClass("input-focus"); searchWrapper.removeClass("input-focus");
}); });
input.on("input", () => { input.on("keyup", function(e) {
if (input.val() === "") { if (e.keyCode === 8 && input.val() === "") {
if (isMobileView()) { if (!isMobileView()) {
hints.removeClass("unloaded");
} else {
resultSwitch.off(); resultSwitch.off();
} else {
hints.removeClass("unloaded");
}
} else {
if (input.val() !== "") {
resultSwitch.on();
if (!btnClear.hasClass("visible")) {
btnClear.addClass("visible");
} }
} else {
resultSwitch.on();
if (isMobileView()) { if (isMobileView()) {
hints.addClass("unloaded"); hints.addClass("unloaded");
} }
} }
}
});
btnClear.on("click", function() {
input.val("");
if (isMobileView()) {
hints.removeClass("unloaded");
results.empty();
} else {
resultSwitch.off();
}
input.focus();
btnClear.removeClass("visible");
}); });
}); });

View File

@@ -0,0 +1,69 @@
/*
* Hide Header on scroll down
*/
$(function() {
const $topbarWrapper = $("#topbar-wrapper");
const $panel = $("#panel-wrapper");
const $searchInput = $("#search-input");
const CLASS_TOPBAR_UP = "topbar-up";
const CLASS_TOPBAR_DOWN = "topbar-down";
const ATTR_TOC_SCROLLING_UP = "toc-scrolling-up"; // topbar locked
let didScroll;
let lastScrollTop = 0;
const delta = $topbarWrapper.outerHeight();
const topbarHeight = $topbarWrapper.outerHeight();
function hasScrolled() {
let st = $(this).scrollTop();
/* Make sure they scroll more than delta */
if (Math.abs(lastScrollTop - st) <= delta) {
return;
}
if (st > lastScrollTop ) { // Scroll Down
if (st > topbarHeight) {
$topbarWrapper.removeClass(CLASS_TOPBAR_DOWN).addClass(CLASS_TOPBAR_UP);
$panel.removeClass(CLASS_TOPBAR_DOWN);
if ($searchInput.is(":focus")) {
$searchInput.blur(); /* remove focus */
}
}
} else {// Scroll up
// did not reach the bottom of the document, i.e., still have space to scroll up
if (st + $(window).height() < $(document).height()) {
let tocScrollingUp = $topbarWrapper.attr(ATTR_TOC_SCROLLING_UP);
if (typeof tocScrollingUp !== "undefined") {
if (tocScrollingUp === "false") {
$topbarWrapper.removeAttr(ATTR_TOC_SCROLLING_UP);
}
} else {
$topbarWrapper.removeClass(CLASS_TOPBAR_UP).addClass(CLASS_TOPBAR_DOWN);
$panel.addClass(CLASS_TOPBAR_DOWN);
}
}
}
lastScrollTop = st;
}
$(window).scroll(function(event) {
if ($("#topbar-title").is(":hidden")) {
didScroll = true;
}
});
setInterval(function() {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 250);
});

View File

@@ -1,90 +0,0 @@
/*
* Hide Header on scroll down
*/
$(function() {
const $searchInput = $("#search-input");
const delta = ScrollHelper.getTopbarHeight();
let didScroll;
let lastScrollTop = 0;
function hasScrolled() {
let st = $(this).scrollTop();
/* Make sure they scroll more than delta */
if (Math.abs(lastScrollTop - st) <= delta) {
return;
}
if (st > lastScrollTop ) { // Scroll Down
ScrollHelper.hideTopbar();
if ($searchInput.is(":focus")) {
$searchInput.blur(); /* remove focus */
}
} else { // Scroll up
// has not yet scrolled to the bottom of the screen, that is, there is still space for scrolling
if (st + $(window).height() < $(document).height()) {
if (ScrollHelper.hasScrollUpTask()) {
return;
}
if (ScrollHelper.topbarLocked()) { // avoid redundant scroll up event from smooth scrolling
ScrollHelper.unlockTopbar();
} else {
if (ScrollHelper.orientationLocked()) { // avoid device auto scroll up on orientation change
ScrollHelper.unLockOrientation();
} else {
ScrollHelper.showTopbar();
}
}
}
}
lastScrollTop = st;
} // hasScrolled()
function handleLandscape() {
if ($(window).scrollTop() === 0) {
return;
}
ScrollHelper.lockOrientation();
ScrollHelper.hideTopbar();
}
if (screen.orientation) {
screen.orientation.onchange = () => {
const type = screen.orientation.type;
if (type === "landscape-primary" || type === "landscape-secondary") {
handleLandscape();
}
};
} else {
// for the browsers that not support `window.screen.orientation` API
$(window).on("orientationchange",() => {
if ($(window).width() < $(window).height()) { // before rotating, it is still in portrait mode.
handleLandscape();
}
});
}
$(window).scroll(() => {
if (didScroll) {
return;
}
didScroll = true;
});
setInterval(() => {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 250);
});

View File

@@ -1,66 +1,46 @@
/* /*
* Top bar title auto change while scrolling up/down in mobile screens. * Top bar title auto change while scrolling in mobile screens.
*/ */
$(function() { $(function() {
const titleSelector = "div.post>h1:first-of-type";
const $pageTitle = $(titleSelector);
const $topbarTitle = $("#topbar-title");
if ($pageTitle.length === 0 /* on Home page */ const topbarTitle = $("#topbar-title");
|| $pageTitle.hasClass("dynamic-title") const postTitle = $("div.post>h1");
|| $topbarTitle.is(":hidden")) {/* not in mobile views */
return;
}
const defaultTitleText = $topbarTitle.text().trim(); const DEFAULT = topbarTitle.text().trim();
let pageTitleText = $pageTitle.text().trim();
let hasScrolled = false; let title = (postTitle.length > 0) ?
let lastScrollTop = 0; postTitle.text().trim() : $("h1").text().trim();
if ($("#page-category").length || $("#page-tag").length) { if ($("#page-category").length || $("#page-tag").length) {
/* The title in Category or Tag page will be "<title> <count_of_posts>" */ /* The title in Category or Tag page will be "<title> <count_of_posts>" */
if (/\s/.test(pageTitleText)) { if (/\s/.test(title)) {
pageTitleText = pageTitleText.replace(/[0-9]/g, "").trim(); title = title.replace(/[0-9]/g, "").trim();
} }
} }
// When the page is scrolled down and then refreshed, the topbar title needs to be initialized /* Replace topbar title while scroll screens. */
if ($pageTitle.offset().top < $(window).scrollTop()) { $(window).scroll(function () {
$topbarTitle.text(pageTitleText); if ($("#post-list").length /* in Home page */
|| postTitle.is(":hidden") /* is tab pages */
|| topbarTitle.is(":hidden") /* not mobile screens */
|| $("#sidebar.sidebar-expand").length) { /* when the sidebar trigger is clicked */
return false;
} }
let options = { if ($(this).scrollTop() >= 95) {
rootMargin: '-48px 0px 0px 0px', // 48px equals to the topbar height (3rem) if (topbarTitle.text() !== title) {
threshold: [0, 1] topbarTitle.text(title);
};
let observer = new IntersectionObserver((entries) => {
if (!hasScrolled) {
hasScrolled = true;
return;
}
let curScrollTop = $(window).scrollTop();
let isScrollDown = lastScrollTop < curScrollTop;
lastScrollTop = curScrollTop;
let heading = entries[0];
if (isScrollDown) {
if (heading.intersectionRatio === 0) {
$topbarTitle.text(pageTitleText);
} }
} else { } else {
if (heading.intersectionRatio === 1) { if (topbarTitle.text() !== DEFAULT) {
$topbarTitle.text(defaultTitleText); topbarTitle.text(DEFAULT);
} }
} }
}, options); });
observer.observe(document.querySelector(titleSelector)); /* Click title remove hover effect. */
topbarTitle.click(function() {
/* Click title will scroll to top */
$topbarTitle.click(function() {
$("body,html").animate({scrollTop: 0}, 800); $("body,html").animate({scrollTop: 0}, 800);
}); });

View File

@@ -1,5 +1,5 @@
/*! /*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View File

@@ -10,8 +10,6 @@ $(function() {
const btnSelector = '.code-header>button'; const btnSelector = '.code-header>button';
const ICON_SUCCESS = 'fas fa-check'; const ICON_SUCCESS = 'fas fa-check';
const ATTR_TIMEOUT = 'timeout'; const ATTR_TIMEOUT = 'timeout';
const ATTR_TITLE_SUCCEED = 'data-title-succeed';
const ATTR_TITLE_ORIGIN = 'data-original-title';
const TIMEOUT = 2000; // in milliseconds const TIMEOUT = 2000; // in milliseconds
function isLocked(node) { function isLocked(node) {
@@ -55,12 +53,12 @@ $(function() {
const ICON_DEFAULT = getIcon(btnSelector); const ICON_DEFAULT = getIcon(btnSelector);
function showTooltip(btn) { function showTooltip(btn) {
const succeedTitle = $(btn).attr(ATTR_TITLE_SUCCEED); const succeedTitle = $(btn).attr('title-succeed');
$(btn).attr(ATTR_TITLE_ORIGIN, succeedTitle).tooltip('show'); $(btn).attr('data-original-title', succeedTitle).tooltip('show');
} }
function hideTooltip(btn) { function hideTooltip(btn) {
$(btn).tooltip('hide').removeAttr(ATTR_TITLE_ORIGIN); $(btn).tooltip('hide').removeAttr('data-original-title');
} }
function setSuccessIcon(btn) { function setSuccessIcon(btn) {
@@ -117,14 +115,14 @@ $(function() {
// Switch tooltip title // Switch tooltip title
const defaultTitle = target.attr(ATTR_TITLE_ORIGIN); const defaultTitle = target.attr('data-original-title');
const succeedTitle = target.attr(ATTR_TITLE_SUCCEED); const succeedTitle = target.attr('title-succeed');
target.attr(ATTR_TITLE_ORIGIN, succeedTitle).tooltip('show'); target.attr('data-original-title', succeedTitle).tooltip('show');
lock(target); lock(target);
setTimeout(() => { setTimeout(() => {
target.attr(ATTR_TITLE_ORIGIN, defaultTitle); target.attr('data-original-title', defaultTitle);
unlock(target); unlock(target);
}, TIMEOUT); }, TIMEOUT);

View File

@@ -1,45 +0,0 @@
/**
* Update month/day to locale datetime
*
* Requirement: <https://github.com/iamkun/dayjs>
*/
/* A tool for locale datetime */
const LocaleHelper = (function () {
const $preferLocale = $('meta[name="prefer-datetime-locale"]');
const locale = $preferLocale.length > 0 ?
$preferLocale.attr('content').toLowerCase() : $('html').attr('lang').substr(0, 2);
const attrTimestamp = 'data-ts';
const attrDateFormat = 'data-df';
return {
locale: () => locale,
attrTimestamp: () => attrTimestamp,
attrDateFormat: () => attrDateFormat,
getTimestamp: ($elem) => Number($elem.attr(attrTimestamp)), // unix timestamp
getDateFormat: ($elem) => $elem.attr(attrDateFormat)
};
}());
$(function() {
dayjs.locale(LocaleHelper.locale());
dayjs.extend(window.dayjs_plugin_localizedFormat);
$(`[${LocaleHelper.attrTimestamp()}]`).each(function () {
const date = dayjs.unix(LocaleHelper.getTimestamp($(this)));
const text = date.format(LocaleHelper.getDateFormat($(this)));
$(this).text(text);
$(this).removeAttr(LocaleHelper.attrTimestamp());
$(this).removeAttr(LocaleHelper.attrDateFormat());
// setup tooltips
const tooltip = $(this).attr('data-toggle');
if (typeof tooltip === 'undefined' || tooltip !== 'tooltip') {
return;
}
const tooltipText = date.format('llll'); // see: https://day.js.org/docs/en/display/format#list-of-localized-formats
$(this).attr('data-original-title', tooltipText);
});
});

View File

@@ -8,56 +8,53 @@
*/ */
$(function() { $(function() {
const $topbarWrapper = $("#topbar-wrapper");
const topbarHeight = $topbarWrapper.outerHeight();
const $topbarTitle = $("#topbar-title"); const $topbarTitle = $("#topbar-title");
const ATTR_TOC_SCROLLING = "toc-scrolling-up";
const SCROLL_MARK = "scroll-focus";
const REM = 16; // in pixels const REM = 16; // in pixels
const ATTR_SCROLL_FOCUS = "scroll-focus"; let tocScrollUpCount = 0;
$("a[href*='#']") $("a[href*='#']")
.not("[href='#']") .not("[href='#']")
.not("[href='#0']") .not("[href='#0']")
.click(function(event) { .click(function(event) {
if (this.pathname.replace(/^\//, "") !== if (this.pathname.replace(/^\//, "") === location.pathname.replace(/^\//, "")) {
location.pathname.replace(/^\//, "")) { if (location.hostname === this.hostname) {
return;
}
if (location.hostname !== this.hostname) {
return;
}
const hash = decodeURI(this.hash); const hash = decodeURI(this.hash);
let toFootnoteRef = RegExp(/^#fnref:/).test(hash); let toFootnoteRef = RegExp(/^#fnref:/).test(hash);
let toFootnote = toFootnoteRef? false : RegExp(/^#fn:/).test(hash); let toFootnote = toFootnoteRef? false : RegExp(/^#fn:/).test(hash);
let selector = hash.includes(":") ? hash.replace(/\:/g, "\\:") : hash; let selector = hash.includes(":") ? hash.replace(/\:/g, "\\:") : hash;
let $target = $(selector); let $target = $(selector);
let isMobileViews = $topbarTitle.is(":visible"); let parent = $(this).parent().prop("tagName");
let isPortrait = $(window).width() < $(window).height(); let isAnchor = RegExp(/^H\d/).test(parent);
let isMobileViews = !$topbarTitle.is(":hidden");
if (typeof $target === "undefined") {
return;
}
if (typeof $target !== "undefined") {
event.preventDefault(); event.preventDefault();
if (history.pushState) { /* add hash to URL */ if (history.pushState) { /* add hash to URL */
history.pushState(null, null, hash); history.pushState(null, null, hash);
} }
let curOffset = $(window).scrollTop(); let curOffset = isAnchor? $(this).offset().top : $(window).scrollTop();
let destOffset = $target.offset().top -= REM / 2; let destOffset = $target.offset().top -= REM / 2;
if (destOffset < curOffset) { // scroll up if (destOffset < curOffset) { // scroll up
ScrollHelper.hideTopbar(); if (!isAnchor && !toFootnote) { // trigger by ToC item
ScrollHelper.addScrollUpTask(); if (!isMobileViews) { // on desktop/tablet screens
$topbarWrapper.removeClass("topbar-down").addClass("topbar-up");
if (isMobileViews && isPortrait) { // Send message to `${JS_ROOT}/commons/topbar-switch.js`
destOffset -= ScrollHelper.getTopbarHeight(); $topbarWrapper.attr(ATTR_TOC_SCROLLING, true);
tocScrollUpCount += 1;
}
} }
} else { // scroll down if ((isAnchor || toFootnoteRef) && isMobileViews) {
if (isMobileViews && isPortrait) { destOffset -= topbarHeight;
destOffset -= ScrollHelper.getTopbarHeight();
} }
} }
@@ -67,18 +64,18 @@ $(function() {
$target.focus(); $target.focus();
/* clean up old scroll mark */ /* clean up old scroll mark */
if ($(`[${ATTR_SCROLL_FOCUS}=true]`).length) { if ($(`[${SCROLL_MARK}=true]`).length) {
$(`[${ATTR_SCROLL_FOCUS}=true]`).attr(ATTR_SCROLL_FOCUS, false); $(`[${SCROLL_MARK}=true]`).attr(SCROLL_MARK, false);
} }
/* Clean :target links */ /* Clean :target links */
if ($(":target").length) { /* element that visited by the URL with hash */ if ($(":target").length) { /* element that visited by the URL with hash */
$(":target").attr(ATTR_SCROLL_FOCUS, false); $(":target").attr(SCROLL_MARK, false);
} }
/* set scroll mark to footnotes */ /* set scroll mark to footnotes */
if (toFootnote || toFootnoteRef) { if (toFootnote || toFootnoteRef) {
$target.attr(ATTR_SCROLL_FOCUS, true); $target.attr(SCROLL_MARK, true);
} }
if ($target.is(":focus")) { /* Checking if the target was focused */ if ($target.is(":focus")) { /* Checking if the target was focused */
@@ -88,9 +85,17 @@ $(function() {
$target.focus(); /* Set focus again */ $target.focus(); /* Set focus again */
} }
if (ScrollHelper.hasScrollUpTask()) { if (typeof $topbarWrapper.attr(ATTR_TOC_SCROLLING) !== "undefined") {
ScrollHelper.popScrollUpTask(); tocScrollUpCount -= 1;
if (tocScrollUpCount <= 0) {
$topbarWrapper.attr(ATTR_TOC_SCROLLING, "false");
}
} }
}); });
}
}
}
}); /* click() */ }); /* click() */
}); });

View File

@@ -0,0 +1,77 @@
/*
* Calculate the Timeago
*/
$(function() {
const timeagoElem = $(".timeago");
let tasks = timeagoElem.length;
let intervalId = void 0;
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(date, initDate) {
let now = new Date();
let past = new Date(date);
if (past.getFullYear() !== now.getFullYear()
|| past.getMonth() !== now.getMonth()) {
return initDate;
}
let seconds = Math.floor((now - past) / 1000);
let day = Math.floor(seconds / 86400);
if (day >= 1) {
return ` ${day} ${dPrompt}`;
}
let hour = Math.floor(seconds / 3600);
if (hour >= 1) {
return ` ${hour} ${hrPrompt}`;
}
let minute = Math.floor(seconds / 60);
if (minute >= 1) {
return ` ${minute} ${minPrompt}`;
}
return justnowPrompt;
}
function updateTimeago() {
$(".timeago").each(function() {
if ($(this)[0].hasAttribute("date") === false) {
tasks -= 1;
return;
}
let date = $(this).attr("date");
let initDate = $(this).text();
let relativeDate = timeago(date, initDate);
if (relativeDate === initDate) {
$(this).removeAttr("date");
} else {
$(this).text(relativeDate);
}
});
if (tasks === 0 && typeof intervalId !== "undefined") {
clearInterval(intervalId); /* stop interval */
}
return tasks;
}
if (tasks === 0) {
return;
}
if (updateTimeago() > 0) { /* run immediately */
intervalId = setInterval(updateTimeago, 60000); /* run every minute */
}
});

View File

@@ -5,15 +5,8 @@ layout: page
{% include lang.html %} {% include lang.html %}
{% 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-2"> <div id="archives" class="pl-xl-2">
{% for post in site.posts %} {% for post in site.posts %}
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %} {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% capture pre_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %} {% capture pre_year %}{{ post.previous.date | date: "%Y" }}{% endcapture %}
@@ -25,13 +18,11 @@ layout: page
{% endif %} {% endif %}
<li> <li>
<div> <div>
{% assign ts = post.date | date: '%s' %} {% capture this_day %}{{ post.date | date: "%d" }}{% endcapture %}
<span class="date day" data-ts="{{ ts }}" data-df="DD"> {% capture _mth_df %}{{ site.data.locales[lang].date_format.post.archive_month }}{% endcapture %}
{{ post.date | date: "%d" }} {% capture this_month %}{{ post.date | date: _mth_df }}{% endcapture %}
</span> <span class="date day">{{ this_day }}</span>
<span class="date month small text-muted" data-ts="{{ ts }}" data-df="{{ df_dayjs_m }}"> <span class="date month small text-muted">{% include no-zero-date.html date_str=this_month %}</span>
{{ post.date | date: df_strftime_m }}
</span>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a> <a href="{{ post.url | relative_url }}">{{ post.title }}</a>
</div> </div>
</li> </li>

View File

@@ -47,24 +47,10 @@ layout: page
<span class="text-muted small font-weight-light"> <span class="text-muted small font-weight-light">
{% if sub_categories_size > 0 %} {% if sub_categories_size > 0 %}
{{ sub_categories_size }} {{ sub_categories_size }}
{% if sub_categories_size > 1 %} {{ site.data.locales[lang].categories.category_measure }},
{{ site.data.locales[lang].categories.category_measure.plural
| default: site.data.locales[lang].categories.category_measure }}
{% else %}
{{ site.data.locales[lang].categories.category_measure.singular
| default: site.data.locales[lang].categories.category_measure }}
{% endif %},
{% endif %} {% endif %}
{{ top_posts_size }} {{ top_posts_size }}
{{ site.data.locales[lang].categories.post_measure }}
{% if top_posts_size > 1 %}
{{ site.data.locales[lang].categories.post_measure.plural
| default: site.data.locales[lang].categories.post_measure }}
{% else %}
{{ site.data.locales[lang].categories.post_measure.singular
| default: site.data.locales[lang].categories.post_measure }}
{% endif %}
</span> </span>
</span> </span>
@@ -97,14 +83,7 @@ layout: page
{% assign posts_size = site.categories[sub_category] | size %} {% assign posts_size = site.categories[sub_category] | size %}
<span class="text-muted small font-weight-light"> <span class="text-muted small font-weight-light">
{{ posts_size }} {{ posts_size }}
{{ site.data.locales[lang].categories.post_measure }}
{% if posts_size > 1 %}
{{ site.data.locales[lang].categories.post_measure.plural
| default: site.data.locales[lang].categories.post_measure }}
{% else %}
{{ site.data.locales[lang].categories.post_measure.singular
| default: site.data.locales[lang].categories.post_measure }}
{% endif %}
</span> </span>
</li> </li>
{% endfor %} {% endfor %}

View File

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

View File

@@ -7,11 +7,9 @@ layout: compress
{% include lang.html %} {% include lang.html %}
{% include assets-origin.html %}
{% capture prefer_mode %} {% capture prefer_mode %}
{% if site.theme_mode %} {% if site.theme_mode %}
data-mode="{{ site.theme_mode }}" mode="{{ site.theme_mode }}"
{% endif %} {% endif %}
{% endcapture %} {% endcapture %}
@@ -19,14 +17,18 @@ layout: compress
{% include head.html %} {% include head.html %}
<body data-spy="scroll" data-target="#toc" data-topbar-visible="true"> {% unless site.theme_mode %}
{% include mode-toggle.html %}
{% endunless %}
<body data-spy="scroll" data-target="#toc">
{% include sidebar.html %} {% include sidebar.html %}
{% include topbar.html %} {% include topbar.html %}
<div id="main-wrapper" class="d-flex justify-content-center"> <div id="main-wrapper">
<div id="main" class="container pl-xl-4 pr-xl-4"> <div id="main">
{{ content }} {{ content }}
@@ -48,23 +50,6 @@ layout: compress
<i class="fas fa-angle-up"></i> <i class="fas fa-angle-up"></i>
</a> </a>
{% if site.pwa.enabled %}
<div id="notification" class="toast" role="alert" aria-live="assertive" aria-atomic="true"
data-animation="true" data-autohide="false">
<div class="toast-header">
<button type="button" class="ml-2 ml-auto close" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="toast-body text-center pt-0">
<p class="pl-2 pr-2 mb-3">{{ site.data.locales[lang].notification.update_found }}</p>
<button type="button" class="btn btn-primary" aria-label="Update">
{{ site.data.locales[lang].notification.update }}
</button>
</div>
</div>
{% endif %}
{% include search-loader.html %} {% include search-loader.html %}
{% include js-selector.html %} {% include js-selector.html %}

View File

@@ -6,7 +6,7 @@ layout: page
{% include lang.html %} {% 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" %}
{% assign posts = "" | split: "" %} {% assign posts = "" | split: "" %}
@@ -23,6 +23,7 @@ layout: page
{% assign pinned_num = 0 %} {% assign pinned_num = 0 %}
{% endif %} {% endif %}
<!-- Get default posts --> <!-- Get default posts -->
{% assign default_beg = offset | minus: pinned.size %} {% assign default_beg = offset | minus: pinned.size %}
@@ -57,11 +58,15 @@ layout: page
</div> </div>
<div class="post-meta text-muted d-flex"> <div class="post-meta text-muted d-flex">
<div class="mr-auto">
<div class="mr-auto">
<!-- posted date --> <!-- posted date -->
<i class="far fa-calendar fa-fw"></i> <i class="far fa-calendar fa-fw"></i>
{% include datetime.html date=post.date %} {% include timeago.html date=post.date tooltip=true %}
<!-- time to read -->
<i class="far fa-clock fa-fw"></i>
{% include read-time.html content=post.content %}
<!-- categories --> <!-- categories -->
{% if post.categories.size > 0 %} {% if post.categories.size > 0 %}
@@ -73,7 +78,6 @@ layout: page
{% endfor %} {% endfor %}
</span> </span>
{% endif %} {% endif %}
</div> </div>
{% if post.pin %} {% if post.pin %}

View File

@@ -4,13 +4,11 @@ layout: default
{% include lang.html %} {% include lang.html %}
{% include assets-origin.html %}
<div class="row"> <div class="row">
<!-- core --> <!-- core -->
<div id="core-wrapper" class="col-12 col-lg-11 col-xl-9 pr-xl-4"> <div id="core-wrapper" class="col-12 col-lg-11 col-xl-8">
<div class="post pl-1 pr-1 pl-md-2 pr-md-2"> <div class="post pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4">
{% capture _content %} {% capture _content %}
{% if layout.refactor or page.layout == 'page' %} {% if layout.refactor or page.layout == 'page' %}
@@ -36,7 +34,7 @@ layout: default
</div> <!-- #core-wrapper --> </div> <!-- #core-wrapper -->
<!-- pannel --> <!-- pannel -->
<div id="panel-wrapper" class="col-xl-3 pl-2 text-muted"> <div id="panel-wrapper" class="col-xl-3 pl-2 text-muted topbar-down">
<div class="access"> <div class="access">
{% include update-list.html %} {% include update-list.html %}
@@ -54,11 +52,13 @@ layout: default
<!-- tail --> <!-- tail -->
{% if layout.tail_includes %} {% if layout.tail_includes %}
<div class="row"> <div class="row">
<div id="tail-wrapper" class="col-12 col-lg-11 col-xl-9 pl-3 pr-3 pr-xl-4"> <div class="col-12 col-lg-11 col-xl-8">
<div id="tail-wrapper" class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4">
{% for _include in layout.tail_includes %} {% for _include in layout.tail_includes %}
{% assign _include_path = _include | append: '.html' %} {% assign _include_path = _include | append: '.html' %}
{% include {{ _include_path }} %} {% include {{ _include_path }} %}
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</div> <!-- .row -->
{% endif %} {% endif %}

View File

@@ -11,30 +11,11 @@ tail_includes:
{% include lang.html %} {% include lang.html %}
<h1 data-toc-skip>{{ page.title }}</h1> {% if page.image.src %}
<div class="post-meta text-muted">
<!-- published date -->
<span>
{{ site.data.locales[lang].post.posted }}
{% include datetime.html date=page.date tooltip=true %}
</span>
<!-- lastmod date -->
{% if page.last_modified_at %}
<span>
{{ site.data.locales[lang].post.updated }}
{% include datetime.html date=page.last_modified_at tooltip=true %}
</span>
{% endif %}
{% if page.image.path %}
{% capture bg %} {% capture bg %}
{% unless page.image.no_bg %}{{ 'bg' }}{% endunless %} {% unless page.image.no_bg %}{{ 'bg' }}{% endunless %}
{% endcapture %} {% endcapture %}
<img src="{{ page.image.src }}" class="preview-img {{ bg | strip }}"
<div class="mt-3 mb-3">
<img src="{{ page.image.path }}" class="preview-img {{ bg | strip }}"
alt="{{ page.image.alt | default: "Preview Image" }}" alt="{{ page.image.alt | default: "Preview Image" }}"
{% if page.image.width %} {% if page.image.width %}
@@ -48,28 +29,24 @@ tail_includes:
{% elsif page.image.h %} {% elsif page.image.h %}
height="{{ page.image.h }}" height="{{ page.image.h }}"
{% endif %}> {% endif %}>
{% if page.image.alt %}
<figcaption class="pt-2 pb-2">{{ page.image.alt }}</figcaption>
{% endif %} {% endif %}
</div> <h1 data-toc-skip>{{ page.title }}</h1>
{% endif %}
<div class="post-meta text-muted">
<div class="d-flex justify-content-between">
<!-- author --> <!-- author -->
<span> <div>
{% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %} {% capture author_name %}{{ page.author.name | default: site.social.name }}{% endcapture %}
{% assign author_link = nil %} {% assign author_link = nil %}
{% if page.author %} {% if page.author.link %}
{% assign author_link = site.data.authors[page.author].url %} {% assign author_link = page.author.link %}
{% elsif author_name == site.social.name %} {% elsif author_name == site.social.name %}
{% assign author_link = site.social.links[0] %} {% assign author_link = site.social.links[0] %}
{% endif %} {% endif %}
{{ site.data.locales[lang].post.written_by }} {{ site.data.locales[lang].post.written_by }}
<em> <em>
{% if author_link %} {% if author_link %}
<a href="{{ author_link }}">{{ author_name }}</a> <a href="{{ author_link }}">{{ author_name }}</a>
@@ -77,9 +54,27 @@ tail_includes:
{{ author_name }} {{ author_name }}
{% endif %} {% endif %}
</em> </em>
</div>
<div class="d-flex">
<div>
<!-- published date -->
<span>
{{ site.data.locales[lang].post.posted }}
{% include timeago.html date=page.date tooltip=true %}
</span> </span>
<div> <!-- lastmod date -->
{% if page.last_modified_at %}
<span>
{{ site.data.locales[lang].post.updated }}
{% include timeago.html date=page.last_modified_at tooltip=true %}
</span>
{% endif %}
<!-- read time -->
{% include read-time.html content=content prompt=true %}
<!-- page views --> <!-- page views -->
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<span> <span>
@@ -89,9 +84,6 @@ tail_includes:
{{ site.data.locales[lang].post.pageview_measure }} {{ site.data.locales[lang].post.pageview_measure }}
</span> </span>
{% endif %} {% endif %}
<!-- read time -->
{% include read-time.html content=content prompt=true %}
</div> </div>
</div> <!-- .d-flex --> </div> <!-- .d-flex -->

View File

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

View File

@@ -14,9 +14,7 @@ layout: page
{% for t in sorted_tags %} {% for t in sorted_tags %}
<div> <div>
<a class="tag" href="{{ t | slugify | url_encode | prepend: '/tags/' | append: '/' | relative_url }}"> <a class="tag" href="{{ site.baseurl }}/tags/{{ t | slugify | url_encode }}/">{{ t }}<span class="text-muted">{{ site.tags[t].size }}</span></a>
{{ t }}<span class="text-muted">{{ site.tags[t].size }}</span>
</a>
</div> </div>
{% endfor %} {% endfor %}

View File

@@ -1,16 +1,17 @@
--- ---
title: Text and Typography title: Text and Typography
author: cotes author:
name: Cotes Chung
link: https://github.com/cotes2020
date: 2019-08-08 11:33:00 +0800 date: 2019-08-08 11:33:00 +0800
categories: [Blogging, Demo] categories: [Blogging, Demo]
tags: [typography] tags: [typography]
math: true math: true
mermaid: true mermaid: true
image: image:
path: /commons/devices-mockup.png src: /commons/devices-mockup.png
width: 800 width: 800
height: 500 height: 500
alt: Responsive rendering of Chirpy theme on multiple devices.
--- ---
This post is to show Markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography. This post is to show Markdown syntax rendering on [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), you can also use it as an example of writing. Now, let's start looking at text and typography.
@@ -75,21 +76,7 @@ Moon
## Block Quote ## Block Quote
> This line shows the _block quote_. > This line to shows the Block Quote.
## Prompts
> An example showing the `tip` type prompt.
{: .prompt-tip }
> An example showing the `info` type prompt.
{: .prompt-info }
> An example showing the `warning` type prompt.
{: .prompt-warning }
> An example showing the `danger` type prompt.
{: .prompt-danger }
## Tables ## Tables
@@ -167,10 +154,6 @@ $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
This is an example of `Inline Code`. This is an example of `Inline Code`.
## Filepath
Here is the `/path/to/the/file.extend`{: .filepath}.
## Code block ## Code block
### Common ### Common

View File

@@ -1,6 +1,8 @@
--- ---
title: Writing a New Post title: Writing a New Post
author: cotes author:
name: Cotes Chung
link: https://github.com/cotes2020
date: 2019-08-08 14:10:00 +0800 date: 2019-08-08 14:10:00 +0800
categories: [Blogging, Tutorial] categories: [Blogging, Tutorial]
tags: [writing] tags: [writing]
@@ -11,7 +13,7 @@ This post will guide you how to write a post on _Chirpy_ theme. Even if you have
## Naming and Path ## Naming and Path
Create a new file named `YYYY-MM-DD-TITLE.EXTENSION`{: .filepath} and put it in the `_posts`{: .filepath} of the root directory. Please note that the `EXTENSION`{: .filepath} must be one of `md`{: .filepath} and `markdown`{: .filepath}. If you want to save time of creating files, please consider using the plugin [`Jekyll-Compose`](https://github.com/jekyll/jekyll-compose) to accomplish this. Create a new file named `YYYY-MM-DD-TITLE.EXTENSION` and put it in the `_posts` of the root directory. Please note that the `EXTENSION` must be one of `md` and `markdown`. If you want to save time of creating files, please consider using the plugin [`Jekyll-Compose`](https://github.com/jekyll/jekyll-compose) to accomplish this.
## Front Matter ## Front Matter
@@ -26,12 +28,11 @@ tags: [TAG] # TAG names should always be lowercase
--- ---
``` ```
> The posts' _layout_ has been set to `post` by default, so there is no need to add the variable _layout_ in the Front Matter block. > **Note**: The posts' _layout_ has been set to `post` by default, so there is no need to add the variable _layout_ in the Front Matter block.
{: .prompt-tip }
### Timezone of Date ### Timezone of Date
In order to accurately record the release date of a post, you should not only set up the `timezone` of `_config.yml`{: .filepath} but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`. In order to accurately record the release date of a post, you should not only set up the `timezone` of _\_config.yml_ but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`.
### Categories and Tags ### Categories and Tags
@@ -48,30 +49,17 @@ tags: [bee]
The author information of the post usually does not need to be filled in the _Front Matter_ , they will be obtained from variables `social.name` and the first entry of `social.links` of the configuration file by default. But you can also override it as follows: The author information of the post usually does not need to be filled in the _Front Matter_ , they will be obtained from variables `social.name` and the first entry of `social.links` of the configuration file by default. But you can also override it as follows:
Add author information in `_data/authors.yml` (If your website doesn't have this file, don't hesitate to create one.)
```yaml
<author_id>:
name: <full name>
twitter: <twitter_of_author>
url: <homepage_of_author>
```
{: file="_data/authors.yml" }
And then set up the custom author in the post's YAML block:
```yaml ```yaml
--- ---
author: <author_id> author:
name: Full Name
link: https://example.com
--- ---
``` ```
> Another benefit of reading the author information from the file `_data/authors.yml`{: .filepath } is that the page will have the meta tag `twitter:creator`, which enriches the [Twitter Cards](https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started#card-and-content-attribution) and is good for SEO.
{: .prompt-info }
## Table of Contents ## Table of Contents
By default, the **T**able **o**f **C**ontents (TOC) is displayed on the right panel of the post. If you want to turn it off globally, go to `_config.yml`{: .filepath} and set the value of variable `toc` to `false`. If you want to turn off TOC for a specific post, add the following to the post's [Front Matter](https://jekyllrb.com/docs/front-matter/): By default, the **T**able **o**f **C**ontents (TOC) is displayed on the right panel of the post. If you want to turn it off globally, go to _\_config.yml_ and set the value of variable `toc` to `false`. If you want to turn off TOC for a specific post, add the following to the post's [Front Matter](https://jekyllrb.com/docs/front-matter/):
```yaml ```yaml
--- ---
@@ -81,7 +69,7 @@ toc: false
## Comments ## Comments
The global switch of comments is defined by variable `comments.active` in the file `_config.yml`{: .filepath}. After selecting a comment system for this variable, comments will be turned on for all posts. The global switch of comments is defined by variable `comments.active` in the file _\_config.yml_. After selecting a comment system for this variable, comments will be turned on for all posts.
If you want to close the comment for a specific post, add the following to the **Front Matter** of the post: If you want to close the comment for a specific post, add the following to the **Front Matter** of the post:
@@ -143,10 +131,7 @@ Starting from _Chirpy v5.0.0_, `height` and `width` support abbreviations (`heig
### Position ### Position
By default, the image is centered, but you can specify the position by using one of the classes `normal`, `left`, and `right`. By default, the image is centered, but you can specify the position by using one of the classes `normal`, `left`, and `right`. For example:
> Once the position is specified, the image caption should not be added.
{: .prompt-warning }
- **Normal position** - **Normal position**
@@ -171,6 +156,8 @@ By default, the image is centered, but you can specify the position by using one
``` ```
{: .nolineno} {: .nolineno}
> **Limitation**: Once the position of the image is specified, the image caption should not be added.
### Shadow ### Shadow
The screenshots of the program window can be considered to show the shadow effect, and the shadow will be visible in the `light` mode: The screenshots of the program window can be considered to show the shadow effect, and the shadow will be visible in the `light` mode:
@@ -182,7 +169,7 @@ The screenshots of the program window can be considered to show the shadow effec
### CDN URL ### CDN URL
If you host the images on the CDN, you can save the time of repeatedly writing the CDN URL by assigning the variable `img_cdn` of `_config.yml`{: .filepath} file: If you host the images on the CDN, you can save the time of repeatedly writing the CDN URL by assigning the variable `img_cdn` of _\_config.yml_ file:
```yaml ```yaml
img_cdn: https://cdn.com img_cdn: https://cdn.com
@@ -230,14 +217,15 @@ The output will be:
``` ```
{: .nolineno } {: .nolineno }
### Preview Image ### Preview Image
If you want to add an image to the top of the post contents, specify the attribute `path`, `width`, `height`, and `alt` for the image: If you want to add an image to the top of the post contents, specify the attribute `src`, `width`, `height`, and `alt` for the image:
```yaml ```yaml
--- ---
image: image:
path: /path/to/image/file src: /path/to/image/file
width: 1000 # in pixels width: 1000 # in pixels
height: 400 # in pixels height: 400 # in pixels
alt: image alternative text alt: image alternative text
@@ -246,7 +234,7 @@ image:
Except for `alt`, all other options are necessary, especially the `width` and `height`, which are related to user experience and web page loading performance. The above section "[Size](#size)" also mentions this. Except for `alt`, all other options are necessary, especially the `width` and `height`, which are related to user experience and web page loading performance. The above section "[Size](#size)" also mentions this.
Starting from _Chirpy v5.0.0_, the attributes `height` and `width` can be abbreviated: `height` → `h`, `width` → `w`. In addition, the [`img_path`](#image-path) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name. Starting from _Chirpy v5.0.0_, the attributes `height` and `width` can be abbreviated: `height` → `h`, `width` → `w`. In addition, the [`img_path`](#image-path) can also be passed to the preview image, that is, when it has been set, the attribute `src` only needs the image file name.
## Pinned Posts ## Pinned Posts
@@ -258,43 +246,15 @@ pin: true
--- ---
``` ```
## Prompts ## Code Block
There are several types of prompts: `tip`, `info`, `warning`, and `danger`. They can be generated by adding the class `prompt-{type}` to the blockquote. For example, define a prompt of type `info` as follows:
```md
> Example line for prompt.
{: .prompt-info }
```
{: .nolineno }
## Syntax
### Inline Code
```md
`inline code part`
```
{: .nolineno }
### Filepath Hightlight
```md
`/path/to/a/file.extend`{: .filepath}
```
{: .nolineno }
### Code Block
Markdown symbols ```` ``` ```` can easily create a code block as follows: Markdown symbols ```` ``` ```` can easily create a code block as follows:
````md
``` ```
This is a plaintext code snippet. This is a plaintext code snippet.
``` ```
````
#### Specifying Language ### Specifying Language
Using ```` ```{language} ```` you will get a code block with syntax highlight: Using ```` ```{language} ```` you will get a code block with syntax highlight:
@@ -304,12 +264,11 @@ key: value
``` ```
```` ````
> The Jekyll tag `{% highlight %}` is not compatible with this theme. > **Limitation**: The Jekyll style `highlight` tag is not compatible with this theme.
{: .prompt-danger }
#### Line Number ### Line Number
By default, all languages except `plaintext`, `console`, and `terminal` will display line numbers. When you want to hide the line number of a code block, add the class `nolineno` to it: By default, all languages except `plaintext`, `console`, and `terminal` will display line numbers. When you want to hide the line number of the code block, you can append `{: .nolineno}` at the next line:
````markdown ````markdown
```shell ```shell
@@ -318,9 +277,9 @@ echo 'No more line numbers!'
{: .nolineno} {: .nolineno}
```` ````
#### Specifying the Filename ### Specifying the Filename
You may have noticed that the code language will be displayed at the top of the code block. If you want to replace it with the file name, you can add the attribute `file` to achieve this: You may have noticed that the code language will be displayed on the left side of the header of the code block. If you want to replace it with the file name, you can add the attribute `file` to achieve this:
````markdown ````markdown
```shell ```shell
@@ -329,7 +288,7 @@ You may have noticed that the code language will be displayed at the top of the
{: file="path/to/file" } {: file="path/to/file" }
```` ````
#### Liquid Codes ### Liquid Codes
If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}` and `{% endraw %}`: If you want to display the **Liquid** snippet, surround the liquid code with `{% raw %}` and `{% endraw %}`:

View File

@@ -1,6 +1,8 @@
--- ---
title: Getting Started title: Getting Started
author: cotes author:
name: Cotes Chung
link: https://github.com/cotes2020
date: 2019-08-09 20:55:00 +0800 date: 2019-08-09 20:55:00 +0800
categories: [Blogging, Tutorial] categories: [Blogging, Tutorial]
tags: [getting started] tags: [getting started]
@@ -9,7 +11,7 @@ pin: true
## Prerequisites ## Prerequisites
Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll`, and `Bundler`. In addition, [Git](https://git-scm.com/) is also required to be installed. Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll`, and `Bundler`.
## Installation ## Installation
@@ -34,18 +36,18 @@ And then execute:
$ bash tools/init.sh $ bash tools/init.sh
``` ```
> If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command. > **Note**: If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command.
{: .prompt-info }
The above command will: The above command will:
1. Removes some files or directories from your repository: 1. Removes some files or directories from your repository:
- `.travis.yml`{: .filepath} - `.travis.yml`
- files under `_posts`{: .filepath} - files under `_posts`
- folder `docs`
2. If the option `--no-gh` is provided, the directory `.github`{: .filepath} will be deleted. Otherwise, set up the GitHub Action workflow by removing the extension `.hook`{: .filepath} of `.github/workflows/pages-deploy.yml.hook`{: .filepath}, and then remove the other files and directories in the folder `.github`{: .filepath}. 2. If the option `--no-gh` is provided, the directory `.github` will be deleted. Otherwise, set up the GitHub Action workflow by removing the extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in the folder `.github`.
3. Removes item `Gemfile.lock` from `.gitignore`{: .filepath}. 3. Removes item `Gemfile.lock` from `.gitignore`.
4. Creates a new commit to save the changes automatically. 4. Creates a new commit to save the changes automatically.
@@ -61,7 +63,7 @@ $ bundle
### Configuration ### Configuration
Update the variables of `_config.yml`{: .filepath} as needed. Some of them are typical options: Update the variables of `_config.yml` as needed. Some of them are typical options:
- `url` - `url`
- `avatar` - `avatar`
@@ -70,15 +72,9 @@ Update the variables of `_config.yml`{: .filepath} as needed. Some of them are t
### Customing Stylesheet ### Customing Stylesheet
If you need to customize the stylesheet, copy the theme's `assets/css/style.scss`{: .filepath} to the same path on your Jekyll site, and then add the custom style at the end of the style file. If you need to customize the stylesheet, copy the theme's `assets/css/style.scss` to the same path on your Jekyll site, and then add the custom style at the end of the style file.
Starting from [`v4.1.0`][chirpy-4.1.0], if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, create a new file `_sass/variables-hook.scss`{: .filepath} and assign new values to the target variable in it. Starting from [`v4.1.0`][chirpy-4.1.0], if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`, create a new file `_sass/variables-hook.scss` and assign new values to the target variable in it.
### Customing Static Assets
Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined by file `_data/assets/cross_origin.yml`{: .filepath }, and you can replace some of them according to the network conditions in the region where your website is published.
Also, if you'd like to self-host the static assets, please refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme).
### Running Local Server ### Running Local Server
@@ -99,23 +95,23 @@ $ docker run -it --rm \
After a while, the local service will be published at _<http://127.0.0.1:4000>_. After a while, the local service will be published at _<http://127.0.0.1:4000>_.
## Deployment ### Deployment
Before the deployment begins, check out the file `_config.yml`{: .filepath} and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starts with a slash, e.g, `/project-name`. Before the deployment begins, check out the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starts with a slash, e.g, `/project-name`.
Now you can choose ONE of the following methods to deploy your Jekyll site. Now you can choose ONE of the following methods to deploy your Jekyll site.
### Deploy by Using Github Actions #### Deploy by Using Github Actions
For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the GitHub Pages service. For security reasons, GitHub Pages build runs on `safe` mode, which restricts us from using plugins to generate additional page files. Therefore, we can use **GitHub Actions** to build the site, store the built site files on a new branch, and use that branch as the source of the GitHub Pages service.
Quickly check the files needed for GitHub Actions build: Quickly check the files needed for GitHub Actions build:
- Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`{: .filepath}. Otherwise, create a new one and fill in the contents of the [sample file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name. - Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [sample file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
- Ensure your Jekyll site has file `tools/deploy.sh`{: .filepath}. Otherwise, copy it from here to your Jekyll site. - Ensure your Jekyll site has file `tools/deploy.sh`. Otherwise, copy it from here to your Jekyll site.
- Furthermore, if you have committed `Gemfile.lock`{: .filepath} to the repo, and your runtime system is not Linux, don't forget to update the platform list in the lock file: - Furthermore, if you have committed `Gemfile.lock` to the repo, and your runtime system is not Linux, don't forget to update the platform list in the lock file:
```console ```console
$ bundle lock --add-platform x86_64-linux $ bundle lock --add-platform x86_64-linux
@@ -133,7 +129,7 @@ Now publish your Jekyll site by:
3. Visit your website at the address indicated by GitHub. 3. Visit your website at the address indicated by GitHub.
### Manually Build and Deploy #### Manually Build and Deploy
On self-hosted servers, you cannot enjoy the convenience of **GitHub Actions**. Therefore, you should build the site on your local machine and then upload the site files to the server. On self-hosted servers, you cannot enjoy the convenience of **GitHub Actions**. Therefore, you should build the site on your local machine and then upload the site files to the server.
@@ -153,13 +149,13 @@ $ docker run -it --rm \
jekyll build jekyll build
``` ```
Unless you specified the output path, the generated site files will be placed in folder `_site`{: .filepath} of the project's root directory. Now you should upload those files to the target server. Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to the target server.
## Upgrading ### Upgrading
It depends on how you use the theme: It depends on how you use the theme:
- If you are using the theme gem (there will be `gem "jekyll-theme-chirpy"` in the `Gemfile`{: .filepath}), editing the `Gemfile`{: .filepath} and update the version number of the theme gem, for example: - If you are using the theme gem (there will be `gem "jekyll-theme-chirpy"` in the `Gemfile`), editing the `Gemfile` and update the version number of the theme gem, for example:
```diff ```diff
- gem "jekyll-theme-chirpy", "~> 3.2", ">= 3.2.1" - gem "jekyll-theme-chirpy", "~> 3.2", ">= 3.2.1"
@@ -175,7 +171,7 @@ It depends on how you use the theme:
As the version upgrades, the critical files (for details, see the [Startup Template][starter]) and configuration options will change. Please refer to the [Upgrade Guide](https://github.com/cotes2020/jekyll-theme-chirpy/wiki/Upgrade-Guide) to keep your repo's files in sync with the latest version of the theme. As the version upgrades, the critical files (for details, see the [Startup Template][starter]) and configuration options will change. Please refer to the [Upgrade Guide](https://github.com/cotes2020/jekyll-theme-chirpy/wiki/Upgrade-Guide) to keep your repo's files in sync with the latest version of the theme.
- If you forked from the source project (there will be `gemspec` in the `Gemfile`{: .filepath} of your site), then merge the [latest upstream tags][latest-tag] into your Jekyll site to complete the upgrade. - If you forked from the source project (there will be `gemspec` in the `Gemfile` of your site), then merge the [latest upstream tags][latest-tag] into your Jekyll site to complete the upgrade.
The merge is likely to conflict with your local modifications. Please be patient and careful to resolve these conflicts. The merge is likely to conflict with your local modifications. Please be patient and careful to resolve these conflicts.
[starter]: https://github.com/cotes2020/chirpy-starter [starter]: https://github.com/cotes2020/chirpy-starter

View File

@@ -1,12 +1,14 @@
--- ---
title: Customize the Favicon title: Customize the Favicon
author: cotes author:
name: Cotes Chung
link: https://github.com/cotes2020
date: 2019-08-11 00:34:00 +0800 date: 2019-08-11 00:34:00 +0800
categories: [Blogging, Tutorial] categories: [Blogging, Tutorial]
tags: [favicon] tags: [favicon]
--- ---
The [favicons](https://www.favicon-generator.org/about/) of [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) are placed in the directory `assets/img/favicons/`{: .filepath}. You may want to replace them with your own. The following sections will guide you to create and replace the default favicons. The [favicons](https://www.favicon-generator.org/about/) of [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) are placed in the directory `assets/img/favicons/`. You may want to replace them with your own. The following sections will guide you to create and replace the default favicons.
## Generate the favicon ## Generate the favicon
@@ -18,10 +20,10 @@ In the next step, the webpage will show all usage scenarios. You can keep the de
Download the generated package, unzip and delete the following two from the extracted files: Download the generated package, unzip and delete the following two from the extracted files:
- `browserconfig.xml`{: .filepath} - `browserconfig.xml`
- `site.webmanifest`{: .filepath} - `site.webmanifest`
And then copy the remaining image files (`.PNG`{: .filepath} and `.ICO`{: .filepath}) to cover the original files in the directory `assets/img/favicons/`{: .filepath} of your Jekyll site. If your Jekyll site doesn't have this directory yet, just create one. And then copy the remaining image files (`PNG` and `ICO`) to cover the original files in the directory `assets/img/favicons/` of your Jekyll site. If your Jekyll site doesn't have this directory yet, just create one.
The following table will help you understand the changes to the favicon files: The following table will help you understand the changes to the favicon files:
@@ -30,7 +32,6 @@ The following table will help you understand the changes to the favicon files:
| `*.PNG` | ✓ | ✗ | | `*.PNG` | ✓ | ✗ |
| `*.ICO` | ✓ | ✗ | | `*.ICO` | ✓ | ✗ |
> ✓ means keep, ✗ means delete. > Note: ✓ means keep, ✗ means delete.
{: .prompt-info }
The next time you build the site, the favicon will be replaced with a customized edition. The next time you build the site, the favicon will be replaced with a customized edition.

View File

@@ -1,6 +1,8 @@
--- ---
title: Enable Google Page Views title: Enable Google Page Views
author: sille_bille author:
name: Dinesh Prasanth Moluguwan Krishnamoorthy
link: https://github.com/SilleBille
date: 2021-01-03 18:32:00 -0500 date: 2021-01-03 18:32:00 -0500
categories: [Blogging, Tutorial] categories: [Blogging, Tutorial]
tags: [google analytics, pageviews] tags: [google analytics, pageviews]
@@ -35,7 +37,7 @@ It should look like this:
![google-analytics-data-stream](/posts/20210103/01-google-analytics-data-stream.png){: width="1086" height="542"} ![google-analytics-data-stream](/posts/20210103/01-google-analytics-data-stream.png){: width="1086" height="542"}
Now, click on the new data stream and grab the **Measurement ID**. It should look something like `G-V6XXXXXXXX`. Copy this to your `_config.yml`{: .filepath} file: Now, click on the new data stream and grab the **Measurement ID**. It should look something like `G-V6XXXXXXXX`. Copy this to your `_config.yml` file
```yaml ```yaml
google_analytics: google_analytics:
@@ -113,16 +115,16 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
1. Clone the **Google Analytics superProxy** project on Github: <https://github.com/googleanalytics/google-analytics-super-proxy> to your local. 1. Clone the **Google Analytics superProxy** project on Github: <https://github.com/googleanalytics/google-analytics-super-proxy> to your local.
2. Remove the first 2 lines in the [`src/app.yaml`{: .filepath}](https://github.com/googleanalytics/google-analytics-super-proxy/blob/master/src/app.yaml#L1-L2) file: 2. Remove the first 2 lines in the [`src/app.yaml`](https://github.com/googleanalytics/google-analytics-super-proxy/blob/master/src/app.yaml#L1-L2) file:
```diff ```diff
- application: your-project-id - application: your-project-id
- version: 1 - version: 1
``` ```
3. In `src/config.py`{: .filepath}, add the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` that you gathered from your App Engine Dashboard. 3. In `src/config.py`, add the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` that you gathered from your App Engine Dashboard.
4. Enter any random key for `XSRF_KEY`, your `config.py`{: .filepath} should look similar to this 4. Enter any random key for `XSRF_KEY`, your `config.py` should look similar to this
```python ```python
#!/usr/bin/python2.7 #!/usr/bin/python2.7
@@ -144,11 +146,9 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
``` ```
{: file="src/config.py"} {: file="src/config.py"}
> You can configure a custom domain instead of `https://PROJECT_ID.REGION_ID.r.appspot.com`. **Tip:** You can configure a custom domain instead of `https://PROJECT_ID.REGION_ID.r.appspot.com`. But, for the sake of keeping it simple, we will be using the Google provided default URL.
> But, for the sake of keeping it simple, we will be using the Google provided default URL.
{: .prompt-info }
5. From inside the `src/`{: .filepath} directory, deploy the app 5. From inside the src/ directory, deploy the app
```console ```console
[root@bc96abf71ef8 src]# gcloud app deploy [root@bc96abf71ef8 src]# gcloud app deploy
@@ -221,7 +221,7 @@ Once all the hard part is done, it is very easy to enable the Page View on Chirp
![superproxy-dashboard](/posts/20210103/05-superproxy-dashboard.png){: width="1210" height="694"} ![superproxy-dashboard](/posts/20210103/05-superproxy-dashboard.png){: width="1210" height="694"}
Update the `_config.yml`{: .filepath} file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following: Update the `_config.yml` file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following:
```yaml ```yaml
google_analytics: google_analytics:

View File

@@ -1,30 +1,37 @@
/* /*
The common styles The common styles
*/ */
@import url('https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:wght@400;600;900&display=swap');
html { @mixin mode-toggle($dark-mode: false) {
@media (prefers-color-scheme: light) { @if $dark-mode {
&:not([data-mode]), @include dark-scheme;
&[data-mode=light] { } @else {
@include light-scheme; @include light-scheme;
} }
&[data-mode=dark] {
@include dark-scheme;
} }
html:not([mode]),
html[mode=light] {
@include mode-toggle();
}
html[mode=dark] {
@include mode-toggle(true);
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
&:not([data-mode]), html:not([mode]),
&[data-mode=dark] { html[mode=dark] {
@include dark-scheme; @include mode-toggle(true);
} }
&[data-mode=light] { html[mode=light] {
@include light-scheme; @include mode-toggle();
} }
} }
:root {
font-size: 16px; font-size: 16px;
} }
@@ -47,7 +54,7 @@ h1 {
h2 { h2 {
@extend %heading; @extend %heading;
@extend %section; @extend %section;
@extend %anchor; @extend %anchor-relative;
font-size: 1.5rem; font-size: 1.5rem;
} }
@@ -97,38 +104,6 @@ blockquote {
border-left: 5px solid var(--blockquote-border-color); border-left: 5px solid var(--blockquote-border-color);
padding-left: 1rem; padding-left: 1rem;
color: var(--blockquote-text-color); color: var(--blockquote-text-color);
&[class^="prompt-"] {
display: flex;
border-left: 0;
border-radius: 6px;
padding: 0.75rem 1.2rem;
color: var(--prompt-text-color);
&::before {
margin-right: 1rem;
font-family: "Font Awesome 5 Free";
text-align: center;
width: 1.25rem;
}
p:last-child {
margin-bottom: 0rem;
}
}
@include prompt("tip", "\f0eb", 400);
@include prompt("info", "\f06a");
@include prompt("warning", "\f06a");
@include prompt("danger", "\f071");
}
mjx-container {
overflow-x: auto;
overflow-y: hidden;
} }
kbd { kbd {
@@ -148,15 +123,18 @@ kbd {
} }
footer { footer {
@include pl-pr(1.5rem); position: absolute;
bottom: 0;
padding: 0 1rem;
height: $footer-height;
font-size: 0.8rem; font-size: 0.8rem;
> div.d-flex { > div.d-flex {
height: $footer-height;
line-height: 1.2rem; line-height: 1.2rem;
padding-bottom: 1rem; width: 95%;
max-width: 1045px;
border-top: 1px solid var(--main-border-color); border-top: 1px solid var(--main-border-color);
margin-bottom: 1rem;
> div { > div {
width: 350px; width: 350px;
@@ -182,7 +160,7 @@ footer {
} }
} }
i { /* fontawesome icons */ i { // fontawesome icons
&.far, &.far,
&.fas { &.fas {
@extend %no-cursor; @extend %no-cursor;
@@ -213,10 +191,7 @@ img[data-src] {
&.shadow { &.shadow {
filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08)); filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08));
box-shadow: none !important; /* cover the Bootstrap 4.6.1 styles */
} }
@extend %img-caption;
} }
/* --- Panels --- */ /* --- Panels --- */
@@ -224,6 +199,7 @@ img[data-src] {
.access { .access {
top: 2rem; top: 2rem;
transition: top 0.2s ease-in-out; transition: top 0.2s ease-in-out;
margin-right: 1.5rem;
margin-top: 3rem; margin-top: 3rem;
margin-bottom: 4rem; margin-bottom: 4rem;
@@ -248,7 +224,7 @@ img[data-src] {
} }
#panel-wrapper { #panel-wrapper {
/* the headings */ // the headings
.panel-heading { .panel-heading {
@include label(inherit); @include label(inherit);
} }
@@ -271,7 +247,7 @@ img[data-src] {
} }
} }
[data-topbar-visible=true] & > div { &.topbar-down > div {
top: 6rem; top: 6rem;
} }
} }
@@ -314,7 +290,7 @@ img[data-src] {
margin-bottom: 0; margin-bottom: 0;
} }
/* [scroll-focus] added by `smooth-scroll.js` */ // [scroll-focus] added by `smooth-scroll.js`
&:target:not([scroll-focus]), &:target:not([scroll-focus]),
&[scroll-focus=true] > p { &[scroll-focus=true] > p {
background-color: var(--footnote-target-bg); background-color: var(--footnote-target-bg);
@@ -335,7 +311,7 @@ img[data-src] {
transition: background-color 1.5s ease-in-out; transition: background-color 1.5s ease-in-out;
} }
/* [scroll-focus] added by `smooth-scroll.js` */ // [scroll-focus] added by `smooth-scroll.js`
@at-root sup:target:not([scroll-focus]), @at-root sup:target:not([scroll-focus]),
sup[scroll-focus=true] > a#{&} { sup[scroll-focus=true] > a#{&} {
background-color: var(--footnote-target-bg); background-color: var(--footnote-target-bg);
@@ -355,7 +331,7 @@ img[data-src] {
/* --- Begin of Markdown table style --- */ /* --- Begin of Markdown table style --- */
/* it will be created by Liquid */ // it will be created by Liquid
.table-wrapper { .table-wrapper {
overflow-x: auto; overflow-x: auto;
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
@@ -389,8 +365,8 @@ img[data-src] {
@extend %table-cell; @extend %table-cell;
} }
} }
} /* tbody */ } // tbody
}/* table */ }// table
} }
/* --- post --- */ /* --- post --- */
@@ -406,7 +382,7 @@ img[data-src] {
@extend %no-cursor; @extend %no-cursor;
} }
/* created by `_includes/img-extra.html` */ // created by `_includes/img-extra.html`
&.popup { &.popup {
cursor: zoom-in; cursor: zoom-in;
@@ -420,7 +396,7 @@ img[data-src] {
@extend %link-hover; @extend %link-hover;
} }
} }
} /* a */ } // a
} }
@@ -437,7 +413,7 @@ img[data-src] {
margin-right: 2px; margin-right: 2px;
} }
&:not([class]):hover { &:hover {
@extend %link-hover; @extend %link-hover;
} }
} }
@@ -463,18 +439,23 @@ img[data-src] {
} }
} }
&.img-link { &.img-link + em {
@extend %img-caption; display: block;
text-align: center;
font-style: normal;
font-size: 80%;
padding: 0;
color: #6d6c6c;
} }
} }
ul { ul {
/* attribute 'hide-bullet' was added by liquid */ // attribute 'hide-bullet' was added by liquid
.task-list-item[hide-bullet] { .task-list-item[hide-bullet] {
list-style-type: none; list-style-type: none;
> i { /* checkbox icon */ > i { // checkbox icon
margin: 0 0.4rem 0.2rem -1.4rem; margin: 0 0.4rem 0.2rem -1.4rem;
vertical-align: middle; vertical-align: middle;
color: var(--checkbox-color); color: var(--checkbox-color);
@@ -491,7 +472,7 @@ img[data-src] {
vertical-align: middle; vertical-align: middle;
} }
} /* ul */ } // ul
> ol, > ol,
> ul { > ul {
@@ -499,7 +480,7 @@ img[data-src] {
li { li {
ol, ol,
ul { /* sub list */ ul { // sub list
padding-left: 2rem; padding-left: 2rem;
margin-top: 0.3rem; margin-top: 0.3rem;
} }
@@ -517,7 +498,7 @@ img[data-src] {
margin-left: 1rem; margin-left: 1rem;
} }
} /* .post-content */ } // .post-content
.tag:hover { .tag:hover {
@extend %tag-hover; @extend %tag-hover;
@@ -589,6 +570,10 @@ img[data-src] {
box-shadow: 0 0 8px 0 var(--btn-box-shadow) !important; box-shadow: 0 0 8px 0 var(--btn-box-shadow) !important;
} }
.topbar-up {
top: -3rem !important; /* same as topbar height. */
}
.no-text-decoration { .no-text-decoration {
@include no-text-decoration; @include no-text-decoration;
} }
@@ -618,14 +603,14 @@ img[data-src] {
/* --- Overriding --- */ /* --- Overriding --- */
/* magnific-popup */ // magnific-popup
figure .mfp-title { figure .mfp-title {
text-align: center; text-align: center;
padding-right: 0; padding-right: 0;
margin-top: 0.5rem; margin-top: 0.5rem;
} }
/* mermaid */ // mermaid
.mermaid { .mermaid {
text-align: center; text-align: center;
} }
@@ -673,7 +658,7 @@ $sidebar-display: "sidebar-display";
border-radius: 50%; border-radius: 50%;
border: 2px solid rgba(222, 222, 222, 0.7); border: 2px solid rgba(222, 222, 222, 0.7);
overflow: hidden; overflow: hidden;
transform: translateZ(0); /* fixed the zoom in Safari */ transform: translateZ(0); // fixed the zoom in Safari
-webkit-transition: border-color 0.35s ease-in-out; -webkit-transition: border-color 0.35s ease-in-out;
-moz-transition: border-color 0.35s ease-in-out; -moz-transition: border-color 0.35s ease-in-out;
transition: border-color 0.35s ease-in-out; transition: border-color 0.35s ease-in-out;
@@ -697,7 +682,7 @@ $sidebar-display: "sidebar-display";
transform: scale(1.2); transform: scale(1.2);
} }
} }
} /* #avatar */ } // #avatar
.site-title { .site-title {
a { a {
@@ -716,7 +701,7 @@ $sidebar-display: "sidebar-display";
line-height: 1.2rem; line-height: 1.2rem;
word-spacing: 1px; word-spacing: 1px;
margin: 0.5rem 1.5rem 0.5rem 1.5rem; margin: 0.5rem 1.5rem 0.5rem 1.5rem;
min-height: 3rem; /* avoid vertical shifting in multi-line words */ min-height: 3rem; // avoid vertical shifting in multi-line words
user-select: none; user-select: none;
} }
@@ -760,7 +745,7 @@ $sidebar-display: "sidebar-display";
width: 100%; width: 100%;
} }
&::after { /* the cursor */ &::after { // the cursor
display: table; display: table;
visibility: hidden; visibility: hidden;
content: ""; content: "";
@@ -773,7 +758,7 @@ $sidebar-display: "sidebar-display";
pointer-events: none; pointer-events: none;
} }
} }
} /* li */ } // li
@mixin fix-cursor($top) { @mixin fix-cursor($top) {
top: $top; top: $top;
@@ -798,9 +783,9 @@ $sidebar-display: "sidebar-display";
} }
} }
} /* @for */ } // @for
} /* ul */ } // ul
.sidebar-bottom { .sidebar-bottom {
margin-bottom: 2.1rem; margin-bottom: 2.1rem;
@@ -851,9 +836,9 @@ $sidebar-display: "sidebar-display";
border-radius: 50%; border-radius: 50%;
} }
} /* .sidebar-bottom */ } // .sidebar-bottom
} /* #sidebar */ } // #sidebar
@media (hover: hover) { @media (hover: hover) {
#sidebar ul > li:last-child::after { #sidebar ul > li:last-child::after {
@@ -872,7 +857,6 @@ $sidebar-display: "sidebar-display";
#search-result-wrapper { #search-result-wrapper {
display: none; display: none;
height: 100%; height: 100%;
width: 100%;
overflow: auto; overflow: auto;
.post-content { .post-content {
@@ -892,14 +876,10 @@ $sidebar-display: "sidebar-display";
z-index: 50; z-index: 50;
border-bottom: 1px solid rgba(0, 0, 0, 0.07); border-bottom: 1px solid rgba(0, 0, 0, 0.07);
background-color: var(--topbar-wrapper-bg); background-color: var(--topbar-wrapper-bg);
[data-topbar-visible=false] & {
top: -$topbar-height; /* same as topbar height. */
}
} }
#topbar { #topbar {
i { /* icons */ i { // icons
color: #999; color: #999;
} }
@@ -921,7 +901,7 @@ $sidebar-display: "sidebar-display";
} }
} }
} }
} /* #topbar */ } // #topbar
#sidebar-trigger, #sidebar-trigger,
#search-trigger { #search-trigger {
@@ -930,7 +910,7 @@ $sidebar-display: "sidebar-display";
#search-wrapper { #search-wrapper {
display: flex; display: flex;
width: 100%; width: 85%;
border-radius: 1rem; border-radius: 1rem;
border: 1px solid var(--search-wrapper-border-color); border: 1px solid var(--search-wrapper-border-color);
background: var(--search-wrapper-bg); background: var(--search-wrapper-bg);
@@ -941,6 +921,12 @@ $sidebar-display: "sidebar-display";
font-size: 0.9rem; font-size: 0.9rem;
color: var(--search-icon-color); color: var(--search-icon-color);
} }
.fa-times-circle { /* button 'clean up' */
@extend %cursor-pointer;
visibility: hidden;
}
} }
#search-cancel { /* 'Cancel' link */ #search-cancel { /* 'Cancel' link */
@@ -957,7 +943,6 @@ $sidebar-display: "sidebar-display";
border-radius: 0; border-radius: 0;
padding: 0.18rem 0.3rem; padding: 0.18rem 0.3rem;
color: var(--text-color); color: var(--text-color);
height: auto;
&:focus { &:focus {
box-shadow: none; box-shadow: none;
@@ -999,7 +984,7 @@ $sidebar-display: "sidebar-display";
} }
#search-results { #search-results {
padding-bottom: 3rem; padding-bottom: 6rem;
a { a {
&:hover { &:hover {
@@ -1021,7 +1006,7 @@ $sidebar-display: "sidebar-display";
margin-bottom: 1rem; margin-bottom: 1rem;
} }
i { /* icons */ i { // icons
color: #818182; color: #818182;
margin-right: 0.15rem; margin-right: 0.15rem;
font-size: 80%; font-size: 80%;
@@ -1035,7 +1020,7 @@ $sidebar-display: "sidebar-display";
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
} }
} /* #search-results */ } // #search-results
#topbar-title { #topbar-title {
display: none; display: none;
@@ -1052,7 +1037,7 @@ $sidebar-display: "sidebar-display";
} }
#core-wrapper { #core-wrapper {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height}); min-height: calc(100vh - #{$topbar-height} - #{$footer-height} - #{$bottom-min-height}) !important;
.categories, .categories,
#tags, #tags,
@@ -1085,15 +1070,31 @@ $sidebar-display: "sidebar-display";
background-color: var(--main-wrapper-bg); background-color: var(--main-wrapper-bg);
position: relative; position: relative;
min-height: 100vh; min-height: 100vh;
padding-bottom: $footer-height;
@include pl-pr(0); @include pl-pr(0);
} }
#core-wrapper, #main {
#panel-wrapper { .row:first-child {
> div {
&:nth-child(1),
&:nth-child(2) {
margin-top: $topbar-height; /* same as the height of topbar */ margin-top: $topbar-height; /* same as the height of topbar */
} }
&:first-child {
/* 3rem for topbar, 6rem for footer */
min-height: calc(100vh - #{$topbar-height} - #{$footer-height} - #{$bottom-min-height});
}
}
}
div.row:first-of-type:last-of-type { // alone
margin-bottom: 4rem;
}
}
#topbar-wrapper.row, #topbar-wrapper.row,
#main > .row, #main > .row,
#search-result-wrapper > .row { #search-result-wrapper > .row {
@@ -1131,51 +1132,6 @@ $sidebar-display: "sidebar-display";
-webkit-transform: translate3d(0, -5px, 0); -webkit-transform: translate3d(0, -5px, 0);
} }
#notification {
@keyframes popup {
from {
opacity: 0;
bottom: 0;
}
}
.toast-header {
background: none;
border-bottom: none;
color: inherit;
}
.toast-body {
font-family: 'Lato';
line-height: 1.25rem;
button {
font-size: 90%;
min-width: 4rem;
}
}
&.toast {
display: none;
&.show {
display: block;
min-width: 20rem;
border-radius: 0.5rem;
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
background-color: rgba(255, 255, 255, 0.5);
color: #1b1b1eba;
position: fixed;
left: 50%;
bottom: 20%;
transform: translateX(-50%);
animation: popup 0.8s;
}
}
}
/* /*
Responsive Design: Responsive Design:
@@ -1186,37 +1142,20 @@ $sidebar-display: "sidebar-display";
*/ */
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
footer {
height: $footer-height-mobile;
> div.d-flex { $footer-height: $footer-height-mobile; // overwrite
padding: 1.5rem 0;
flex-wrap: wrap;
-ms-flex-pack: distribute !important;
justify-content: space-around !important;
}
.footer-left, #main > div.row:first-child > div:first-child {
.footer-right { min-height: calc(100vh - #{$topbar-height} - #{$footer-height});
text-align: center;
}
} }
#core-wrapper { #core-wrapper {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height-mobile}) !important; min-height: calc(100vh - #{$topbar-height} - #{$footer-height} - #{$bottom-min-height}) !important;
h1 { h1 {
margin-top: 2.2rem; margin-top: 2.2rem;
font-size: 1.75rem; font-size: 1.75rem;
} }
.post-content {
> blockquote[class^=prompt-] {
@include ml-mr(-1.25rem);
border-radius: 0;
}
}
} }
#avatar > a { #avatar > a {
@@ -1228,34 +1167,35 @@ $sidebar-display: "sidebar-display";
@include ml-mr(1.8rem); @include ml-mr(1.8rem);
} }
#main-wrapper {
padding-bottom: $footer-height;
} }
@media all and (max-width: 768px) { footer {
%full-width { height: $footer-height;
max-width: 100%;
> div.d-flex {
width: 100%;
padding: 1.5rem 0;
margin-bottom: 0.3rem;
flex-wrap: wrap;
-ms-flex-pack: distribute !important;
justify-content: space-around !important;
} }
#topbar { .footer-left,
@extend %full-width; .footer-right {
text-align: center;
}
} }
#main {
@extend %full-width;
@include pl-pr(0);
}
} }
/* hide sidebar and panel */ /* hide sidebar and panel */
@media all and (max-width: 849px) { @media all and (max-width: 849px) {
@mixin slide($append: null) { %slide {
$basic: transform 0.4s ease; -webkit-transition: transform 0.4s ease;
@if $append { transition: transform 0.4s ease;
-webkit-transition: $basic, $append;
transition: $basic, $append;
} @else {
-webkit-transition: $basic;
transition: $basic;
}
} }
html, html,
@@ -1263,6 +1203,15 @@ $sidebar-display: "sidebar-display";
overflow-x: hidden; overflow-x: hidden;
} }
.footnotes ol > li {
padding-top: 3.5rem;
margin-top: -3.2rem;
&:first-child {
margin-top: -3.5rem;
}
}
[#{$sidebar-display}] { [#{$sidebar-display}] {
#sidebar { #sidebar {
transform: translateX(0); transform: translateX(0);
@@ -1272,12 +1221,13 @@ $sidebar-display: "sidebar-display";
#main-wrapper { #main-wrapper {
transform: translateX(#{$sidebar-width}); transform: translateX(#{$sidebar-width});
} }
} }
#sidebar { #sidebar {
@include slide; @extend %slide;
transform: translateX(-#{$sidebar-width}); /* hide */ transform: translateX(-#{$sidebar-width}); // hide
-webkit-transform: translateX(-#{$sidebar-width}); -webkit-transform: translateX(-#{$sidebar-width});
.cursor { .cursor {
@@ -1288,16 +1238,11 @@ $sidebar-display: "sidebar-display";
} }
#main-wrapper { #main-wrapper {
@include slide; @extend %slide;
padding-top: $topbar-height; padding-top: $topbar-height;
} }
#topbar,
#main {
max-width: 100%;
}
#search-result-wrapper { #search-result-wrapper {
width: 100%; width: 100%;
} }
@@ -1308,13 +1253,17 @@ $sidebar-display: "sidebar-display";
} }
#topbar-wrapper { #topbar-wrapper {
@include slide(top 0.2s ease); @extend %slide;
left: 0; left: 0;
} }
#core-wrapper, .topbar-up {
#panel-wrapper { top: 0 !important;
}
#main > div.row:first-child > div:nth-child(1),
#main > div.row:first-child > div:nth-child(2) {
margin-top: 0; margin-top: 0;
} }
@@ -1324,6 +1273,21 @@ $sidebar-display: "sidebar-display";
display: block; display: block;
} }
#search-wrapper {
&.loaded ~ a {
margin-right: 1rem;
}
.fa-times-circle {
right: 5.2rem;
}
}
#search-input {
margin-left: 0;
width: 95%;
}
#search-result-wrapper .post-content { #search-result-wrapper .post-content {
letter-spacing: 0; letter-spacing: 0;
} }
@@ -1342,13 +1306,7 @@ $sidebar-display: "sidebar-display";
} }
} }
} /* max-width: 849px */ } // max-width: 849px
@media all and (max-width: 849px) and (orientation: portrait) {
[data-topbar-visible=false] #topbar-wrapper {
top: 0;
}
}
/* Phone & Pad */ /* Phone & Pad */
@media all and (min-width: 577px) and (max-width: 1199px) { @media all and (min-width: 577px) and (max-width: 1199px) {
@@ -1372,17 +1330,13 @@ $sidebar-display: "sidebar-display";
margin-top: 3rem; margin-top: 3rem;
} }
#search-hints {
display: none;
}
#search-wrapper { #search-wrapper {
max-width: $search-max-width; width: 22%;
min-width: 150px;
} }
#search-result-wrapper { #search-result-wrapper {
margin-top: 3rem; margin-top: 3rem;
max-width: $main-content-max-width;
} }
div.post-content .table-wrapper > table { div.post-content .table-wrapper > table {
@@ -1392,17 +1346,21 @@ $sidebar-display: "sidebar-display";
/* button 'back-to-Top' position */ /* button 'back-to-Top' position */
#back-to-top { #back-to-top {
bottom: 5.5rem; bottom: 5.5rem;
right: 5%; right: 1.2rem;
} }
#topbar { .topbar-up {
@include pl-pr(2rem); box-shadow: none !important;
} }
#topbar-title { #topbar-title {
text-align: left; text-align: left;
} }
footer > div.d-flex {
width: 92%;
}
} }
/* Pad horizontal */ /* Pad horizontal */
@@ -1476,6 +1434,10 @@ $sidebar-display: "sidebar-display";
display: none; display: none;
} }
#topbar {
padding: 0;
}
#main > div.row { #main > div.row {
-webkit-box-pack: center !important; -webkit-box-pack: center !important;
-ms-flex-pack: center !important; -ms-flex-pack: center !important;
@@ -1486,12 +1448,26 @@ $sidebar-display: "sidebar-display";
/* --- desktop mode, both sidebar and panel are visible --- */ /* --- desktop mode, both sidebar and panel are visible --- */
@media all and (min-width: 1200px) { @media all and (min-width: 1200px) {
#back-to-top { #main > div.row > div.col-xl-8 {
bottom: 6.5rem; -webkit-box-flex: 0;
-ms-flex: 0 0 75%;
flex: 0 0 75%;
max-width: 75%;
padding-left: 3%;
} }
#search-wrapper { #topbar {
margin-right: 4rem; padding: 0;
max-width: 1070px;
}
#panel-wrapper {
max-width: $panel-max-width;
}
#back-to-top {
bottom: 6.5rem;
right: 4.3rem;
} }
#search-input { #search-input {
@@ -1516,6 +1492,10 @@ $sidebar-display: "sidebar-display";
} }
} }
#search-hints {
display: none;
}
.post-content { .post-content {
font-size: 1.03rem; font-size: 1.03rem;
} }
@@ -1527,36 +1507,66 @@ $sidebar-display: "sidebar-display";
} }
@media all and (min-width: 1400px) { @media all and (min-width: 1400px) {
#back-to-top { #main > div.row {
right: calc((100vw - #{$sidebar-width} - 1140px) / 2 + 3rem); padding-left: calc((100% - #{$main-content-max-width}) / 2);
> div.col-xl-8 {
max-width: 850px;
}
}
#search-result-wrapper {
padding-right: 2rem;
> div {
max-width: 1110px;
}
}
#search-wrapper .fa-times-circle {
right: 2.6rem;
}
}
@media all and (min-width: 1400px) and (max-width: 1650px) {
#topbar {
padding-right: 2rem;
} }
} }
@media all and (min-width: 1650px) { @media all and (min-width: 1650px) {
#breadcrumb {
padding-left: 0;
}
#main > div.row > div.col-xl-8 {
padding-left: 0;
> div:first-child {
padding-left: 0.55rem !important;
padding-right: 1.9rem !important;
}
}
#main-wrapper { #main-wrapper {
margin-left: $sidebar-width-large; margin-left: $sidebar-width-large;
} }
#panel-wrapper {
margin-left: calc((100% - #{$main-content-max-width}) / 10);
}
#topbar-wrapper { #topbar-wrapper {
left: $sidebar-width-large; left: $sidebar-width-large;
} }
#topbar {
max-width: #{$main-content-max-width};
}
#search-wrapper { #search-wrapper {
margin-right: calc(#{$main-content-max-width} * 0.25 - #{$search-max-width}); margin-right: 3%;
}
#topbar,
#main {
max-width: $main-content-max-width;
}
#core-wrapper,
#tail-wrapper {
padding-right: 4.5rem !important;
}
#back-to-top {
right: calc((100vw - #{$sidebar-width-large} - #{$main-content-max-width}) / 2 + 2rem);
} }
#sidebar { #sidebar {
@@ -1603,7 +1613,7 @@ $sidebar-display: "sidebar-display";
margin-top: 0.3rem; margin-top: 0.3rem;
} }
} /* .profile-wrapper (min-width: 1650px) */ } // .profile-wrapper (min-width: 1650px)
ul { ul {
padding-left: 2.5rem; padding-left: 2.5rem;
@@ -1650,7 +1660,7 @@ $sidebar-display: "sidebar-display";
@include ml-mr(0.15rem); @include ml-mr(0.15rem);
height: $icon-block-size; height: $icon-block-size;
margin-bottom: 0.5rem; /* wrap line */ margin-bottom: 0.5rem; // wrap line
} }
i { i {
@@ -1673,8 +1683,62 @@ $sidebar-display: "sidebar-display";
top: 0.9rem; top: 0.9rem;
} }
} /* .sidebar-bottom */ } // .sidebar-bottom
} /* #sidebar */ } // #sidebar
} /* min-width: 1650px */ footer > div.d-flex {
width: 92%;
max-width: 1140px;
}
#search-result-wrapper {
> div {
max-width: #{$main-content-max-width};
}
}
} // min-width: 1650px
@media all and (min-width: 1700px) {
#topbar-wrapper {
/* 100% - 350px - (1920px - 350px); */
padding-right: calc(100% - #{$sidebar-width-large} - (1920px - #{$sidebar-width-large}));
}
#topbar {
max-width: calc(#{$main-content-max-width} + 20px);
}
#main > div.row {
padding-left: calc((100% - #{$main-content-max-width} - 2%) / 2);
}
#panel-wrapper {
margin-left: 3%;
}
footer {
padding-left: 0;
padding-right: calc(100% - #{$sidebar-width-large} - 1180px);
}
#back-to-top {
right: calc(100% - 1920px + 15rem);
}
}
@media (min-width: 1920px) {
#main > div.row {
padding-left: 190px;
}
#search-result-wrapper {
padding-right: calc(100% - #{$sidebar-width-large} - 1180px);
}
#panel-wrapper {
margin-left: 41px;
}
}

View File

@@ -13,21 +13,19 @@
%section { %section {
#core-wrapper & { #core-wrapper & {
margin-top: 2.5rem; margin-top: 2.5rem;
margin-bottom: 1.25rem; margin-bottom: 2rem;
&:focus {
outline: none; /* avoid outline in Safari */
}
} }
} }
%anchor { %anchor {
.anchor { .anchor {
font-size: 80%; font-size: 1rem;
margin-left: 0.5rem;
} }
@media (hover: hover) { @media (hover: hover) {
.anchor { .anchor {
border-bottom: none !important;
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
transition: opacity 0.25s ease-in, visibility 0s ease-in 0.25s; transition: opacity 0.25s ease-in, visibility 0s ease-in 0.25s;
@@ -43,6 +41,15 @@
} }
} }
%anchor-relative {
@extend %anchor;
.anchor {
position: relative;
bottom: 1px;
}
}
%tag-hover { %tag-hover {
background: var(--tag-hover); background: var(--tag-hover);
transition: background 0.35s ease-in-out; transition: background 0.35s ease-in-out;
@@ -88,15 +95,10 @@
font-style: normal; font-style: normal;
} }
%img-caption { /* ---------- scss mixin --------- */
+ em {
display: block; @mixin no-text-decoration {
text-align: center; text-decoration: none;
font-style: normal;
font-size: 80%;
padding: 0;
color: #6d6c6c;
}
} }
%sidebar-links { %sidebar-links {
@@ -104,12 +106,6 @@
user-select: none; user-select: none;
} }
/* ---------- scss mixin --------- */
@mixin no-text-decoration {
text-decoration: none;
}
@mixin ml-mr($value) { @mixin ml-mr($value) {
margin-left: $value; margin-left: $value;
margin-right: $value; margin-right: $value;
@@ -137,15 +133,3 @@
-ms-transform: translateX(-50%); -ms-transform: translateX(-50%);
transform: translateX(-50%); transform: translateX(-50%);
} }
@mixin prompt($type, $fw-icon, $icon-weight: 900) {
&.prompt-#{$type} {
background-color: var(--prompt-#{$type}-bg);
&::before {
content: $fw-icon;
color: var(--prompt-#{$type}-icon-color);
font-weight: $icon-weight;
}
}
}

View File

@@ -5,29 +5,25 @@
@import "colors/light-syntax"; @import "colors/light-syntax";
@import "colors/dark-syntax"; @import "colors/dark-syntax";
html { html:not([mode]),
@media (prefers-color-scheme: light) { html[mode=light] {
&:not([data-mode]),
&[data-mode=light] {
@include light-syntax; @include light-syntax;
} }
&[data-mode=dark] { html[mode=dark] {
@include dark-syntax; @include dark-syntax;
} }
}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
&:not([data-mode]), html:not([mode]),
&[data-mode=dark] { html[mode=dark] {
@include dark-syntax; @include dark-syntax;
} }
&[data-mode=light] { html[mode=light] {
@include light-syntax; @include light-syntax;
} }
} }
}
/* -- Codes Snippet -- */ /* -- Codes Snippet -- */
@@ -99,7 +95,7 @@ $code-radius: 6px;
user-select: none; user-select: none;
} }
} /* .highlight */ } //.highlight
code { code {
-webkit-hyphens: none; -webkit-hyphens: none;
@@ -114,15 +110,8 @@ code {
background-color: var(--inline-code-bg); background-color: var(--inline-code-bg);
} }
&.filepath {
background-color: inherit;
color: var(--filepath-text-color);
font-weight: 600;
padding: 0;
}
a > &.highlighter-rouge { a > &.highlighter-rouge {
padding-bottom: 0; /* show link's underlinke */ padding-bottom: 0; // show link's underlinke
color: inherit; color: inherit;
} }
@@ -130,7 +119,7 @@ code {
border-bottom: none; border-bottom: none;
} }
blockquote & { blockquote &.highlighter-rouge {
color: inherit; color: inherit;
} }
@@ -142,10 +131,8 @@ code {
td.rouge-code { td.rouge-code {
@extend %code-snippet-padding; @extend %code-snippet-padding;
/* // Prevent some browser extends from
Prevent some browser extends from // changing the URL string of code block.
changing the URL string of code block.
*/
a { a {
color: inherit !important; color: inherit !important;
border-bottom: none !important; border-bottom: none !important;
@@ -199,9 +186,9 @@ div {
($dot-size + $dot-margin) * 2 0 0 var(--code-header-muted-color); ($dot-size + $dot-margin) * 2 0 0 var(--code-header-muted-color);
} }
/* the label block */ // the label block
span { span {
/* label icon */ // label icon
i { i {
font-size: 1rem; font-size: 1rem;
margin-right: 0.4rem; margin-right: 0.4rem;
@@ -214,19 +201,19 @@ div {
@at-root [file] #{&} > i { @at-root [file] #{&} > i {
position: relative; position: relative;
top: 1px; /* center the file icon */ top: 1px; // center the file icon
} }
/* label text */ // label text
&::after { &::after {
content: attr(data-label-text); content: attr(label-text);
font-size: 0.85rem; font-size: 0.85rem;
font-weight: 600; font-weight: 600;
color: var(--code-header-text-color); color: var(--code-header-text-color);
} }
} }
/* clipboard */ // clipboard
button { button {
@extend %cursor-pointer; @extend %cursor-pointer;

View File

@@ -4,28 +4,28 @@
/* sidebar */ /* sidebar */
$sidebar-width: 260px !default; /* the basic width */ $sidebar-width: 260px !default; // the basic width
$sidebar-width-small: 210px !default; /* screen width: >= 850px, <= 1199px (iPad landscape) */ $sidebar-width-small: 210px !default; // screen width: >= 850px, <= 1199px (iPad landscape)
$sidebar-width-large: 350px !default; /* screen width: >= 1650px */ $sidebar-width-large: 350px !default; // screen width: >= 1650px
/* tabs of sidebar */ /* tabs of sidebar */
$tab-count: 5 !default; /* backward compatible (version <= 4.0.2) */ $tab-count: 5 !default; // backward compatible (version <= 4.0.2)
$tab-height: 3rem !default; $tab-height: 3rem !default;
$tab-cursor-height: 1.6rem !default; $tab-cursor-height: 1.6rem !default;
$cursor-width: 2px !default; /* the cursor width of the selected tab */ $cursor-width: 2px !default; // the cursor width of the selected tab
/* other framework sizes */ /* other framework sizes */
$topbar-height: 3rem !default; $topbar-height: 3rem !default;
$search-max-width: 210px !default;
$footer-height: 5rem !default; $footer-height: 5rem !default;
$footer-height-mobile: 6rem !default; /* screen width: <= 576px */ $footer-height-mobile: 6rem !default; // screen width: <= 576px
$main-content-max-width: 1250px !default; $main-content-max-width: 1150px !default;
$panel-max-width: 300px !default;
$bottom-min-height: 35rem !default; $bottom-min-height: 35rem !default;

View File

@@ -78,7 +78,6 @@
--code-header-muted-color: rgb(60 60 60); --code-header-muted-color: rgb(60 60 60);
--code-header-icon-color: rgb(86 86 86); --code-header-icon-color: rgb(86 86 86);
--clipboard-checked-color: #2bcc2b; --clipboard-checked-color: #2bcc2b;
--filepath-text-color: #bdbdbd;
.highlight { .highlight {
.gp { color: #818c96; } .gp { color: #818c96; }

View File

@@ -69,15 +69,6 @@
--kbd-wrap-color: #6a6a6a; --kbd-wrap-color: #6a6a6a;
--kbd-text-color: #d3d3d3; --kbd-text-color: #d3d3d3;
--kbd-bg-color: #242424; --kbd-bg-color: #242424;
--prompt-text-color: rgb(216 212 212 / 75%);
--prompt-tip-bg: rgba(77, 187, 95, 0.2);
--prompt-tip-icon-color: rgb(5 223 5 / 68%);
--prompt-info-bg: rgb(7 59 104 / 80%);
--prompt-info-icon-color: #0075d1;
--prompt-warning-bg: rgb(90 69 3 / 95%);
--prompt-warning-icon-color: rgb(255 165 0 / 80%);
--prompt-danger-bg: rgb(86 28 8 / 80%);
--prompt-danger-icon-color: #cd0202;
/* tags */ /* tags */
--tag-border: rgb(59, 79, 88); --tag-border: rgb(59, 79, 88);
@@ -154,4 +145,4 @@
color-scheme: none; color-scheme: none;
} }
} /* dark-scheme */ } // dark-scheme

View File

@@ -76,9 +76,4 @@
--code-header-icon-color: #d1d1d1; --code-header-icon-color: #d1d1d1;
--clipboard-checked-color: #43c743; --clipboard-checked-color: #43c743;
[class^=prompt-] { } // light-syntax
--inline-code-bg: #fbfafa;
--highlighter-rouge-color: rgb(82 82 82);
}
} /* light-syntax */

View File

@@ -68,19 +68,6 @@
--kbd-wrap-color: #bdbdbd; --kbd-wrap-color: #bdbdbd;
--kbd-text-color: var(--text-color); --kbd-text-color: var(--text-color);
--kbd-bg-color: white; --kbd-bg-color: white;
--prompt-text-color: rgb(46 46 46 / 77%);
--prompt-tip-bg: rgb(123 247 144 / 20%);
--prompt-tip-icon-color: #03b303;
--prompt-info-bg: #e1f5fe;
--prompt-info-icon-color: #0070cb;
--prompt-warning-bg: rgb(255 243 205);
--prompt-warning-icon-color: #ef9c03;
--prompt-danger-bg: rgb(248 215 218 / 56%);
--prompt-danger-icon-color: #df3c30;
[class^=prompt-] {
--link-underline-color: rgb(219 216 216);
}
/* Categories */ /* Categories */
--categories-hover-bg: var(--btn-border-color); --categories-hover-bg: var(--btn-border-color);
@@ -91,4 +78,4 @@
--timeline-node-bg: #c2c6cc; --timeline-node-bg: #c2c6cc;
--timeline-year-dot-color: #ffffff; --timeline-year-dot-color: #ffffff;
} /* light-scheme */ } // light-scheme

View File

@@ -1,7 +1,7 @@
/*! /*!
* The styles for Jekyll theme Chirpy * The styles for Jekyll theme Chirpy
* *
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy) * Chirpy v5.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View File

@@ -41,7 +41,8 @@ h1 + .post-meta {
} }
img.preview-img { img.preview-img {
margin: 0; margin-top: 3.75rem;
margin-bottom: 0;
border-radius: 6px; border-radius: 6px;
&.bg[data-loaded=true] { &.bg[data-loaded=true] {
@@ -54,7 +55,7 @@ img.preview-img {
border-bottom: 1px double var(--main-border-color); border-bottom: 1px double var(--main-border-color);
font-size: 0.85rem; font-size: 0.85rem;
.post-meta a:not(:hover) { .post-meta a {
@extend %link-underline; @extend %link-underline;
} }
} }
@@ -172,8 +173,6 @@ nav[data-toggle=toc] {
em { em {
@extend %normal-font-style; @extend %normal-font-style;
color: var(--relate-post-date);
} }
.card { .card {
@@ -195,6 +194,10 @@ nav[data-toggle=toc] {
} }
} }
.timeago {
color: var(--relate-post-date);
}
p { p {
font-size: 0.9rem; font-size: 0.9rem;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;

View File

@@ -4,5 +4,5 @@ icon: fas fa-info-circle
order: 4 order: 4
--- ---
> Add Markdown syntax content to file `_tabs/about.md`{: .filepath } and it will show up on this page.
{: .prompt-tip } > **Note**: Add Markdown syntax content to file `_tabs/about.md` and it will show up on this page.

View File

@@ -7,10 +7,27 @@ redirect_from:
- /norobots/ - /norobots/
- /assets/ - /assets/
- /posts/ - /posts/
dynamic_title: true
--- ---
{% include lang.html %} {% include lang.html %}
<div class="lead"> <div class="lead">
{%- capture _head_back -%}
<a href="{{ '/' | relative_url }}">{{ site.data.locales[lang].not_found.head_back }}</a>
{%- endcapture -%}
{%- capture _archives_page -%}
<a href="{{ 'archives' | relative_url }}">{{ site.data.locales[lang].not_found.archives_page }}</a>
{%- endcapture -%}
<p>{{site.data.locales[lang].not_found.statment }}</p> <p>{{site.data.locales[lang].not_found.statment }}</p>
<p>{{ site.data.locales[lang].not_found.hint_template
| replace: ':HEAD_BAK', _head_back
| replace: ':ARCHIVES_PAGE', _archives_page }}
</p>
</div> </div>

View File

@@ -1,18 +1,17 @@
--- ---
layout: compress layout: compress
swcache: true
--- ---
[ [
{% for post in site.posts %} {% for post in site.posts %}
{ {
"title": {{ post.title | jsonify }}, "title": "{{ post.title | escape }}",
"url": {{ post.url | relative_url | jsonify }}, "url": "{{ post.url | relative_url }}",
"categories": {{ post.categories | join: ', ' | jsonify }}, "categories": "{{ post.categories | join: ', '}}",
"tags": {{ post.tags | join: ', ' | jsonify }}, "tags": "{{ post.tags | join: ', ' }}",
"date": "{{ post.date }}", "date": "{{ post.date }}",
{% include no-linenos.html content=post.content %} {% include no-linenos.html content=post.content %}
"snippet": {{ content | strip_html | strip_newlines | jsonify }} "snippet": "{{ content | strip_html | strip_newlines | remove_chars | escape | replace: '\', '\\\\' }}"
}{% unless forloop.last %},{% endunless %} }{% unless forloop.last %},{% endunless %}
{% endfor %} {% endfor %}
] ]

View File

@@ -9,7 +9,13 @@ const resource = [
/* --- CSS --- */ /* --- CSS --- */
'{{ "/assets/css/style.css" | relative_url }}', '{{ "/assets/css/style.css" | relative_url }}',
/* --- PWA --- */ /* --- JavaScripts --- */
{% assign js_path = "/assets/js" | relative_url %}
'{{ js_path }}/dist/home.min.js',
'{{ js_path }}/dist/page.min.js',
'{{ js_path }}/dist/post.min.js',
'{{ js_path }}/dist/categories.min.js',
'{{ js_path }}/data/search.json',
'{{ "/app.js" | relative_url }}', '{{ "/app.js" | relative_url }}',
'{{ "/sw.js" | relative_url }}', '{{ "/sw.js" | relative_url }}',
@@ -20,27 +26,30 @@ const resource = [
'{{ tab.url | relative_url }}', '{{ tab.url | relative_url }}',
{% endfor %} {% endfor %}
/* --- Favicons & compressed JS --- */ /* --- Favicons --- */
{% assign cache_list = site.static_files | where: 'swcache', true %} {% assign favicon_path = "/assets/img/favicons" | relative_url %}
{% for file in cache_list %}
'{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%} '{{ favicon_path }}/android-chrome-192x192.png',
{% endfor %} '{{ favicon_path }}/android-chrome-512x512.png',
'{{ favicon_path }}/apple-touch-icon.png',
'{{ favicon_path }}/favicon-16x16.png',
'{{ favicon_path }}/favicon-32x32.png',
'{{ favicon_path }}/favicon.ico',
'{{ favicon_path }}/mstile-150x150.png',
'{{ favicon_path }}/site.webmanifest',
'{{ favicon_path }}/browserconfig.xml'
]; ];
/* The request url with below domain will be cached */ /* The request url with below domain will be cached */
const allowedDomains = [ const allowedDomains = [
{% if site.google_analytics.id != empty and site.google_analytics.id %} {% if site.google_analytics.id != '' %}
'www.googletagmanager.com', 'www.googletagmanager.com',
'www.google-analytics.com', 'www.google-analytics.com',
{% endif %} {% endif %}
'{{ site.url | split: "//" | last }}', '{{ site.url | split: "//" | last }}',
{% if site.img_cdn contains '//' and site.img_cdn %}
'{{ site.img_cdn | split: '//' | last | split: '/' | first }}',
{% endif %}
'fonts.gstatic.com', 'fonts.gstatic.com',
'fonts.googleapis.com', 'fonts.googleapis.com',
'cdn.jsdelivr.net', 'cdn.jsdelivr.net',

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 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=>{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"))})}); $(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 o=$(e.target);let t=o.prop("tagName")==="button".toUpperCase()?o:o.parent();t.blur(),flipMode()})}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),t=$("#search-cancel"),s=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),r=$("#search-wrapper"),n=$("#search-result-wrapper"),d=$("#search-results"),i=$("#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(){return e}}}(),f={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),r.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),r.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},p=function(){let e=!1;return{on(){e||(u.block(),n.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(d.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),s.removeClass("visible"),a.removeClass("unloaded"),u.release(),i.val(""),e=!1)},isVisible(){return e}}}();function h(){return t.hasClass("loaded")}o.click(function(){f.on(),p.on(),i.focus()}),t.click(function(){f.off(),p.off()}),i.focus(function(){r.addClass("input-focus")}),i.focusout(function(){r.removeClass("input-focus")}),i.on("keyup",function(e){8===e.keyCode&&""===i.val()?h()?c.removeClass("unloaded"):p.off():""!==i.val()&&(p.on(),s.hasClass("visible")||s.addClass("visible"),h()&&c.addClass("unloaded"))}),s.on("click",function(){i.val(""),h()?(c.removeClass("unloaded"),d.empty()):p.off(),i.focus(),s.removeClass("visible")})}),$(function(){var e=function(){const e="sidebar-display";let o=!1;const t=$("body");return{toggle(){!1===o?t.attr(e,""):t.removeAttr(e),o=!o}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const t=$("#topbar-wrapper"),s=$("#panel-wrapper"),a=$("#search-input"),l="topbar-up",r="topbar-down",n="toc-scrolling-up";let o,d=0;const i=t.outerHeight(),c=t.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(o=!0)}),setInterval(function(){o&&(function(){var e,o=$(this).scrollTop();Math.abs(d-o)<=i||(o>d?o>c&&(t.removeClass(r).addClass(l),s.removeClass(r),a.is(":focus")&&a.blur()):o+$(window).height()<$(document).height()&&(void 0!==(e=t.attr(n))?"false"===e&&t.removeAttr(n):(t.removeClass(l).addClass(r),s.addClass(r))),d=o)}(),o=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),t=e.text().trim();let s=(0<o.length?o:$("h1")).text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(s)&&(s=s.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){return!($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)&&void(95<=$(this).scrollTop()?e.text()!==s&&e.text(s):e.text()!==t&&e.text(t))}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){const e=$(".collapse");e.on("hide.bs.collapse",function(){var e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder-open`).attr("class","far fa-folder fa-fw"),$(`#${e} i.fas`).addClass("rotate"),$("#"+e).removeClass("hide-border-bottom"))}),e.on("show.bs.collapse",function(){var e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder`).attr("class","far fa-folder-open fa-fw"),$(`#${e} i.fas`).removeClass("rotate"),$("#"+e).addClass("hide-border-bottom"))})});

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 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=>{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)})}}); $(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 o=$(e.target);let t=o.prop("tagName")==="button".toUpperCase()?o:o.parent();t.blur(),flipMode()})}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),t=$("#search-cancel"),s=$("#search-cleaner"),l=$("#main"),a=$("#topbar-title"),n=$("#search-wrapper"),r=$("#search-result-wrapper"),d=$("#search-results"),i=$("#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(){return e}}}(),p={on(){e.addClass("unloaded"),a.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),a.removeClass("unloaded"),o.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),r.removeClass("unloaded"),l.addClass("unloaded"),e=!0)},off(){e&&(d.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),s.removeClass("visible"),l.removeClass("unloaded"),u.release(),i.val(""),e=!1)},isVisible(){return e}}}();function h(){return t.hasClass("loaded")}o.click(function(){p.on(),f.on(),i.focus()}),t.click(function(){p.off(),f.off()}),i.focus(function(){n.addClass("input-focus")}),i.focusout(function(){n.removeClass("input-focus")}),i.on("keyup",function(e){8===e.keyCode&&""===i.val()?h()?c.removeClass("unloaded"):f.off():""!==i.val()&&(f.on(),s.hasClass("visible")||s.addClass("visible"),h()&&c.addClass("unloaded"))}),s.on("click",function(){i.val(""),h()?(c.removeClass("unloaded"),d.empty()):f.off(),i.focus(),s.removeClass("visible")})}),$(function(){var e=function(){const e="sidebar-display";let o=!1;const t=$("body");return{toggle(){!1===o?t.attr(e,""):t.removeAttr(e),o=!o}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const t=$("#topbar-wrapper"),s=$("#panel-wrapper"),l=$("#search-input"),a="topbar-up",n="topbar-down",r="toc-scrolling-up";let o,d=0;const i=t.outerHeight(),c=t.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(o=!0)}),setInterval(function(){o&&(function(){var e,o=$(this).scrollTop();Math.abs(d-o)<=i||(o>d?o>c&&(t.removeClass(n).addClass(a),s.removeClass(n),l.is(":focus")&&l.blur()):o+$(window).height()<$(document).height()&&(void 0!==(e=t.attr(r))?"false"===e&&t.removeAttr(r):(t.removeClass(a).addClass(n),s.addClass(n))),d=o)}(),o=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),t=e.text().trim();let s=(0<o.length?o:$("h1")).text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(s)&&(s=s.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){return!($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)&&void(95<=$(this).scrollTop()?e.text()!==s&&e.text(s):e.text()!==t&&e.text(t))}),e.click(function(){$("body,html").animate({scrollTop:0},800)})});

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 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=>{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=$('meta[name="prefer-datetime-locale"]'),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(){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))})}); $(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(t=>{const e=$(t.target);let o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();o.blur(),flipMode()})}),$(function(){const t=$("#sidebar-trigger"),e=$("#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 t=0;return{block(){t=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(t)},getOffset(){return t}}}(),p={on(){t.addClass("unloaded"),l.addClass("unloaded"),e.addClass("unloaded"),n.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),n.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"),s.addClass("unloaded"),t=!0)},off(){t&&(i.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),a.removeClass("visible"),s.removeClass("unloaded"),u.release(),d.val(""),t=!1)},isVisible(){return 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(){n.addClass("input-focus")}),d.focusout(function(){n.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(){var t=function(){const t="sidebar-display";let e=!1;const o=$("body");return{toggle(){!1===e?o.attr(t,""):o.removeAttr(t),e=!e}}}();$("#sidebar-trigger").click(t.toggle),$("#mask").click(t.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const o=$("#topbar-wrapper"),a=$("#panel-wrapper"),s=$("#search-input"),l="topbar-up",n="topbar-down",r="toc-scrolling-up";let e,i=0;const d=o.outerHeight(),c=o.outerHeight();$(window).scroll(function(t){$("#topbar-title").is(":hidden")&&(e=!0)}),setInterval(function(){e&&(function(){var t,e=$(this).scrollTop();Math.abs(i-e)<=d||(e>i?e>c&&(o.removeClass(n).addClass(l),a.removeClass(n),s.is(":focus")&&s.blur()):e+$(window).height()<$(document).height()&&(void 0!==(t=o.attr(r))?"false"===t&&o.removeAttr(r):(o.removeClass(l).addClass(n),a.addClass(n))),i=e)}(),e=!1)},250)}),$(function(){const t=$("#topbar-title"),e=$("div.post>h1"),o=t.text().trim();let a=(0<e.length?e:$("h1")).text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){return!($("#post-list").length||e.is(":hidden")||t.is(":hidden")||$("#sidebar.sidebar-expand").length)&&void(95<=$(this).scrollTop()?t.text()!==a&&t.text(a):t.text()!==o&&t.text(o))}),t.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){let o=$(".timeago").length,t=void 0;const s=$("meta[name=day-prompt]").attr("content"),l=$("meta[name=hour-prompt]").attr("content"),n=$("meta[name=minute-prompt]").attr("content"),r=$("meta[name=justnow-prompt]").attr("content");function e(){return $(".timeago").each(function(){var t,e;!1!==$(this)[0].hasAttribute("date")?(e=function(t,e){let o=new Date,a=new Date(t);return a.getFullYear()!==o.getFullYear()||a.getMonth()!==o.getMonth()?e:(t=Math.floor((o-a)/1e3),1<=(e=Math.floor(t/86400))?` ${e} `+s:1<=(e=Math.floor(t/3600))?` ${e} `+l:1<=(t=Math.floor(t/60))?` ${t} `+n:r)}($(this).attr("date"),t=$(this).text()))===t?$(this).removeAttr("date"):$(this).text(e):--o}),0===o&&void 0!==t&&clearInterval(t),o}0!==o&&0<e()&&(t=setInterval(e,6e4))});

View File

@@ -1,6 +0,0 @@
/*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 2019 Cotes Chung
* 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=>{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=$('meta[name="prefer-datetime-locale"]'),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(){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))})});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.0.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
* © 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(){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())}); 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())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()}else 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?(r=parseInt(a.text().replace(/,/g,""),10),o>r&&countUp(r,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())});

View File

@@ -3,45 +3,7 @@ layout: compress
permalink: '/app.js' permalink: '/app.js'
--- ---
const $notification = $('#notification');
const $btnRefresh = $('#notification .toast-body>button');
if ('serviceWorker' in navigator) {
/* Registering Service Worker */ /* Registering Service Worker */
navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}') if('serviceWorker' in navigator) {
.then(registration => { navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}');
};
/* in case the user ignores the notification */
if (registration.waiting) {
$notification.toast('show');
}
registration.addEventListener('updatefound', () => {
registration.installing.addEventListener('statechange', () => {
if (registration.waiting) {
if (navigator.serviceWorker.controller) {
$notification.toast('show');
}
}
});
});
$btnRefresh.click(() => {
if (registration.waiting) {
registration.waiting.postMessage('SKIP_WAITING');
}
$notification.toast('hide');
});
}
);
let refreshing = false;
/* Detect controller change and refresh all the opened tabs */
navigator.serviceWorker.addEventListener('controllerchange', () => {
if (!refreshing) {
window.location.reload();
refreshing = true;
}
});
}

View File

@@ -6,7 +6,7 @@ permalink: '/sw.js'
self.importScripts('{{ "/assets/js/data/swcache.js" | relative_url }}'); self.importScripts('{{ "/assets/js/data/swcache.js" | relative_url }}');
const cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M%S" }}'; const cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M" }}';
function verifyDomain(url) { function verifyDomain(url) {
for (const domain of allowedDomains) { for (const domain of allowedDomains) {
@@ -28,42 +28,25 @@ function isExcluded(url) {
return false; return false;
} }
self.addEventListener('install', event => { self.addEventListener('install', e => {
event.waitUntil( self.skipWaiting();
e.waitUntil(
caches.open(cacheName).then(cache => { caches.open(cacheName).then(cache => {
return cache.addAll(resource); return cache.addAll(resource);
}) })
); );
}); });
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys().then(keyList => {
return Promise.all(
keyList.map(key => {
if (key !== cacheName) {
return caches.delete(key);
}
})
);
})
);
});
self.addEventListener('message', (event) => {
if (event.data === 'SKIP_WAITING') {
self.skipWaiting();
}
});
self.addEventListener('fetch', event => { self.addEventListener('fetch', event => {
event.respondWith( event.respondWith(
caches.match(event.request).then(response => { caches.match(event.request)
.then(response => {
if (response) { if (response) {
return response; return response;
} }
return fetch(event.request).then(response => { return fetch(event.request)
.then(response => {
const url = event.request.url; const url = event.request.url;
if (event.request.method !== 'GET' || if (event.request.method !== 'GET' ||
@@ -77,7 +60,8 @@ self.addEventListener('fetch', event => {
*/ */
let responseToCache = response.clone(); let responseToCache = response.clone();
caches.open(cacheName).then(cache => { caches.open(cacheName)
.then(cache => {
/* console.log('[sw] Caching new resource: ' + event.request.url); */ /* console.log('[sw] Caching new resource: ' + event.request.url); */
cache.put(event.request, responseToCache); cache.put(event.request, responseToCache);
}); });
@@ -87,3 +71,17 @@ self.addEventListener('fetch', event => {
}) })
); );
}); });
self.addEventListener('activate', e => {
e.waitUntil(
caches.keys().then(keyList => {
return Promise.all(
keyList.map(key => {
if(key !== cacheName) {
return caches.delete(key);
}
})
);
})
);
});

View File

@@ -1,12 +0,0 @@
---
layout: compress
permalink: '/unregister.js'
---
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then((registrations) => {
for (let reg of registrations) {
reg.unregister();
}
});
}

Submodule assets/lib deleted from d1d2ec17c8

View File

@@ -11,7 +11,7 @@ const insert = require('gulp-insert');
const fs = require('fs'); const fs = require('fs');
const JS_SRC = '_javascript'; const JS_SRC = '_javascript';
const JS_DEST = `assets/js/dist`; const JS_DEST = `assets/js/dist/`;
function concatJs(files, output) { function concatJs(files, output) {
return src(files) return src(files)
@@ -34,7 +34,7 @@ const commonsJs = () => {
const homeJs = () => { const homeJs = () => {
return concatJs([ return concatJs([
`${JS_SRC}/commons/*.js`, `${JS_SRC}/commons/*.js`,
`${JS_SRC}/utils/locale-datetime.js` `${JS_SRC}/utils/timeago.js`
], ],
'home' 'home'
); );
@@ -44,7 +44,7 @@ const postJs = () => {
return concatJs([ return concatJs([
`${JS_SRC}/commons/*.js`, `${JS_SRC}/commons/*.js`,
`${JS_SRC}/utils/img-extra.js`, `${JS_SRC}/utils/img-extra.js`,
`${JS_SRC}/utils/locale-datetime.js`, `${JS_SRC}/utils/timeago.js`,
`${JS_SRC}/utils/checkbox.js`, `${JS_SRC}/utils/checkbox.js`,
`${JS_SRC}/utils/clipboard.js`, `${JS_SRC}/utils/clipboard.js`,
// 'smooth-scroll.js' must be called after ToC is ready // 'smooth-scroll.js' must be called after ToC is ready
@@ -66,27 +66,17 @@ const pageJs = () => {
`${JS_SRC}/commons/*.js`, `${JS_SRC}/commons/*.js`,
`${JS_SRC}/utils/checkbox.js`, `${JS_SRC}/utils/checkbox.js`,
`${JS_SRC}/utils/img-extra.js`, `${JS_SRC}/utils/img-extra.js`,
`${JS_SRC}/utils/clipboard.js`, `${JS_SRC}/utils/clipboard.js`
`${JS_SRC}/utils/smooth-scroll.js`
], 'page' ], 'page'
); );
}; };
const miscJs = () => {
return concatJs([
`${JS_SRC}/commons/*.js`,
`${JS_SRC}/utils/locale-datetime.js`
], 'misc'
);
};
// GA pageviews report // GA pageviews report
const pvreportJs = () => { const pvreportJs = () => {
return concatJs(`${JS_SRC}/utils/pageviews.js`, 'pvreport'); return concatJs(`${JS_SRC}/utils/pageviews.js`, 'pvreport');
}; };
const buildJs = parallel( const buildJs = parallel(commonsJs, homeJs, postJs, categoriesJs, pageJs, pvreportJs);
commonsJs, homeJs, postJs, categoriesJs, pageJs, miscJs, pvreportJs);
exports.build = series(buildJs, minifyJs); exports.build = series(buildJs, minifyJs);
@@ -95,7 +85,8 @@ exports.liveRebuild = () => {
watch([ watch([
`${ JS_SRC }/commons/*.js`, `${ JS_SRC }/commons/*.js`,
`${ JS_SRC }/utils/*.js` `${ JS_SRC }/utils/*.js`,
`${ JS_SRC }/lib/*.js`
], ],
buildJs buildJs
); );

Some files were not shown because too many files have changed in this diff Show More