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

Compare commits

..

134 Commits

Author SHA1 Message Date
Cotes Chung
4c45f3788e Merge branch 'master' into production 2022-06-09 17:59:55 +08:00
Cotes Chung
baad801066 chore(release): 5.2.0 2022-06-09 17:59:27 +08:00
Cotes Chung
7f18cdc1fd build: fix the preview mode for release tool 2022-06-09 17:59:25 +08:00
Cotes Chung
fd0f983bbe chore: optimize the layout of main content and search input 2022-06-09 03:46:47 +08:00
Cotes Chung
35cadf969d perf(categories): support singular and plural forms of locale (#595)
resolves #595
2022-06-08 19:02:18 +08:00
Raymond Wright
cc6398c104 docs: fix typo in English locale file (#594) 2022-06-08 16:48:11 +08:00
Cotes Chung
5d6e8c5ef6 perf: improve the responsive design for ultrawide screens (#540)
Resolves #540
2022-06-08 16:15:38 +08:00
Cotes Chung
20caace68a fix(PWA): avoid repeated notification of SW update 2022-06-08 16:09:18 +08:00
Cotes Chung
ac1731d123 Merge branch 'feature/enhance-pwa' 2022-06-05 00:10:49 +08:00
Cotes Chung
106c981bac feat: add option to turn off PWA (#527) 2022-06-05 00:10:20 +08:00
Cotes Chung
d127183b97 feat(PWA): add Service Worker update notification 2022-06-04 23:54:06 +08:00
bibi2233
54124d5134 fix: assets URL is missing baseurl in self-hosted mode (#591) 2022-06-02 20:55:34 +08:00
Cotes Chung
76a1b6a068 fix(theme mode): SCSS syntax error (#588)
Fixes #588
2022-05-30 05:50:46 +08:00
Cotes Chung
91308ae567 refactor: decouple the Archives from 404 page (#576)
Resolves #576
2022-05-24 23:47:24 +08:00
Cotes Chung
12f1e6fe89 refactor(tags): avoid URL errors caused by improper site.baseurl settings
Resolves #580
2022-05-24 16:33:42 +08:00
Six Jonathan
94e81447af feat: add fr-FR support to locales (#582) 2022-05-24 16:31:50 +08:00
Cotes Chung
b7ad538ce2 Merge branch 'feature/improve-post-meta' 2022-04-26 05:05:15 +08:00
Cotes Chung
097bb23530 docs: add description for preview image 2022-04-26 04:55:38 +08:00
Cotes Chung
2bd6efa95a feat: support showing description of preview image
Also moved the image position to the metadata area
2022-04-26 04:55:38 +08:00
Cotes Chung
135a16f13e perf: avoid post pageviews from shifting while loading 2022-04-26 04:55:37 +08:00
Cotes Chung
6d35f5f8da perf: avoid the layout shift for post datetime 2022-04-26 04:55:37 +08:00
Cotes Chung
42c44a8bc1 refactor: simplify travis config 2022-04-17 17:02:32 +08:00
Cotes
138c537010 Merge pull request #541 from ZakKemble/fix-various
Fix various
2022-04-14 23:58:37 +08:00
Zak Kemble
59e955745f fix: spurious header closing tags
`right` already contains the closing tag
2022-04-14 16:50:13 +01:00
Zak Kemble
4f590e2bba fix: p is not allowed in span 2022-04-14 16:50:13 +01:00
Zak Kemble
6900d9f2bc fix: follow paginate_path config for pagination
Using "paginate_path: /page/:num/" to generate "/page/2/" paths would still generate invalid
pagination links to "/page2/"
2022-04-14 16:50:13 +01:00
Jayitha
30787fc4cf fix: horizontal scroll for long equations (#545) 2022-04-03 04:10:34 +08:00
Galen Rice
5402523ae5 fix: force checkout of gh-pages branch (#544)
When using the theme starter, which uses a git submodule,
assets loaded from that submodule are "untracked" files in the pages branch working tree.
The build can fail at this line due to Git, saying "the following untracked working tree files would be overwritten by checkout".

Adding `-f` forces the checkout, overwriting all files.
The other deploy steps then take over and rewrite the files as needed.
2022-04-02 19:22:48 +08:00
Cotes Chung
156c02a91a Merge branch 'feature/commitlint-config' 2022-04-02 19:21:52 +08:00
Cotes Chung
6ca66366d5 build(git-ignore): add missing item
When using the theme starter, which uses a git submodule,
assets loaded from that submodule are "untracked" files in the pages branch working tree.
The build can fail at this line due to Git, saying "the following untracked working tree files would be overwritten by checkout".

Adding `-f` forces the checkout, overwriting all files.
The other deploy steps then take over and rewrite the files as needed.
2022-04-02 19:18:32 +08:00
Cotes Chung
0740b857c6 build(deps): disables the rule body-max-line-length 2022-04-02 19:13:54 +08:00
Zak Kemble
58928dbc90 fix: alt is not a valid attribute for 'a' tag 2022-03-27 18:01:24 +01:00
Cotes Chung
0542b5149c fix: remove whitespace from avatar URL (#537)
Fix #537
2022-03-22 21:13:39 +08:00
Cotes Chung
e68108014a style: add indentation 2022-03-22 21:13:39 +08:00
Camilo Martínez Burgos
efe75adf27 feat: add es-ES support to locales (#533)
Using the already existing locales in the chirpy repository, I added a new locale file in Spanish.
2022-03-17 02:22:46 +08:00
Cotes Chung
3e64400246 Merge branch 'fix/seo-tag' 2022-03-17 02:11:47 +08:00
Cotes Chung
f581b4395f docs: update posts for author info 2022-03-17 02:05:45 +08:00
Cotes Chung
96a16c868e fix: correct the twitter:creator of Twitter summary card 2022-03-17 01:40:38 +08:00
Cotes Chung
67d51d5df2 docs: update preview image's font-matter 2022-03-16 22:51:41 +08:00
Cotes Chung
9cefe58993 fix: when the site.img_cdn is set to the local path, the preview-image path loses the baseurl 2022-03-16 22:17:19 +08:00
Cotes Chung
b8d1bcd3de fix: resume the preview image SEO tag (#529)
Fix #529
2022-03-16 22:17:19 +08:00
Cotes Chung
a60a4562bf Merge branch 'feature/global-npm-bin' 2022-03-13 18:02:52 +08:00
Cotes Chung
03e4f575ba build(npm, shell): use the global standard-version 2022-03-13 16:53:13 +08:00
Cotes Chung
b58cab1c07 docs: update contributing guidelines 2022-03-13 16:50:12 +08:00
Cotes Chung
da05d395fb build(npm): use the global commitlint & husky 2022-03-13 16:47:22 +08:00
Cotes Chung
f0a2e2f4e1 chore(gh-actions): resume the trigger branch 2022-03-12 22:29:15 +08:00
Cotes Chung
c57238975a docs: update bug report template 2022-03-12 22:27:39 +08:00
Paulo Freitas
c2c503f633 feat: add pt-BR support to locales 2022-03-07 16:12:53 +08:00
Cotes Chung
5607a1755a Merge branch 'feature/update-deps' 2022-03-05 00:09:22 +08:00
Cotes Chung
5a575613bb build: update required ruby version & docs uri 2022-03-04 23:58:13 +08:00
Cotes Chung
00ad357033 ci: update matrix environment 2022-03-04 23:58:13 +08:00
Zak Kemble
dd9d5a7207 fix: use jsonify to generate valid json (#521) 2022-03-03 21:49:05 +08:00
Cotes
d2bbcb791f Merge pull request #520 from ZakKemble/fix-script-location-and-url-encode 2022-03-03 21:06:48 +08:00
Zak Kemble
4c1c8d8b0e fix: correctly URL encode share links
Relates to #496
2022-03-03 12:55:27 +00:00
Zak Kemble
2103191b2f fix: script code should be in head or body, not in between 2022-03-03 12:54:44 +00:00
Cotes Chung
5d85ccb994 fix: table bypass refactoring when it contains IAL (#519)
Fix #519
2022-03-03 18:05:48 +08:00
Cotes Chung
7fef3fafec Merge branch 'feature/auto-versioning' 2022-03-03 03:11:08 +08:00
Cotes Chung
887859dd32 docs: update contributing guidelines 2022-03-03 02:46:28 +08:00
Cotes Chung
42fe8f5d21 build(shell): update release tool to work with standard-version 2022-03-03 02:46:28 +08:00
HigherOrderLogic
171463d76d Add Vietnamese locale (#517) 2022-03-02 02:16:31 +08:00
Cotes Chung
dd264e793c ci(gh-actions): add commitlint for PR 2022-03-01 23:26:07 +08:00
Cotes Chung
004ab6c56a build(deps): add commitlint, husky, and standard-version 2022-03-01 23:26:07 +08:00
Cotes Chung
3969b28743 Bump version to 5.1.0 2022-02-14 23:59:48 +08:00
Cotes Chung
5f31fbcf72 Enhance versioning tools 2022-02-14 23:59:17 +08:00
Cotes Chung
4986db1204 Improve SCSS comment symbols: change // to /* */ 2022-02-14 23:39:50 +08:00
Cotes Chung
508d3c5c6a Update docs 2022-02-14 22:15:38 +08:00
Cotes Chung
35e013f7fd Adapt the search input to Bootstrap 4.6 2022-02-14 22:15:38 +08:00
Cotes Chung
e52dc9551c Beautify heading style (margin, anchor) 2022-02-14 22:15:38 +08:00
Cotes Chung
5753118d8b Keep the original image shadow of the theme
Bootstrap 4.6.x has its own class `.shadow`
2022-02-14 21:41:50 +08:00
Cotes Chung
5295bbf4f9 Merge branch 'feature/expand-prompt' 2022-02-14 21:39:10 +08:00
Cotes Chung
cfd05d1aa5 Update prompt related docs 2022-02-14 20:14:39 +08:00
Cotes Chung
6c4d0e0def Rename prompt type note to info 2022-02-14 20:14:39 +08:00
Cotes Chung
15cfa84ddb Add tip type prompt 2022-02-13 03:08:57 +08:00
Cotes Chung
08a993be90 Bypass hidden posts in home page pagination (fix #504) 2022-02-12 06:10:21 +08:00
Cotes Chung
2b66ad0441 Update readme 2022-02-12 06:06:42 +08:00
Cotes Chung
0f6b170e24 Use constants to define resources for utterances
Self-host the JS for `utterances` is not necessary, because the list of comments cannot be loaded if the network is offline.
2022-02-12 05:47:48 +08:00
Cotes Chung
4df4f7f8db Add Giscus comments support (resolve #501) 2022-02-12 05:47:48 +08:00
Cotes Chung
09f1ded60c Merge branch 'feature/configurable-assets-cdn' 2022-02-10 04:14:03 +08:00
Cotes Chung
70e089c392 Add introduction to new features 2022-02-10 04:12:35 +08:00
Cotes Chung
dc42b6f800 Add assets submodule 2022-02-10 04:12:35 +08:00
Cotes Chung
3685685b28 Make the source of the static assets configurable
- Easy to switch between different CDN
- Allow self-host static assets
2022-02-10 04:12:35 +08:00
Cotes Chung
51688ccc9f Correct the branches that triggers gh-action 2022-02-04 06:47:03 +08:00
Cotes Chung
3db6de0abb Update project description 2022-02-04 06:23:09 +08:00
Cotes Chung
b27258899b Clear references to deleted folder docs 2022-02-04 06:23:09 +08:00
Cotes Chung
cfe9029cd1 Remove unused HTML attribute from sidebar 2022-02-04 06:23:09 +08:00
Cotes Chung
2c5e67f02b Improve the SW cache list 2022-02-04 06:23:09 +08:00
Cotes Chung
7a392510e6 Remove unused include from layouts 2022-02-03 01:04:42 +08:00
Cotes Chung
85fe258b20 Migrate the images from jsDelivr CDN to GitHub
jsDelivr does not allow caching of website images to their CDN!

see: <https://www.jsdelivr.com/terms/acceptable-use-policy-jsdelivr-net#2-hard-limits-and-restrictions>
2022-01-29 01:08:52 +08:00
Cotes Chung
55fd119d35 Fix hover color for links at the tail of posts 2022-01-28 23:48:46 +08:00
Cotes Chung
fc36f8b66d Improve the color of prompts 2022-01-28 23:48:46 +08:00
Cotes Chung
a5d38e7fbc Improve local datetime display
- Protect author's location privacy
- Reduce locale configuration parameters
2022-01-28 23:45:29 +08:00
Cotes Chung
a24545ed60 Prevent relative time conversion failure on Safari 2022-01-25 01:18:25 +08:00
Cotes Chung
66e655f09b Escape the post sharing URL (fix #496) 2022-01-23 05:11:14 +08:00
Cotes Chung
c3b2151ca0 Simplify the wiki 2022-01-23 04:30:54 +08:00
Cotes Chung
3d8184602b Merge branch 'feature/filepath-code' 2022-01-23 04:04:38 +08:00
Cotes Chung
c344926886 Show the filepath style in docs 2022-01-23 03:57:20 +08:00
Cotes Chung
756465d621 Add filepath style for code 2022-01-23 03:49:28 +08:00
Cotes Chung
7b0e9a6803 Merge branch 'feature/prompt-blockquote' 2022-01-23 02:00:48 +08:00
Cotes Chung
f043123f23 Introduce the prompts in docs 2022-01-23 01:59:36 +08:00
Cotes Chung
ca181422a6 Add blockquote prompts (resolve #489) 2022-01-23 01:59:36 +08:00
Cotes Chung
4845f6ef14 Fix attribute name of share URL button 2022-01-19 17:54:50 +08:00
Cotes Chung
031e878620 Travis: using the minimal environment when updating starter 2022-01-19 17:22:29 +08:00
Oaker Min
166c05bcd1 Update the telegram share URL of the post (#490)
Telegram API update
2022-01-19 01:36:00 +08:00
Cotes Chung
0890147423 Merge branch 'feature/docs' 2022-01-19 01:27:33 +08:00
Cotes Chung
323a888160 Update docs in real time 2022-01-19 00:30:55 +08:00
Cotes Chung
7788a140f2 Update prerequisites in tutorial (resolve #484) 2022-01-19 00:23:16 +08:00
Cotes Chung
1b379e3870 Improve chapter levels of guide 2022-01-19 00:23:16 +08:00
Cotes Chung
640bde95c4 Fix tutorial on writing posts 2022-01-19 00:23:16 +08:00
Roman Kvasnytskyi
1a93d5e557 Added russian and ukrainian translation and locales (#485) 2022-01-16 00:13:09 +08:00
Oaker Min
b8c3ea221e Added Burmese translation and locales (#483) 2022-01-15 17:59:39 +08:00
Tamme Schichler
4a2016a9e3 Don't include Google Analytics scripts without analytics id (#482) 2022-01-14 19:03:16 +08:00
Cotes Chung
a6c73e8f4f Avoid image caption shifting on load 2022-01-13 01:07:47 +08:00
Cotes Chung
f8f4dd889e Normalized attribute name in HTML
Add prefix `data-` for following attributes:
- `topbar-visible`
- `mode`
- `label-text`
- `title-succeed`
2022-01-13 00:23:08 +08:00
Cotes Chung
96e7cd79af Avoid whitespace before anchors when wrapping 2022-01-12 22:51:38 +08:00
Cotes Chung
22c12a4d34 Merge branch 'feature/improve-topabar-ux-on-mobile' 2022-01-09 19:12:50 +08:00
Cotes Chung
2cef631385 Hide topbar when mobile orientation in landscape mode (resolve #459) 2022-01-09 19:09:29 +08:00
Cotes Chung
9620eddd12 Simplify the top-bar title detect process 2022-01-08 02:57:16 +08:00
Cotes Chung
dbf86a2309 Merge branch 'hotfix/5.0.2' 2022-01-08 02:44:36 +08:00
Cotes Chung
2d02a6415d Bump version to 5.0.2 2022-01-08 02:44:19 +08:00
Cotes Chung
67bd6679b9 Update travis: deploy only when tagging
The bundler cache is also disabled because the tag name is always changing
2022-01-08 02:43:06 +08:00
Cotes Chung
f2a2792405 Fix responsive design of search hints 2022-01-08 02:28:10 +08:00
Cotes Chung
837d0778b6 Avoid preview-image delaying the switching of the top bar title (mobile views)
Use Intersection Observer API to optimize the performance of title switching
2022-01-08 02:28:10 +08:00
Cotes Chung
97ae2bf6c0 Update ReadMe 2022-01-08 01:19:49 +08:00
Cotes Chung
e7b377cf63 Prevent the top bar from covering the heading when scrolling down (in mobile views) 2022-01-06 21:46:08 +08:00
Cotes Chung
b0815b53c0 Enable smooth scrolling for layout page 2022-01-06 21:46:00 +08:00
Josh Johanning
4dd0c6d16f improve english locales for recently updated posts 2022-01-05 16:35:07 +08:00
Cotes Chung
57a76097d6 Merge branch 'hotfix/5.0.1' 2022-01-05 03:14:38 +08:00
Cotes Chung
22e2367b45 Bump version to 5.0.1 2022-01-05 03:11:24 +08:00
Cotes Chung
b44bf78f10 Improve the creation of header anchors (fix #474) 2022-01-05 02:36:07 +08:00
Cotes Chung
948356d7d6 Fix <img> HTML element refactoring issue (resolve #476, close #477) 2022-01-05 02:36:07 +08:00
Cotes Chung
7337fa5f20 Merge branch 'feature/docs' 2022-01-04 06:49:45 +08:00
Cotes Chung
44acea2f5d Add content to the contributing guidelines 2022-01-04 06:48:41 +08:00
Cotes Chung
65a38c8f22 Simplify the README 2022-01-04 05:20:31 +08:00
Cotes Chung
b91b6711b0 Update the tutorial on comments and image attributes 2022-01-04 02:20:58 +08:00
106 changed files with 2513 additions and 1334 deletions

5
.commitlintrc.json Normal file
View File

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

View File

@@ -1,6 +1,6 @@
# How to Contribute # How to Contribute
We want to thank you for sparing time to improve this project! Here are some guidelines for contributing We'd like 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,34 +9,57 @@ 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 (e.g., `my-new-feature`, `fix-a-bug`). 2. Create a new branch from the default branch and give it a descriptive name (format: `feature/<add-new-feat>` / `fix/<fix-a-bug>`).
3. After completing the development, submit a new _Pull Request_. 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.
## Modifying JavaScript ## Modifying JavaScript
If your contribution involves JS modification, please read the following sections. If your contribution involves JavaScript modification, please read the following sections.
### Inline Scripts ### Inline Scripts
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. 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.
### External Scripts ### External Scripts
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). 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:
During development, real-time debugging can be performed through the following commands: ```console
$ 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
``` ```
Open another terminal tab and run: And then open a new terminal tab and run:
```console ```console
$ gulp dev # Type 'Ctrl + C' to stop # Type 'Ctrl + C' to stop
$ npx gulp dev
``` ```
After debugging, run the command `gulp` (without any argument) will automatically output the compressed files to the directory `assests/js/dist/`. After debugging, run the command `npx gulp` (without any argument) will automatically output the compressed files to the directory `assets/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,14 +35,15 @@ Steps to reproduce the behavior:
<!-- If applicable, add screenshots to help explain your problem. --> <!-- If applicable, add screenshots to help explain your problem. -->
### Software ### Environment
<!-- Please complete the following information --> | Command | Version |
- Ruby version: <!-- by running: `ruby -v` --> |-----------------------------------|---------|
- Gem version: <!-- by running: `gem -v`--> | `ruby -v` | |
- Bundler version: <!-- by running: `bundle -v`--> | `gem -v` | |
- Jekyll version: <!-- by running: `bundle list | grep " jekyll "` --> | `bundle -v` | |
- Theme version: <!-- by running: `gem list | grep jekyll-theme-chirpy` --> | `bundle exec jekyll -v` | |
| `bundle info jekyll-theme-chirpy` | |
### Desktop ### Desktop

View File

@@ -1,16 +1,16 @@
name: 'Continuous Integration' name: 'CI'
on: on:
push: push:
branches-ignore: branches-ignore:
- 'production' - 'release/**'
- '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,23 +18,20 @@ on:
- '**' - '**'
jobs: jobs:
ci: build:
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest] ruby: [2.5, 2.6, 2.7, 3]
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: 2.7 ruby-version: ${{ matrix.ruby }}
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

11
.github/workflows/commitlint.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
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,6 +4,9 @@
!.editorconfig !.editorconfig
!.nojekyll !.nojekyll
!.travis.yml !.travis.yml
!.husky
!.commitlintrc.json
!.versionrc.json
# bundler cache # bundler cache
_site _site

3
.gitmodules vendored Normal file
View File

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

4
.husky/commit-msg Executable file
View File

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

View File

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

20
.versionrc.json Normal file
View File

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

44
CHANGELOG.md Normal file
View File

@@ -0,0 +1,44 @@
# 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.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://cdn.jsdelivr.net/gh/cotes2020/chirpy-images@f4e0354b674f65a53b8917f0f786ed2956898cc1/commons/devices-mockup.png)](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)
</div> </div>
@@ -28,7 +28,7 @@
- Syntax Highlighting - Syntax Highlighting
- Mathematical Expressions - Mathematical Expressions
- Mermaid Diagram & Flowchart - Mermaid Diagram & Flowchart
- Disqus/Utterances Comments - Disqus/Utterances/Giscus 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`. 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.
### 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, the local service will be published at _<http://127.0.0.1:4000>_. After a while, navigate to the site at <http://localhost:4000>.
## Documentation ## 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. 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.
## 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 open source license. Last but not least, thank [JetBrains][jb] for providing the OSS development license.
## Sponsoring ## Sponsoring

View File

@@ -12,6 +12,9 @@ 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
@@ -23,9 +26,7 @@ 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, portfolio, sidebar, A minimal, responsive, and powerful Jekyll theme for presenting professional writing.
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: ''
@@ -49,13 +50,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: google_meta_tag_verification # change to your verification string google_site_verification: # fill in 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
@@ -79,7 +80,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://cdn.jsdelivr.net/gh/cotes2020/chirpy-images@f4e0354b674f65a53b8917f0f786ed2956898cc1' img_cdn: 'https://raw.githubusercontent.com/cotes2020/chirpy-images/main'
# 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'
@@ -96,6 +97,26 @@ 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
@@ -118,8 +139,7 @@ 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:
@@ -129,18 +149,24 @@ 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
@@ -158,7 +184,6 @@ exclude:
- '*.gem' - '*.gem'
- '*.gemspec' - '*.gemspec'
- tools - tools
- docs
- README.md - README.md
- LICENSE - LICENSE
- gulpfile.js - gulpfile.js

View File

@@ -0,0 +1,62 @@
# 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

@@ -0,0 +1,51 @@
# 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

17
_data/authors.yml Normal file
View File

@@ -0,0 +1,17 @@
## 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,21 +20,13 @@ tabs:
search: search:
hint: search hint: search
cancel: Cancel cancel: Cancel
no_results: Oops! No result founds. no_results: Oops! No results found.
panel: panel:
lastmod: Recent Update lastmod: Recently Updated
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:
@@ -52,9 +44,10 @@ 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.
head_back: Head back Home notification:
archives_page: Archives page update_found: A new version of content is available.
update: Update
# ----- Posts related labels ----- # ----- Posts related labels -----
@@ -62,11 +55,6 @@ 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:
@@ -87,5 +75,9 @@ post:
# categories page # categories page
categories: categories:
category_measure: categories category_measure:
post_measure: posts singular: category
plural: categories
post_measure:
singular: post
plural: posts

79
_data/locales/es-ES.yml Normal file
View File

@@ -0,0 +1,79 @@
# 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

79
_data/locales/fr-FR.yml Normal file
View File

@@ -0,0 +1,79 @@
# 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,14 +27,6 @@ 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:
@@ -52,9 +44,10 @@ 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.
head_back: Kembali ke Beranda notification:
archives_page: Halaman Arsip update_found: Versi konten baru tersedia.
update: Perbarui
# ----- Posts related labels ----- # ----- Posts related labels -----
@@ -62,11 +55,6 @@ 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,14 +27,6 @@ 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:
@@ -52,9 +44,10 @@ meta: Powered by :PLATFORM with :THEME theme.
not_found: not_found:
statment: 해당 URL은 존재하지 않습니다. statment: 해당 URL은 존재하지 않습니다.
hint_template: :HEAD_BAK을 눌러 다시 찾거나 :ARCHIVES_PAGE에서 검색해 주세요.
head_back: 홈으로 돌아가기 notification:
archives_page: 아카이브 페이지 update_found: 새 버전의 콘텐츠를 사용할 수 있습니다.
update: 업데이트
# ----- Posts related labels ----- # ----- Posts related labels -----
@@ -62,11 +55,6 @@ 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:

79
_data/locales/my-MM.yml Normal file
View File

@@ -0,0 +1,79 @@
# 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: ပို့စ်များ

79
_data/locales/pt-BR.yml Normal file
View File

@@ -0,0 +1,79 @@
# 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

79
_data/locales/ru-RU.yml Normal file
View File

@@ -0,0 +1,79 @@
# 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: публикации

79
_data/locales/uk-UA.yml Normal file
View File

@@ -0,0 +1,79 @@
# 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: публікації

77
_data/locales/vi-VN.yml Normal file
View File

@@ -0,0 +1,77 @@
# 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,14 +27,6 @@ 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:
@@ -51,9 +43,10 @@ meta: 本站由 :PLATFORM 生成,采用 :THEME 主题。
not_found: not_found:
statment: 抱歉,我们放错了该 URL或者它指向了不存在的内容。 statment: 抱歉,我们放错了该 URL或者它指向了不存在的内容。
hint_template: :HEAD_BAK尝试再次查找它或在:ARCHIVES_PAGE上搜索它。
head_back: 返回主页 notification:
archives_page: 归档页面 update_found: 发现新版本的内容。
update: 更新
# ----- Posts related labels ----- # ----- Posts related labels -----
@@ -61,11 +54,6 @@ 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://telegram.me/share?text=TITLE&url=URL" link: "https://t.me/share/url?url=URL&text=TITLE"
# Uncomment below if you need to. # Uncomment below if you need to.
# - # -

View File

@@ -0,0 +1,12 @@
{% 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

@@ -0,0 +1,56 @@
<!-- 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[mode=dark]").length > 0 if ($("html[data-mode=dark]").length > 0
|| ($("html[mode]").length == 0 || ($("html[data-mode]").length == 0
&& window.matchMedia("(prefers-color-scheme: dark)").matches)) { && window.matchMedia("(prefers-color-scheme: dark)").matches)) {
initTheme = darkTheme; initTheme = darkTheme;
} }

View File

@@ -1,15 +0,0 @@
<!--
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 %}

21
_includes/datetime.html Normal file
View File

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

View File

@@ -6,13 +6,12 @@
<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">
{% if page.layout == 'home' or page.layout == 'post' %} <!-- 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 %}
<!-- i18n for `_javascript/utils/timeago.js` --> {% if page.layout == 'home' or page.layout == 'post' %}
<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 }}">
@@ -24,7 +23,30 @@
{% endif %} {% endif %}
{% seo title=false %} {% capture seo_tags %}
{% 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" -%}
@@ -35,12 +57,24 @@
{% include favicons.html %} {% include favicons.html %}
<!-- Google Fonts --> {% if site.resources.ignore_env != jekyll.environment and site.resources.self_hosted %}
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous">
<link rel="dns-prefetch" href="https://fonts.gstatic.com"> <link href="{{ site.data.assets[origin].webfonts | relative_url }}" rel="stylesheet">
{% 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">
@@ -49,27 +83,34 @@
{% 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="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="{{ site.data.assets[origin].bootstrap.css | relative_url}}">
<!-- Font Awesome --> <!-- Font Awesome -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css"> <link rel="stylesheet" href="{{ site.data.assets[origin].fontawesome.css | relative_url }}">
{% include css-selector.html %} <link rel="stylesheet" href="{{ '/assets/css/style.css' | relative_url }}">
{% 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="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script> <script src="{{ site.data.assets[origin].jquery.js | relative_url }}"></script>
{% unless site.theme_mode %}
{% include mode-toggle.html %}
{% endunless %}
</head> </head>

View File

@@ -7,14 +7,43 @@
{% 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="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script> <script async src="{{ site.data.assets[origin].countup.js | relative_url }}"></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 --> <!-- image lazy-loading & popup & clipboard -->
<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> {% assign _urls = site.data.assets[origin].magnific-popup.js
| 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'
@@ -22,12 +51,16 @@
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 %}
{% assign js = type | prepend: '/assets/js/dist/' | append: '.min.js' %} {% capture script %}/assets/js/dist/{{ type }}.min.js{% endcapture %}
<script defer src="{{ js | relative_url }}"></script> <script defer src="{{ script | relative_url }}"></script>
{% if page.math %} {% if page.math %}
<!-- MathJax --> <!-- MathJax -->
@@ -46,22 +79,25 @@
} }
}; };
</script> </script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> <script src="{{ site.data.assets[origin].polyfill.js | relative_url }}"></script>
<script type="text/javascript" id="MathJax-script" async <script id="MathJax-script" async src="{{ site.data.assets[origin].mathjax.js | relative_url }}">
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script> </script>
{% endif %} {% endif %}
<!-- commons --> <!-- commons -->
<script src="https://cdn.jsdelivr.net/combine/npm/popper.js@1.16.1,npm/bootstrap@4/dist/js/bootstrap.min.js"></script> <script src="{{ site.data.assets[origin].bootstrap.js | relative_url }}"></script>
{% if jekyll.environment == 'production' %} {% if jekyll.environment == 'production' %}
<!-- PWA --> <!-- PWA -->
<script defer src="{{ '/app.js' | relative_url }}"></script> {% if site.pwa.enabled %}
<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 %} {% if site.google_analytics.id != empty and site.google_analytics.id %}
{% include google-analytics.html %} {% include google-analytics.html %}
{% endif %} {% endif %}

View File

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

View File

@@ -5,6 +5,7 @@
<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"; }
@@ -70,17 +71,17 @@
} }
setDark() { setDark() {
$('html').attr(ModeToggle.MODE_KEY, ModeToggle.DARK_MODE); $('html').attr(ModeToggle.MODE_ATTR, 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_KEY, ModeToggle.LIGHT_MODE); $('html').attr(ModeToggle.MODE_ATTR, 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_KEY); $('html').removeAttr(ModeToggle.MODE_ATTR);
sessionStorage.removeItem(ModeToggle.MODE_KEY); sessionStorage.removeItem(ModeToggle.MODE_KEY);
} }

View File

@@ -1,13 +0,0 @@
{% 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 %}
<span class="btn btn-outline-primary disabled" <div class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[lang].post.button.previous }}"> prompt="{{ site.data.locales[lang].post.button.previous }}">
<p>-</p> <p>-</p>
</span> </div>
{% 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 %}
<span class="btn btn-outline-primary disabled" <div class="btn btn-outline-primary disabled"
prompt="{{ site.data.locales[lang].post.button.next }}"> prompt="{{ site.data.locales[lang].post.button.next }}">
<p>-</p> <p>-</p>
</span> </div>
{% 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-0 pl-lg-2"> <ul class="pagination align-items-center mt-4 mb-5 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="{{ site.baseurl }}/{% if i > 1%}page{{ i }}/{% endif %}">{{ i }}</a> <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>
</li> </li>
{% else %} {% else %}
<!-- hide number --> <!-- hide number -->

View File

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

View File

@@ -9,10 +9,11 @@
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 %}
@@ -91,7 +92,11 @@
<!-- Add CDN URL --> <!-- Add CDN URL -->
{% if site.img_cdn %} {% if site.img_cdn %}
{% assign _src_prefix = site.img_cdn %} {% if site.img_cdn contains '//' %}
{% 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 %}
@@ -165,13 +170,13 @@
{% endif %} {% endif %}
{% capture _label %} {% capture _label %}
<span label-text="{{ _label_text | strip }}"><i class="{{ _label_icon }}"></i></span> <span data-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" title-succeed="' | append: '<button aria-label="copy" data-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>'
@@ -205,15 +210,14 @@
{% endif %} {% endif %}
{% assign id = snippet | split: '"' | first %} {% assign id = snippet | split: '"' | first %}
{% capture anchor %}<a href="#{{ id }}" class="anchor"><i class="fas fa-hashtag"></i></a>{% endcapture %} {% capture anchor %}<a href="#{{ id }}" class="anchor text-muted"><i class="fas fa-hashtag"></i></a>{% endcapture %}
{% assign left = snippet | split: mark_end | first %} {% assign left = snippet | split: mark_end | first %}
{% assign _start_index = left | size %} {% assign right = snippet | slice: left.size, snippet.size %}
{% assign _end_index = snippet | size | minus: 1 %} {% assign left = left | replace: '">', '"><span class="mr-2">' | append: '</span>' %}
{% 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: mark_end | append: right | append: left | append: anchor | append: right
%} %}
{% endfor %} {% endfor %}
@@ -225,6 +229,54 @@
{% 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,7 +60,6 @@
{% 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 %}
@@ -74,10 +73,8 @@
{% 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"
@@ -89,7 +86,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 timeago.html date=post.date class="small" %} {% include datetime.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="https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js"></script> <script src="{{ site.data.assets[origin].search.js | relative_url }}"></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" lang="{{lang}}"> <div id="sidebar" class="d-flex flex-column align-items-end">
<div class="profile-wrapper text-center"> <div class="profile-wrapper text-center">
<div id="avatar"> <div id="avatar">
<a href="{{ '/' | relative_url }}" alt="avatar" class="mx-auto"> <a href="{{ '/' | relative_url }}" class="mx-auto">
{% if site.avatar != '' and site.avatar %} {% if site.avatar != empty 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 != '' and site.img_cdn -%} {% elsif site.img_cdn != empty 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 }}" alt="avatar" onerror="this.style.display='none'"> <img src="{{ avatar_url | strip }}" alt="avatar" onerror="this.style.display='none'">
{% endif %} {% endif %}
</a> </a>
</div> </div>

View File

@@ -1,26 +0,0 @@
<!--
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="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.js"></script> <script src="{{ site.data.assets[origin].bootstrap-toc.js | relative_url }}"></script>
<div id="toc-wrapper" class="pl-0 pr-4 mb-5"> <div id="toc-wrapper" class="pl-0 pr-4 mb-5">
<div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[lang].panel.toc -}}</div> <div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[lang].panel.toc -}}</div>

View File

@@ -2,8 +2,8 @@
The Top Bar The Top Bar
--> -->
<div id="topbar-wrapper" class="row justify-content-center topbar-down"> <div id="topbar-wrapper">
<div id="topbar" class="col-11 d-flex h-100 align-items-center justify-content-between"> <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">
<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.dynamic_title %} {% elsif page.collection == 'tabs' or page.layout == 'page' %}
{%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%} {%- capture tab_key -%}{{ page.url | split: '/' }}{%- endcapture -%}
{{- site.data.locales[lang].tabs[tab_key] | default: page.title -}} {{- site.data.locales[lang].tabs[tab_key] | default: page.title -}}
{% else %} {% else %}
@@ -63,7 +63,6 @@
<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

@@ -0,0 +1,36 @@
/**
* 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,12 +3,9 @@
*/ */
$(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");
@@ -33,8 +30,7 @@ $(function() {
}; };
}()); }());
/*--- Actions in mobile screens (Sidebar hidden) ---*/
/*--- Actions in small screens (Sidebar unloaded) ---*/
const mobileSearchBar = (function () { const mobileSearchBar = (function () {
return { return {
@@ -75,7 +71,6 @@ $(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
@@ -92,7 +87,6 @@ $(function() {
}()); }());
function isMobileView() { function isMobileView() {
return btnCancel.hasClass("loaded"); return btnCancel.hasClass("loaded");
} }
@@ -116,38 +110,20 @@ $(function() {
searchWrapper.removeClass("input-focus"); searchWrapper.removeClass("input-focus");
}); });
input.on("keyup", function(e) { input.on("input", () => {
if (e.keyCode === 8 && input.val() === "") { if (input.val() === "") {
if (!isMobileView()) { if (isMobileView()) {
resultSwitch.off();
} else {
hints.removeClass("unloaded"); hints.removeClass("unloaded");
} else {
resultSwitch.off();
} }
} else { } else {
if (input.val() !== "") { resultSwitch.on();
resultSwitch.on(); if (isMobileView()) {
hints.addClass("unloaded");
if (!btnClear.hasClass("visible")) {
btnClear.addClass("visible");
}
if (isMobileView()) {
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

@@ -1,70 +0,0 @@
/*
* Hide Header on scroll down
*/
$(function() {
const $topbarWrapper = $("#topbar-wrapper");
const $topbarTitle = $("#topbar-title");
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 ($topbarTitle.is(":hidden")) {
didScroll = true;
}
});
setInterval(function() {
if (didScroll) {
hasScrolled();
didScroll = false;
}
}, 250);
});

View File

@@ -0,0 +1,90 @@
/*
* 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

@@ -14,17 +14,22 @@ $(function() {
} }
const defaultTitleText = $topbarTitle.text().trim(); const defaultTitleText = $topbarTitle.text().trim();
let titleText = $pageTitle.text().trim(); let pageTitleText = $pageTitle.text().trim();
let hasScrolled = false; let hasScrolled = false;
let lastScrollTop = 0; let lastScrollTop = 0;
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(titleText)) { if (/\s/.test(pageTitleText)) {
titleText = titleText.replace(/[0-9]/g, "").trim(); pageTitleText = pageTitleText.replace(/[0-9]/g, "").trim();
} }
} }
// When the page is scrolled down and then refreshed, the topbar title needs to be initialized
if ($pageTitle.offset().top < $(window).scrollTop()) {
$topbarTitle.text(pageTitleText);
}
let options = { let options = {
rootMargin: '-48px 0px 0px 0px', // 48px equals to the topbar height (3rem) rootMargin: '-48px 0px 0px 0px', // 48px equals to the topbar height (3rem)
threshold: [0, 1] threshold: [0, 1]
@@ -43,7 +48,7 @@ $(function() {
if (isScrollDown) { if (isScrollDown) {
if (heading.intersectionRatio === 0) { if (heading.intersectionRatio === 0) {
$topbarTitle.text(titleText); $topbarTitle.text(pageTitleText);
} }
} else { } else {
if (heading.intersectionRatio === 1) { if (heading.intersectionRatio === 1) {

View File

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

View File

@@ -10,6 +10,8 @@ $(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) {
@@ -53,12 +55,12 @@ $(function() {
const ICON_DEFAULT = getIcon(btnSelector); const ICON_DEFAULT = getIcon(btnSelector);
function showTooltip(btn) { function showTooltip(btn) {
const succeedTitle = $(btn).attr('title-succeed'); const succeedTitle = $(btn).attr(ATTR_TITLE_SUCCEED);
$(btn).attr('data-original-title', succeedTitle).tooltip('show'); $(btn).attr(ATTR_TITLE_ORIGIN, succeedTitle).tooltip('show');
} }
function hideTooltip(btn) { function hideTooltip(btn) {
$(btn).tooltip('hide').removeAttr('data-original-title'); $(btn).tooltip('hide').removeAttr(ATTR_TITLE_ORIGIN);
} }
function setSuccessIcon(btn) { function setSuccessIcon(btn) {
@@ -115,14 +117,14 @@ $(function() {
// Switch tooltip title // Switch tooltip title
const defaultTitle = target.attr('data-original-title'); const defaultTitle = target.attr(ATTR_TITLE_ORIGIN);
const succeedTitle = target.attr('title-succeed'); const succeedTitle = target.attr(ATTR_TITLE_SUCCEED);
target.attr('data-original-title', succeedTitle).tooltip('show'); target.attr(ATTR_TITLE_ORIGIN, succeedTitle).tooltip('show');
lock(target); lock(target);
setTimeout(() => { setTimeout(() => {
target.attr('data-original-title', defaultTitle); target.attr(ATTR_TITLE_ORIGIN, defaultTitle);
unlock(target); unlock(target);
}, TIMEOUT); }, TIMEOUT);

View File

@@ -0,0 +1,45 @@
/**
* 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,21 +8,16 @@
*/ */
$(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
let tocScrollUpCount = 0; const ATTR_SCROLL_FOCUS = "scroll-focus";
$("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(/^\//, "")) {
return; return;
} }
@@ -36,9 +31,8 @@ $(function() {
let selector = hash.includes(":") ? hash.replace(/\:/g, "\\:") : hash; let selector = hash.includes(":") ? hash.replace(/\:/g, "\\:") : hash;
let $target = $(selector); let $target = $(selector);
let parent = $(this).parent().prop("tagName"); let isMobileViews = $topbarTitle.is(":visible");
let isAnchor = RegExp(/^H\d/).test(parent); let isPortrait = $(window).width() < $(window).height();
let isMobileViews = !$topbarTitle.is(":hidden");
if (typeof $target === "undefined") { if (typeof $target === "undefined") {
return; return;
@@ -50,26 +44,20 @@ $(function() {
history.pushState(null, null, hash); history.pushState(null, null, hash);
} }
let curOffset = isAnchor ? $(this).offset().top : $(window).scrollTop(); let curOffset = $(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
if (!isAnchor && !toFootnote) { // trigger by ToC item ScrollHelper.hideTopbar();
if (!isMobileViews) { // on desktop/tablet screens ScrollHelper.addScrollUpTask();
$topbarWrapper.removeClass("topbar-down").addClass("topbar-up");
// Send message to `${JS_ROOT}/commons/topbar-switch.js` if (isMobileViews && isPortrait) {
$topbarWrapper.attr(ATTR_TOC_SCROLLING, true); destOffset -= ScrollHelper.getTopbarHeight();
tocScrollUpCount += 1;
}
} }
if ((isAnchor || toFootnoteRef) && isMobileViews) { } else { // scroll down
destOffset -= topbarHeight; if (isMobileViews && isPortrait) {
} destOffset -= ScrollHelper.getTopbarHeight();
} else {
if (isMobileViews) {
destOffset -= topbarHeight;
} }
} }
@@ -79,18 +67,18 @@ $(function() {
$target.focus(); $target.focus();
/* clean up old scroll mark */ /* clean up old scroll mark */
if ($(`[${SCROLL_MARK}=true]`).length) { if ($(`[${ATTR_SCROLL_FOCUS}=true]`).length) {
$(`[${SCROLL_MARK}=true]`).attr(SCROLL_MARK, false); $(`[${ATTR_SCROLL_FOCUS}=true]`).attr(ATTR_SCROLL_FOCUS, 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(SCROLL_MARK, false); $(":target").attr(ATTR_SCROLL_FOCUS, false);
} }
/* set scroll mark to footnotes */ /* set scroll mark to footnotes */
if (toFootnote || toFootnoteRef) { if (toFootnote || toFootnoteRef) {
$target.attr(SCROLL_MARK, true); $target.attr(ATTR_SCROLL_FOCUS, true);
} }
if ($target.is(":focus")) { /* Checking if the target was focused */ if ($target.is(":focus")) { /* Checking if the target was focused */
@@ -100,12 +88,8 @@ $(function() {
$target.focus(); /* Set focus again */ $target.focus(); /* Set focus again */
} }
if (typeof $topbarWrapper.attr(ATTR_TOC_SCROLLING) !== "undefined") { if (ScrollHelper.hasScrollUpTask()) {
tocScrollUpCount -= 1; ScrollHelper.popScrollUpTask();
if (tocScrollUpCount <= 0) {
$topbarWrapper.attr(ATTR_TOC_SCROLLING, "false");
}
} }
}); });
}); /* click() */ }); /* click() */

View File

@@ -1,77 +0,0 @@
/*
* 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,8 +5,15 @@ layout: page
{% include lang.html %} {% include lang.html %}
<div id="archives" class="pl-xl-2"> {% 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">
{% 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 %}
@@ -18,11 +25,13 @@ layout: page
{% endif %} {% endif %}
<li> <li>
<div> <div>
{% capture this_day %}{{ post.date | date: "%d" }}{% endcapture %} {% assign ts = post.date | date: '%s' %}
{% capture _mth_df %}{{ site.data.locales[lang].date_format.post.archive_month }}{% endcapture %} <span class="date day" data-ts="{{ ts }}" data-df="DD">
{% capture this_month %}{{ post.date | date: _mth_df }}{% endcapture %} {{ post.date | date: "%d" }}
<span class="date day">{{ this_day }}</span> </span>
<span class="date month small text-muted">{% include no-zero-date.html date_str=this_month %}</span> <span class="date month small text-muted" data-ts="{{ ts }}" data-df="{{ df_dayjs_m }}">
{{ 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,10 +47,24 @@ 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 }}
{{ site.data.locales[lang].categories.category_measure }}, {% if sub_categories_size > 1 %}
{{ 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 %}
{{ top_posts_size }}
{% 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 %} {% endif %}
{{ top_posts_size }}
{{ site.data.locales[lang].categories.post_measure }}
</span> </span>
</span> </span>
@@ -83,7 +97,14 @@ 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,13 +13,11 @@ 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>
<span class="text-muted small">{{ post.date | date: post_df }}</span> {% include datetime.html date=post.date wrap='span' class='text-muted small' %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@@ -7,9 +7,11 @@ 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 %}
mode="{{ site.theme_mode }}" data-mode="{{ site.theme_mode }}"
{% endif %} {% endif %}
{% endcapture %} {% endcapture %}
@@ -17,18 +19,14 @@ layout: compress
{% include head.html %} {% include head.html %}
{% unless site.theme_mode %} <body data-spy="scroll" data-target="#toc" data-topbar-visible="true">
{% 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"> <div id="main-wrapper" class="d-flex justify-content-center">
<div id="main"> <div id="main" class="container pl-xl-4 pr-xl-4">
{{ content }} {{ content }}
@@ -50,6 +48,23 @@ 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" %} {% assign default = site.posts | where_exp: "item", "item.pin != true and item.hidden != true" %}
{% assign posts = "" | split: "" %} {% assign posts = "" | split: "" %}
@@ -23,7 +23,6 @@ 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 %}
@@ -58,15 +57,11 @@ 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 timeago.html date=post.date tooltip=true %} {% include datetime.html date=post.date %}
<!-- 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 %}
@@ -78,6 +73,7 @@ layout: page
{% endfor %} {% endfor %}
</span> </span>
{% endif %} {% endif %}
</div> </div>
{% if post.pin %} {% if post.pin %}

View File

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

View File

@@ -11,12 +11,31 @@ tail_includes:
{% include lang.html %} {% include lang.html %}
{% if page.image.src %} <h1 data-toc-skip>{{ page.title }}</h1>
{% capture bg %}
{% unless page.image.no_bg %}{{ 'bg' }}{% endunless %} <div class="post-meta text-muted">
{% endcapture %} <!-- published date -->
<img src="{{ page.image.src }}" class="preview-img {{ bg | strip }}" <span>
alt="{{ page.image.alt | default: "Preview Image" }}" {{ 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 %}
{% unless page.image.no_bg %}{{ 'bg' }}{% endunless %}
{% endcapture %}
<div class="mt-3 mb-3">
<img src="{{ page.image.path }}" class="preview-img {{ bg | strip }}"
alt="{{ page.image.alt | default: "Preview Image" }}"
{% if page.image.width %} {% if page.image.width %}
width="{{ page.image.width }}" width="{{ page.image.width }}"
@@ -29,52 +48,38 @@ tail_includes:
{% elsif page.image.h %} {% elsif page.image.h %}
height="{{ page.image.h }}" height="{{ page.image.h }}"
{% endif %}> {% endif %}>
{% endif %}
<h1 data-toc-skip>{{ page.title }}</h1> {% if page.image.alt %}
<figcaption class="pt-2 pb-2">{{ page.image.alt }}</figcaption>
{% endif %}
<div class="post-meta text-muted"> </div>
{% endif %}
<!-- author --> <div class="d-flex justify-content-between">
<div> <!-- author -->
{% capture author_name %}{{ page.author.name | default: site.social.name }}{% endcapture %} <span>
{% assign author_link = nil %} {% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %}
{% assign author_link = nil %}
{% if page.author.link %} {% if page.author %}
{% assign author_link = page.author.link %} {% assign author_link = site.data.authors[page.author].url %}
{% 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>
{% if author_link %} <em>
<a href="{{ author_link }}">{{ author_name }}</a> {% if author_link %}
{% else %} <a href="{{ author_link }}">{{ author_name }}</a>
{% else %}
{{ author_name }} {{ author_name }}
{% endif %} {% endif %}
</em> </em>
</div> </span>
<div class="d-flex">
<div> <div>
<!-- published date -->
<span>
{{ site.data.locales[lang].post.posted }}
{% include timeago.html date=page.date tooltip=true %}
</span>
<!-- 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>
@@ -84,6 +89,9 @@ 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,13 +12,11 @@ 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>
<span class="text-muted small">{{ post.date | date: post_df }}</span> {% include datetime.html date=post.date wrap='span' class='text-muted small' %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

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

View File

@@ -1,17 +1,16 @@
--- ---
title: Text and Typography title: Text and Typography
author: author: cotes
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:
src: /commons/devices-mockup.png path: /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.
@@ -76,7 +75,21 @@ Moon
## Block Quote ## Block Quote
> This line to shows the Block Quote. > This line 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
@@ -154,6 +167,10 @@ $$ 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,8 +1,6 @@
--- ---
title: Writing a New Post title: Writing a New Post
author: author: cotes
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]
@@ -13,7 +11,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` 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. 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.
## Front Matter ## Front Matter
@@ -28,11 +26,12 @@ tags: [TAG] # TAG names should always be lowercase
--- ---
``` ```
> **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. > 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_ 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`{: .filepath} 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
@@ -49,17 +48,30 @@ 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: <author_id>
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_ 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`{: .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/):
```yaml ```yaml
--- ---
@@ -69,7 +81,7 @@ toc: false
## Comments ## Comments
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. 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.
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:
@@ -131,7 +143,10 @@ 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`. For example: By default, the image is centered, but you can specify the position by using one of the classes `normal`, `left`, and `right`.
> Once the position is specified, the image caption should not be added.
{: .prompt-warning }
- **Normal position** - **Normal position**
@@ -156,8 +171,6 @@ 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:
@@ -169,7 +182,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_ 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`{: .filepath} file:
```yaml ```yaml
img_cdn: https://cdn.com img_cdn: https://cdn.com
@@ -217,15 +230,14 @@ 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 `src`, `width`, `height`, and `alt` for the 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:
```yaml ```yaml
--- ---
image: image:
src: /path/to/image/file path: /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
@@ -234,7 +246,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 `src` 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 `path` only needs the image file name.
## Pinned Posts ## Pinned Posts
@@ -246,15 +258,43 @@ pin: true
--- ---
``` ```
## Code Block ## Prompts
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:
@@ -264,22 +304,23 @@ key: value
``` ```
```` ````
> **Limitation**: The Jekyll style `highlight` tag is not compatible with this theme. > The Jekyll tag `{% highlight %}` 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 the code block, you can append `{: .nolineno}` at the next line: 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:
````markdown ````markdown
```shell ```shell
echo 'No more line numbers!' echo 'No more line numbers!'
``` ```
{: .nolineno} {: .nolineno }
```` ````
### Specifying the Filename #### Specifying the Filename
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: 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:
````markdown ````markdown
```shell ```shell
@@ -288,7 +329,7 @@ You may have noticed that the code language will be displayed on the left side o
{: 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,8 +1,6 @@
--- ---
title: Getting Started title: Getting Started
author: author: cotes
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]
@@ -11,7 +9,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`. 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.
## Installation ## Installation
@@ -36,18 +34,18 @@ And then execute:
$ bash tools/init.sh $ bash tools/init.sh
``` ```
> **Note**: If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command. > 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` - `.travis.yml`{: .filepath}
- files under `_posts` - files under `_posts`{: .filepath}
- folder `docs`
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`. 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}.
3. Removes item `Gemfile.lock` from `.gitignore`. 3. Removes item `Gemfile.lock` from `.gitignore`{: .filepath}.
4. Creates a new commit to save the changes automatically. 4. Creates a new commit to save the changes automatically.
@@ -63,7 +61,7 @@ $ bundle
### Configuration ### Configuration
Update the variables of `_config.yml` as needed. Some of them are typical options: Update the variables of `_config.yml`{: .filepath} as needed. Some of them are typical options:
- `url` - `url`
- `avatar` - `avatar`
@@ -72,9 +70,15 @@ Update the variables of `_config.yml` as needed. Some of them are typical option
### Customing Stylesheet ### Customing Stylesheet
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. 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.
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. 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.
### 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
@@ -95,23 +99,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` 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`{: .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`.
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`. 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`{: .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 file `tools/deploy.sh`. Otherwise, copy it from here to your Jekyll site. - Ensure your Jekyll site has file `tools/deploy.sh`{: .filepath}. Otherwise, copy it from here to your Jekyll site.
- 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: - 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:
```console ```console
$ bundle lock --add-platform x86_64-linux $ bundle lock --add-platform x86_64-linux
@@ -129,7 +133,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.
@@ -149,13 +153,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` 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`{: .filepath} 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`), editing the `Gemfile` 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`{: .filepath}), editing the `Gemfile`{: .filepath} 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"
@@ -171,7 +175,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` 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`{: .filepath} 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,14 +1,12 @@
--- ---
title: Customize the Favicon title: Customize the Favicon
author: author: cotes
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/`. 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/`{: .filepath}. 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
@@ -20,10 +18,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` - `browserconfig.xml`{: .filepath}
- `site.webmanifest` - `site.webmanifest`{: .filepath}
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. 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.
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:
@@ -32,6 +30,7 @@ The following table will help you understand the changes to the favicon files:
| `*.PNG` | ✓ | ✗ | | `*.PNG` | ✓ | ✗ |
| `*.ICO` | ✓ | ✗ | | `*.ICO` | ✓ | ✗ |
> Note: ✓ means keep, ✗ means delete. > ✓ 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,8 +1,6 @@
--- ---
title: Enable Google Page Views title: Enable Google Page Views
author: author: sille_bille
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]
@@ -37,7 +35,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` 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`{: .filepath} file:
```yaml ```yaml
google_analytics: google_analytics:
@@ -115,16 +113,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`](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`{: .filepath}](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`, add the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` that you gathered from your App Engine Dashboard. 3. In `src/config.py`{: .filepath}, 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` should look similar to this 4. Enter any random key for `XSRF_KEY`, your `config.py`{: .filepath} should look similar to this
```python ```python
#!/usr/bin/python2.7 #!/usr/bin/python2.7
@@ -146,9 +144,11 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
``` ```
{: file="src/config.py"} {: file="src/config.py"}
**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. > 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.
{: .prompt-info }
5. From inside the src/ directory, deploy the app 5. From inside the `src/`{: .filepath} 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` file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following: Update the `_config.yml`{: .filepath} 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,37 +1,30 @@
/* /*
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');
@mixin mode-toggle($dark-mode: false) { html {
@if $dark-mode { @media (prefers-color-scheme: light) {
@include dark-scheme; &:not([data-mode]),
} @else { &[data-mode=light] {
@include light-scheme; @include light-scheme;
} }
}
html:not([mode]), &[data-mode=dark] {
html[mode=light] { @include dark-scheme;
@include mode-toggle(); }
}
html[mode=dark] {
@include mode-toggle(true);
}
@media (prefers-color-scheme: dark) {
html:not([mode]),
html[mode=dark] {
@include mode-toggle(true);
} }
html[mode=light] { @media (prefers-color-scheme: dark) {
@include mode-toggle(); &:not([data-mode]),
} &[data-mode=dark] {
} @include dark-scheme;
}
&[data-mode=light] {
@include light-scheme;
}
}
:root {
font-size: 16px; font-size: 16px;
} }
@@ -54,7 +47,7 @@ h1 {
h2 { h2 {
@extend %heading; @extend %heading;
@extend %section; @extend %section;
@extend %anchor-relative; @extend %anchor;
font-size: 1.5rem; font-size: 1.5rem;
} }
@@ -104,6 +97,38 @@ 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 {
@@ -123,18 +148,15 @@ kbd {
} }
footer { footer {
position: absolute; @include pl-pr(1.5rem);
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;
width: 95%; padding-bottom: 1rem;
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;
@@ -160,7 +182,7 @@ footer {
} }
} }
i { // fontawesome icons i { /* fontawesome icons */
&.far, &.far,
&.fas { &.fas {
@extend %no-cursor; @extend %no-cursor;
@@ -191,7 +213,10 @@ 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 --- */
@@ -199,7 +224,6 @@ 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;
@@ -224,7 +248,7 @@ img[data-src] {
} }
#panel-wrapper { #panel-wrapper {
// the headings /* the headings */
.panel-heading { .panel-heading {
@include label(inherit); @include label(inherit);
} }
@@ -247,7 +271,7 @@ img[data-src] {
} }
} }
&.topbar-down > div { [data-topbar-visible=true] & > div {
top: 6rem; top: 6rem;
} }
} }
@@ -290,7 +314,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);
@@ -311,7 +335,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);
@@ -331,7 +355,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;
@@ -365,8 +389,8 @@ img[data-src] {
@extend %table-cell; @extend %table-cell;
} }
} }
} // tbody } /* tbody */
}// table }/* table */
} }
/* --- post --- */ /* --- post --- */
@@ -382,7 +406,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;
@@ -396,7 +420,7 @@ img[data-src] {
@extend %link-hover; @extend %link-hover;
} }
} }
} // a } /* a */
} }
@@ -413,7 +437,7 @@ img[data-src] {
margin-right: 2px; margin-right: 2px;
} }
&:hover { &:not([class]):hover {
@extend %link-hover; @extend %link-hover;
} }
} }
@@ -439,23 +463,18 @@ img[data-src] {
} }
} }
&.img-link + em { &.img-link {
display: block; @extend %img-caption;
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);
@@ -472,7 +491,7 @@ img[data-src] {
vertical-align: middle; vertical-align: middle;
} }
} // ul } /* ul */
> ol, > ol,
> ul { > ul {
@@ -480,7 +499,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;
} }
@@ -498,7 +517,7 @@ img[data-src] {
margin-left: 1rem; margin-left: 1rem;
} }
} // .post-content } /* .post-content */
.tag:hover { .tag:hover {
@extend %tag-hover; @extend %tag-hover;
@@ -570,10 +589,6 @@ 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;
} }
@@ -603,14 +618,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;
} }
@@ -658,7 +673,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;
@@ -682,7 +697,7 @@ $sidebar-display: "sidebar-display";
transform: scale(1.2); transform: scale(1.2);
} }
} }
} // #avatar } /* #avatar */
.site-title { .site-title {
a { a {
@@ -701,7 +716,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;
} }
@@ -745,7 +760,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: "";
@@ -758,7 +773,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;
@@ -783,9 +798,9 @@ $sidebar-display: "sidebar-display";
} }
} }
} // @for } /* @for */
} // ul } /* ul */
.sidebar-bottom { .sidebar-bottom {
margin-bottom: 2.1rem; margin-bottom: 2.1rem;
@@ -836,9 +851,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 {
@@ -857,6 +872,7 @@ $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 {
@@ -876,10 +892,14 @@ $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;
} }
@@ -901,7 +921,7 @@ $sidebar-display: "sidebar-display";
} }
} }
} }
} // #topbar } /* #topbar */
#sidebar-trigger, #sidebar-trigger,
#search-trigger { #search-trigger {
@@ -910,7 +930,7 @@ $sidebar-display: "sidebar-display";
#search-wrapper { #search-wrapper {
display: flex; display: flex;
width: 85%; width: 100%;
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);
@@ -921,12 +941,6 @@ $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 */
@@ -943,6 +957,7 @@ $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;
@@ -984,7 +999,7 @@ $sidebar-display: "sidebar-display";
} }
#search-results { #search-results {
padding-bottom: 6rem; padding-bottom: 3rem;
a { a {
&:hover { &:hover {
@@ -1006,7 +1021,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%;
@@ -1020,7 +1035,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;
@@ -1037,7 +1052,7 @@ $sidebar-display: "sidebar-display";
} }
#core-wrapper { #core-wrapper {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height} - #{$bottom-min-height}) !important; min-height: calc(100vh - #{$topbar-height} - #{$footer-height});
.categories, .categories,
#tags, #tags,
@@ -1070,29 +1085,13 @@ $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);
} }
#main { #core-wrapper,
.row:first-child { #panel-wrapper {
> div { margin-top: $topbar-height; /* same as the height of topbar */
&:nth-child(1),
&:nth-child(2) {
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,
@@ -1132,6 +1131,51 @@ $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:
@@ -1142,42 +1186,11 @@ $sidebar-display: "sidebar-display";
*/ */
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
$footer-height: $footer-height-mobile; // overwrite
#main > div.row:first-child > div:first-child {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height});
}
#core-wrapper {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height} - #{$bottom-min-height}) !important;
h1 {
margin-top: 2.2rem;
font-size: 1.75rem;
}
}
#avatar > a {
width: 5rem;
height: 5rem;
}
.site-subtitle {
@include ml-mr(1.8rem);
}
#main-wrapper {
padding-bottom: $footer-height;
}
footer { footer {
height: $footer-height; height: $footer-height-mobile;
> div.d-flex { > div.d-flex {
width: 100%;
padding: 1.5rem 0; padding: 1.5rem 0;
margin-bottom: 0.3rem;
flex-wrap: wrap; flex-wrap: wrap;
-ms-flex-pack: distribute !important; -ms-flex-pack: distribute !important;
justify-content: space-around !important; justify-content: space-around !important;
@@ -1189,13 +1202,60 @@ $sidebar-display: "sidebar-display";
} }
} }
#core-wrapper {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height-mobile}) !important;
h1 {
margin-top: 2.2rem;
font-size: 1.75rem;
}
.post-content {
> blockquote[class^=prompt-] {
@include ml-mr(-1.25rem);
border-radius: 0;
}
}
}
#avatar > a {
width: 5rem;
height: 5rem;
}
.site-subtitle {
@include ml-mr(1.8rem);
}
}
@media all and (max-width: 768px) {
%full-width {
max-width: 100%;
}
#topbar {
@extend %full-width;
}
#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) {
%slide { @mixin slide($append: null) {
-webkit-transition: transform 0.4s ease; $basic: transform 0.4s ease;
transition: transform 0.4s ease; @if $append {
-webkit-transition: $basic, $append;
transition: $basic, $append;
} @else {
-webkit-transition: $basic;
transition: $basic;
}
} }
html, html,
@@ -1203,15 +1263,6 @@ $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);
@@ -1221,13 +1272,12 @@ $sidebar-display: "sidebar-display";
#main-wrapper { #main-wrapper {
transform: translateX(#{$sidebar-width}); transform: translateX(#{$sidebar-width});
} }
} }
#sidebar { #sidebar {
@extend %slide; @include slide;
transform: translateX(-#{$sidebar-width}); // hide transform: translateX(-#{$sidebar-width}); /* hide */
-webkit-transform: translateX(-#{$sidebar-width}); -webkit-transform: translateX(-#{$sidebar-width});
.cursor { .cursor {
@@ -1238,11 +1288,16 @@ $sidebar-display: "sidebar-display";
} }
#main-wrapper { #main-wrapper {
@extend %slide; @include slide;
padding-top: $topbar-height; padding-top: $topbar-height;
} }
#topbar,
#main {
max-width: 100%;
}
#search-result-wrapper { #search-result-wrapper {
width: 100%; width: 100%;
} }
@@ -1253,17 +1308,13 @@ $sidebar-display: "sidebar-display";
} }
#topbar-wrapper { #topbar-wrapper {
@extend %slide; @include slide(top 0.2s ease);
left: 0; left: 0;
} }
.topbar-up { #core-wrapper,
top: 0 !important; #panel-wrapper {
}
#main > div.row:first-child > div:nth-child(1),
#main > div.row:first-child > div:nth-child(2) {
margin-top: 0; margin-top: 0;
} }
@@ -1273,21 +1324,6 @@ $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;
} }
@@ -1306,7 +1342,13 @@ $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) {
@@ -1330,17 +1372,17 @@ $sidebar-display: "sidebar-display";
margin-top: 3rem; margin-top: 3rem;
} }
#search-wrapper {
width: 22%;
min-width: 150px;
}
#search-hints { #search-hints {
display: none; display: none;
} }
#search-wrapper {
max-width: $search-max-width;
}
#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 {
@@ -1350,21 +1392,17 @@ $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: 1.2rem; right: 5%;
} }
.topbar-up { #topbar {
box-shadow: none !important; @include pl-pr(2rem);
} }
#topbar-title { #topbar-title {
text-align: left; text-align: left;
} }
footer > div.d-flex {
width: 92%;
}
} }
/* Pad horizontal */ /* Pad horizontal */
@@ -1438,10 +1476,6 @@ $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;
@@ -1452,26 +1486,12 @@ $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) {
#main > div.row > div.col-xl-8 {
-webkit-box-flex: 0;
-ms-flex: 0 0 75%;
flex: 0 0 75%;
max-width: 75%;
padding-left: 3%;
}
#topbar {
padding: 0;
max-width: 1070px;
}
#panel-wrapper {
max-width: $panel-max-width;
}
#back-to-top { #back-to-top {
bottom: 6.5rem; bottom: 6.5rem;
right: 4.3rem; }
#search-wrapper {
margin-right: 4rem;
} }
#search-input { #search-input {
@@ -1507,66 +1527,36 @@ $sidebar-display: "sidebar-display";
} }
@media all and (min-width: 1400px) { @media all and (min-width: 1400px) {
#main > div.row { #back-to-top {
padding-left: calc((100% - #{$main-content-max-width}) / 2); right: calc((100vw - #{$sidebar-width} - 1140px) / 2 + 3rem);
> 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 { #search-wrapper {
max-width: #{$main-content-max-width}; margin-right: calc(#{$main-content-max-width} * 0.25 - #{$search-max-width});
} }
#search-wrapper { #topbar,
margin-right: 3%; #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 {
@@ -1613,7 +1603,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;
@@ -1660,7 +1650,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 {
@@ -1683,62 +1673,8 @@ $sidebar-display: "sidebar-display";
top: 0.9rem; top: 0.9rem;
} }
} // .sidebar-bottom } /* .sidebar-bottom */
} // #sidebar } /* #sidebar */
footer > div.d-flex { } /* min-width: 1650px */
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,19 +13,21 @@
%section { %section {
#core-wrapper & { #core-wrapper & {
margin-top: 2.5rem; margin-top: 2.5rem;
margin-bottom: 2rem; margin-bottom: 1.25rem;
&:focus {
outline: none; /* avoid outline in Safari */
}
} }
} }
%anchor { %anchor {
.anchor { .anchor {
font-size: 1rem; font-size: 80%;
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;
@@ -41,15 +43,6 @@
} }
} }
%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;
@@ -95,10 +88,15 @@
font-style: normal; font-style: normal;
} }
/* ---------- scss mixin --------- */ %img-caption {
+ em {
@mixin no-text-decoration { display: block;
text-decoration: none; text-align: center;
font-style: normal;
font-size: 80%;
padding: 0;
color: #6d6c6c;
}
} }
%sidebar-links { %sidebar-links {
@@ -106,6 +104,12 @@
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;
@@ -133,3 +137,15 @@
-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,23 +5,27 @@
@import "colors/light-syntax"; @import "colors/light-syntax";
@import "colors/dark-syntax"; @import "colors/dark-syntax";
html:not([mode]), html {
html[mode=light] { @media (prefers-color-scheme: light) {
@include light-syntax; &:not([data-mode]),
} &[data-mode=light] {
@include light-syntax;
}
html[mode=dark] { &[data-mode=dark] {
@include dark-syntax; @include dark-syntax;
} }
@media (prefers-color-scheme: dark) {
html:not([mode]),
html[mode=dark] {
@include dark-syntax;
} }
html[mode=light] { @media (prefers-color-scheme: dark) {
@include light-syntax; &:not([data-mode]),
&[data-mode=dark] {
@include dark-syntax;
}
&[data-mode=light] {
@include light-syntax;
}
} }
} }
@@ -95,7 +99,7 @@ $code-radius: 6px;
user-select: none; user-select: none;
} }
} //.highlight } /* .highlight */
code { code {
-webkit-hyphens: none; -webkit-hyphens: none;
@@ -110,8 +114,15 @@ 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;
} }
@@ -119,7 +130,7 @@ code {
border-bottom: none; border-bottom: none;
} }
blockquote &.highlighter-rouge { blockquote & {
color: inherit; color: inherit;
} }
@@ -131,8 +142,10 @@ code {
td.rouge-code { td.rouge-code {
@extend %code-snippet-padding; @extend %code-snippet-padding;
// Prevent some browser extends from /*
// changing the URL string of code block. Prevent some browser extends from
changing the URL string of code block.
*/
a { a {
color: inherit !important; color: inherit !important;
border-bottom: none !important; border-bottom: none !important;
@@ -186,9 +199,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;
@@ -201,19 +214,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(label-text); content: attr(data-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: 1150px !default; $main-content-max-width: 1250px !default;
$panel-max-width: 300px !default;
$bottom-min-height: 35rem !default; $bottom-min-height: 35rem !default;

View File

@@ -78,6 +78,7 @@
--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,6 +69,15 @@
--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);
@@ -145,4 +154,4 @@
color-scheme: none; color-scheme: none;
} }
} // dark-scheme } /* dark-scheme */

View File

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

View File

@@ -68,6 +68,19 @@
--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);
@@ -78,4 +91,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.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy) * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy)
* © 2019 Cotes Chung * © 2019 Cotes Chung
* MIT Licensed * MIT Licensed
*/ */

View File

@@ -41,8 +41,7 @@ h1 + .post-meta {
} }
img.preview-img { img.preview-img {
margin-top: 3.75rem; margin: 0;
margin-bottom: 0;
border-radius: 6px; border-radius: 6px;
&.bg[data-loaded=true] { &.bg[data-loaded=true] {
@@ -55,7 +54,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 { .post-meta a:not(:hover) {
@extend %link-underline; @extend %link-underline;
} }
} }
@@ -173,6 +172,8 @@ nav[data-toggle=toc] {
em { em {
@extend %normal-font-style; @extend %normal-font-style;
color: var(--relate-post-date);
} }
.card { .card {
@@ -194,10 +195,6 @@ 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.
> **Note**: Add Markdown syntax content to file `_tabs/about.md` and it will show up on this page. {: .prompt-tip }

View File

@@ -7,27 +7,10 @@ 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,17 +1,18 @@
--- ---
layout: compress layout: compress
swcache: true
--- ---
[ [
{% for post in site.posts %} {% for post in site.posts %}
{ {
"title": "{{ post.title | escape }}", "title": {{ post.title | jsonify }},
"url": "{{ post.url | relative_url }}", "url": {{ post.url | relative_url | jsonify }},
"categories": "{{ post.categories | join: ', '}}", "categories": {{ post.categories | join: ', ' | jsonify }},
"tags": "{{ post.tags | join: ', ' }}", "tags": {{ post.tags | join: ', ' | jsonify }},
"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 | remove_chars | escape | replace: '\', '\\\\' }}" "snippet": {{ content | strip_html | strip_newlines | jsonify }}
}{% unless forloop.last %},{% endunless %} }{% unless forloop.last %},{% endunless %}
{% endfor %} {% endfor %}
] ]

View File

@@ -9,13 +9,7 @@ const resource = [
/* --- CSS --- */ /* --- CSS --- */
'{{ "/assets/css/style.css" | relative_url }}', '{{ "/assets/css/style.css" | relative_url }}',
/* --- JavaScripts --- */ /* --- PWA --- */
{% 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 }}',
@@ -26,30 +20,27 @@ const resource = [
'{{ tab.url | relative_url }}', '{{ tab.url | relative_url }}',
{% endfor %} {% endfor %}
/* --- Favicons --- */ /* --- Favicons & compressed JS --- */
{% assign favicon_path = "/assets/img/favicons" | relative_url %} {% assign cache_list = site.static_files | where: 'swcache', true %}
{% for file in cache_list %}
'{{ favicon_path }}/android-chrome-192x192.png', '{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%}
'{{ favicon_path }}/android-chrome-512x512.png', {% endfor %}
'{{ 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 != '' %} {% if site.google_analytics.id != empty and 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.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.2.0 (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 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"),o=$("#topbar-title"),s=$("#panel-wrapper"),a=$("#search-input"),l="topbar-up",r="topbar-down",n="toc-scrolling-up";let d,i=0;const c=t.outerHeight(),u=t.outerHeight();$(window).scroll(function(e){o.is(":hidden")&&(d=!0)}),setInterval(function(){d&&(function(){var e,o=$(this).scrollTop();Math.abs(i-o)<=c||(o>i?o>u&&(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))),i=o)}(),d=!1)},250)}),$(function(){var o="div.post>h1:first-of-type";const t=$(o),r=$("#topbar-title");if(0!==t.length&&!t.hasClass("dynamic-title")&&!r.is(":hidden")){const n=r.text().trim();let s=t.text().trim(),a=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(s)&&(s=s.replace(/[0-9]/g,"").trim());let e=new IntersectionObserver(e=>{var o,t;a?(o=$(window).scrollTop(),t=l<o,l=o,e=e[0],t?0===e.intersectionRatio&&r.text(s):1===e.intersectionRatio&&r.text(n)):a=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});e.observe(document.querySelector(o)),r.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"))})}); $(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"))})});

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v5.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.2.0 (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 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"),n=$("#search-wrapper"),r=$("#search-result-wrapper"),i=$("#search-results"),d=$("#search-input"),c=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),p={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),r.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(i.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),s.removeClass("visible"),a.removeClass("unloaded"),u.release(),d.val(""),e=!1)},isVisible(){return e}}}();function m(){return t.hasClass("loaded")}o.click(function(){p.on(),f.on(),d.focus()}),t.click(function(){p.off(),f.off()}),d.focus(function(){n.addClass("input-focus")}),d.focusout(function(){n.removeClass("input-focus")}),d.on("keyup",function(e){8===e.keyCode&&""===d.val()?m()?c.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),s.hasClass("visible")||s.addClass("visible"),m()&&c.addClass("unloaded"))}),s.on("click",function(){d.val(""),m()?(c.removeClass("unloaded"),i.empty()):f.off(),d.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"),o=$("#topbar-title"),s=$("#panel-wrapper"),a=$("#search-input"),l="topbar-up",n="topbar-down",r="toc-scrolling-up";let i,d=0;const c=t.outerHeight(),u=t.outerHeight();$(window).scroll(function(e){o.is(":hidden")&&(i=!0)}),setInterval(function(){i&&(function(){var e,o=$(this).scrollTop();Math.abs(d-o)<=c||(o>d?o>u&&(t.removeClass(n).addClass(l),s.removeClass(n),a.is(":focus")&&a.blur()):o+$(window).height()<$(document).height()&&(void 0!==(e=t.attr(r))?"false"===e&&t.removeAttr(r):(t.removeClass(l).addClass(n),s.addClass(n))),d=o)}(),i=!1)},250)}),$(function(){var o="div.post>h1:first-of-type";const t=$(o),n=$("#topbar-title");if(0!==t.length&&!t.hasClass("dynamic-title")&&!n.is(":hidden")){const r=n.text().trim();let s=t.text().trim(),a=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(s)&&(s=s.replace(/[0-9]/g,"").trim());let e=new IntersectionObserver(e=>{var o,t;a?(o=$(window).scrollTop(),t=l<o,l=o,e=e[0],t?0===e.intersectionRatio&&n.text(s):1===e.intersectionRatio&&n.text(r)):a=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});e.observe(document.querySelector(o)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}}); $(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$(".mode-toggle").click(o=>{const e=$(o.target);let t=e.prop("tagName")==="button".toUpperCase()?e:e.parent();t.blur(),flipMode()})});const ScrollHelper=function(){const o=$("body"),e="data-topbar-visible",t=$("#topbar-wrapper").outerHeight();let l=0,r=!1,a=!1;return{hideTopbar:()=>o.attr(e,!1),showTopbar:()=>o.attr(e,!0),addScrollUpTask:()=>{l+=1,r=r||!0},popScrollUpTask:()=>--l,hasScrollUpTask:()=>0<l,topbarLocked:()=>!0===r,unlockTopbar:()=>r=!1,getTopbarHeight:()=>t,orientationLocked:()=>!0===a,lockOrientation:()=>a=!0,unLockOrientation:()=>a=!1}}();$(function(){const o=$("#sidebar-trigger"),e=$("#search-trigger"),t=$("#search-cancel"),l=$("#main"),r=$("#topbar-title"),a=$("#search-wrapper"),n=$("#search-result-wrapper"),s=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),d=function(){let o=0;return{block(){o=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(o)},getOffset(){return o}}}(),p={on(){o.addClass("unloaded"),r.addClass("unloaded"),e.addClass("unloaded"),a.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),a.removeClass("d-flex"),o.removeClass("unloaded"),r.removeClass("unloaded"),e.removeClass("unloaded")}},u=function(){let o=!1;return{on(){o||(d.block(),n.removeClass("unloaded"),l.addClass("unloaded"),o=!0)},off(){o&&(s.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),n.addClass("unloaded"),l.removeClass("unloaded"),d.release(),i.val(""),o=!1)},isVisible(){return o}}}();function f(){return t.hasClass("loaded")}e.click(function(){p.on(),u.on(),i.focus()}),t.click(function(){p.off(),u.off()}),i.focus(function(){a.addClass("input-focus")}),i.focusout(function(){a.removeClass("input-focus")}),i.on("input",()=>{""===i.val()?f()?c.removeClass("unloaded"):u.off():(u.on(),f()&&c.addClass("unloaded"))})}),$(function(){var o=function(){const o="sidebar-display";let e=!1;const t=$("body");return{toggle(){!1===e?t.attr(o,""):t.removeAttr(o),e=!e}}}();$("#sidebar-trigger").click(o.toggle),$("#mask").click(o.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#search-input"),t=ScrollHelper.getTopbarHeight();let o,l=0;function r(){0!==$(window).scrollTop()&&(ScrollHelper.lockOrientation(),ScrollHelper.hideTopbar())}screen.orientation?screen.orientation.onchange=()=>{var o=screen.orientation.type;"landscape-primary"!==o&&"landscape-secondary"!==o||r()}:$(window).on("orientationchange",()=>{$(window).width()<$(window).height()&&r()}),$(window).scroll(()=>{o=o||!0}),setInterval(()=>{o&&(!function(){var o=$(this).scrollTop();if(!(Math.abs(l-o)<=t)){if(o>l)ScrollHelper.hideTopbar(),e.is(":focus")&&e.blur();else if(o+$(window).height()<$(document).height()){if(ScrollHelper.hasScrollUpTask())return;ScrollHelper.topbarLocked()?ScrollHelper.unlockTopbar():ScrollHelper.orientationLocked()?ScrollHelper.unLockOrientation():ScrollHelper.showTopbar()}l=o}}(),o=!1)},250)}),$(function(){var e="div.post>h1:first-of-type";const t=$(e),n=$("#topbar-title");if(0!==t.length&&!t.hasClass("dynamic-title")&&!n.is(":hidden")){const s=n.text().trim();let l=t.text().trim(),r=!1,a=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(l)&&(l=l.replace(/[0-9]/g,"").trim()),t.offset().top<$(window).scrollTop()&&n.text(l);let o=new IntersectionObserver(o=>{var e,t;r?(t=$(window).scrollTop(),e=a<t,a=t,t=o[0],e?0===t.intersectionRatio&&n.text(l):1===t.intersectionRatio&&n.text(s)):r=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});o.observe(document.querySelector(e)),n.click(function(){$("body,html").animate({scrollTop:0},800)})}});

View File

@@ -1,6 +1,6 @@
/*! /*!
* Chirpy v5.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.2.0 (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(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 m(){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()?m()?c.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),m()&&c.addClass("unloaded"))}),a.on("click",function(){d.val(""),m()?(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"),e=$("#topbar-title"),a=$("#panel-wrapper"),s=$("#search-input"),l="topbar-up",n="topbar-down",r="toc-scrolling-up";let i,d=0;const c=o.outerHeight(),u=o.outerHeight();$(window).scroll(function(t){e.is(":hidden")&&(i=!0)}),setInterval(function(){i&&(function(){var t,e=$(this).scrollTop();Math.abs(d-e)<=c||(e>d?e>u&&(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))),d=e)}(),i=!1)},250)}),$(function(){var e="div.post>h1:first-of-type";const o=$(e),n=$("#topbar-title");if(0!==o.length&&!o.hasClass("dynamic-title")&&!n.is(":hidden")){const r=n.text().trim();let a=o.text().trim(),s=!1,l=0;($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim());let t=new IntersectionObserver(t=>{var e,o;s?(e=$(window).scrollTop(),o=l<e,l=e,t=t[0],o?0===t.intersectionRatio&&n.text(a):1===t.intersectionRatio&&n.text(r)):s=!0},{rootMargin:"-48px 0px 0px 0px",threshold:[0,1]});t.observe(document.querySelector(e)),n.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))}); $(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))})});

6
assets/js/dist/misc.min.js vendored Normal file
View File

@@ -0,0 +1,6 @@
/*!
* Chirpy v5.2.0 (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.0.2 (https://github.com/cotes2020/jekyll-theme-chirpy/) * Chirpy v5.2.0 (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())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())}); 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())});

View File

@@ -3,7 +3,58 @@ layout: compress
permalink: '/app.js' permalink: '/app.js'
--- ---
/* Registering Service Worker */ const keyWaiting = 'sw-waiting';
if('serviceWorker' in navigator) { const $notification = $('#notification');
navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}'); const $btnRefresh = $('#notification .toast-body>button');
};
function skipWating(registration) {
registration.waiting.postMessage('SKIP_WAITING');
localStorage.removeItem(keyWaiting);
}
if ('serviceWorker' in navigator) {
/* Registering Service Worker */
navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}')
.then(registration => {
if (registration) {
registration.addEventListener('updatefound', () => {
let serviceWorker = registration.installing;
serviceWorker.addEventListener('statechange', () => {
if (serviceWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
$notification.toast('show');
/* in case the user ignores the notification */
localStorage.setItem(keyWaiting, true);
}
}
});
});
$btnRefresh.click(() => {
skipWating(registration);
$notification.toast('hide');
});
if (localStorage.getItem(keyWaiting)) {
if (registration.waiting) {
/* there's a new Service Worker waiting to be activated */
$notification.toast('show');
} else {
/* closed all open pages after receiving notification */
localStorage.removeItem(keyWaiting);
}
}
}
});
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" }}'; const cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M%S" }}';
function verifyDomain(url) { function verifyDomain(url) {
for (const domain of allowedDomains) { for (const domain of allowedDomains) {
@@ -28,60 +28,62 @@ function isExcluded(url) {
return false; return false;
} }
self.addEventListener('install', e => { self.addEventListener('install', event => {
self.skipWaiting(); event.waitUntil(
e.waitUntil(
caches.open(cacheName).then(cache => { caches.open(cacheName).then(cache => {
return cache.addAll(resource); return cache.addAll(resource);
}) })
); );
}); });
self.addEventListener('fetch', event => { self.addEventListener('activate', event => {
event.respondWith( event.waitUntil(
caches.match(event.request)
.then(response => {
if (response) {
return response;
}
return fetch(event.request)
.then(response => {
const url = event.request.url;
if (event.request.method !== 'GET' ||
!verifyDomain(url) ||
isExcluded(url)) {
return response;
}
/*
see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests>
*/
let responseToCache = response.clone();
caches.open(cacheName)
.then(cache => {
/* console.log('[sw] Caching new resource: ' + event.request.url); */
cache.put(event.request, responseToCache);
});
return response;
});
})
);
});
self.addEventListener('activate', e => {
e.waitUntil(
caches.keys().then(keyList => { caches.keys().then(keyList => {
return Promise.all( return Promise.all(
keyList.map(key => { keyList.map(key => {
if(key !== cacheName) { if (key !== cacheName) {
return caches.delete(key); return caches.delete(key);
} }
}) })
); );
})
);
});
self.addEventListener('message', (event) => {
if (event.data === 'SKIP_WAITING') {
self.skipWaiting();
}
});
self.addEventListener('fetch', event => {
event.respondWith(
caches.match(event.request).then(response => {
if (response) {
return response;
}
return fetch(event.request).then(response => {
const url = event.request.url;
if (event.request.method !== 'GET' ||
!verifyDomain(url) ||
isExcluded(url)) {
return response;
}
/*
see: <https://developers.google.com/web/fundamentals/primers/service-workers#cache_and_return_requests>
*/
let responseToCache = response.clone();
caches.open(cacheName).then(cache => {
/* console.log('[sw] Caching new resource: ' + event.request.url); */
cache.put(event.request, responseToCache);
});
return response;
});
}) })
); );
}); });

View File

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

1
assets/lib Submodule

Submodule assets/lib added at 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/timeago.js` `${JS_SRC}/utils/locale-datetime.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/timeago.js`, `${JS_SRC}/utils/locale-datetime.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
@@ -72,12 +72,21 @@ const pageJs = () => {
); );
}; };
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(commonsJs, homeJs, postJs, categoriesJs, pageJs, pvreportJs); const buildJs = parallel(
commonsJs, homeJs, postJs, categoriesJs, pageJs, miscJs, pvreportJs);
exports.build = series(buildJs, minifyJs); exports.build = series(buildJs, minifyJs);
@@ -86,8 +95,7 @@ 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