mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-18 13:44:15 +00:00
Compare commits
116 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
387f0ec64a | ||
|
|
c45f399e65 | ||
|
|
8225174cb5 | ||
|
|
8b4f99c87f | ||
|
|
6f97636fb9 | ||
|
|
bf199d779c | ||
|
|
6fec411c18 | ||
|
|
61d9c2247c | ||
|
|
0d9cec6abc | ||
|
|
6e6b6479f5 | ||
|
|
388efb1ae3 | ||
|
|
471e8c4018 | ||
|
|
3cd81e7128 | ||
|
|
b85f6330de | ||
|
|
111b82838d | ||
|
|
e8e4901e34 | ||
|
|
d96b8811a7 | ||
|
|
820ba62e9e | ||
|
|
3c7934abf0 | ||
|
|
02b7bd5095 | ||
|
|
474b4ba681 | ||
|
|
016399a6db | ||
|
|
60229ae334 | ||
|
|
b69d3d7edd | ||
|
|
002f02533d | ||
|
|
968c13ec7d | ||
|
|
4681df7151 | ||
|
|
7e6c667e7a | ||
|
|
09121c1d11 | ||
|
|
fe82cea576 | ||
|
|
1e5c025a1c | ||
|
|
712a9b2240 | ||
|
|
d921b981f7 | ||
|
|
b1453ccb0c | ||
|
|
f517b33960 | ||
|
|
4490ce4107 | ||
|
|
d0cf2a8dd5 | ||
|
|
5c6ec9d06b | ||
|
|
c3a840076e | ||
|
|
a2d01365de | ||
|
|
ecff5630a6 | ||
|
|
909d136b37 | ||
|
|
27f4bf07bc | ||
|
|
5cbaf24bcb | ||
|
|
af8986bf50 | ||
|
|
7a601715df | ||
|
|
3b89bf1df2 | ||
|
|
5df953f6c8 | ||
|
|
2b59326fa8 | ||
|
|
5021678250 | ||
|
|
8bc9d25434 | ||
|
|
0c9558de8a | ||
|
|
54ba8befbe | ||
|
|
4b6722124d | ||
|
|
babb4a0c5a | ||
|
|
511df11546 | ||
|
|
dd339aea2b | ||
|
|
269506b647 | ||
|
|
765af53b77 | ||
|
|
41ed331456 | ||
|
|
9a011e14d6 | ||
|
|
5f628767e0 | ||
|
|
808d3743e5 | ||
|
|
e8d20bf7b0 | ||
|
|
d6d03183ea | ||
|
|
bd374dd383 | ||
|
|
f2d285844e | ||
|
|
98d48f5da4 | ||
|
|
7754a71ff9 | ||
|
|
5ea3d0f496 | ||
|
|
7887b5ab62 | ||
|
|
937b22316a | ||
|
|
8440d42984 | ||
|
|
6fa1777eb0 | ||
|
|
5a191e79af | ||
|
|
72700be7dd | ||
|
|
d7bcb40cde | ||
|
|
09e4ad245b | ||
|
|
09f9305d4c | ||
|
|
7a3d743419 | ||
|
|
d2190c726f | ||
|
|
8e73a91d25 | ||
|
|
8f2b42b1b3 | ||
|
|
e01eb8af14 | ||
|
|
9306c7b39e | ||
|
|
ed6dc539ef | ||
|
|
8de1abda6b | ||
|
|
4b6ccbcbcc | ||
|
|
ab16fdc7fc | ||
|
|
bffaf6374f | ||
|
|
ca41c7ebff | ||
|
|
7651d2851b | ||
|
|
5561cd86b5 | ||
|
|
7fb0ee0bed | ||
|
|
7efd2f8aa2 | ||
|
|
ec98f07aca | ||
|
|
e7426ec67e | ||
|
|
5fc428353c | ||
|
|
9de95bf089 | ||
|
|
fa9879b5f1 | ||
|
|
7fd15a285f | ||
|
|
8734d1c1a3 | ||
|
|
5b5a3865ac | ||
|
|
fe2a3cdf51 | ||
|
|
4e7bf00ee9 | ||
|
|
773d3b1263 | ||
|
|
b0d5956f5a | ||
|
|
e50343b06b | ||
|
|
b3de722778 | ||
|
|
782a930fdf | ||
|
|
da7d7e25b6 | ||
|
|
f6e9a3fccf | ||
|
|
ae2669fedc | ||
|
|
48f14e39ac | ||
|
|
6774e0e1fb | ||
|
|
8134209aa2 |
5
.browserslistrc
Normal file
5
.browserslistrc
Normal file
@@ -0,0 +1,5 @@
|
||||
# https://github.com/browserslist/browserslist#browserslistrc
|
||||
|
||||
last 2 versions
|
||||
> 0.2%
|
||||
not dead
|
||||
@@ -9,6 +9,11 @@ trim_trailing_whitespace = true
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{js,css,scss}]
|
||||
quote_type = single
|
||||
|
||||
[*.js]
|
||||
indent_size = 4
|
||||
[*.{yml,yaml}]
|
||||
quote_type = double
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
65
.github/CONTRIBUTING.md
vendored
65
.github/CONTRIBUTING.md
vendored
@@ -1,66 +1,55 @@
|
||||
# How to Contribute
|
||||
|
||||
We'd like to thank you for sparing time to improve this project! Here are some guidelines for contributing:
|
||||
:tada: We really appreciate you taking the time to improve this project! :tada:
|
||||
|
||||
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 confusing, 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][pr-issue] issue to discuss whether your idea fits the project.
|
||||
|
||||
## Basic Process
|
||||
|
||||
Generally, contribute to the project by:
|
||||
Basically, you can follow these steps to complete the contribution.
|
||||
|
||||
1. Fork this project on GitHub and clone it locally.
|
||||
2. Create a new branch from the default branch and give it a descriptive name (format: `feature/<add-new-feat>` / `fix/<fix-a-bug>`).
|
||||
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.
|
||||
2. Create a new branch from the default branch and give it a descriptive name
|
||||
(format: `feature/<add-new-feat>` or `fix/<fix-a-bug>`).
|
||||
3. After completing development, create a [Conventional Commit][cc] with git.
|
||||
(See also: ["Verify the commits"](#verify-the-commits))
|
||||
4. Create a [Pull Request][gh-pr].
|
||||
|
||||
## Modifying JavaScript
|
||||
## Make sure you can pass the CI tests
|
||||
|
||||
If your contribution involves JavaScript modification, please read the following sections.
|
||||
|
||||
### Inline Scripts
|
||||
|
||||
If you need to add comments to the inline JavaScript (the code between the HTML tags `<script>` and `</script>`), please use `/* */` instead of two slashes `//`. Because the HTML will be compressed by [jekyll-compress-html](https://github.com/penibelst/jekyll-compress-html) during deployment, but it cannot handle the `//` properly, which will disrupt the structure of the compressed HTML.
|
||||
|
||||
### External Scripts
|
||||
|
||||
If you need to add/change/delete the JavaScript in the directory `_javascript/`, setting up [`Node.js`](https://nodejs.org/) and [`npx`](https://www.npmjs.com/package/npx) is a requirement. And then install the development dependencies:
|
||||
This project has [CI][ci] turned on. In order for your [PR][gh-pr] to pass the test,
|
||||
please read the following.
|
||||
|
||||
### Check the core functionality
|
||||
|
||||
```console
|
||||
$ npm i
|
||||
bash ./tools/test
|
||||
```
|
||||
|
||||
During JavaScript development, real-time debugging can be performed through the following commands:
|
||||
|
||||
Firstly, start a Jekyll server:
|
||||
### Check the SASS syntax style
|
||||
|
||||
```console
|
||||
$ bash tools/run.sh
|
||||
npm test
|
||||
```
|
||||
|
||||
And then open a new terminal tab and run:
|
||||
### Verify the commits
|
||||
|
||||
```console
|
||||
# Type 'Ctrl + C' to stop
|
||||
$ npx gulp dev
|
||||
```
|
||||
|
||||
After debugging, run the command `npx gulp` (without any argument) will automatically output the compressed files to the directory `assets/js/dist/`.
|
||||
|
||||
## Verify the commit messages
|
||||
|
||||
If you want to make sure your commits pass the CI check, you can refer to the following steps.
|
||||
Before you create a git commit, please complete the following setup.
|
||||
|
||||
Install `commitlint` & `husky`:
|
||||
|
||||
```console
|
||||
$ npm i -g @commitlint/{cli,config-conventional} husky
|
||||
npm i -g @commitlint/{cli,config-conventional} husky
|
||||
```
|
||||
|
||||
And then enable `husky`:
|
||||
|
||||
```console
|
||||
$ husky install
|
||||
husky install
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
:tada: Your volunteering will make the open-source world more beautiful, thanks again! :tada:
|
||||
[pr-issue]: https://github.com/cotes2020/jekyll-theme-chirpy/issues/new?labels=enhancement&template=feature_request.md
|
||||
[gh-pr]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests
|
||||
[cc]: https://www.conventionalcommits.org/
|
||||
[ci]: https://en.wikipedia.org/wiki/Continuous_integration
|
||||
|
||||
33
.github/ISSUE_TEMPLATE/bug_report.md
vendored
33
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -3,21 +3,20 @@ name: Bug Report
|
||||
about: Create a report to help us improve
|
||||
---
|
||||
|
||||
<!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) -->
|
||||
**NOTE:** Before you start, the following should be completed.
|
||||
|
||||
## Checklist
|
||||
- Read [tutorial][tutorial] to understand the usage and the correct effect of functional design.
|
||||
- Make sure no [similar issue(including closed ones)][issues] exists.
|
||||
- Make sure the bug is found in the latest code of the `master` branch.
|
||||
|
||||
<!-- Please complete the following list of tasks, and then check it by changing the "[ ]" to "[x]" -->
|
||||
|
||||
- [ ] I have read the [tutorials](https://cotes2020.github.io/chirpy-demo/categories/tutorial/) and know the correct effect of the functional design.
|
||||
- [ ] There are no similar reports on [existing issues](https://github.com/cotes2020/jekyll-theme-chirpy/issues?q=is%3Aissue) (including closed ones).
|
||||
- [ ] I found the bug on the latest code of the `master` branch.
|
||||
[tutorial]: https://cotes2020.github.io/chirpy-demo/categories/tutorial/
|
||||
[issues]: https://github.com/cotes2020/jekyll-theme-chirpy/issues?q=is%3Aissue
|
||||
|
||||
## Describe the bug
|
||||
|
||||
<!-- A clear and concise description of what the bug is. -->
|
||||
|
||||
### To Reproduce
|
||||
## To Reproduce
|
||||
|
||||
Steps to reproduce the behavior:
|
||||
<!--
|
||||
@@ -27,15 +26,15 @@ Steps to reproduce the behavior:
|
||||
4. See error
|
||||
-->
|
||||
|
||||
### Expected behavior
|
||||
## Expected behavior
|
||||
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
### Screenshots
|
||||
## Logs/Screenshots
|
||||
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
<!-- If applicable, add logs/screenshots to help explain your problem. -->
|
||||
|
||||
### Environment
|
||||
## Environment
|
||||
|
||||
| Command | Version |
|
||||
|-----------------------------------|---------|
|
||||
@@ -45,21 +44,25 @@ Steps to reproduce the behavior:
|
||||
| `bundle exec jekyll -v` | |
|
||||
| `bundle info jekyll-theme-chirpy` | |
|
||||
|
||||
<!-- If necessary, uncomment and fill in the following list:
|
||||
|
||||
### Desktop
|
||||
|
||||
<!-- If necessary, uncomment and fill in the following list:
|
||||
- OS: [e.g. macOS 10.15.6]
|
||||
- Browser: [e.g. Chrome 85.0.4183.83 (64-bit)]
|
||||
|
||||
-->
|
||||
|
||||
<!-- If necessary, uncomment and fill in the following list:
|
||||
|
||||
### Smartphone
|
||||
|
||||
<!-- If necessary, uncomment and fill in the following list:
|
||||
- Device: [e.g. iPhone 6]
|
||||
- OS: [e.g. iOS 13.6.1]
|
||||
- Browser: [e.g. Chrome 22]
|
||||
|
||||
-->
|
||||
|
||||
### Additional context
|
||||
## Additional context
|
||||
|
||||
<!-- Add any other context about the problem here. -->
|
||||
|
||||
14
.github/ISSUE_TEMPLATE/feature_request.md
vendored
14
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -4,16 +4,14 @@ about: Suggest an idea for this project
|
||||
labels: enhancement
|
||||
---
|
||||
|
||||
<!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) -->
|
||||
**NOTE:** Before you start, the following should be completed.
|
||||
|
||||
## Checklist
|
||||
|
||||
<!-- Please complete the following list of tasks, and then check it by changing the "[ ]" to "[x]" -->
|
||||
- [ ] I have read the [contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/CONTRIBUTING.md).
|
||||
- [ ] There is no similar request on [existing issues](https://github.com/cotes2020/jekyll-theme-chirpy/issues?q=is%3Aissue) (including closed ones).
|
||||
- [ ] I have read the [project progress](https://github.com/cotes2020/jekyll-theme-chirpy/projects) and know the current progress of the project.
|
||||
- [ ] I was in the `master` branch of the latest code.
|
||||
- Read [tutorial][tutorial] to understand the usage and the correct effect of functional design.
|
||||
- Make sure no [similar issue(including closed ones)][issues] exists.
|
||||
- Make sure the request is based on the latest code in the `master` branch.
|
||||
|
||||
[tutorial]: https://cotes2020.github.io/chirpy-demo/categories/tutorial/
|
||||
[issues]: https://github.com/cotes2020/jekyll-theme-chirpy/issues?q=is%3Aissue
|
||||
|
||||
## Is your feature request related to a problem? Please describe
|
||||
|
||||
|
||||
28
.github/ISSUE_TEMPLATE/help_wanted.md
vendored
Normal file
28
.github/ISSUE_TEMPLATE/help_wanted.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
name: Help Wanted
|
||||
about: Need help that is not covered in the tutorial
|
||||
labels: 'help wanted'
|
||||
---
|
||||
|
||||
**NOTE:** Before you start, the following should be completed.
|
||||
|
||||
- Read [tutorial][tutorial] to understand the usage and the correct effect of functional design.
|
||||
- Make sure no [similar issue(including closed ones)][issues] exists.
|
||||
- Try to find the answer on [Jekyll Forum][forum] and [StackOverflow][stack_overflow].
|
||||
|
||||
[tutorial]: https://cotes2020.github.io/chirpy-demo/categories/tutorial/
|
||||
[issues]: https://github.com/cotes2020/jekyll-theme-chirpy/issues?q=is%3Aissue
|
||||
[forum]: https://talk.jekyllrb.com/
|
||||
[stack_overflow]: https://stackoverflow.com/questions/tagged/jekyll
|
||||
|
||||
## Description
|
||||
|
||||
<!-- Please describe your need in detail. -->
|
||||
|
||||
## Operations you have already tried
|
||||
|
||||
<!-- Describe the effort you went through. -->
|
||||
|
||||
## Logs/Screenshots
|
||||
|
||||
<!-- If applicable, add logs/screenshots to help explain your problem. -->
|
||||
18
.github/ISSUE_TEMPLATE/question.md
vendored
18
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -1,19 +1,19 @@
|
||||
---
|
||||
name: Question
|
||||
about: Ask whatever you want
|
||||
about: Issues that differ from other templates
|
||||
labels: question
|
||||
---
|
||||
|
||||
<!-- NOTE: Please maintain all sections, otherwise the issue will be automatically closed :) -->
|
||||
**NOTE:** Before you start, the following should be completed.
|
||||
|
||||
## Checklist
|
||||
- Read [tutorial][tutorial] to understand the usage and the correct effect of functional design.
|
||||
- Make sure no [similar issue(including closed ones)][issues] exists.
|
||||
- Try to find the answer on [Jekyll Forum][forum] and [StackOverflow][stack_overflow].
|
||||
|
||||
<!-- Please complete the following list of tasks, and then check it by changing the "[ ]" to "[x]" -->
|
||||
|
||||
- [ ] I have read the [newlest tutorials](https://cotes2020.github.io/chirpy-demo/categories/tutorial/) and know the correct effect of the functional design.
|
||||
- [ ] There is no similar question on [existing issues](https://github.com/cotes2020/jekyll-theme-chirpy/issues?q=is%3Aissue) (including closed ones).
|
||||
- [ ] I have tried to find the answer on [Jekyll Forum](https://talk.jekyllrb.com/) and [StackOverflow](https://stackoverflow.com/questions/tagged/jekyll).
|
||||
- [ ] My question is based on the latest code of the `master` branch.
|
||||
[tutorial]: https://cotes2020.github.io/chirpy-demo/categories/tutorial/
|
||||
[issues]: https://github.com/cotes2020/jekyll-theme-chirpy/issues?q=is%3Aissue
|
||||
[forum]: https://talk.jekyllrb.com/
|
||||
[stack_overflow]: https://stackoverflow.com/questions/tagged/jekyll
|
||||
|
||||
## Description
|
||||
|
||||
|
||||
10
.github/PULL_REQUEST_TEMPLATE.md
vendored
10
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -22,7 +22,7 @@ Please select the desired item checkbox and change it to "[x]", then delete opti
|
||||
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
|
||||
-->
|
||||
|
||||
- [ ] I have run `bash ./tools/test.sh` (at the root of the project) locally and passed
|
||||
- [ ] I have run `bash ./tools/test` (at the root of the project) locally and passed
|
||||
- [ ] I have tested this feature in the browser
|
||||
|
||||
### Test Configuration
|
||||
@@ -32,11 +32,3 @@ Please describe the tests that you ran to verify your changes. Provide instructi
|
||||
- Ruby version: <!-- by running: `ruby -v` -->
|
||||
- Bundler version: <!-- by running: `bundle -v`-->
|
||||
- Jekyll version: <!-- by running: `bundle list | grep " jekyll "` -->
|
||||
|
||||
### Checklist
|
||||
|
||||
<!-- Select checkboxes by change the "[ ]" to "[x]" -->
|
||||
- [ ] I have performed a self-review of my code
|
||||
- [ ] I have commented on my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] My changes generate no new warnings
|
||||
|
||||
12
.github/SECURITY.md
vendored
Normal file
12
.github/SECURITY.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
|---------| ------------------ |
|
||||
| 5.x | :white_check_mark: |
|
||||
| < 5.0.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you find a vulnerability, please report it to `cotes.chung@gmail.com`. We will try our best to respond within a week. Thank you for your time!
|
||||
14
.github/workflows/cd.yml
vendored
Normal file
14
.github/workflows/cd.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: CD
|
||||
on:
|
||||
push:
|
||||
branches: [production, docs]
|
||||
|
||||
jobs:
|
||||
launch:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
curl -X POST -H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer ${{ secrets.GH_PAT }}" \
|
||||
https://api.github.com/repos/${{ secrets.BUILDER }}/dispatches \
|
||||
-d '{"event_type":"deploy", "client_payload":{"branch": "${{ github.ref_name }}"}}'
|
||||
33
.github/workflows/ci.yml
vendored
33
.github/workflows/ci.yml
vendored
@@ -1,21 +1,18 @@
|
||||
name: 'CI'
|
||||
name: "CI"
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'release/**'
|
||||
- 'docs'
|
||||
tags-ignore:
|
||||
- '**'
|
||||
- "production"
|
||||
- "docs"
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
- '!.github/workflows/ci.yml'
|
||||
- '.travis.yml'
|
||||
- '.gitignore'
|
||||
- 'README.md'
|
||||
- 'LICENSE'
|
||||
- ".github/**"
|
||||
- "!.github/workflows/ci.yml"
|
||||
- ".gitignore"
|
||||
- "README.md"
|
||||
- "LICENSE"
|
||||
pull_request:
|
||||
paths:
|
||||
- '**'
|
||||
- "**"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -23,13 +20,13 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
ruby: [2.5, 2.6, 2.7, 3]
|
||||
ruby: [2.7, 3]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # for posts's lastmod
|
||||
fetch-depth: 0 # for posts's lastmod
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
@@ -37,5 +34,11 @@ jobs:
|
||||
ruby-version: ${{ matrix.ruby }}
|
||||
bundler-cache: true
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
|
||||
- name: Build Assets
|
||||
run: npm i && npm run build
|
||||
|
||||
- name: Test Site
|
||||
run: bash tools/test.sh
|
||||
run: bash tools/test
|
||||
|
||||
44
.github/workflows/codeql.yml
vendored
Normal file
44
.github/workflows/codeql.yml
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
paths: ["**.js"]
|
||||
pull_request:
|
||||
paths: ["**.js"]
|
||||
schedule:
|
||||
- cron: "0 0 * * 5"
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ["javascript"]
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: "${{ matrix.language }}"
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{ matrix.language }}"
|
||||
18
.github/workflows/issue-interceptor.yml
vendored
18
.github/workflows/issue-interceptor.yml
vendored
@@ -1,18 +0,0 @@
|
||||
name: Intercept bad issues
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened, edited]
|
||||
|
||||
jobs:
|
||||
auto_close_issues:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Auto close issues that did not follow template
|
||||
uses: lucasbento/auto-close-issues@v1.0.2
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-close-message: ":wave: Hi @${issue.user.login},\n\nThis issue is being automatically closed because it does not follow the issue template. Please DO NOT open another similar issue, try to edit the current issue according to the template, then it will be reopened automatically."
|
||||
closed-issues-label: "🙁 Not following issue template"
|
||||
4
.github/workflows/pages-deploy.yml.hook
vendored
4
.github/workflows/pages-deploy.yml.hook
vendored
@@ -37,12 +37,12 @@ jobs:
|
||||
|
||||
- name: Setup Pages
|
||||
id: pages
|
||||
uses: actions/configure-pages@v1
|
||||
uses: actions/configure-pages@v3
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 3 # reads from a '.ruby-version' or '.tools-version' file if 'ruby-version' is omitted
|
||||
ruby-version: 3 # reads from a '.ruby-version' or '.tools-version' file if 'ruby-version' is omitted
|
||||
bundler-cache: true
|
||||
|
||||
- name: Build site
|
||||
|
||||
9
.github/workflows/style-lint.yml
vendored
9
.github/workflows/style-lint.yml
vendored
@@ -1,12 +1,15 @@
|
||||
name: 'Style Lint'
|
||||
name: "Style Lint"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- "production"
|
||||
- "docs"
|
||||
paths:
|
||||
- '_sass/**.scss'
|
||||
- "_sass/**/*.scss"
|
||||
pull_request:
|
||||
paths:
|
||||
- '_sass/**.scss'
|
||||
- "_sass/**/*.scss"
|
||||
|
||||
jobs:
|
||||
stylelint:
|
||||
|
||||
30
.gitignore
vendored
30
.gitignore
vendored
@@ -1,22 +1,22 @@
|
||||
# hidden files
|
||||
.*
|
||||
!.git*
|
||||
!.editorconfig
|
||||
!.nojekyll
|
||||
!.travis.yml
|
||||
!.husky
|
||||
!.commitlintrc.json
|
||||
!.versionrc.json
|
||||
!.stylelintrc.json
|
||||
|
||||
# bundler cache
|
||||
_site
|
||||
# Bundler cache
|
||||
.bundle
|
||||
vendor
|
||||
Gemfile.lock
|
||||
|
||||
# rubygem
|
||||
# Jekyll cache
|
||||
.jekyll-cache
|
||||
_site
|
||||
|
||||
# RubyGems
|
||||
*.gem
|
||||
|
||||
# npm dependencies
|
||||
# NPM dependencies
|
||||
node_modules
|
||||
package-lock.json
|
||||
|
||||
# IDE configurations
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
# Misc
|
||||
assets/js/dist
|
||||
|
||||
3
.prettierrc
Normal file
3
.prettierrc
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"trailingComma": "none"
|
||||
}
|
||||
@@ -12,11 +12,10 @@
|
||||
"selector-not-notation": "simple",
|
||||
"color-hex-length": "long",
|
||||
"declaration-block-single-line-max-declarations": 3,
|
||||
"font-family-no-missing-generic-family-keyword": [
|
||||
true,
|
||||
{
|
||||
"ignoreFontFamilies": ["Font Awesome 5 Free"]
|
||||
}
|
||||
"scss/operator-no-newline-after": null,
|
||||
"rule-empty-line-before": [
|
||||
"always",
|
||||
{ "ignore": ["after-comment", "first-nested", "inside-block"] }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
51
.travis.yml
51
.travis.yml
@@ -1,51 +0,0 @@
|
||||
os: linux
|
||||
dist: bionic
|
||||
language: ruby
|
||||
rvm: 2.7.0
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libcurl4-openssl-dev # to avoid SSL error (for htmlproofer)
|
||||
|
||||
# Overriding to drop the `--development` flag which requires the Gemfile.lock at build
|
||||
install: bundle install --jobs=3 --retry=3 --path=vendor/bundle
|
||||
|
||||
before_script: git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: Upgrade
|
||||
cache: bundler
|
||||
git:
|
||||
depth: false # for posts' lastmod
|
||||
script: eval "$BUILD_CMD"
|
||||
|
||||
- stage: Starter
|
||||
language: minimal
|
||||
install: true # skip install step
|
||||
script: eval "$FLUSH_STARTER"
|
||||
|
||||
- stage: Docs
|
||||
cache: bundler
|
||||
git:
|
||||
depth: false # for posts' lastmod
|
||||
script: eval "$DOCS_CMD"
|
||||
|
||||
stages:
|
||||
- name: Upgrade
|
||||
if: branch = production
|
||||
- name: Starter
|
||||
if: branch = production
|
||||
- name: Docs
|
||||
if: branch = docs
|
||||
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- secure: "fFLqX7uOzFA8RE2AUFlU1mmxMw+rdV6DnODJ/1Gl+3ecNtrv5LeH3c5a4a5ShQqYTrx9BPfD40VRN7UB+lzOdXiWLI9yDGRPPxGG26/WfrKpdQPZilc8zAOEeDnLAJeGZLsUvgmNb3KCXW6S8NPqqh34CfWcTIzjCARhRgO33wcs8X5wP5cugtNqO5Ew/pUcfWcmiuXNX0GNT6l+nL5A7yN+IO5mRHqSRmlfYd5EHhGMTIL4La+Cd1CNv1m4Dl0Ah2cDeJwi5wLnVbqAgunLhAYmDtxIOCVYMTBrP37UiNe/7QeFelyJfODsmMg1mx3WCykbXydC753WVoAlTg6nNoeeI9fmK+/tuLK+sx/KnYfTVGBXQYq39DyV/2o/IfCzEAKImlzFKGD8R13+ddu4B5UML+cby5KBvhTKIGaC5tKoe39z/31UPpy11/EHMCof2BUOzIgu5Hsv4OSNJlw3oRE31oOPn8xP4e7uWR8bRUhAgzN0Cn0ht+UfpemfGAXrp0M3IXQdc9L4azEFqxRhivMTLK/P6INay7IM+DJ30Ht2dWylGw/sxcRTqyNm3YomJQnXIO4xeqTSLulWr80FFHTys3JEDJYrcKvJmpwLFEAOZtwKsZ6ZShrOIA4LE5fgQtakH3ZLJG9a7jVSlMcNIfaSKgjdDQOe6CoRQL7KouA="
|
||||
on_success: never
|
||||
|
||||
env:
|
||||
global:
|
||||
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
|
||||
95
CHANGELOG.md
95
CHANGELOG.md
@@ -2,7 +2,100 @@
|
||||
|
||||
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.3.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.3.0...v5.3.1) (2022-10-25)
|
||||
## [5.6.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.6.0...v5.6.1) (2023-03-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **deps:** `tocbot` has no initialization detection ([#957](https://github.com/cotes2020/jekyll-theme-chirpy/issues/957)) ([8225174](https://github.com/cotes2020/jekyll-theme-chirpy/commit/8225174cb5e02fda7b3cc548ec821c876b0a5139))
|
||||
* mode-toggle leads to Disqus loading failure ([#945](https://github.com/cotes2020/jekyll-theme-chirpy/issues/945)) ([6fec411](https://github.com/cotes2020/jekyll-theme-chirpy/commit/6fec411c18ca5689c467c7b216ddeda02df23623))
|
||||
* pageviews not updated immediately ([8b4f99c](https://github.com/cotes2020/jekyll-theme-chirpy/commit/8b4f99c87f9a9227f47e84fb39d7b0f551d6f4dd))
|
||||
|
||||
## [5.6.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.5.2...v5.6.0) (2023-03-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* change TOC plugin to `tocbot` ([#774](https://github.com/cotes2020/jekyll-theme-chirpy/issues/774)) ([02b7bd5](https://github.com/cotes2020/jekyll-theme-chirpy/commit/02b7bd5095a2affe5b4c5ed7b5b182baaf642ff3))
|
||||
* **i18n:** add Greek Language Support. ([#903](https://github.com/cotes2020/jekyll-theme-chirpy/issues/903)) ([712a9b2](https://github.com/cotes2020/jekyll-theme-chirpy/commit/712a9b22401ce591cf4c0bb03fbdd1693fee30bb))
|
||||
* **ux:** turn home page posts into clickable cards ([#895](https://github.com/cotes2020/jekyll-theme-chirpy/issues/895)) ([b85f633](https://github.com/cotes2020/jekyll-theme-chirpy/commit/b85f6330dea666350631c4461b742cdb54c5f052))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* css selector string escaping vulnerability ([#888](https://github.com/cotes2020/jekyll-theme-chirpy/issues/888)) ([5c6ec9d](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5c6ec9d06b6571e2c0efe6652078442dca8af477))
|
||||
* mathematics cannot scroll horizontally ([#760](https://github.com/cotes2020/jekyll-theme-chirpy/issues/760)) ([4681df7](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4681df715118a37ae1e91b588de0adb67f4e331a))
|
||||
* notch status bar doesn't match theme color ([#918](https://github.com/cotes2020/jekyll-theme-chirpy/issues/918)) ([820ba62](https://github.com/cotes2020/jekyll-theme-chirpy/commit/820ba62e9e939090523a7077d01d01bd78ec84eb))
|
||||
* some console snippets will be incompletely copied ([e8e4901](https://github.com/cotes2020/jekyll-theme-chirpy/commit/e8e4901e340dd7e5fc5f656dd3c7bcd6c97b886a))
|
||||
|
||||
## [5.5.2](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.5.1...v5.5.2) (2023-01-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* position of prompt icon is incorrect in paragraph on mobile ([5df953f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5df953f6c877e2aa3f1f4981c97a0b8007abe6d4))
|
||||
|
||||
## [5.5.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.5.0...v5.5.1) (2023-01-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* the icon position of the prompts in the list is incorrect ([0c9558d](https://github.com/cotes2020/jekyll-theme-chirpy/commit/0c9558de8a01e9ab795778f351a8bbf4d6b21763))
|
||||
|
||||
## [5.5.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.4.0...v5.5.0) (2023-01-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **i18n:** add Arabic translation ([#857](https://github.com/cotes2020/jekyll-theme-chirpy/issues/857)) ([765af53](https://github.com/cotes2020/jekyll-theme-chirpy/commit/765af53b77e5c63804784d5728f5970ae274c2c7))
|
||||
* **i18n:** add Czech language ([#833](https://github.com/cotes2020/jekyll-theme-chirpy/issues/833)) ([98d48f5](https://github.com/cotes2020/jekyll-theme-chirpy/commit/98d48f5da412276d4a0c99cd01a87b19349bc6bc))
|
||||
* **i18n:** add Finnish translations ([#843](https://github.com/cotes2020/jekyll-theme-chirpy/issues/843)) ([d6d0318](https://github.com/cotes2020/jekyll-theme-chirpy/commit/d6d03183eaf94b44e037cc48b6e1c47cee183f6e))
|
||||
* **i18n:** add Italian translation ([#850](https://github.com/cotes2020/jekyll-theme-chirpy/issues/850)) ([9a011e1](https://github.com/cotes2020/jekyll-theme-chirpy/commit/9a011e14d66195d8b2fb9ec62f3e60a3e56cd032))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* copy command line incomplete(`.gp` part) ([41ed331](https://github.com/cotes2020/jekyll-theme-chirpy/commit/41ed33145639415148aec8e85edc7a6fd0de0ca3))
|
||||
* correct encoding of spaces in share URLs ([#835](https://github.com/cotes2020/jekyll-theme-chirpy/issues/835)) ([f2d2858](https://github.com/cotes2020/jekyll-theme-chirpy/commit/f2d285844e6e2979f2b0eec1d20073d3c05b6c0c))
|
||||
* post's image would cover the PWA update alert ([bd374dd](https://github.com/cotes2020/jekyll-theme-chirpy/commit/bd374dd383c50f89c8f018ecb4e25772eeb8f6d8))
|
||||
* prompt with nested blockquotes renders incorrectly ([#846](https://github.com/cotes2020/jekyll-theme-chirpy/issues/846)) ([babb4a0](https://github.com/cotes2020/jekyll-theme-chirpy/commit/babb4a0c5a58ceb2e4093bc465670accdd526c18))
|
||||
|
||||
## [5.4.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.3.2...v5.4.0) (2022-12-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add `rel="me"` to Mastodon sidebar contact links for verification ([#807](https://github.com/cotes2020/jekyll-theme-chirpy/issues/807)) ([d2190c7](https://github.com/cotes2020/jekyll-theme-chirpy/commit/d2190c726f61c8c9732b88b4aecf699dc8bc7deb))
|
||||
* add embed video support ([ed6dc53](https://github.com/cotes2020/jekyll-theme-chirpy/commit/ed6dc539eff7003a3765bcd8c31ae5e91a863d65))
|
||||
* add shimmer background when image loads ([ab16fdc](https://github.com/cotes2020/jekyll-theme-chirpy/commit/ab16fdc7fc26811130b98a1773beb62bff6182e8))
|
||||
* set preview image ratio to 1.91 : 1 ([4b6ccbc](https://github.com/cotes2020/jekyll-theme-chirpy/commit/4b6ccbcbccce27b9fcb035812efefe4eb69301cf))
|
||||
* support dark and light mode images ([#481](https://github.com/cotes2020/jekyll-theme-chirpy/issues/481)) ([9306c7b](https://github.com/cotes2020/jekyll-theme-chirpy/commit/9306c7b39ecf9d9146bc1a25eebedc38eb2c3dd6))
|
||||
* support LQIP for images ([bffaf63](https://github.com/cotes2020/jekyll-theme-chirpy/commit/bffaf6374f265cec96ef743d42b46fbec3b59797))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* `hreflang` tag attribute of feed misses `site.alt_lang` ([7651d28](https://github.com/cotes2020/jekyll-theme-chirpy/commit/7651d2851b4bb7d8f0d068b62c036c89a1089bbc))
|
||||
* `og:image` will be incorrect if the image uses a cross-domain URL ([8de1abd](https://github.com/cotes2020/jekyll-theme-chirpy/commit/8de1abda6be3633982392178731431b0ddb1b52b))
|
||||
* refactoring error when the image URL contains parameters ([ec98f07](https://github.com/cotes2020/jekyll-theme-chirpy/commit/ec98f07aca0b80a9c07fbcdc8e0d7d66dba98ed2))
|
||||
* spaces in post title are encoded when sharing ([7efd2f8](https://github.com/cotes2020/jekyll-theme-chirpy/commit/7efd2f8aa2ea1c3aeb7d740bf9a018881c26fe65))
|
||||
|
||||
|
||||
### Improvements
|
||||
|
||||
* **cdn:** optimize cache policy for static assets ([7fb0ee0](https://github.com/cotes2020/jekyll-theme-chirpy/commit/7fb0ee0bedb63eee3f90a49c6d7fb8b5d78c9830))
|
||||
|
||||
## [5.3.2](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.3.1...v5.3.2) (2022-11-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* `mermaid` occasionally fails to initialize ([#536](https://github.com/cotes2020/jekyll-theme-chirpy/issues/536)) ([48f14e3](https://github.com/cotes2020/jekyll-theme-chirpy/commit/48f14e39ac81bbfb3b9913ea3ee789d775b2d1ae))
|
||||
* **comment:** disqus doesn't follow theme mode switching ([b0d5956](https://github.com/cotes2020/jekyll-theme-chirpy/commit/b0d5956f5a0ed894984d6b1754efeba04d8bc966))
|
||||
* restore full-text search ([#741](https://github.com/cotes2020/jekyll-theme-chirpy/issues/741)) ([6774e0e](https://github.com/cotes2020/jekyll-theme-chirpy/commit/6774e0e1fb37cf467b14be481347412713763f05))
|
||||
* the image URL in the SEO-related tags is incomplete ([#754](https://github.com/cotes2020/jekyll-theme-chirpy/issues/754)) ([f6e9a3f](https://github.com/cotes2020/jekyll-theme-chirpy/commit/f6e9a3fccf7ab34db71f8aefaf86fdcc05861076))
|
||||
|
||||
## [5.3.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.3.0...v5.3.1) (2022-10-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
16
Gemfile
16
Gemfile
@@ -10,13 +10,19 @@ end
|
||||
|
||||
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
# and associated library.
|
||||
install_if -> { RUBY_PLATFORM =~ %r!mingw|mswin|java! } do
|
||||
gem "tzinfo", "~> 1.2"
|
||||
platforms :mingw, :x64_mingw, :mswin, :jruby do
|
||||
gem "tzinfo", ">= 1", "< 3"
|
||||
gem "tzinfo-data"
|
||||
end
|
||||
|
||||
# Performance-booster for watching directories on Windows
|
||||
gem "wdm", "~> 0.1.1", :install_if => Gem.win_platform?
|
||||
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
|
||||
|
||||
# Jekyll <= 4.2.0 compatibility with Ruby 3.0
|
||||
gem "webrick", "~> 1.7"
|
||||
# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
|
||||
# do not have a Java counterpart.
|
||||
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]
|
||||
|
||||
# Lock jekyll-sass-converter to 2.x on Linux-musl
|
||||
if RUBY_PLATFORM =~ /linux-musl/
|
||||
gem "jekyll-sass-converter", "~> 2.0"
|
||||
end
|
||||
|
||||
122
README.md
122
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
# Chirpy Jekyll Theme
|
||||
|
||||
A minimal, responsive, and powerful Jekyll theme for presenting professional writing.
|
||||
A minimal, responsive and feature-rich Jekyll theme for technical writing.
|
||||
|
||||
[](https://rubygems.org/gems/jekyll-theme-chirpy)
|
||||
[](https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml)
|
||||
@@ -10,96 +10,86 @@
|
||||
[](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
|
||||
[](https://996.icu)
|
||||
|
||||
[**Live Demo →**](https://cotes2020.github.io/chirpy-demo)
|
||||
[**Live Demo →**][demo]
|
||||
|
||||
[](https://cotes2020.github.io/chirpy-demo)
|
||||
[][demo]
|
||||
|
||||
</div>
|
||||
|
||||
## Features
|
||||
|
||||
- Localized Layout
|
||||
- Dark/Light Theme Mode
|
||||
- Pinned Posts
|
||||
- Hierarchical Categories
|
||||
- Last Modified Date for Posts
|
||||
- Table of Contents
|
||||
- Auto-generated Related Posts
|
||||
- Syntax Highlighting
|
||||
- Mathematical Expressions
|
||||
- Mermaid Diagram & Flowchart
|
||||
- Disqus/Utterances/Giscus Comments
|
||||
- Search
|
||||
- Atom Feeds
|
||||
- Google Analytics
|
||||
- GA Pageviews Reporting
|
||||
- SEO & Performance Optimization
|
||||
<details>
|
||||
<summary>
|
||||
<i>Click to view features</i>
|
||||
</summary>
|
||||
<p>
|
||||
|
||||
- Dark / Light Theme Mode
|
||||
- Localized UI language
|
||||
- Pinned Posts
|
||||
- Hierarchical Categories
|
||||
- Trending Tags
|
||||
- Table of Contents
|
||||
- Last Modified Date of Posts
|
||||
- Syntax Highlighting
|
||||
- Mathematical Expressions
|
||||
- Mermaid Diagram & Flowchart
|
||||
- Dark / Light Mode Images
|
||||
- Embed Videos
|
||||
- Disqus / Utterances / Giscus Comments
|
||||
- Search
|
||||
- Atom Feeds
|
||||
- Google Analytics
|
||||
- Page Views Reporting
|
||||
- SEO & Performance Optimization
|
||||
|
||||
## Quick Start
|
||||
|
||||
Before starting, please follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll`, and `Bundler`. In addition, [Git](https://git-scm.com/) is also required to be installed.
|
||||
|
||||
### Step 1. Creating a New Site
|
||||
|
||||
Create a new repository from the [**Chirpy Starter**](https://github.com/cotes2020/chirpy-starter/generate) and name it `<GH_USERNAME>.github.io`, where `GH_USERNAME` represents your GitHub username.
|
||||
|
||||
### Step 2. Installing Dependencies
|
||||
|
||||
Before running for the first time, go to the root directory of your site, and install dependencies as follows:
|
||||
|
||||
```console
|
||||
$ bundle
|
||||
```
|
||||
|
||||
### Step 3. Running Local Server
|
||||
|
||||
Run the following command in the root directory of the site:
|
||||
|
||||
```console
|
||||
$ bundle exec jekyll s
|
||||
```
|
||||
|
||||
Or run with Docker:
|
||||
|
||||
```console
|
||||
$ docker run -it --rm \
|
||||
--volume="$PWD:/srv/jekyll" \
|
||||
-p 4000:4000 jekyll/jekyll \
|
||||
jekyll serve
|
||||
```
|
||||
|
||||
After a while, navigate to the site at <http://localhost:4000>.
|
||||
</p>
|
||||
</details>
|
||||
|
||||
## 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 release](https://github.com/cotes2020/jekyll-theme-chirpy/releases/latest), and the features of the default branch are usually ahead of the documentation.
|
||||
To explore usage, development, and upgrade guide of the project, please refer to
|
||||
the [Wiki][wiki].
|
||||
|
||||
## Contributing
|
||||
|
||||
Welcome to report bugs, improve code quality or submit a new feature. For more information, see [contributing guidelines](.github/CONTRIBUTING.md).
|
||||
Welcome to report bugs, help improve the code or submit new features.
|
||||
For more information, please see the ["Contributing Guidelines"][contribute-guide].
|
||||
|
||||
## Credits
|
||||
|
||||
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][jekyllrb] ecosystem,
|
||||
[Bootstrap][bootstrap], [Font Awesome][icons] and some other [wonderful tools][lib].
|
||||
The avatar and favicon design come from [Clipart Max][image].
|
||||
|
||||
: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.
|
||||
Thanks to all the [contributors][contributors]. Also, folks who submitted issues
|
||||
or unmerged PRs should not be forgotten. Because they reported bugs, shared ideas,
|
||||
or inspired me to write more readable documentation.
|
||||
|
||||
Last but not least, thank [JetBrains][jb] for providing the OSS development license.
|
||||
Last but not least, thanks to [JetBrains][jetbrains] for providing the
|
||||
_Open Source Development_ license.
|
||||
|
||||
## Sponsoring
|
||||
|
||||
If you like this theme or find it helpful, please consider sponsoring me, because it will encourage and help me better maintain the project, I will be very grateful!
|
||||
If you'd like to sponsor this project, the following options are available.
|
||||
|
||||
[](https://ko-fi.com/coteschung)
|
||||
[][cn-donation]
|
||||
[][cn-donation]
|
||||
[][donation]
|
||||
[][donation]
|
||||
|
||||
## License
|
||||
|
||||
This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE) License.
|
||||
This work is published under [MIT][mit] License.
|
||||
|
||||
<!-- ReadMe links -->
|
||||
|
||||
[jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy
|
||||
[cn-donation]: https://cotes2020.github.io/sponsor/
|
||||
[jekyllrb]: https://jekyllrb.com/
|
||||
[bootstrap]: https://getbootstrap.com/
|
||||
[icons]: https://fontawesome.com/
|
||||
[image]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/
|
||||
[demo]: https://cotes2020.github.io/chirpy-demo/
|
||||
[wiki]: https://github.com/cotes2020/jekyll-theme-chirpy/wiki
|
||||
[contribute-guide]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/CONTRIBUTING.md
|
||||
[contributors]: https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors
|
||||
[lib]: https://github.com/cotes2020/chirpy-static-assets
|
||||
[jetbrains]: https://www.jetbrains.com/?from=jekyll-theme-chirpy
|
||||
[donation]: https://sponsor.cotes.page/
|
||||
[mit]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE
|
||||
|
||||
79
_config.yml
79
_config.yml
@@ -5,60 +5,59 @@ theme: jekyll-theme-chirpy
|
||||
|
||||
# Change the following value to '/PROJECT_NAME' ONLY IF your site type is GitHub Pages Project sites
|
||||
# and doesn't have a custom domain.
|
||||
baseurl: ''
|
||||
baseurl: ""
|
||||
|
||||
# The language of the webpage › http://www.lingoes.net/en/translator/langcode.htm
|
||||
# If it has the same name as one of the files in folder `_data/locales`, the layout language will also be changed,
|
||||
# otherwise, the layout language will use the default value of 'en'.
|
||||
lang: en
|
||||
|
||||
|
||||
# Change to your timezone › http://www.timezoneconverter.com/cgi-bin/findzone/findzone
|
||||
timezone: Asia/Shanghai
|
||||
|
||||
# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
|
||||
# ↓ --------------------------
|
||||
|
||||
title: Chirpy # the main title
|
||||
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
|
||||
A minimal, responsive, and powerful Jekyll theme for presenting professional writing.
|
||||
description: >- # used by seo meta and the atom feed
|
||||
A minimal, responsive and feature-rich Jekyll theme for technical writing.
|
||||
|
||||
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
|
||||
url: ''
|
||||
url: ""
|
||||
|
||||
github:
|
||||
username: github_username # change to your github username
|
||||
username: github_username # change to your github username
|
||||
|
||||
twitter:
|
||||
username: twitter_username # change to your twitter username
|
||||
username: twitter_username # change to your twitter username
|
||||
|
||||
social:
|
||||
# Change to your full name.
|
||||
# It will be displayed as the default author of the posts and the copyright owner in the Footer
|
||||
name: your_full_name
|
||||
email: example@domain.com # change to your email address
|
||||
email: example@domain.com # change to your email address
|
||||
links:
|
||||
# The first element serves as the copyright owner's link
|
||||
- https://twitter.com/username # change to your twitter homepage
|
||||
- https://github.com/username # change to your github homepage
|
||||
- https://twitter.com/username # change to your twitter homepage
|
||||
- https://github.com/username # change to your github homepage
|
||||
# Uncomment below to add more social links
|
||||
# - https://www.facebook.com/username
|
||||
# - https://www.linkedin.com/in/username
|
||||
|
||||
google_site_verification: # fill in to your verification string
|
||||
google_site_verification: # fill in to your verification string
|
||||
|
||||
# ↑ --------------------------
|
||||
# The end of `jekyll-seo-tag` settings
|
||||
|
||||
google_analytics:
|
||||
id: # fill in your Google Analytics ID
|
||||
id: # fill in your Google Analytics ID
|
||||
# Google Analytics pageviews report settings
|
||||
pv:
|
||||
proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine
|
||||
cache_path: # the local PV cache data, friendly to visitors from GFW region
|
||||
proxy_endpoint: # fill in the Google Analytics superProxy endpoint of Google App Engine
|
||||
cache_path: # the local PV cache data, friendly to visitors from GFW region
|
||||
|
||||
# Prefer color scheme setting.
|
||||
#
|
||||
@@ -71,51 +70,51 @@ google_analytics:
|
||||
# light - Use the light color scheme
|
||||
# dark - Use the dark color scheme
|
||||
#
|
||||
theme_mode: # [light|dark]
|
||||
theme_mode: # [light|dark]
|
||||
|
||||
# The CDN endpoint for images.
|
||||
# Notice that once it is assigned, the CDN url
|
||||
# will be added to all image (site avatar & posts' images) paths starting with '/'
|
||||
#
|
||||
# e.g. 'https://cdn.com'
|
||||
img_cdn: 'https://raw.githubusercontent.com/cotes2020/chirpy-images/main'
|
||||
img_cdn: "https://chirpy-img.netlify.app"
|
||||
|
||||
# the avatar on sidebar, support local or CORS resources
|
||||
avatar: '/commons/avatar.jpg'
|
||||
avatar: "/commons/avatar.jpg"
|
||||
|
||||
# boolean type, the global switch for ToC in posts.
|
||||
# boolean type, the global switch for TOC in posts.
|
||||
toc: true
|
||||
|
||||
comments:
|
||||
active: # The global switch for posts comments, e.g., 'disqus'. Keep it empty means disable
|
||||
active: # The global switch for posts comments, e.g., 'disqus'. Keep it empty means disable
|
||||
# The active options are as follows:
|
||||
disqus:
|
||||
shortname: # fill with the Disqus shortname. › https://help.disqus.com/en/articles/1717111-what-s-a-shortname
|
||||
shortname: # fill with the Disqus shortname. › https://help.disqus.com/en/articles/1717111-what-s-a-shortname
|
||||
# utterances settings › https://utteranc.es/
|
||||
utterances:
|
||||
repo: # <gh-username>/<repo>
|
||||
issue_term: # < url | pathname | title | ...>
|
||||
repo: # <gh-username>/<repo>
|
||||
issue_term: # < url | pathname | title | ...>
|
||||
# Giscus options › https://giscus.app
|
||||
giscus:
|
||||
repo: # <gh-username>/<repo>
|
||||
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`
|
||||
mapping: # optional, default to 'pathname'
|
||||
input_position: # optional, default to 'bottom'
|
||||
lang: # optional, default to the value of `site.lang`
|
||||
reactions_enabled: # optional, default to the value of `1`
|
||||
|
||||
# Self-hosted static assets, optional › https://github.com/cotes2020/chirpy-static-assets
|
||||
assets:
|
||||
self_host:
|
||||
enabled: # boolean, keep empty means false
|
||||
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]
|
||||
env: # [development|production]
|
||||
|
||||
pwa:
|
||||
enabled: true # the option for PWA feature
|
||||
enabled: true # the option for PWA feature
|
||||
|
||||
paginate: 10
|
||||
|
||||
@@ -123,7 +122,7 @@ paginate: 10
|
||||
|
||||
kramdown:
|
||||
syntax_highlighter: rouge
|
||||
syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options
|
||||
syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options
|
||||
css_class: highlight
|
||||
# default_lang: console
|
||||
span:
|
||||
@@ -139,12 +138,12 @@ collections:
|
||||
|
||||
defaults:
|
||||
- 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
|
||||
values:
|
||||
layout: post
|
||||
comments: true # Enable comments in posts.
|
||||
toc: true # Display TOC column in posts.
|
||||
comments: true # Enable comments in posts.
|
||||
toc: true # Display TOC column in posts.
|
||||
# DO NOT modify the following parameter unless you are confident enough
|
||||
# to update the code of all other post links in this project.
|
||||
permalink: /posts/:title/
|
||||
@@ -153,8 +152,8 @@ defaults:
|
||||
values:
|
||||
comments: false
|
||||
- scope:
|
||||
path: ''
|
||||
type: tabs # see `site.collections`
|
||||
path: ""
|
||||
type: tabs # see `site.collections`
|
||||
values:
|
||||
layout: page
|
||||
permalink: /:title/
|
||||
@@ -180,13 +179,13 @@ compress_html:
|
||||
envs: [development]
|
||||
|
||||
exclude:
|
||||
- '*.gem'
|
||||
- '*.gemspec'
|
||||
- "*.gem"
|
||||
- "*.gemspec"
|
||||
- tools
|
||||
- README.md
|
||||
- CHANGELOG.md
|
||||
- LICENSE
|
||||
- gulpfile.js
|
||||
- rollup.config.js
|
||||
- node_modules
|
||||
- package*.json
|
||||
|
||||
|
||||
@@ -16,47 +16,47 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato&family=Source+Sans+Pro:w
|
||||
# Libraries
|
||||
|
||||
jquery:
|
||||
js: https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
|
||||
js: https://cdn.jsdelivr.net/npm/jquery@3.6.1/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
|
||||
css: https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css
|
||||
js: https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/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
|
||||
toc:
|
||||
css: https://cdn.jsdelivr.net/npm/tocbot@4.20.1/dist/tocbot.min.css
|
||||
js: https://cdn.jsdelivr.net/npm/tocbot@4.20.1/dist/tocbot.min.js
|
||||
|
||||
fontawesome:
|
||||
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css
|
||||
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.2.1/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@9/dist/mermaid.min.js
|
||||
js: https://cdn.jsdelivr.net/npm/mermaid@9.2.2/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
|
||||
common: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/dayjs.min.js
|
||||
locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/locale/:LOCALE.min.js
|
||||
relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/plugin/relativeTime.min.js
|
||||
localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.6/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
|
||||
css: https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/magnific-popup.min.css
|
||||
js: https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/jquery.magnific-popup.min.js
|
||||
|
||||
lozad:
|
||||
js: https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js
|
||||
lazysizes:
|
||||
js: https://cdn.jsdelivr.net/npm/lazysizes@5.3.2/lazysizes.min.js
|
||||
|
||||
clipboard:
|
||||
js: https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js
|
||||
js: https://cdn.jsdelivr.net/npm/clipboard@2.0.11/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
|
||||
js: https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-chtml.js
|
||||
|
||||
@@ -5,47 +5,47 @@ webfonts: /assets/lib/fonts/main.css
|
||||
# Libraries
|
||||
|
||||
jquery:
|
||||
js: /assets/lib/jquery-3.6.0/jquery.min.js
|
||||
js: /assets/lib/jquery/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
|
||||
css: /assets/lib/bootstrap/bootstrap.min.css
|
||||
js: /assets/lib/bootstrap/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
|
||||
toc:
|
||||
css: /assets/lib/tocbot/tocbot.min.css
|
||||
js: /assets/lib/tocbot/tocbot.min.js
|
||||
|
||||
fontawesome:
|
||||
css: /assets/lib/fontawesome-free-5.15.4/css/all.min.css
|
||||
css: /assets/lib/fontawesome-free/css/all.min.css
|
||||
|
||||
search:
|
||||
js: /assets/lib/simple-jekyll-search-1.10.0/simple-jekyll-search.min.js
|
||||
js: /assets/lib/simple-jekyll-search/simple-jekyll-search.min.js
|
||||
|
||||
mermaid:
|
||||
js: /assets/lib/mermaid-9.1.7/mermaid.min.js
|
||||
js: /assets/lib/mermaid/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
|
||||
common: /assets/lib/dayjs/dayjs.min.js
|
||||
locale: /assets/lib/dayjs/locale/en.min.js
|
||||
relativeTime: /assets/lib/dayjs/plugin/relativeTime.min.js
|
||||
localizedFormat: /assets/lib/dayjs/plugin/localizedFormat.min.js
|
||||
|
||||
countup:
|
||||
js: /assets/lib/countup.js-1.9.3/countUp.min.js
|
||||
js: /assets/lib/countup.js/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
|
||||
css: /assets/lib/magnific-popup/magnific-popup.css
|
||||
js: /assets/lib/magnific-popup/jquery.magnific-popup.min.js
|
||||
|
||||
lozad:
|
||||
js: /assets/lib/lozad-1.16.0/lozad.min.js
|
||||
lazysizes:
|
||||
js: /assets/lib/lazysizes/lazysizes.min.js
|
||||
|
||||
clipboard:
|
||||
js: /assets/lib/clipboard-2.0.9/clipboard.min.js
|
||||
js: /assets/lib/clipboard/clipboard.min.js
|
||||
|
||||
polyfill:
|
||||
js: /assets/lib/polyfill-v3-es6/polyfill.min.js
|
||||
|
||||
mathjax:
|
||||
js: /assets/lib/mathjax-3.2.0/tex-chtml.js
|
||||
js: /assets/lib/mathjax/tex-chtml.js
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
# The contact options.
|
||||
|
||||
-
|
||||
type: github
|
||||
icon: 'fab fa-github'
|
||||
-
|
||||
type: twitter
|
||||
icon: 'fab fa-twitter'
|
||||
-
|
||||
type: email
|
||||
icon: 'fas fa-envelope'
|
||||
noblank: true # open link in current tab
|
||||
-
|
||||
type: rss
|
||||
icon: 'fas fa-rss'
|
||||
noblank: true
|
||||
- type: github
|
||||
icon: "fab fa-github"
|
||||
|
||||
- type: twitter
|
||||
icon: "fab fa-twitter"
|
||||
|
||||
- type: email
|
||||
icon: "fas fa-envelope"
|
||||
noblank: true # open link in current tab
|
||||
|
||||
- type: rss
|
||||
icon: "fas fa-rss"
|
||||
noblank: true
|
||||
# Uncomment and complete the url below to enable more contact options
|
||||
# -
|
||||
# type: mastodon
|
||||
#
|
||||
# - type: mastodon
|
||||
# icon: 'fab fa-mastodon' # icons powered by <https://fontawesome.com/>
|
||||
# url: '' # Fill with your mastodon account page
|
||||
# -
|
||||
# type: linkedin
|
||||
# url: '' # Fill with your Mastodon account page, rel="me" will be applied for verification
|
||||
#
|
||||
# - type: linkedin
|
||||
# icon: 'fab fa-linkedin' # icons powered by <https://fontawesome.com/>
|
||||
# url: '' # Fill with your Linkedin homepage
|
||||
# -
|
||||
# type: stack-overflow
|
||||
#
|
||||
# - type: stack-overflow
|
||||
# icon: 'fab fa-stack-overflow'
|
||||
# url: '' # Fill with your stackoverflow homepage
|
||||
|
||||
93
_data/locales/ar.yml
Normal file
93
_data/locales/ar.yml
Normal file
@@ -0,0 +1,93 @@
|
||||
# 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: باستخدام :PLATFORM السمة :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: مثبت
|
||||
|
||||
# Date time format.
|
||||
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
|
||||
df:
|
||||
post:
|
||||
strftime: '%b %e, %Y'
|
||||
dayjs: 'll'
|
||||
archives:
|
||||
strftime: '%b'
|
||||
dayjs: 'MMM'
|
||||
|
||||
# categories page
|
||||
categories:
|
||||
category_measure:
|
||||
singular: فئة
|
||||
plural: فئات
|
||||
post_measure:
|
||||
singular: منشور
|
||||
plural: منشورات
|
||||
@@ -5,7 +5,7 @@
|
||||
layout:
|
||||
post: Публикация
|
||||
category: Категория
|
||||
tag: Тагове
|
||||
tag: Таг
|
||||
|
||||
# The tabs of sidebar
|
||||
tabs:
|
||||
@@ -43,7 +43,7 @@ copyright:
|
||||
meta: Създадено чрез :PLATFORM и :THEME тема.
|
||||
|
||||
not_found:
|
||||
statment: Съжалявам, но този на този URL адрес няма налично съдържание.
|
||||
statment: Съжалявам, но на този URL адрес няма налично съдържание.
|
||||
|
||||
notification:
|
||||
update_found: Налична е нова версия на съдържанието.
|
||||
@@ -71,7 +71,7 @@ post:
|
||||
title: Копирай линк
|
||||
succeed: Линкът е копиран успешно!
|
||||
# pinned prompt of posts list on homepage
|
||||
pin_prompt: Прикрепен
|
||||
pin_prompt: Прикрепенa
|
||||
|
||||
# categories page
|
||||
categories:
|
||||
|
||||
91
_data/locales/cs-CZ.yml
Normal file
91
_data/locales/cs-CZ.yml
Normal file
@@ -0,0 +1,91 @@
|
||||
# The layout text of site
|
||||
|
||||
# ----- Commons label -----
|
||||
|
||||
layout:
|
||||
post: Příspěvek
|
||||
category: Kategorie
|
||||
tag: Štítek
|
||||
|
||||
# The tabs of sidebar
|
||||
tabs:
|
||||
# format: <filename_without_extension>: <value>
|
||||
home: Domů
|
||||
categories: Kategorie
|
||||
tags: Štítky
|
||||
archives: Archivy
|
||||
about: O mně
|
||||
|
||||
# the text displayed in the search bar & search results
|
||||
search:
|
||||
hint: hledat
|
||||
cancel: Zrušit
|
||||
no_results: Ups! Žádný výsledek nenalezen.
|
||||
|
||||
panel:
|
||||
lastmod: Nedávno aktualizováno
|
||||
trending_tags: Trendy štítky
|
||||
toc: Obsah
|
||||
|
||||
copyright:
|
||||
# Shown at the bottom of the post
|
||||
license:
|
||||
template: Tento příspěvek je licencován pod :LICENSE_NAME autorem.
|
||||
name: CC BY 4.0
|
||||
link: https://creativecommons.org/licenses/by/4.0/
|
||||
|
||||
# Displayed in the footer
|
||||
brief: Některá práva vyhrazena.
|
||||
verbose: >-
|
||||
Pokud není uvedeno jinak, jsou příspěvky na tomto webu licencovány
|
||||
pod licencí Creative Commons Attribution 4.0 International (CC BY 4.0) Licence autora.
|
||||
|
||||
meta: Použití :PLATFORM s motivem :THEME.
|
||||
|
||||
not_found:
|
||||
statment: Omlouváme se, adresu URL jsme špatně umístili nebo odkazuje na něco, co neexistuje.
|
||||
|
||||
notification:
|
||||
update_found: Je k dispozici nová verze obsahu.
|
||||
update: Aktualizace
|
||||
|
||||
# ----- Posts related labels -----
|
||||
|
||||
post:
|
||||
written_by: Od
|
||||
posted: Zveřejněno
|
||||
updated: Aktualizováno
|
||||
words: slova
|
||||
pageview_measure: zhlednutí
|
||||
read_time:
|
||||
unit: minut
|
||||
prompt: čtení
|
||||
relate_posts: Další čtení
|
||||
share: Sdílet
|
||||
button:
|
||||
next: Novější
|
||||
previous: Starší
|
||||
copy_code:
|
||||
succeed: Zkopírováno!
|
||||
share_link:
|
||||
title: Kopírovat odkaz
|
||||
succeed: Zkopírováno!
|
||||
# pinned prompt of posts list on homepage
|
||||
pin_prompt: Připnuto
|
||||
|
||||
# Date time format.
|
||||
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
|
||||
df:
|
||||
post:
|
||||
strftime: '%b %e, %Y'
|
||||
dayjs: 'll'
|
||||
archives:
|
||||
strftime: '%b'
|
||||
dayjs: 'MMM'
|
||||
|
||||
# categories page
|
||||
categories:
|
||||
category_measure: kategorie
|
||||
post_measure:
|
||||
singular: příspěvěk
|
||||
plural: příspěvky
|
||||
93
_data/locales/el-GR.yml
Normal file
93
_data/locales/el-GR.yml
Normal file
@@ -0,0 +1,93 @@
|
||||
# The layout text of site
|
||||
|
||||
# ----- Commons label -----
|
||||
|
||||
layout:
|
||||
post: Δημοσίευση
|
||||
category: Κατηγορία
|
||||
tag: Ετικέτα
|
||||
|
||||
# The tabs of sidebar
|
||||
tabs:
|
||||
# format: <filename_without_extension>: <value>
|
||||
home: Home
|
||||
categories: Κατηγορίες
|
||||
tags: Ετικέτες
|
||||
archives: Αρχεία
|
||||
about: Σχετικά
|
||||
|
||||
# the text displayed in the search bar & search results
|
||||
search:
|
||||
hint: αναζήτηση
|
||||
cancel: Ακύρωση
|
||||
no_results: Oops! Κανένα αποτέλεσμα δεν βρέθηκε.
|
||||
|
||||
panel:
|
||||
lastmod: Σχετικά ενημερωμένα
|
||||
trending_tags: Ετικέτες τάσης
|
||||
toc: Περιεχόμενα
|
||||
|
||||
copyright:
|
||||
# Shown at the bottom of the post
|
||||
license:
|
||||
template: Η δημοσίευση αυτή βρίσκεται υπο την άδεια :LICENSE_NAME Greekforce1821.
|
||||
name: CC BY 4.0
|
||||
link: https://creativecommons.org/licenses/by/4.0/
|
||||
|
||||
# Displayed in the footer
|
||||
brief: Ορισμένα δικαιώματα reserved.
|
||||
verbose: >-
|
||||
Εκτός αλλού ή οπουδήποτε αλλού, τα blog posts σε αυτήν την σελίδα βρίσκονται υπο την άδεια
|
||||
Creative Commons Attribution 4.0 International (CC BY 4.0) του δημιουργού.
|
||||
|
||||
meta: Αξιοποιώντας την :PLATFORM 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: Pinned
|
||||
|
||||
# Date time format.
|
||||
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
|
||||
df:
|
||||
post:
|
||||
strftime: '%b %e, %Y'
|
||||
dayjs: 'll'
|
||||
archives:
|
||||
strftime: '%b'
|
||||
dayjs: 'MMM'
|
||||
|
||||
# categories page
|
||||
categories:
|
||||
category_measure:
|
||||
singular: Κατηγορία
|
||||
plural: Κατηγορίες
|
||||
post_measure:
|
||||
singular: Δημοσίευση
|
||||
plural: Δημοσιεύσεις
|
||||
@@ -40,7 +40,7 @@ copyright:
|
||||
Except where otherwise noted, the blog posts on this site are licensed
|
||||
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.
|
||||
|
||||
meta: Powered by :PLATFORM with :THEME theme.
|
||||
meta: Using the :PLATFORM theme :THEME.
|
||||
|
||||
not_found:
|
||||
statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.
|
||||
|
||||
92
_data/locales/fi-FI.yml
Normal file
92
_data/locales/fi-FI.yml
Normal file
@@ -0,0 +1,92 @@
|
||||
# The layout text of site
|
||||
|
||||
# ----- Commons label -----
|
||||
|
||||
layout:
|
||||
post: Julkaisu
|
||||
category: Kateogoria
|
||||
tag: Tagi
|
||||
|
||||
# The tabs of sidebar
|
||||
tabs:
|
||||
# format: <filename_without_extension>: <value>
|
||||
home: Koti
|
||||
categories: Kateogoriat
|
||||
tags: Tagit
|
||||
archives: Arkistot
|
||||
about: Minusta
|
||||
|
||||
# the text displayed in the search bar & search results
|
||||
search:
|
||||
hint: etsi
|
||||
cancel: Peruuta
|
||||
no_results: Hups! Ei tuloksia.
|
||||
|
||||
panel:
|
||||
lastmod: Viimeksi päivitetty
|
||||
trending_tags: Trendaavat tagit
|
||||
toc: Sisältö
|
||||
|
||||
copyright:
|
||||
# Shown at the bottom of the post
|
||||
license:
|
||||
template: Tämä julkaisu on lisenssoitu :LICENSE_NAME julkaisijan toimesta.
|
||||
name: CC BY 4.0
|
||||
link: https://creativecommons.org/licenses/by/4.0/
|
||||
|
||||
# Displayed in the footer
|
||||
brief: Jotkut oikeudet pidätetään.
|
||||
verbose: >-
|
||||
Paitsi jos erikseen mainitaan on kaikki sisältö Creative Commons Attribution 4.0 International (CC BY 4.0) Lisensoitu kirjoittajan toimesta.
|
||||
|
||||
meta: Käytetään :PLATFORM iä Teema :THEME.
|
||||
|
||||
not_found:
|
||||
statment: Valitettavasti tällä URL-osoitteella ei ole saatavilla sisältöä.
|
||||
|
||||
notification:
|
||||
update_found: Uusi versio sisällöstä on saatavilla.
|
||||
update: Päivitä
|
||||
|
||||
# ----- Posts related labels -----
|
||||
|
||||
post:
|
||||
written_by: Kirjoittaja
|
||||
posted: Julkaistu
|
||||
updated: Päivitetty
|
||||
words: sanaa
|
||||
pageview_measure: katselukertoja
|
||||
read_time:
|
||||
unit: minuuttia
|
||||
prompt: lukea
|
||||
relate_posts: Jatka lukemista
|
||||
share: Jaa
|
||||
button:
|
||||
next: Uudempi
|
||||
previous: Vanhempi
|
||||
copy_code:
|
||||
succeed: Kopiotu!
|
||||
share_link:
|
||||
title: Kopioi linkki
|
||||
succeed: Linkki kopioitu onnistuneesti!
|
||||
# pinned prompt of posts list on homepage
|
||||
pin_prompt: Kiinnitetty
|
||||
|
||||
# Date time format.
|
||||
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
|
||||
df:
|
||||
post:
|
||||
strftime: '%b %e, %Y'
|
||||
dayjs: 'll'
|
||||
archives:
|
||||
strftime: '%b'
|
||||
dayjs: 'MMM'
|
||||
|
||||
# categories page
|
||||
categories:
|
||||
category_measure:
|
||||
singular: kategoria
|
||||
plural: kategoriat
|
||||
post_measure:
|
||||
singular: julkaisu
|
||||
plural: julkaisut
|
||||
93
_data/locales/it-IT.yml
Normal file
93
_data/locales/it-IT.yml
Normal file
@@ -0,0 +1,93 @@
|
||||
# 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: Pagina principale
|
||||
categories: Categorie
|
||||
tags: Tags
|
||||
archives: Archivio
|
||||
about: Informazioni
|
||||
|
||||
# the text displayed in the search bar & search results
|
||||
search:
|
||||
hint: ricerca
|
||||
cancel: Cancella
|
||||
no_results: Oops! La ricerca non ha fornito risultati.
|
||||
|
||||
panel:
|
||||
lastmod: Aggiornati recentemente
|
||||
trending_tags: Tags più cliccati
|
||||
toc: Contenuti
|
||||
|
||||
copyright:
|
||||
# Shown at the bottom of the post
|
||||
license:
|
||||
template: Questo post è sotto licenza :LICENSE_NAME a nome dell'autore.
|
||||
name: CC BY 4.0
|
||||
link: https://creativecommons.org/licenses/by/4.0/
|
||||
|
||||
# Displayed in the footer
|
||||
brief: Alcuni diritti riservati.
|
||||
verbose: >-
|
||||
Eccetto quando esplicitamente menzionato, i post di questo blog sono da ritenersi sotto
|
||||
i termini di licenza Creative Commons Attribution 4.0 International (CC BY 4.0).
|
||||
|
||||
|
||||
meta: Servizio offerto da :PLATFORM con tema :THEME.
|
||||
not_found:
|
||||
statment: Ci scusiamo, non è stato possibile trovare l'URL in questione. Potrebbe puntare ad una pagina non esistente.
|
||||
|
||||
notification:
|
||||
update_found: Nuova versione del contenuto disponibile.
|
||||
update: Aggiornamento
|
||||
|
||||
# ----- Posts related labels -----
|
||||
|
||||
post:
|
||||
written_by: Da
|
||||
posted: Postato
|
||||
updated: Aggiornato
|
||||
words: parole
|
||||
pageview_measure: visioni
|
||||
read_time:
|
||||
unit: min
|
||||
prompt: lettura
|
||||
relate_posts: Continua a leggere
|
||||
share: Condividi
|
||||
button:
|
||||
next: Più recenti
|
||||
previous: Meno recenti
|
||||
copy_code:
|
||||
succeed: Copiato!
|
||||
share_link:
|
||||
title: Copia link
|
||||
succeed: Link copiato con successo!
|
||||
# pinned prompt of posts list on homepage
|
||||
pin_prompt: In alto
|
||||
|
||||
# Date time format.
|
||||
# See: <http://strftime.net/>, <https://day.js.org/docs/en/display/format>
|
||||
df:
|
||||
post:
|
||||
strftime: '%b %e, %Y'
|
||||
dayjs: 'll'
|
||||
archives:
|
||||
strftime: '%b'
|
||||
dayjs: 'MMM'
|
||||
|
||||
# categories page
|
||||
categories:
|
||||
category_measure:
|
||||
singular: categoria
|
||||
plural: categorie
|
||||
post_measure:
|
||||
singular: post
|
||||
plural: posts
|
||||
@@ -2,26 +2,24 @@
|
||||
# Icons from <https://fontawesome.com/>
|
||||
|
||||
platforms:
|
||||
-
|
||||
type: Twitter
|
||||
- type: Twitter
|
||||
icon: "fab fa-twitter"
|
||||
link: "https://twitter.com/intent/tweet?text=TITLE&url=URL"
|
||||
-
|
||||
type: Facebook
|
||||
|
||||
- type: Facebook
|
||||
icon: "fab fa-facebook-square"
|
||||
link: "https://www.facebook.com/sharer/sharer.php?title=TITLE&u=URL"
|
||||
-
|
||||
type: Telegram
|
||||
|
||||
- type: Telegram
|
||||
icon: "fab fa-telegram"
|
||||
link: "https://t.me/share/url?url=URL&text=TITLE"
|
||||
|
||||
# Uncomment below if you need to.
|
||||
# -
|
||||
# type: Linkedin
|
||||
#
|
||||
# - type: Linkedin
|
||||
# icon: "fab fa-linkedin"
|
||||
# link: "https://www.linkedin.com/sharing/share-offsite/?url=URL"
|
||||
#
|
||||
# -
|
||||
# type: Weibo
|
||||
# - type: Weibo
|
||||
# icon: "fab fa-weibo"
|
||||
# link: "http://service.weibo.com/share/share.php?title=TITLE&url=URL"
|
||||
|
||||
@@ -1,54 +1,49 @@
|
||||
<!--
|
||||
The Disqus lazy loading.
|
||||
-->
|
||||
<!-- The Disqus lazy loading. -->
|
||||
<div id="disqus_thread" class="pt-2 pb-2">
|
||||
<p class="text-center text-muted small">
|
||||
Comments powered by <a href="https://disqus.com/">Disqus</a>.
|
||||
</p>
|
||||
<p class="text-center text-muted small">Comments powered by <a href="https://disqus.com/">Disqus</a>.</p>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var disqus_config = function () {
|
||||
this.page.url = '{{ page.url | absolute_url }}';
|
||||
this.page.identifier = '{{ page.url }}';
|
||||
};
|
||||
|
||||
/* Lazy loading */
|
||||
|
||||
var disqus_observer = new IntersectionObserver(function (entries) {
|
||||
if(entries[0].isIntersecting) {
|
||||
var disqus_observer = new IntersectionObserver(
|
||||
function (entries) {
|
||||
if (entries[0].isIntersecting) {
|
||||
(function () {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
|
||||
s.setAttribute('data-timestamp', +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
var d = document,
|
||||
s = d.createElement('script');
|
||||
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
|
||||
s.setAttribute('data-timestamp', +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
|
||||
disqus_observer.disconnect();
|
||||
}
|
||||
}, { threshold: [0] });
|
||||
}
|
||||
},
|
||||
{ threshold: [0] }
|
||||
);
|
||||
|
||||
disqus_observer.observe(document.querySelector('#disqus_thread'));
|
||||
|
||||
/* Auto switch theme */
|
||||
|
||||
function reloadDisqus() {
|
||||
/* Disqus hasn't been loaded */
|
||||
if (typeof DISQUS === "undefined") {
|
||||
return;
|
||||
}
|
||||
if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
|
||||
/* Disqus hasn't been loaded */
|
||||
if (typeof DISQUS === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (document.readyState == 'complete') {
|
||||
DISQUS.reset({ reload: true, config: disqus_config });
|
||||
if (document.readyState == 'complete') {
|
||||
DISQUS.reset({ reload: true, config: disqus_config });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const modeToggle = document.querySelector(".mode-toggle");
|
||||
|
||||
if (typeof modeToggle !== "undefined") {
|
||||
/* modeToggle.addEventListener('click', reloadDisqus); // not pretty for 'color-scheme' */
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', reloadDisqus);
|
||||
if (document.querySelector('.mode-toggle')) {
|
||||
window.addEventListener('message', reloadDisqus);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
4
_includes/embed/twitch.html
Normal file
4
_includes/embed/twitch.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<iframe class="embed-video twitch lazyload"
|
||||
src="https://player.twitch.tv/?video={{ include.id }}&parent={{ site.url | split: '://' | last | remove: '/' }}"
|
||||
frameborder="0" allowfullscreen="true"
|
||||
scrolling="no"></iframe>
|
||||
6
_includes/embed/youtube.html
Normal file
6
_includes/embed/youtube.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<iframe class="embed-video youtube lazyload"
|
||||
src="https://www.youtube.com/embed/{{ include.id }}"
|
||||
title="YouTube video player"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen></iframe>
|
||||
@@ -17,16 +17,16 @@
|
||||
<div class="footer-right">
|
||||
<p class="mb-0">
|
||||
|
||||
{% capture _platform %}
|
||||
{%- capture _platform -%}
|
||||
<a href="https://jekyllrb.com" target="_blank" rel="noopener">Jekyll</a>
|
||||
{% endcapture %}
|
||||
{%- endcapture -%}
|
||||
|
||||
{% capture _theme %}
|
||||
{%- capture _theme -%}
|
||||
<a href="https://github.com/cotes2020/jekyll-theme-chirpy" target="_blank" rel="noopener">Chirpy</a>
|
||||
{% endcapture %}
|
||||
{%- endcapture -%}
|
||||
|
||||
{{ site.data.locales[site.lang].meta
|
||||
| default: 'Powered by :PLATFORM with :THEME theme.'
|
||||
| default: 'Using the :PLATFORM theme :THEME.'
|
||||
| replace: ':PLATFORM', _platform | replace: ':THEME', _theme
|
||||
}}
|
||||
</p>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
<!--
|
||||
The Head
|
||||
-->
|
||||
<!-- The Head -->
|
||||
|
||||
<head>
|
||||
<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="theme-color" media="(prefers-color-scheme: light)" content="#f7f7f7">
|
||||
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#1b1b1e">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, user-scalable=no initial-scale=1, shrink-to-fit=no, viewport-fit=cover"
|
||||
>
|
||||
|
||||
{% if page.layout == 'home' or page.layout == 'post' %}
|
||||
|
||||
{% if site.google_analytics.pv.proxy_endpoint %}
|
||||
<meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}">
|
||||
{% endif %}
|
||||
@@ -15,61 +19,58 @@
|
||||
{% if site.google_analytics.pv.cache_path %}
|
||||
<meta name="pv-cache-path" content="{{ site.google_analytics.pv.cache_path | relative_url }}">
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% capture seo_tags %}
|
||||
{% seo title=false %}
|
||||
{% endcapture %}
|
||||
|
||||
{% if site.img_cdn and seo_tags contains 'og:image' %}
|
||||
{% assign properties = 'og:image,twitter:image' | split: ',' %}
|
||||
{% if page.image %}
|
||||
{% assign img = page.image.path | default: page.image %}
|
||||
|
||||
{% unless img contains '://' %}
|
||||
{% assign img_path = page.img_path | append: '/' | append: img | replace: '//', '/' %}
|
||||
{% capture target %}"{{ img | absolute_url }}"{% endcapture %}
|
||||
|
||||
{% 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 %}
|
||||
<!-- it's a cross-origin URL -->
|
||||
{% capture replacement %}"{{ site.img_cdn }}{{ img_path }}"{% 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 %}
|
||||
<!-- it's a local file path -->
|
||||
{%- capture replacement -%}
|
||||
"{{ site.img_cdn | append: '/' | append: img_path | replace: '//', '/' | absolute_url }}"
|
||||
{%- endcapture -%}
|
||||
{% endif %}
|
||||
|
||||
{% assign seo_tags = seo_tags | replace: target, replacement %}
|
||||
|
||||
{% endfor %}
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
|
||||
{{ seo_tags }}
|
||||
|
||||
<title>
|
||||
{%- unless page.layout == "home" -%}
|
||||
{{ page.title | append: " | "}}
|
||||
{%- endunless -%}
|
||||
{%- unless page.layout == 'home' -%}
|
||||
{{ page.title | append: ' | ' }}
|
||||
{%- endunless -%}
|
||||
{{ site.title }}
|
||||
</title>
|
||||
|
||||
{% include favicons.html %}
|
||||
|
||||
{% if site.resources.ignore_env != jekyll.environment and site.resources.self_hosted %}
|
||||
|
||||
<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 -->
|
||||
{% if jekyll.environment == 'production'
|
||||
and site.google_analytics.id != empty and site.google_analytics.id %}
|
||||
{% 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="dns-prefetch" href="https://www.google-analytics.com">
|
||||
|
||||
@@ -78,7 +79,11 @@
|
||||
|
||||
{% if 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="dns-prefetch" href="{{ proxy_url }}">
|
||||
{% endif %}
|
||||
@@ -93,7 +98,7 @@
|
||||
<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 }}">
|
||||
<link rel="stylesheet" href="{{ site.data.assets[origin].toc.css | relative_url }}">
|
||||
{% endif %}
|
||||
|
||||
{% if page.layout == 'page' or page.layout == 'post' %}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<!--
|
||||
JS selector for site.
|
||||
-->
|
||||
<!-- JS selector for site. -->
|
||||
|
||||
<!-- layout specified -->
|
||||
|
||||
@@ -8,52 +6,50 @@
|
||||
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
|
||||
<!-- pv-report needs countup.js -->
|
||||
<script async src="{{ site.data.assets[origin].countup.js | relative_url }}"></script>
|
||||
<script defer src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.layout == 'post' or page.layout == 'page' %}
|
||||
<!-- image lazy-loading & popup & clipboard -->
|
||||
{% 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
|
||||
{% assign _urls = site.data.assets[origin]['magnific-popup'].js
|
||||
| append: ','
|
||||
| append: site.data.assets[origin].lazysizes.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' %}
|
||||
|
||||
or page.layout == 'post'
|
||||
or page.layout == 'archives'
|
||||
or page.layout == 'category'
|
||||
or page.layout == 'tag'
|
||||
%}
|
||||
{% assign locale = site.lang | split: '-' | first %}
|
||||
|
||||
{% 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
|
||||
| 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 %}
|
||||
|
||||
{% if page.layout == 'home'
|
||||
or page.layout == 'categories'
|
||||
or page.layout == 'post'
|
||||
or page.layout == 'page' %}
|
||||
{% assign type = page.layout %}
|
||||
{% elsif page.layout == 'archives'
|
||||
or page.layout == 'category'
|
||||
or page.layout == 'tag' %}
|
||||
{% assign type = "misc" %}
|
||||
{% else %}
|
||||
{% assign type = "commons" %}
|
||||
{% endif %}
|
||||
{% case page.layout %}
|
||||
{% when 'categories', 'post', 'page' %}
|
||||
{% assign type = page.layout %}
|
||||
{% when 'home', 'archives', 'category', 'tag' %}
|
||||
{% assign type = 'misc' %}
|
||||
{% else %}
|
||||
{% assign type = 'commons' %}
|
||||
{% endcase %}
|
||||
|
||||
{% capture script %}/assets/js/dist/{{ type }}.min.js{% endcapture %}
|
||||
<script defer src="{{ script | relative_url }}"></script>
|
||||
@@ -61,23 +57,24 @@
|
||||
{% if page.math %}
|
||||
<!-- MathJax -->
|
||||
<script>
|
||||
/* see: <https://docs.mathjax.org/en/latest/options/input/tex.html#tex-options> */
|
||||
MathJax = {
|
||||
tex: {
|
||||
inlineMath: [ /* start/end delimiter pairs for in-line math */
|
||||
['$','$'],
|
||||
['\\(','\\)']
|
||||
],
|
||||
displayMath: [ /* start/end delimiter pairs for display math */
|
||||
['$$', '$$'],
|
||||
['\\[', '\\]']
|
||||
]
|
||||
}
|
||||
};
|
||||
/* see: <https://docs.mathjax.org/en/latest/options/input/tex.html#tex-options> */
|
||||
MathJax = {
|
||||
tex: {
|
||||
/* start/end delimiter pairs for in-line math */
|
||||
inlineMath: [
|
||||
['$', '$'],
|
||||
['\\(', '\\)']
|
||||
],
|
||||
/* start/end delimiter pairs for display math */
|
||||
displayMath: [
|
||||
['$$', '$$'],
|
||||
['\\[', '\\]']
|
||||
]
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="{{ site.data.assets[origin].polyfill.js | relative_url }}"></script>
|
||||
<script id="MathJax-script" async src="{{ site.data.assets[origin].mathjax.js | relative_url }}">
|
||||
</script>
|
||||
<script id="MathJax-script" async src="{{ site.data.assets[origin].mathjax.js | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
<!-- commons -->
|
||||
@@ -96,5 +93,4 @@
|
||||
{% if site.google_analytics.id != empty and site.google_analytics.id %}
|
||||
{% include google-analytics.html %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
<script src="{{ site.data.assets[origin].mermaid.js | relative_url }}"></script>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
(function () {
|
||||
|
||||
function updateMermaid(event) {
|
||||
if (event.source === window && event.data &&
|
||||
event.data.direction === ModeToggle.ID) {
|
||||
event.data.direction === ModeToggle.ID) {
|
||||
|
||||
const mode = event.data.message;
|
||||
|
||||
@@ -16,11 +17,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let expectedTheme = (mode === ModeToggle.DARK_MODE? "dark" : "default");
|
||||
let config = { theme: expectedTheme };
|
||||
let expectedTheme = (mode === ModeToggle.DARK_MODE ? "dark" : "default");
|
||||
let config = {theme: expectedTheme};
|
||||
|
||||
/* Re-render the SVG › <https://github.com/mermaid-js/mermaid/issues/311#issuecomment-332557344> */
|
||||
$(".mermaid").each(function() {
|
||||
$(".mermaid").each(function () {
|
||||
let svgCode = $(this).prev().children().html();
|
||||
$(this).removeAttr("data-processed");
|
||||
$(this).html(svgCode);
|
||||
@@ -35,7 +36,7 @@
|
||||
|
||||
if ($("html[data-mode=dark]").length > 0
|
||||
|| ($("html[data-mode]").length == 0
|
||||
&& window.matchMedia("(prefers-color-scheme: dark)").matches ) ) {
|
||||
&& window.matchMedia("(prefers-color-scheme: dark)").matches)) {
|
||||
initTheme = "dark";
|
||||
}
|
||||
|
||||
@@ -43,15 +44,16 @@
|
||||
theme: initTheme /* <default|dark|forest|neutral> */
|
||||
};
|
||||
|
||||
/* Markdown converts to HTML */
|
||||
$("pre").has("code.language-mermaid").each(function() {
|
||||
/* Create mermaid tag */
|
||||
$("pre").has("code.language-mermaid").each(function () {
|
||||
let svgCode = $(this).children().html();
|
||||
$(this).addClass("unloaded");
|
||||
$(this).after(`<div class=\"mermaid\">${svgCode}</div>`);
|
||||
$(this).after(`<pre class=\"mermaid\">${svgCode}</pre>`);
|
||||
});
|
||||
|
||||
mermaid.initialize(mermaidConf);
|
||||
|
||||
window.addEventListener("message", updateMermaid);
|
||||
});
|
||||
})();
|
||||
|
||||
</script>
|
||||
|
||||
@@ -26,13 +26,12 @@
|
||||
let self = this;
|
||||
|
||||
/* always follow the system prefers */
|
||||
this.sysDarkPrefers.addEventListener("change", () => {
|
||||
this.sysDarkPrefers.addEventListener('change', () => {
|
||||
if (self.hasMode) {
|
||||
if (self.isDarkMode) {
|
||||
if (!self.isSysDarkPrefer) {
|
||||
self.setDark();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (self.isSysDarkPrefer) {
|
||||
self.setLight();
|
||||
@@ -43,9 +42,7 @@
|
||||
}
|
||||
|
||||
self.notify();
|
||||
|
||||
});
|
||||
|
||||
} /* constructor() */
|
||||
|
||||
get sysDarkPrefers() { return window.matchMedia("(prefers-color-scheme: dark)"); }
|
||||
@@ -62,8 +59,7 @@
|
||||
|
||||
/* get the current mode on screen */
|
||||
get modeStatus() {
|
||||
if (this.isDarkMode
|
||||
|| (!this.hasMode && this.isSysDarkPrefer)) {
|
||||
if (this.isDarkMode || (!this.hasMode && this.isSysDarkPrefer)) {
|
||||
return ModeToggle.DARK_MODE;
|
||||
} else {
|
||||
return ModeToggle.LIGHT_MODE;
|
||||
@@ -93,37 +89,32 @@
|
||||
}, "*");
|
||||
}
|
||||
|
||||
flipMode() {
|
||||
if (this.hasMode) {
|
||||
if (this.isSysDarkPrefer) {
|
||||
if (this.isLightMode) {
|
||||
this.clearMode();
|
||||
} else {
|
||||
this.setLight();
|
||||
}
|
||||
} else {
|
||||
if (this.isDarkMode) {
|
||||
this.clearMode();
|
||||
} else {
|
||||
this.setDark();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.isSysDarkPrefer) {
|
||||
this.setLight();
|
||||
} else {
|
||||
this.setDark();
|
||||
}
|
||||
}
|
||||
|
||||
this.notify();
|
||||
} /* flipMode() */
|
||||
} /* ModeToggle */
|
||||
|
||||
const toggle = new ModeToggle();
|
||||
|
||||
function flipMode() {
|
||||
if (toggle.hasMode) {
|
||||
if (toggle.isSysDarkPrefer) {
|
||||
if (toggle.isLightMode) {
|
||||
toggle.clearMode();
|
||||
} else {
|
||||
toggle.setLight();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (toggle.isDarkMode) {
|
||||
toggle.clearMode();
|
||||
} else {
|
||||
toggle.setDark();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (toggle.isSysDarkPrefer) {
|
||||
toggle.setLight();
|
||||
} else {
|
||||
toggle.setDark();
|
||||
}
|
||||
}
|
||||
|
||||
toggle.notify();
|
||||
|
||||
} /* flipMode() */
|
||||
|
||||
const modeToggle = new ModeToggle();
|
||||
</script>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<span class="share-label text-muted mr-1">{{ site.data.locales[site.lang].post.share }}</span>
|
||||
<span class="share-icons">
|
||||
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
|
||||
{% assign title = title | url_encode %}
|
||||
{% assign title = title | uri_escape %}
|
||||
{% assign url = page.url | absolute_url | url_encode %}
|
||||
|
||||
{% for share in site.data.share.platforms %}
|
||||
|
||||
@@ -51,31 +51,52 @@
|
||||
{% assign _img_content = nil %}
|
||||
{% assign _img_snippets = _content | split: IMG_TAG %}
|
||||
|
||||
<!-- CDN URL -->
|
||||
{% if site.img_cdn %}
|
||||
{% if site.img_cdn contains '//' %}
|
||||
{% assign _path_prefix = site.img_cdn %}
|
||||
{% else %}
|
||||
{% assign _path_prefix = site.img_cdn | relative_url %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% assign _path_prefix = site.baseurl %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Add image path -->
|
||||
{% if page.img_path %}
|
||||
{% assign _path = page.img_path | append: '/' | replace: '//', '/' %}
|
||||
{% assign _path_prefix = _path_prefix | append: _path %}
|
||||
{% endif %}
|
||||
|
||||
{% for _img_snippet in _img_snippets %}
|
||||
{% if forloop.first %}
|
||||
{% assign _img_content = _img_snippet %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% assign _width = nil %}
|
||||
{% assign _height = nil %}
|
||||
{% assign _src = nil %}
|
||||
|
||||
{% assign _left = _img_snippet | split: '>' | first %}
|
||||
{% assign _right = _img_snippet | remove: _left %}
|
||||
|
||||
{% assign _left = _left | remove: ' /' %}
|
||||
{% assign _left = _left | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
|
||||
{% assign _attrs = _left | split: ' ' %}
|
||||
{% unless _left contains 'src=' %}
|
||||
{% continue %}
|
||||
{% endunless %}
|
||||
|
||||
{% assign _left = _left | remove: ' /' | replace: ' w=', ' width=' | replace: ' h=', ' height=' %}
|
||||
{% assign _attrs = _left | split: '" ' %}
|
||||
|
||||
{% assign _width = nil %}
|
||||
{% assign _height = nil %}
|
||||
{% assign _lqip = nil %}
|
||||
{% assign _class = nil %}
|
||||
|
||||
{% for _attr in _attrs %}
|
||||
{% assign _pair = _attr | split: '=' %}
|
||||
{% if _pair.size < 2 %}
|
||||
{% unless _attr contains '=' %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
{% endunless %}
|
||||
|
||||
{% assign _pair = _attr | remove: '"' | split: '=' %}
|
||||
{% capture _key %}{{ _pair | first }}{% endcapture %}
|
||||
{% capture _value %}{{ _pair | last | replace: '"', '' }}{% endcapture %}
|
||||
{% capture _value %}{{ _pair | last }}{% endcapture %}
|
||||
|
||||
{% case _key %}
|
||||
{% when 'width' %}
|
||||
@@ -84,68 +105,91 @@
|
||||
{% assign _height = _value %}
|
||||
{% when 'src' %}
|
||||
{% assign _src = _value %}
|
||||
{% when 'lqip' %}
|
||||
{% assign _lqip = _value %}
|
||||
{% when 'class' %}
|
||||
{% assign _class = _value %}
|
||||
{% endcase %}
|
||||
|
||||
{% if _width and _height and _src %}
|
||||
{% break %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if _src %}
|
||||
{% unless _src contains '://' %}
|
||||
|
||||
<!-- Add CDN URL -->
|
||||
{% if 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 %}
|
||||
{% assign _src_prefix = site.baseurl %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Add image path -->
|
||||
{% if page.img_path %}
|
||||
{% assign _path = page.img_path %}
|
||||
{% assign last_char = _path | slice: -1 %}
|
||||
|
||||
{% unless last_char == '/' %}
|
||||
{% assign _path = _path | append: '/' %}
|
||||
{% endunless %}
|
||||
|
||||
{% assign _src_prefix = _src_prefix | append: _path %}
|
||||
{% endif %}
|
||||
|
||||
{% assign _final_src = _src_prefix | append: _src %}
|
||||
{% assign _left = _left | replace: _src, _final_src %}
|
||||
|
||||
{% endunless %}
|
||||
|
||||
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
|
||||
|
||||
{% assign _left = _left | replace: 'src=', 'data-src=' %}
|
||||
|
||||
<!-- take out classes -->
|
||||
{% if _class %}
|
||||
{% capture _old_class %}class="{{ _class }}"{% endcapture %}
|
||||
{% assign _left = _left | remove: _old_class %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Add SVG placehoder to prevent layout reflow -->
|
||||
{% assign _final_src = nil %}
|
||||
|
||||
{% if _width and _height %}
|
||||
{%- capture _svg -%}
|
||||
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{ _width }} {{ _height }}'%3E%3C/svg%3E"
|
||||
{%- endcapture -%}
|
||||
{% unless _src contains '//' %}
|
||||
{% assign _final_src = _path_prefix | append: _src %}
|
||||
{% capture _src_from %}"{{ _src }}"{% endcapture %}
|
||||
{% capture _src_to %}"{{ _final_src }}"{% endcapture %}
|
||||
{% assign _left = _left | replace: _src_from, _src_to %}
|
||||
{% endunless %}
|
||||
|
||||
{% assign _left = _svg | append: ' ' | append: _left %}
|
||||
{% if _lqip %}
|
||||
{% unless _lqip contains ':' %}
|
||||
{% assign _final_lqip = _path_prefix | append: _lqip %}
|
||||
{% capture _lqip_from %}"{{ _lqip }}"{% endcapture %}
|
||||
{% capture _lqip_to %}"{{ _final_lqip }}"{% endcapture %}
|
||||
{% assign _left = _left | replace: _lqip_from, _lqip_to %}
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
|
||||
<!-- lazy-load images <https://github.com/aFarkas/lazysizes#readme> -->
|
||||
{% assign _left = _left | replace: 'src=', 'data-src=' %}
|
||||
{% if _left contains 'class=' %}
|
||||
{% assign _left = _left | replace: 'class="', 'class="lazyload '%}
|
||||
{% else %}
|
||||
{% assign _left = _left | append: ' class="lazyload"' %}
|
||||
{% endif %}
|
||||
|
||||
<!-- add image placeholder -->
|
||||
{% if _lqip %}
|
||||
{% assign _left = _left | replace: ' lqip=', ' data-lqip="true" src=' %}
|
||||
{% else %}
|
||||
{% if _width and _height %}
|
||||
<!-- add SVG placehoder -->
|
||||
{%- capture _svg -%}
|
||||
src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 {{ _width }} {{ _height }}'%3E%3C/svg%3E"
|
||||
{%- endcapture -%}
|
||||
{% assign _left = _svg | append: ' ' | append: _left %}
|
||||
{% assign _class = _class | append: ' shimmer' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Bypass the HTML-proofer test -->
|
||||
{% assign _left = _left | append: ' data-proofer-ignore' %}
|
||||
|
||||
<!-- make sure the `<img>` is wrapped by `<a>` -->
|
||||
{% assign _parent = _right | slice: 1, 4 %}
|
||||
|
||||
{% if _parent == '</a>' %}
|
||||
<!-- add class to exist <a> tag -->
|
||||
{% assign _size = _img_content | size | minus: 1 %}
|
||||
{% capture _class %}
|
||||
class="img-link{% unless _lqip %} shimmer{% endunless %}"
|
||||
{% endcapture %}
|
||||
{% assign _img_content = _img_content | slice: 0, _size | append: _class | append: '>' %}
|
||||
|
||||
{% else %}
|
||||
<!-- create the image wrapper -->
|
||||
{%- capture _wrapper_start -%}
|
||||
<a href="{{ _final_src | default: _src }}" class="popup img-link {{ _class }}">
|
||||
{%- endcapture -%}
|
||||
{% assign _img_content = _img_content | append: _wrapper_start %}
|
||||
{% assign _right = _right | prepend: '></a' %}
|
||||
{% endif %}
|
||||
|
||||
<!-- combine -->
|
||||
{% assign _img_content = _img_content | append: IMG_TAG | append: _left | append: _right %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% assign _content = _img_content %}
|
||||
{% if _img_content %}
|
||||
{% assign _content = _img_content %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
@@ -233,54 +277,6 @@
|
||||
|
||||
{% 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 -->
|
||||
|
||||
{{ _content }}
|
||||
|
||||
@@ -64,24 +64,37 @@
|
||||
{% endunless %}
|
||||
|
||||
{% for entry in site.data.contact %}
|
||||
{% capture url %}
|
||||
{%- if entry.type == 'github' -%}
|
||||
https://github.com/{{ site.github.username }}
|
||||
{%- elsif entry.type == 'twitter' -%}
|
||||
https://twitter.com/{{ site.twitter.username }}
|
||||
{%- elsif entry.type == 'email' -%}
|
||||
{% case entry.type %}
|
||||
{% when 'github', 'twitter' %}
|
||||
{%- capture url -%}
|
||||
https://{{ entry.type }}.com/{{ site[entry.type].username }}
|
||||
{%- endcapture -%}
|
||||
{% when 'email' %}
|
||||
{% assign email = site.social.email | split: '@' %}
|
||||
javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
|
||||
{%- elsif entry.type == 'rss' -%}
|
||||
{{ "/feed.xml" | relative_url }}
|
||||
{%- else -%}
|
||||
{{ entry.url }}
|
||||
{%- endif -%}
|
||||
{% endcapture %}
|
||||
{%- capture url -%}
|
||||
javascript:location.href = 'mailto:' + ['{{ email[0] }}','{{ email[1] }}'].join('@')
|
||||
{%- endcapture -%}
|
||||
{% when 'rss' %}
|
||||
{% assign url = '/feed.xml' | relative_url %}
|
||||
{% else %}
|
||||
{% assign url = entry.url %}
|
||||
{% endcase %}
|
||||
|
||||
{% if url %}
|
||||
<a href="{{ url }}" aria-label="{{ entry.type }}"
|
||||
{% unless entry.noblank %}target="_blank" rel="noopener"{% endunless %}>
|
||||
{% assign link_types = '' %}
|
||||
|
||||
{% unless entry.noblank %}
|
||||
target="_blank"
|
||||
{% assign link_types = 'noopener noreferrer' %}
|
||||
{% endunless %}
|
||||
|
||||
{% if entry.type == 'mastodon' %}
|
||||
{% assign link_types = link_types | append: ' me' | strip %}
|
||||
{% endif %}
|
||||
|
||||
{% unless link_types == empty %}rel="{{ link_types }}"{% endunless %}>
|
||||
|
||||
<i class="{{ entry.icon }}"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
{% endif %}
|
||||
|
||||
{% if enable_toc %}
|
||||
<!-- BS-toc.js will be loaded at medium priority -->
|
||||
<script src="{{ site.data.assets[origin].bootstrap-toc.js | relative_url }}"></script>
|
||||
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
|
||||
<div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[site.lang].panel.toc -}}</div>
|
||||
<nav id="toc"></nav>
|
||||
</div>
|
||||
|
||||
<div id="toc-wrapper" class="pl-0 pr-4 mb-5">
|
||||
<div class="panel-heading pl-3 pt-2 mb-2">{{- site.data.locales[site.lang].panel.toc -}}</div>
|
||||
<nav id="toc" data-toggle="toc"></nav>
|
||||
</div>
|
||||
<!-- toc.js will be loaded at medium priority -->
|
||||
<script src="{{ site.data.assets[origin].toc.js | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
3
_javascript/_copyright
Normal file
3
_javascript/_copyright
Normal file
@@ -0,0 +1,3 @@
|
||||
Chirpy v<%= pkg.version %> (<%= pkg.homepage %>)
|
||||
© 2019 <%= pkg.author %>
|
||||
<%= pkg.license %> Licensed
|
||||
7
_javascript/categories.js
Normal file
7
_javascript/categories.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { basic, initSidebar, initTopbar } from './modules/layouts';
|
||||
import { categoryCollapse } from './modules/plugins';
|
||||
|
||||
basic();
|
||||
initSidebar();
|
||||
initTopbar();
|
||||
categoryCollapse();
|
||||
5
_javascript/commons.js
Normal file
5
_javascript/commons.js
Normal file
@@ -0,0 +1,5 @@
|
||||
import { basic, initSidebar, initTopbar } from './modules/layouts';
|
||||
|
||||
basic();
|
||||
initSidebar();
|
||||
initTopbar();
|
||||
@@ -1,20 +0,0 @@
|
||||
/**
|
||||
* Reference: https://bootsnipp.com/snippets/featured/link-to-top-page
|
||||
*/
|
||||
$(function() {
|
||||
$(window).scroll(() => {
|
||||
if ($(this).scrollTop() > 50 &&
|
||||
$("#sidebar-trigger").css("display") === "none") {
|
||||
$("#back-to-top").fadeIn();
|
||||
} else {
|
||||
$("#back-to-top").fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
$("#back-to-top").click(() => {
|
||||
$("body,html").animate({
|
||||
scrollTop: 0
|
||||
}, 800);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Listener for theme mode toggle
|
||||
*/
|
||||
$(function () {
|
||||
$(".mode-toggle").click((e) => {
|
||||
const $target = $(e.target);
|
||||
let $btn = ($target.prop("tagName") === "button".toUpperCase() ?
|
||||
$target : $target.parent());
|
||||
|
||||
$btn.blur(); // remove the clicking outline
|
||||
flipMode();
|
||||
});
|
||||
});
|
||||
@@ -1,38 +0,0 @@
|
||||
/**
|
||||
* A tool for smooth scrolling and topbar switcher
|
||||
*/
|
||||
const ScrollHelper = (function () {
|
||||
const $body = $("body");
|
||||
const ATTR_TOPBAR_VISIBLE = "data-topbar-visible";
|
||||
const topbarHeight = $("#topbar-wrapper").outerHeight();
|
||||
|
||||
let scrollUpCount = 0; // the number of times the scroll up was triggered by ToC or anchor
|
||||
let topbarLocked = false;
|
||||
let orientationLocked = false;
|
||||
|
||||
return {
|
||||
hideTopbar: () => $body.attr(ATTR_TOPBAR_VISIBLE, false),
|
||||
showTopbar: () => $body.attr(ATTR_TOPBAR_VISIBLE, true),
|
||||
|
||||
// scroll up
|
||||
|
||||
addScrollUpTask: () => {
|
||||
scrollUpCount += 1;
|
||||
if (!topbarLocked) {
|
||||
topbarLocked = true;
|
||||
}
|
||||
},
|
||||
popScrollUpTask: () => scrollUpCount -= 1,
|
||||
hasScrollUpTask: () => scrollUpCount > 0,
|
||||
topbarLocked: () => topbarLocked === true,
|
||||
unlockTopbar: () => topbarLocked = false,
|
||||
getTopbarHeight: () => topbarHeight,
|
||||
|
||||
// orientation change
|
||||
|
||||
orientationLocked: () => orientationLocked === true,
|
||||
lockOrientation: () => orientationLocked = true,
|
||||
unLockOrientation: () => orientationLocked = false
|
||||
};
|
||||
|
||||
}());
|
||||
@@ -1,129 +0,0 @@
|
||||
/**
|
||||
* This script make #search-result-wrapper switch to unloaded or shown automatically.
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
const btnSbTrigger = $("#sidebar-trigger");
|
||||
const btnSearchTrigger = $("#search-trigger");
|
||||
const btnCancel = $("#search-cancel");
|
||||
const main = $("#main");
|
||||
const topbarTitle = $("#topbar-title");
|
||||
const searchWrapper = $("#search-wrapper");
|
||||
const resultWrapper = $("#search-result-wrapper");
|
||||
const results = $("#search-results");
|
||||
const input = $("#search-input");
|
||||
const hints = $("#search-hints");
|
||||
|
||||
const scrollBlocker = (function () {
|
||||
let offset = 0;
|
||||
return {
|
||||
block() {
|
||||
offset = window.scrollY;
|
||||
$("html,body").scrollTop(0);
|
||||
},
|
||||
release() {
|
||||
$("html,body").scrollTop(offset);
|
||||
},
|
||||
getOffset() {
|
||||
return offset;
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
/*--- Actions in mobile screens (Sidebar hidden) ---*/
|
||||
|
||||
const mobileSearchBar = (function () {
|
||||
return {
|
||||
on() {
|
||||
btnSbTrigger.addClass("unloaded");
|
||||
topbarTitle.addClass("unloaded");
|
||||
btnSearchTrigger.addClass("unloaded");
|
||||
searchWrapper.addClass("d-flex");
|
||||
btnCancel.addClass("loaded");
|
||||
},
|
||||
off() {
|
||||
btnCancel.removeClass("loaded");
|
||||
searchWrapper.removeClass("d-flex");
|
||||
btnSbTrigger.removeClass("unloaded");
|
||||
topbarTitle.removeClass("unloaded");
|
||||
btnSearchTrigger.removeClass("unloaded");
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
const resultSwitch = (function () {
|
||||
let visible = false;
|
||||
|
||||
return {
|
||||
on() {
|
||||
if (!visible) {
|
||||
// the block method must be called before $(#main) unloaded.
|
||||
scrollBlocker.block();
|
||||
resultWrapper.removeClass("unloaded");
|
||||
main.addClass("unloaded");
|
||||
visible = true;
|
||||
}
|
||||
},
|
||||
off() {
|
||||
if (visible) {
|
||||
results.empty();
|
||||
if (hints.hasClass("unloaded")) {
|
||||
hints.removeClass("unloaded");
|
||||
}
|
||||
resultWrapper.addClass("unloaded");
|
||||
main.removeClass("unloaded");
|
||||
|
||||
// now the release method must be called after $(#main) display
|
||||
scrollBlocker.release();
|
||||
|
||||
input.val("");
|
||||
visible = false;
|
||||
}
|
||||
},
|
||||
isVisible() {
|
||||
return visible;
|
||||
}
|
||||
};
|
||||
|
||||
}());
|
||||
|
||||
function isMobileView() {
|
||||
return btnCancel.hasClass("loaded");
|
||||
}
|
||||
|
||||
btnSearchTrigger.click(function () {
|
||||
mobileSearchBar.on();
|
||||
resultSwitch.on();
|
||||
input.focus();
|
||||
});
|
||||
|
||||
btnCancel.click(function () {
|
||||
mobileSearchBar.off();
|
||||
resultSwitch.off();
|
||||
});
|
||||
|
||||
input.focus(function () {
|
||||
searchWrapper.addClass("input-focus");
|
||||
});
|
||||
|
||||
input.focusout(function () {
|
||||
searchWrapper.removeClass("input-focus");
|
||||
});
|
||||
|
||||
input.on("input", () => {
|
||||
if (input.val() === "") {
|
||||
if (isMobileView()) {
|
||||
hints.removeClass("unloaded");
|
||||
} else {
|
||||
resultSwitch.off();
|
||||
}
|
||||
|
||||
} else {
|
||||
resultSwitch.on();
|
||||
if (isMobileView()) {
|
||||
hints.addClass("unloaded");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* Expand or close the sidebar in mobile screens.
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
const sidebarUtil = (function () {
|
||||
const ATTR_DISPLAY = "sidebar-display";
|
||||
let isExpanded = false;
|
||||
const body = $("body");
|
||||
|
||||
return {
|
||||
toggle() {
|
||||
if (isExpanded === false) {
|
||||
body.attr(ATTR_DISPLAY, "");
|
||||
} else {
|
||||
body.removeAttr(ATTR_DISPLAY);
|
||||
}
|
||||
|
||||
isExpanded = !isExpanded;
|
||||
}
|
||||
};
|
||||
|
||||
}());
|
||||
|
||||
$("#sidebar-trigger").click(sidebarUtil.toggle);
|
||||
|
||||
$("#mask").click(sidebarUtil.toggle);
|
||||
});
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Initial Bootstrap Tooltip.
|
||||
*/
|
||||
$(function () {
|
||||
$("[data-toggle=\"tooltip\"]").tooltip();
|
||||
});
|
||||
@@ -1,89 +0,0 @@
|
||||
/**
|
||||
* Hide Header on scroll down
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
const $searchInput = $("#search-input");
|
||||
const delta = ScrollHelper.getTopbarHeight();
|
||||
|
||||
let didScroll;
|
||||
let lastScrollTop = 0;
|
||||
|
||||
function hasScrolled() {
|
||||
let st = $(this).scrollTop();
|
||||
|
||||
/* Make sure they scroll more than delta */
|
||||
if (Math.abs(lastScrollTop - st) <= delta) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (st > lastScrollTop) { // Scroll Down
|
||||
ScrollHelper.hideTopbar();
|
||||
|
||||
if ($searchInput.is(":focus")) {
|
||||
$searchInput.blur(); /* remove focus */
|
||||
}
|
||||
|
||||
} else { // Scroll up
|
||||
// has not yet scrolled to the bottom of the screen, that is, there is still space for scrolling
|
||||
if (st + $(window).height() < $(document).height()) {
|
||||
|
||||
if (ScrollHelper.hasScrollUpTask()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ScrollHelper.topbarLocked()) { // avoid redundant scroll up event from smooth scrolling
|
||||
ScrollHelper.unlockTopbar();
|
||||
} else {
|
||||
if (ScrollHelper.orientationLocked()) { // avoid device auto scroll up on orientation change
|
||||
ScrollHelper.unLockOrientation();
|
||||
} else {
|
||||
ScrollHelper.showTopbar();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastScrollTop = st;
|
||||
|
||||
} // hasScrolled()
|
||||
|
||||
function handleLandscape() {
|
||||
if ($(window).scrollTop() === 0) {
|
||||
return;
|
||||
}
|
||||
ScrollHelper.lockOrientation();
|
||||
ScrollHelper.hideTopbar();
|
||||
}
|
||||
|
||||
if (screen.orientation) {
|
||||
screen.orientation.onchange = () => {
|
||||
const type = screen.orientation.type;
|
||||
if (type === "landscape-primary" || type === "landscape-secondary") {
|
||||
handleLandscape();
|
||||
}
|
||||
};
|
||||
|
||||
} else {
|
||||
// for the browsers that not support `window.screen.orientation` API
|
||||
$(window).on("orientationchange", () => {
|
||||
if ($(window).width() < $(window).height()) { // before rotating, it is still in portrait mode.
|
||||
handleLandscape();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(window).scroll(() => {
|
||||
if (didScroll) {
|
||||
return;
|
||||
}
|
||||
didScroll = true;
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
if (didScroll) {
|
||||
hasScrolled();
|
||||
didScroll = false;
|
||||
}
|
||||
}, 250);
|
||||
});
|
||||
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* Top bar title auto change while scrolling up/down in mobile screens.
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
const titleSelector = "div.post>h1:first-of-type";
|
||||
const $pageTitle = $(titleSelector);
|
||||
const $topbarTitle = $("#topbar-title");
|
||||
|
||||
if ($pageTitle.length === 0 /* on Home page */
|
||||
|| $pageTitle.hasClass("dynamic-title")
|
||||
|| $topbarTitle.is(":hidden")) {/* not in mobile views */
|
||||
return;
|
||||
}
|
||||
|
||||
const defaultTitleText = $topbarTitle.text().trim();
|
||||
let pageTitleText = $pageTitle.text().trim();
|
||||
let hasScrolled = false;
|
||||
let lastScrollTop = 0;
|
||||
|
||||
if ($("#page-category").length || $("#page-tag").length) {
|
||||
/* The title in Category or Tag page will be "<title> <count_of_posts>" */
|
||||
if (/\s/.test(pageTitleText)) {
|
||||
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 = {
|
||||
rootMargin: '-48px 0px 0px 0px', // 48px equals to the topbar height (3rem)
|
||||
threshold: [0, 1]
|
||||
};
|
||||
|
||||
let observer = new IntersectionObserver((entries) => {
|
||||
if (!hasScrolled) {
|
||||
hasScrolled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
let curScrollTop = $(window).scrollTop();
|
||||
let isScrollDown = lastScrollTop < curScrollTop;
|
||||
lastScrollTop = curScrollTop;
|
||||
let heading = entries[0];
|
||||
|
||||
if (isScrollDown) {
|
||||
if (heading.intersectionRatio === 0) {
|
||||
$topbarTitle.text(pageTitleText);
|
||||
}
|
||||
} else {
|
||||
if (heading.intersectionRatio === 1) {
|
||||
$topbarTitle.text(defaultTitleText);
|
||||
}
|
||||
}
|
||||
}, options);
|
||||
|
||||
observer.observe(document.querySelector(titleSelector));
|
||||
|
||||
/* Click title will scroll to top */
|
||||
$topbarTitle.click(function () {
|
||||
$("body,html").animate({scrollTop: 0}, 800);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,5 +0,0 @@
|
||||
/*!
|
||||
* Chirpy v5.3.1 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* © 2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
7
_javascript/misc.js
Normal file
7
_javascript/misc.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { basic, initSidebar, initTopbar } from './modules/layouts';
|
||||
import { initLocaleDatetime } from './modules/plugins';
|
||||
|
||||
basic();
|
||||
initSidebar();
|
||||
initTopbar();
|
||||
initLocaleDatetime();
|
||||
26
_javascript/modules/components/back-to-top.js
Normal file
26
_javascript/modules/components/back-to-top.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Reference: https://bootsnipp.com/snippets/featured/link-to-top-page
|
||||
*/
|
||||
|
||||
export function back2top() {
|
||||
$(window).on('scroll', () => {
|
||||
if (
|
||||
$(window).scrollTop() > 50 &&
|
||||
$('#sidebar-trigger').css('display') === 'none'
|
||||
) {
|
||||
$('#back-to-top').fadeIn();
|
||||
} else {
|
||||
$('#back-to-top').fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
$('#back-to-top').on('click', () => {
|
||||
$('body,html').animate(
|
||||
{
|
||||
scrollTop: 0
|
||||
},
|
||||
800
|
||||
);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
36
_javascript/modules/components/category-collapse.js
Normal file
36
_javascript/modules/components/category-collapse.js
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Tab 'Categories' expand/close effect.
|
||||
*/
|
||||
const childPrefix = 'l_';
|
||||
const parentPrefix = 'h_';
|
||||
const collapse = $('.collapse');
|
||||
|
||||
export function categoryCollapse() {
|
||||
/* close up top-category */
|
||||
collapse.on('hide.bs.collapse', function () {
|
||||
/* Bootstrap collapse events. */ const parentId =
|
||||
parentPrefix + $(this).attr('id').substring(childPrefix.length);
|
||||
if (parentId) {
|
||||
$(`#${parentId} .far.fa-folder-open`).attr(
|
||||
'class',
|
||||
'far fa-folder fa-fw'
|
||||
);
|
||||
$(`#${parentId} i.fas`).addClass('rotate');
|
||||
$(`#${parentId}`).removeClass('hide-border-bottom');
|
||||
}
|
||||
});
|
||||
|
||||
/* expand the top category */
|
||||
collapse.on('show.bs.collapse', function () {
|
||||
const parentId =
|
||||
parentPrefix + $(this).attr('id').substring(childPrefix.length);
|
||||
if (parentId) {
|
||||
$(`#${parentId} .far.fa-folder`).attr(
|
||||
'class',
|
||||
'far fa-folder-open fa-fw'
|
||||
);
|
||||
$(`#${parentId} i.fas`).removeClass('rotate');
|
||||
$(`#${parentId}`).addClass('hide-border-bottom');
|
||||
}
|
||||
});
|
||||
}
|
||||
118
_javascript/modules/components/clipboard.js
Normal file
118
_javascript/modules/components/clipboard.js
Normal file
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* Clipboard functions
|
||||
*
|
||||
* Dependencies:
|
||||
* - popper.js (https://github.com/popperjs/popper-core)
|
||||
* - clipboard.js (https://github.com/zenorocha/clipboard.js)
|
||||
*/
|
||||
|
||||
const btnSelector = '.code-header>button';
|
||||
const ICON_SUCCESS = 'fas fa-check';
|
||||
const ATTR_TIMEOUT = 'timeout';
|
||||
const ATTR_TITLE_SUCCEED = 'data-title-succeed';
|
||||
const ATTR_TITLE_ORIGIN = 'data-original-title';
|
||||
const TIMEOUT = 2000; // in milliseconds
|
||||
|
||||
function isLocked(node) {
|
||||
if ($(node)[0].hasAttribute(ATTR_TIMEOUT)) {
|
||||
let timeout = $(node).attr(ATTR_TIMEOUT);
|
||||
if (Number(timeout) > Date.now()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function lock(node) {
|
||||
$(node).attr(ATTR_TIMEOUT, Date.now() + TIMEOUT);
|
||||
}
|
||||
|
||||
function unlock(node) {
|
||||
$(node).removeAttr(ATTR_TIMEOUT);
|
||||
}
|
||||
|
||||
function getIcon(btn) {
|
||||
let iconNode = $(btn).children();
|
||||
return iconNode.attr('class');
|
||||
}
|
||||
|
||||
const ICON_DEFAULT = getIcon(btnSelector);
|
||||
|
||||
function showTooltip(btn) {
|
||||
const succeedTitle = $(btn).attr(ATTR_TITLE_SUCCEED);
|
||||
$(btn).attr(ATTR_TITLE_ORIGIN, succeedTitle).tooltip('show');
|
||||
}
|
||||
|
||||
function hideTooltip(btn) {
|
||||
$(btn).tooltip('hide').removeAttr(ATTR_TITLE_ORIGIN);
|
||||
}
|
||||
|
||||
function setSuccessIcon(btn) {
|
||||
let btnNode = $(btn);
|
||||
let iconNode = btnNode.children();
|
||||
iconNode.attr('class', ICON_SUCCESS);
|
||||
}
|
||||
|
||||
function resumeIcon(btn) {
|
||||
let btnNode = $(btn);
|
||||
let iconNode = btnNode.children();
|
||||
iconNode.attr('class', ICON_DEFAULT);
|
||||
}
|
||||
|
||||
export function initClipboard() {
|
||||
// Initial the clipboard.js object
|
||||
const clipboard = new ClipboardJS(btnSelector, {
|
||||
target(trigger) {
|
||||
let codeBlock = trigger.parentNode.nextElementSibling;
|
||||
return codeBlock.querySelector('code .rouge-code');
|
||||
}
|
||||
});
|
||||
|
||||
$(btnSelector).tooltip({
|
||||
trigger: 'hover',
|
||||
placement: 'left'
|
||||
});
|
||||
|
||||
clipboard.on('success', (e) => {
|
||||
e.clearSelection();
|
||||
|
||||
const trigger = e.trigger;
|
||||
if (isLocked(trigger)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setSuccessIcon(trigger);
|
||||
showTooltip(trigger);
|
||||
lock(trigger);
|
||||
|
||||
setTimeout(() => {
|
||||
hideTooltip(trigger);
|
||||
resumeIcon(trigger);
|
||||
unlock(trigger);
|
||||
}, TIMEOUT);
|
||||
});
|
||||
|
||||
/* --- Post link sharing --- */
|
||||
|
||||
$('#copy-link').on('click', (e) => {
|
||||
let target = $(e.target);
|
||||
|
||||
if (isLocked(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy URL to clipboard
|
||||
navigator.clipboard.writeText(window.location.href).then(() => {
|
||||
const defaultTitle = target.attr(ATTR_TITLE_ORIGIN);
|
||||
const succeedTitle = target.attr(ATTR_TITLE_SUCCEED);
|
||||
// Switch tooltip title
|
||||
target.attr(ATTR_TITLE_ORIGIN, succeedTitle).tooltip('show');
|
||||
lock(target);
|
||||
|
||||
setTimeout(() => {
|
||||
target.attr(ATTR_TITLE_ORIGIN, defaultTitle);
|
||||
unlock(target);
|
||||
}, TIMEOUT);
|
||||
});
|
||||
});
|
||||
}
|
||||
68
_javascript/modules/components/convert-title.js
Normal file
68
_javascript/modules/components/convert-title.js
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* Top bar title auto change while scrolling up/down in mobile screens.
|
||||
*/
|
||||
const titleSelector = 'div.post>h1:first-of-type';
|
||||
const $pageTitle = $(titleSelector);
|
||||
const $topbarTitle = $('#topbar-title');
|
||||
const defaultTitleText = $topbarTitle.text().trim();
|
||||
|
||||
export function convertTitle() {
|
||||
if (
|
||||
$pageTitle.length === 0 /* on Home page */ ||
|
||||
$pageTitle.hasClass('dynamic-title') ||
|
||||
$topbarTitle.is(':hidden')
|
||||
) {
|
||||
/* not in mobile views */
|
||||
return;
|
||||
}
|
||||
|
||||
let pageTitleText = $pageTitle.text().trim();
|
||||
let hasScrolled = false;
|
||||
let lastScrollTop = 0;
|
||||
|
||||
if ($('#page-category').length || $('#page-tag').length) {
|
||||
/* The title in Category or Tag page will be "<title> <count_of_posts>" */
|
||||
if (/\s/.test(pageTitleText)) {
|
||||
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 = {
|
||||
rootMargin: '-48px 0px 0px 0px', // 48px equals to the topbar height (3rem)
|
||||
threshold: [0, 1]
|
||||
};
|
||||
|
||||
let observer = new IntersectionObserver((entries) => {
|
||||
if (!hasScrolled) {
|
||||
hasScrolled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
let curScrollTop = $(window).scrollTop();
|
||||
let isScrollDown = lastScrollTop < curScrollTop;
|
||||
lastScrollTop = curScrollTop;
|
||||
let heading = entries[0];
|
||||
|
||||
if (isScrollDown) {
|
||||
if (heading.intersectionRatio === 0) {
|
||||
$topbarTitle.text(pageTitleText);
|
||||
}
|
||||
} else {
|
||||
if (heading.intersectionRatio === 1) {
|
||||
$topbarTitle.text(defaultTitleText);
|
||||
}
|
||||
}
|
||||
}, options);
|
||||
|
||||
observer.observe(document.querySelector(titleSelector));
|
||||
|
||||
/* Click title will scroll to top */
|
||||
$topbarTitle.on('click', function () {
|
||||
$('body,html').animate({ scrollTop: 0 }, 800);
|
||||
});
|
||||
}
|
||||
27
_javascript/modules/components/img-extra.js
Normal file
27
_javascript/modules/components/img-extra.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Set up image stuff
|
||||
*/
|
||||
|
||||
export function imgExtra() {
|
||||
if ($('#core-wrapper img[data-src]') <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* See: <https://github.com/dimsemenov/Magnific-Popup> */
|
||||
$('.popup').magnificPopup({
|
||||
type: 'image',
|
||||
closeOnContentClick: true,
|
||||
showCloseBtn: false,
|
||||
zoom: {
|
||||
enabled: true,
|
||||
duration: 300,
|
||||
easing: 'ease-in-out'
|
||||
}
|
||||
});
|
||||
|
||||
/* Stop shimmer when image loaded */
|
||||
document.addEventListener('lazyloaded', function (e) {
|
||||
const $img = $(e.target);
|
||||
$img.parent().removeClass('shimmer');
|
||||
});
|
||||
}
|
||||
50
_javascript/modules/components/locale-datetime.js
Normal file
50
_javascript/modules/components/locale-datetime.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Update month/day to locale datetime
|
||||
*
|
||||
* Requirement: <https://github.com/iamkun/dayjs>
|
||||
*/
|
||||
|
||||
/* A tool for locale datetime */
|
||||
class LocaleHelper {
|
||||
static get attrTimestamp() {
|
||||
return 'data-ts';
|
||||
}
|
||||
|
||||
static get attrDateFormat() {
|
||||
return 'data-df';
|
||||
}
|
||||
|
||||
static get locale() {
|
||||
return $('html').attr('lang').substring(0, 2);
|
||||
}
|
||||
|
||||
static getTimestamp(elem) {
|
||||
return Number(elem.attr(LocaleHelper.attrTimestamp)); // unix timestamp
|
||||
}
|
||||
|
||||
static getDateFormat(elem) {
|
||||
return elem.attr(LocaleHelper.attrDateFormat);
|
||||
}
|
||||
}
|
||||
|
||||
export function initLocaleDatetime() {
|
||||
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);
|
||||
});
|
||||
}
|
||||
21
_javascript/modules/components/mode-watcher.js
Normal file
21
_javascript/modules/components/mode-watcher.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Add listener for theme mode toggle
|
||||
*/
|
||||
const $toggleElem = $('.mode-toggle');
|
||||
|
||||
export function modeWatcher() {
|
||||
if ($toggleElem.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$toggleElem.off().on('click', (e) => {
|
||||
const $target = $(e.target);
|
||||
let $btn =
|
||||
$target.prop('tagName') === 'button'.toUpperCase()
|
||||
? $target
|
||||
: $target.parent();
|
||||
|
||||
modeToggle.flipMode(); // modeToggle: `_includes/mode-toggle.html`
|
||||
$btn.trigger('blur'); // remove the clicking outline
|
||||
});
|
||||
}
|
||||
254
_javascript/modules/components/pageviews.js
Normal file
254
_javascript/modules/components/pageviews.js
Normal file
@@ -0,0 +1,254 @@
|
||||
/**
|
||||
* Count page views form GA or local cache file.
|
||||
*
|
||||
* Dependencies:
|
||||
* - jQuery
|
||||
* - countUp.js <https://github.com/inorganik/countUp.js>
|
||||
*/
|
||||
|
||||
const getInitStatus = (function () {
|
||||
let hasInit = false;
|
||||
return () => {
|
||||
let ret = hasInit;
|
||||
if (!hasInit) {
|
||||
hasInit = true;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
})();
|
||||
|
||||
const PvOpts = (function () {
|
||||
function getContent(selector) {
|
||||
return $(selector).attr('content');
|
||||
}
|
||||
|
||||
function hasContent(selector) {
|
||||
let content = getContent(selector);
|
||||
return typeof content !== 'undefined' && content !== false;
|
||||
}
|
||||
|
||||
return {
|
||||
getProxyMeta() {
|
||||
return getContent('meta[name=pv-proxy-endpoint]');
|
||||
},
|
||||
getLocalMeta() {
|
||||
return getContent('meta[name=pv-cache-path]');
|
||||
},
|
||||
hasProxyMeta() {
|
||||
return hasContent('meta[name=pv-proxy-endpoint]');
|
||||
},
|
||||
hasLocalMeta() {
|
||||
return hasContent('meta[name=pv-cache-path]');
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
const PvStorage = (function () {
|
||||
const Keys = {
|
||||
KEY_PV: 'pv',
|
||||
KEY_PV_SRC: 'pv_src',
|
||||
KEY_CREATION: 'pv_created_date'
|
||||
};
|
||||
|
||||
const Source = {
|
||||
LOCAL: 'same-origin',
|
||||
PROXY: 'cors'
|
||||
};
|
||||
|
||||
function get(key) {
|
||||
return localStorage.getItem(key);
|
||||
}
|
||||
|
||||
function set(key, val) {
|
||||
localStorage.setItem(key, val);
|
||||
}
|
||||
|
||||
function saveCache(pv, src) {
|
||||
set(Keys.KEY_PV, pv);
|
||||
set(Keys.KEY_PV_SRC, src);
|
||||
set(Keys.KEY_CREATION, new Date().toJSON());
|
||||
}
|
||||
|
||||
return {
|
||||
keysCount() {
|
||||
return Object.keys(Keys).length;
|
||||
},
|
||||
hasCache() {
|
||||
return localStorage.getItem(Keys.KEY_PV) !== null;
|
||||
},
|
||||
getCache() {
|
||||
return JSON.parse(localStorage.getItem(Keys.KEY_PV));
|
||||
},
|
||||
saveLocalCache(pv) {
|
||||
saveCache(pv, Source.LOCAL);
|
||||
},
|
||||
saveProxyCache(pv) {
|
||||
saveCache(pv, Source.PROXY);
|
||||
},
|
||||
isExpired() {
|
||||
let date = new Date(get(Keys.KEY_CREATION));
|
||||
date.setHours(date.getHours() + 1); // per hour
|
||||
return Date.now() >= date.getTime();
|
||||
},
|
||||
isFromLocal() {
|
||||
return get(Keys.KEY_PV_SRC) === Source.LOCAL;
|
||||
},
|
||||
isFromProxy() {
|
||||
return get(Keys.KEY_PV_SRC) === Source.PROXY;
|
||||
},
|
||||
newerThan(pv) {
|
||||
return (
|
||||
PvStorage.getCache().totalsForAllResults['ga:pageviews'] >
|
||||
pv.totalsForAllResults['ga:pageviews']
|
||||
);
|
||||
},
|
||||
inspectKeys() {
|
||||
if (localStorage.length !== PvStorage.keysCount()) {
|
||||
localStorage.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < localStorage.length; i++) {
|
||||
const key = localStorage.key(i);
|
||||
switch (key) {
|
||||
case Keys.KEY_PV:
|
||||
case Keys.KEY_PV_SRC:
|
||||
case Keys.KEY_CREATION:
|
||||
break;
|
||||
default:
|
||||
localStorage.clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
})(); /* PvStorage */
|
||||
|
||||
function countUp(min, max, destId) {
|
||||
if (min < max) {
|
||||
let numAnim = new CountUp(destId, min, max);
|
||||
if (!numAnim.error) {
|
||||
numAnim.start();
|
||||
} else {
|
||||
console.error(numAnim.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function countPV(path, rows) {
|
||||
let count = 0;
|
||||
|
||||
if (typeof rows !== 'undefined') {
|
||||
for (let i = 0; i < rows.length; ++i) {
|
||||
const gaPath = rows[parseInt(i, 10)][0];
|
||||
if (gaPath === path) {
|
||||
/* path format see: site.permalink */
|
||||
count += parseInt(rows[parseInt(i, 10)][1], 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
function tacklePV(rows, path, elem, hasInit) {
|
||||
let count = countPV(path, rows);
|
||||
count = count === 0 ? 1 : count;
|
||||
|
||||
if (!hasInit) {
|
||||
elem.text(new Intl.NumberFormat().format(count));
|
||||
} else {
|
||||
const initCount = parseInt(elem.text().replace(/,/g, ''), 10);
|
||||
if (count > initCount) {
|
||||
countUp(initCount, count, elem.attr('id'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function displayPageviews(data) {
|
||||
if (typeof data === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
let hasInit = getInitStatus();
|
||||
const rows = data.rows; /* could be undefined */
|
||||
|
||||
if ($('#post-list').length > 0) {
|
||||
/* the Home page */
|
||||
$('.post-preview').each(function () {
|
||||
const path = $(this).find('a').attr('href');
|
||||
tacklePV(rows, path, $(this).find('.pageviews'), hasInit);
|
||||
});
|
||||
} else if ($('.post').length > 0) {
|
||||
/* the post */
|
||||
const path = window.location.pathname;
|
||||
tacklePV(rows, path, $('#pv'), hasInit);
|
||||
}
|
||||
}
|
||||
|
||||
function fetchProxyPageviews() {
|
||||
if (PvOpts.hasProxyMeta()) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: PvOpts.getProxyMeta(),
|
||||
dataType: 'jsonp',
|
||||
success: (data) => {
|
||||
displayPageviews(data);
|
||||
PvStorage.saveProxyCache(JSON.stringify(data));
|
||||
},
|
||||
error: (jqXHR, textStatus, errorThrown) => {
|
||||
console.log(
|
||||
'Failed to load pageviews from proxy server: ' + errorThrown
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function fetchLocalPageviews(hasCache = false) {
|
||||
return fetch(PvOpts.getLocalMeta())
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (hasCache) {
|
||||
// The cache from the proxy will sometimes be more recent than the local one
|
||||
if (PvStorage.isFromProxy() && PvStorage.newerThan(data)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
displayPageviews(data);
|
||||
PvStorage.saveLocalCache(JSON.stringify(data));
|
||||
});
|
||||
}
|
||||
|
||||
export function initPageviews() {
|
||||
if ($('.pageviews').length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
PvStorage.inspectKeys();
|
||||
|
||||
if (PvStorage.hasCache()) {
|
||||
displayPageviews(PvStorage.getCache());
|
||||
|
||||
if (PvStorage.isExpired()) {
|
||||
if (PvOpts.hasLocalMeta()) {
|
||||
fetchLocalPageviews(true).then(fetchProxyPageviews);
|
||||
} else {
|
||||
fetchProxyPageviews();
|
||||
}
|
||||
} else {
|
||||
if (PvStorage.isFromLocal()) {
|
||||
fetchProxyPageviews();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// no cached
|
||||
|
||||
if (PvOpts.hasLocalMeta()) {
|
||||
fetchLocalPageviews().then(fetchProxyPageviews);
|
||||
} else {
|
||||
fetchProxyPageviews();
|
||||
}
|
||||
}
|
||||
}
|
||||
122
_javascript/modules/components/search-display.js
Normal file
122
_javascript/modules/components/search-display.js
Normal file
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* This script make #search-result-wrapper switch to unloaded or shown automatically.
|
||||
*/
|
||||
const $btnSbTrigger = $('#sidebar-trigger');
|
||||
const $btnSearchTrigger = $('#search-trigger');
|
||||
const $btnCancel = $('#search-cancel');
|
||||
const $main = $('#main');
|
||||
const $topbarTitle = $('#topbar-title');
|
||||
const $searchWrapper = $('#search-wrapper');
|
||||
const $resultWrapper = $('#search-result-wrapper');
|
||||
const $results = $('#search-results');
|
||||
const $input = $('#search-input');
|
||||
const $hints = $('#search-hints');
|
||||
const $viewport = $('html,body');
|
||||
|
||||
// class names
|
||||
const C_LOADED = 'loaded';
|
||||
const C_UNLOADED = 'unloaded';
|
||||
const C_FOCUS = 'input-focus';
|
||||
const C_FLEX = 'd-flex';
|
||||
|
||||
class ScrollBlocker {
|
||||
static offset = 0;
|
||||
static resultVisible = false;
|
||||
|
||||
static on() {
|
||||
ScrollBlocker.offset = window.scrollY;
|
||||
$viewport.scrollTop(0);
|
||||
}
|
||||
|
||||
static off() {
|
||||
$viewport.scrollTop(ScrollBlocker.offset);
|
||||
}
|
||||
}
|
||||
|
||||
/*--- Actions in mobile screens (Sidebar hidden) ---*/
|
||||
class MobileSearchBar {
|
||||
static on() {
|
||||
$btnSbTrigger.addClass(C_UNLOADED);
|
||||
$topbarTitle.addClass(C_UNLOADED);
|
||||
$btnSearchTrigger.addClass(C_UNLOADED);
|
||||
$searchWrapper.addClass(C_FLEX);
|
||||
$btnCancel.addClass(C_LOADED);
|
||||
}
|
||||
|
||||
static off() {
|
||||
$btnCancel.removeClass(C_LOADED);
|
||||
$searchWrapper.removeClass(C_FLEX);
|
||||
$btnSbTrigger.removeClass(C_UNLOADED);
|
||||
$topbarTitle.removeClass(C_UNLOADED);
|
||||
$btnSearchTrigger.removeClass(C_UNLOADED);
|
||||
}
|
||||
}
|
||||
|
||||
class ResultSwitch {
|
||||
static on() {
|
||||
if (!ScrollBlocker.resultVisible) {
|
||||
// the block method must be called before $(#main) unloaded.
|
||||
ScrollBlocker.on();
|
||||
$resultWrapper.removeClass(C_UNLOADED);
|
||||
$main.addClass(C_UNLOADED);
|
||||
ScrollBlocker.resultVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
static off() {
|
||||
if (ScrollBlocker.resultVisible) {
|
||||
$results.empty();
|
||||
if ($hints.hasClass(C_UNLOADED)) {
|
||||
$hints.removeClass(C_UNLOADED);
|
||||
}
|
||||
$resultWrapper.addClass(C_UNLOADED);
|
||||
$main.removeClass(C_UNLOADED);
|
||||
|
||||
// now the release method must be called after $(#main) display
|
||||
ScrollBlocker.off();
|
||||
|
||||
$input.val('');
|
||||
ScrollBlocker.resultVisible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isMobileView() {
|
||||
return $btnCancel.hasClass(C_LOADED);
|
||||
}
|
||||
|
||||
export function displaySearch() {
|
||||
$btnSearchTrigger.on('click', function () {
|
||||
MobileSearchBar.on();
|
||||
ResultSwitch.on();
|
||||
$input.trigger('focus');
|
||||
});
|
||||
|
||||
$btnCancel.on('click', function () {
|
||||
MobileSearchBar.off();
|
||||
ResultSwitch.off();
|
||||
});
|
||||
|
||||
$input.on('focus', function () {
|
||||
$searchWrapper.addClass(C_FOCUS);
|
||||
});
|
||||
|
||||
$input.on('focusout', function () {
|
||||
$searchWrapper.removeClass(C_FOCUS);
|
||||
});
|
||||
|
||||
$input.on('input', () => {
|
||||
if ($input.val() === '') {
|
||||
if (isMobileView()) {
|
||||
$hints.removeClass(C_UNLOADED);
|
||||
} else {
|
||||
ResultSwitch.off();
|
||||
}
|
||||
} else {
|
||||
ResultSwitch.on();
|
||||
if (isMobileView()) {
|
||||
$hints.addClass(C_UNLOADED);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
25
_javascript/modules/components/sidebar.js
Normal file
25
_javascript/modules/components/sidebar.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Expand or close the sidebar in mobile screens.
|
||||
*/
|
||||
|
||||
const $body = $('body');
|
||||
const ATTR_DISPLAY = 'sidebar-display';
|
||||
|
||||
class SidebarUtil {
|
||||
static isExpanded = false;
|
||||
|
||||
static toggle() {
|
||||
if (SidebarUtil.isExpanded === false) {
|
||||
$body.attr(ATTR_DISPLAY, '');
|
||||
} else {
|
||||
$body.removeAttr(ATTR_DISPLAY);
|
||||
}
|
||||
|
||||
SidebarUtil.isExpanded = !SidebarUtil.isExpanded;
|
||||
}
|
||||
}
|
||||
|
||||
export function sidebarExpand() {
|
||||
$('#sidebar-trigger').on('click', SidebarUtil.toggle);
|
||||
$('#mask').on('click', SidebarUtil.toggle);
|
||||
}
|
||||
109
_javascript/modules/components/smooth-scroll.js
Normal file
109
_javascript/modules/components/smooth-scroll.js
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
Safari doesn't support CSS `scroll-behavior: smooth`,
|
||||
so here is a compatible solution for all browser to smooth scrolling
|
||||
|
||||
See: <https://css-tricks.com/snippets/jquery/smooth-scrolling/>
|
||||
|
||||
Warning: It must be called after all `<a>` tags (e.g., the dynamic TOC) are ready.
|
||||
*/
|
||||
import ScrollHelper from './utils/scroll-helper';
|
||||
|
||||
export function smoothScroll() {
|
||||
const $topbarTitle = $('#topbar-title');
|
||||
const REM = 16; // in pixels
|
||||
const ATTR_SCROLL_FOCUS = 'scroll-focus';
|
||||
const SCOPE = "a[href*='#']:not([href='#']):not([href='#0'])";
|
||||
|
||||
$(SCOPE).on('click', function (event) {
|
||||
if (
|
||||
this.pathname.replace(/^\//, '') !== location.pathname.replace(/^\//, '')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (location.hostname !== this.hostname) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hash = decodeURI(this.hash);
|
||||
let toFootnoteRef = RegExp(/^#fnref:/).test(hash);
|
||||
let toFootnote = toFootnoteRef ? false : RegExp(/^#fn:/).test(hash);
|
||||
let selector = '#' + $.escapeSelector(hash.substring(1));
|
||||
let $target = $(selector);
|
||||
|
||||
let isMobileViews = $topbarTitle.is(':visible');
|
||||
let isPortrait = $(window).width() < $(window).height();
|
||||
|
||||
if (typeof $target === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if (history.pushState) {
|
||||
/* add hash to URL */
|
||||
history.pushState(null, null, hash);
|
||||
}
|
||||
|
||||
let curOffset = $(window).scrollTop();
|
||||
let destOffset = ($target.offset().top -= REM / 2);
|
||||
|
||||
if (destOffset < curOffset) {
|
||||
// scroll up
|
||||
ScrollHelper.hideTopbar();
|
||||
ScrollHelper.addScrollUpTask();
|
||||
|
||||
if (isMobileViews && isPortrait) {
|
||||
destOffset -= ScrollHelper.getTopbarHeight();
|
||||
}
|
||||
} else {
|
||||
// scroll down
|
||||
if (isMobileViews && isPortrait) {
|
||||
destOffset -= ScrollHelper.getTopbarHeight();
|
||||
}
|
||||
}
|
||||
|
||||
$('html').animate(
|
||||
{
|
||||
scrollTop: destOffset
|
||||
},
|
||||
500,
|
||||
() => {
|
||||
$target.trigger('focus');
|
||||
|
||||
/* clean up old scroll mark */
|
||||
const $scroll_focus = $(`[${ATTR_SCROLL_FOCUS}=true]`);
|
||||
if ($scroll_focus.length) {
|
||||
$scroll_focus.attr(ATTR_SCROLL_FOCUS, 'false');
|
||||
}
|
||||
|
||||
/* Clean :target links */
|
||||
const $target_links = $(':target');
|
||||
if ($target_links.length) {
|
||||
/* element that visited by the URL with hash */
|
||||
$target_links.attr(ATTR_SCROLL_FOCUS, 'false');
|
||||
}
|
||||
|
||||
/* set scroll mark to footnotes */
|
||||
if (toFootnote || toFootnoteRef) {
|
||||
$target.attr(ATTR_SCROLL_FOCUS, 'true');
|
||||
}
|
||||
|
||||
if ($target.is(':focus')) {
|
||||
/* Checking if the target was focused */
|
||||
return false;
|
||||
} else {
|
||||
$target.attr(
|
||||
'tabindex',
|
||||
'-1'
|
||||
); /* Adding tabindex for elements not focusable */
|
||||
$target.trigger('focus'); /* Set focus again */
|
||||
}
|
||||
|
||||
if (ScrollHelper.hasScrollUpTask()) {
|
||||
ScrollHelper.popScrollUpTask();
|
||||
}
|
||||
}
|
||||
);
|
||||
}); /* click() */
|
||||
}
|
||||
13
_javascript/modules/components/toc.js
Normal file
13
_javascript/modules/components/toc.js
Normal file
@@ -0,0 +1,13 @@
|
||||
export function toc() {
|
||||
if (document.querySelector('#core-wrapper h2,#core-wrapper h3')) {
|
||||
// see: https://github.com/tscanlin/tocbot#usage
|
||||
tocbot.init({
|
||||
tocSelector: '#toc',
|
||||
contentSelector: '.post-content',
|
||||
ignoreSelector: '[data-toc-skip]',
|
||||
headingSelector: 'h2, h3',
|
||||
orderedList: false,
|
||||
scrollSmooth: false
|
||||
});
|
||||
}
|
||||
}
|
||||
6
_javascript/modules/components/tooltip-loader.js
Normal file
6
_javascript/modules/components/tooltip-loader.js
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Initial Bootstrap Tooltip.
|
||||
*/
|
||||
export function loadTooptip() {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
}
|
||||
93
_javascript/modules/components/topbar-switcher.js
Normal file
93
_javascript/modules/components/topbar-switcher.js
Normal file
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* Hide Header on scroll down
|
||||
*/
|
||||
import ScrollHelper from './utils/scroll-helper';
|
||||
|
||||
const $searchInput = $('#search-input');
|
||||
const delta = ScrollHelper.getTopbarHeight();
|
||||
|
||||
let didScroll;
|
||||
let lastScrollTop = 0;
|
||||
|
||||
function hasScrolled() {
|
||||
let st = $(window).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.trigger('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();
|
||||
}
|
||||
|
||||
export function switchTopbar() {
|
||||
const orientation = screen.orientation;
|
||||
if (orientation) {
|
||||
orientation.onchange = () => {
|
||||
const type = 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).on('scroll', () => {
|
||||
if (didScroll) {
|
||||
return;
|
||||
}
|
||||
didScroll = true;
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
if (didScroll) {
|
||||
hasScrolled();
|
||||
didScroll = false;
|
||||
}
|
||||
}, 250);
|
||||
}
|
||||
64
_javascript/modules/components/utils/scroll-helper.js
Normal file
64
_javascript/modules/components/utils/scroll-helper.js
Normal file
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* A tool for smooth scrolling and topbar switcher
|
||||
*/
|
||||
|
||||
const ATTR_TOPBAR_VISIBLE = 'data-topbar-visible';
|
||||
const $body = $('body');
|
||||
const $topbarWrapper = $('#topbar-wrapper');
|
||||
|
||||
export default class ScrollHelper {
|
||||
static scrollUpCount = 0; // the number of times the scroll up was triggered by ToC or anchor
|
||||
static topbarIsLocked = false;
|
||||
static orientationIsLocked = false;
|
||||
|
||||
static hideTopbar() {
|
||||
$body.attr(ATTR_TOPBAR_VISIBLE, 'false');
|
||||
}
|
||||
|
||||
static showTopbar() {
|
||||
$body.attr(ATTR_TOPBAR_VISIBLE, 'true');
|
||||
}
|
||||
|
||||
// scroll up
|
||||
|
||||
static addScrollUpTask() {
|
||||
ScrollHelper.scrollUpCount += 1;
|
||||
if (!ScrollHelper.topbarIsLocked) {
|
||||
ScrollHelper.topbarIsLocked = true;
|
||||
}
|
||||
}
|
||||
|
||||
static popScrollUpTask() {
|
||||
ScrollHelper.scrollUpCount -= 1;
|
||||
}
|
||||
|
||||
static hasScrollUpTask() {
|
||||
return ScrollHelper.scrollUpCount > 0;
|
||||
}
|
||||
|
||||
static topbarLocked() {
|
||||
return ScrollHelper.topbarIsLocked === true;
|
||||
}
|
||||
|
||||
static unlockTopbar() {
|
||||
ScrollHelper.topbarIsLocked = false;
|
||||
}
|
||||
|
||||
static getTopbarHeight() {
|
||||
return $topbarWrapper.outerHeight();
|
||||
}
|
||||
|
||||
// orientation change
|
||||
|
||||
static orientationLocked() {
|
||||
return ScrollHelper.orientationIsLocked === true;
|
||||
}
|
||||
|
||||
static lockOrientation() {
|
||||
ScrollHelper.orientationIsLocked = true;
|
||||
}
|
||||
|
||||
static unLockOrientation() {
|
||||
ScrollHelper.orientationIsLocked = false;
|
||||
}
|
||||
}
|
||||
3
_javascript/modules/layouts.js
Normal file
3
_javascript/modules/layouts.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export { basic } from './layouts/basic';
|
||||
export { initSidebar } from './layouts/sidebar';
|
||||
export { initTopbar } from './layouts/topbar';
|
||||
7
_javascript/modules/layouts/basic.js
Normal file
7
_javascript/modules/layouts/basic.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { back2top } from '../components/back-to-top';
|
||||
import { loadTooptip } from '../components/tooltip-loader';
|
||||
|
||||
export function basic() {
|
||||
back2top();
|
||||
loadTooptip();
|
||||
}
|
||||
7
_javascript/modules/layouts/sidebar.js
Normal file
7
_javascript/modules/layouts/sidebar.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { modeWatcher } from '../components/mode-watcher';
|
||||
import { sidebarExpand } from '../components/sidebar';
|
||||
|
||||
export function initSidebar() {
|
||||
modeWatcher();
|
||||
sidebarExpand();
|
||||
}
|
||||
9
_javascript/modules/layouts/topbar.js
Normal file
9
_javascript/modules/layouts/topbar.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import { convertTitle } from '../components/convert-title';
|
||||
import { displaySearch } from '../components/search-display';
|
||||
import { switchTopbar } from '../components/topbar-switcher';
|
||||
|
||||
export function initTopbar() {
|
||||
convertTitle();
|
||||
displaySearch();
|
||||
switchTopbar();
|
||||
}
|
||||
7
_javascript/modules/plugins.js
Normal file
7
_javascript/modules/plugins.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export { categoryCollapse } from './components/category-collapse';
|
||||
export { initClipboard } from './components/clipboard';
|
||||
export { imgExtra } from './components/img-extra';
|
||||
export { initLocaleDatetime } from './components/locale-datetime';
|
||||
export { initPageviews } from './components/pageviews';
|
||||
export { smoothScroll } from './components/smooth-scroll';
|
||||
export { toc } from './components/toc';
|
||||
9
_javascript/page.js
Normal file
9
_javascript/page.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import { basic, initSidebar, initTopbar } from './modules/layouts';
|
||||
import { imgExtra, initClipboard, smoothScroll } from './modules/plugins';
|
||||
|
||||
basic();
|
||||
initSidebar();
|
||||
initTopbar();
|
||||
imgExtra();
|
||||
initClipboard();
|
||||
smoothScroll();
|
||||
19
_javascript/post.js
Normal file
19
_javascript/post.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { basic, initSidebar, initTopbar } from './modules/layouts';
|
||||
import {
|
||||
imgExtra,
|
||||
initLocaleDatetime,
|
||||
initClipboard,
|
||||
smoothScroll,
|
||||
initPageviews,
|
||||
toc
|
||||
} from './modules/plugins';
|
||||
|
||||
basic();
|
||||
initSidebar();
|
||||
initTopbar();
|
||||
imgExtra();
|
||||
initLocaleDatetime();
|
||||
initClipboard();
|
||||
toc();
|
||||
smoothScroll(); // must be called after toc is created
|
||||
initPageviews();
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* Tab 'Categories' expand/close effect.
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
const childPrefix = "l_";
|
||||
const parentPrefix = "h_";
|
||||
const collapse = $(".collapse");
|
||||
|
||||
/* close up top-category */
|
||||
collapse.on("hide.bs.collapse", function () { /* Bootstrap collapse events. */
|
||||
const parentId = parentPrefix + $(this).attr("id").substring(childPrefix.length);
|
||||
if (parentId) {
|
||||
$(`#${parentId} .far.fa-folder-open`).attr("class", "far fa-folder fa-fw");
|
||||
$(`#${parentId} i.fas`).addClass("rotate");
|
||||
$(`#${parentId}`).removeClass("hide-border-bottom");
|
||||
}
|
||||
});
|
||||
|
||||
/* expand the top category */
|
||||
collapse.on("show.bs.collapse", function () {
|
||||
const parentId = parentPrefix + $(this).attr("id").substring(childPrefix.length);
|
||||
if (parentId) {
|
||||
$(`#${parentId} .far.fa-folder`).attr("class", "far fa-folder-open fa-fw");
|
||||
$(`#${parentId} i.fas`).removeClass("rotate");
|
||||
$(`#${parentId}`).addClass("hide-border-bottom");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,133 +0,0 @@
|
||||
/**
|
||||
* Clipboard functions
|
||||
*
|
||||
* Dependencies:
|
||||
* - popper.js (https://github.com/popperjs/popper-core)
|
||||
* - clipboard.js (https://github.com/zenorocha/clipboard.js)
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
const btnSelector = '.code-header>button';
|
||||
const ICON_SUCCESS = 'fas fa-check';
|
||||
const ATTR_TIMEOUT = 'timeout';
|
||||
const ATTR_TITLE_SUCCEED = 'data-title-succeed';
|
||||
const ATTR_TITLE_ORIGIN = 'data-original-title';
|
||||
const TIMEOUT = 2000; // in milliseconds
|
||||
|
||||
function isLocked(node) {
|
||||
if ($(node)[0].hasAttribute(ATTR_TIMEOUT)) {
|
||||
let timeout = $(node).attr(ATTR_TIMEOUT);
|
||||
if (Number(timeout) > Date.now()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function lock(node) {
|
||||
$(node).attr(ATTR_TIMEOUT, Date.now() + TIMEOUT);
|
||||
}
|
||||
|
||||
function unlock(node) {
|
||||
$(node).removeAttr(ATTR_TIMEOUT);
|
||||
}
|
||||
|
||||
/* --- Copy code block --- */
|
||||
|
||||
// Initial the clipboard.js object
|
||||
const clipboard = new ClipboardJS(btnSelector, {
|
||||
target(trigger) {
|
||||
let codeBlock = trigger.parentNode.nextElementSibling;
|
||||
return codeBlock.querySelector('code .rouge-code');
|
||||
}
|
||||
});
|
||||
|
||||
$(btnSelector).tooltip({
|
||||
trigger: 'hover',
|
||||
placement: 'left'
|
||||
});
|
||||
|
||||
function getIcon(btn) {
|
||||
let iconNode = $(btn).children();
|
||||
return iconNode.attr('class');
|
||||
}
|
||||
|
||||
const ICON_DEFAULT = getIcon(btnSelector);
|
||||
|
||||
function showTooltip(btn) {
|
||||
const succeedTitle = $(btn).attr(ATTR_TITLE_SUCCEED);
|
||||
$(btn).attr(ATTR_TITLE_ORIGIN, succeedTitle).tooltip('show');
|
||||
}
|
||||
|
||||
function hideTooltip(btn) {
|
||||
$(btn).tooltip('hide').removeAttr(ATTR_TITLE_ORIGIN);
|
||||
}
|
||||
|
||||
function setSuccessIcon(btn) {
|
||||
let btnNode = $(btn);
|
||||
let iconNode = btnNode.children();
|
||||
iconNode.attr('class', ICON_SUCCESS);
|
||||
}
|
||||
|
||||
function resumeIcon(btn) {
|
||||
let btnNode = $(btn);
|
||||
let iconNode = btnNode.children();
|
||||
iconNode.attr('class', ICON_DEFAULT);
|
||||
}
|
||||
|
||||
clipboard.on('success', (e) => {
|
||||
e.clearSelection();
|
||||
|
||||
const trigger = e.trigger;
|
||||
if (isLocked(trigger)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setSuccessIcon(trigger);
|
||||
showTooltip(trigger);
|
||||
lock(trigger);
|
||||
|
||||
setTimeout(() => {
|
||||
hideTooltip(trigger);
|
||||
resumeIcon(trigger);
|
||||
unlock(trigger);
|
||||
}, TIMEOUT);
|
||||
|
||||
});
|
||||
|
||||
/* --- Post link sharing --- */
|
||||
|
||||
$('#copy-link').click((e) => {
|
||||
|
||||
let target = $(e.target);
|
||||
|
||||
if (isLocked(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy URL to clipboard
|
||||
|
||||
const url = window.location.href;
|
||||
const $temp = $("<input>");
|
||||
|
||||
$("body").append($temp);
|
||||
$temp.val(url).select();
|
||||
document.execCommand("copy");
|
||||
$temp.remove();
|
||||
|
||||
// Switch tooltip title
|
||||
|
||||
const defaultTitle = target.attr(ATTR_TITLE_ORIGIN);
|
||||
const succeedTitle = target.attr(ATTR_TITLE_SUCCEED);
|
||||
|
||||
target.attr(ATTR_TITLE_ORIGIN, succeedTitle).tooltip('show');
|
||||
lock(target);
|
||||
|
||||
setTimeout(() => {
|
||||
target.attr(ATTR_TITLE_ORIGIN, defaultTitle);
|
||||
unlock(target);
|
||||
}, TIMEOUT);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,46 +0,0 @@
|
||||
/**
|
||||
Lazy load images (https://github.com/ApoorvSaxena/lozad.js)
|
||||
and popup when clicked (https://github.com/dimsemenov/Magnific-Popup)
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
const IMG_SCOPE = '#main > div.row:first-child > div:first-child';
|
||||
|
||||
if ($(`${IMG_SCOPE} img`).length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* lazy loading */
|
||||
|
||||
const imgList = document.querySelectorAll(`${IMG_SCOPE} img[data-src]`);
|
||||
const observer = lozad(imgList);
|
||||
observer.observe();
|
||||
|
||||
/* popup */
|
||||
|
||||
$(`${IMG_SCOPE} p > img[data-src], ${IMG_SCOPE} img[data-src].preview-img`).each(
|
||||
function () {
|
||||
let nextTag = $(this).next();
|
||||
const title = nextTag.prop('tagName') === 'EM' ? nextTag.text() : '';
|
||||
const src = $(this).attr('data-src'); // created by lozad.js
|
||||
|
||||
$(this).wrap(`<a href="${src}" title="${title}" class="popup"></a>`);
|
||||
}
|
||||
);
|
||||
|
||||
$('.popup').magnificPopup({
|
||||
type: 'image',
|
||||
closeOnContentClick: true,
|
||||
showCloseBtn: false,
|
||||
zoom: {
|
||||
enabled: true,
|
||||
duration: 300,
|
||||
easing: 'ease-in-out'
|
||||
}
|
||||
});
|
||||
|
||||
/* markup the image links */
|
||||
|
||||
$(`${IMG_SCOPE} a`).has('img').addClass('img-link');
|
||||
|
||||
});
|
||||
@@ -1,43 +0,0 @@
|
||||
/**
|
||||
* Update month/day to locale datetime
|
||||
*
|
||||
* Requirement: <https://github.com/iamkun/dayjs>
|
||||
*/
|
||||
|
||||
/* A tool for locale datetime */
|
||||
const LocaleHelper = (function () {
|
||||
const locale = $('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);
|
||||
});
|
||||
});
|
||||
@@ -1,250 +0,0 @@
|
||||
/**
|
||||
* Count page views form GA or local cache file.
|
||||
*
|
||||
* Dependencies:
|
||||
* - jQuery
|
||||
* - countUp.js <https://github.com/inorganik/countUp.js>
|
||||
*/
|
||||
|
||||
const getInitStatus = (function () {
|
||||
let hasInit = false;
|
||||
return () => {
|
||||
let ret = hasInit;
|
||||
if (!hasInit) {
|
||||
hasInit = true;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}());
|
||||
|
||||
const PvOpts = (function () {
|
||||
function getContent(selector) {
|
||||
return $(selector).attr("content");
|
||||
}
|
||||
|
||||
function hasContent(selector) {
|
||||
let content = getContent(selector);
|
||||
return (typeof content !== "undefined" && content !== false);
|
||||
}
|
||||
|
||||
return {
|
||||
getProxyMeta() {
|
||||
return getContent("meta[name=pv-proxy-endpoint]");
|
||||
},
|
||||
getLocalMeta() {
|
||||
return getContent("meta[name=pv-cache-path]");
|
||||
},
|
||||
hasProxyMeta() {
|
||||
return hasContent("meta[name=pv-proxy-endpoint]");
|
||||
},
|
||||
hasLocalMeta() {
|
||||
return hasContent("meta[name=pv-cache-path]");
|
||||
}
|
||||
};
|
||||
|
||||
}());
|
||||
|
||||
const PvStorage = (function () {
|
||||
const Keys = {
|
||||
KEY_PV: "pv",
|
||||
KEY_PV_SRC: "pv_src",
|
||||
KEY_CREATION: "pv_created_date"
|
||||
};
|
||||
|
||||
const Source = {
|
||||
LOCAL: "same-origin",
|
||||
PROXY: "cors"
|
||||
};
|
||||
|
||||
function get(key) {
|
||||
return localStorage.getItem(key);
|
||||
}
|
||||
|
||||
function set(key, val) {
|
||||
localStorage.setItem(key, val);
|
||||
}
|
||||
|
||||
function saveCache(pv, src) {
|
||||
set(Keys.KEY_PV, pv);
|
||||
set(Keys.KEY_PV_SRC, src);
|
||||
set(Keys.KEY_CREATION, new Date().toJSON());
|
||||
}
|
||||
|
||||
return {
|
||||
keysCount() {
|
||||
return Object.keys(Keys).length;
|
||||
},
|
||||
hasCache() {
|
||||
return (localStorage.getItem(Keys.KEY_PV) !== null);
|
||||
},
|
||||
getCache() {
|
||||
return JSON.parse(localStorage.getItem(Keys.KEY_PV));
|
||||
},
|
||||
saveLocalCache(pv) {
|
||||
saveCache(pv, Source.LOCAL);
|
||||
},
|
||||
saveProxyCache(pv) {
|
||||
saveCache(pv, Source.PROXY);
|
||||
},
|
||||
isExpired() {
|
||||
let date = new Date(get(Keys.KEY_CREATION));
|
||||
date.setHours(date.getHours() + 1); // per hour
|
||||
return Date.now() >= date.getTime();
|
||||
},
|
||||
isFromLocal() {
|
||||
return get(Keys.KEY_PV_SRC) === Source.LOCAL;
|
||||
},
|
||||
isFromProxy() {
|
||||
return get(Keys.KEY_PV_SRC) === Source.PROXY;
|
||||
},
|
||||
newerThan(pv) {
|
||||
return PvStorage.getCache().totalsForAllResults["ga:pageviews"] > pv.totalsForAllResults["ga:pageviews"];
|
||||
},
|
||||
inspectKeys() {
|
||||
if (localStorage.length !== PvStorage.keysCount()) {
|
||||
localStorage.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < localStorage.length; i++) {
|
||||
const key = localStorage.key(i);
|
||||
switch (key) {
|
||||
case Keys.KEY_PV:
|
||||
case Keys.KEY_PV_SRC:
|
||||
case Keys.KEY_CREATION:
|
||||
break;
|
||||
default:
|
||||
localStorage.clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}()); /* PvStorage */
|
||||
|
||||
function countUp(min, max, destId) {
|
||||
if (min < max) {
|
||||
let numAnim = new CountUp(destId, min, max);
|
||||
if (!numAnim.error) {
|
||||
numAnim.start();
|
||||
} else {
|
||||
console.error(numAnim.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function countPV(path, rows) {
|
||||
let count = 0;
|
||||
|
||||
if (typeof rows !== "undefined") {
|
||||
for (let i = 0; i < rows.length; ++i) {
|
||||
const gaPath = rows[parseInt(i, 10)][0];
|
||||
if (gaPath === path) { /* path format see: site.permalink */
|
||||
count += parseInt(rows[parseInt(i, 10)][1], 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
function tacklePV(rows, path, elem, hasInit) {
|
||||
let count = countPV(path, rows);
|
||||
count = (count === 0 ? 1 : count);
|
||||
|
||||
if (!hasInit) {
|
||||
elem.text(new Intl.NumberFormat().format(count));
|
||||
} else {
|
||||
const initCount = parseInt(elem.text().replace(/,/g, ""), 10);
|
||||
if (count > initCount) {
|
||||
countUp(initCount, count, elem.attr("id"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function displayPageviews(data) {
|
||||
if (typeof data === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
let hasInit = getInitStatus();
|
||||
const rows = data.rows; /* could be undefined */
|
||||
|
||||
if ($("#post-list").length > 0) { /* the Home page */
|
||||
$(".post-preview").each(function () {
|
||||
const path = $(this).find("a").attr("href");
|
||||
tacklePV(rows, path, $(this).find(".pageviews"), hasInit);
|
||||
});
|
||||
|
||||
} else if ($(".post").length > 0) { /* the post */
|
||||
const path = window.location.pathname;
|
||||
tacklePV(rows, path, $("#pv"), hasInit);
|
||||
}
|
||||
}
|
||||
|
||||
function fetchProxyPageviews() {
|
||||
if (PvOpts.hasProxyMeta()) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: PvOpts.getProxyMeta(),
|
||||
dataType: "jsonp",
|
||||
jsonpCallback: "displayPageviews",
|
||||
success: (data) => {
|
||||
PvStorage.saveProxyCache(JSON.stringify(data));
|
||||
},
|
||||
error: (jqXHR, textStatus, errorThrown) => {
|
||||
console.log("Failed to load pageviews from proxy server: " + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function fetchLocalPageviews(hasCache = false) {
|
||||
return fetch(PvOpts.getLocalMeta())
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (hasCache) {
|
||||
// The cache from the proxy will sometimes be more recent than the local one
|
||||
if (PvStorage.isFromProxy() && PvStorage.newerThan(data)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
displayPageviews(data);
|
||||
PvStorage.saveLocalCache(JSON.stringify(data));
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
if ($(".pageviews").length <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
PvStorage.inspectKeys();
|
||||
|
||||
if (PvStorage.hasCache()) {
|
||||
displayPageviews(PvStorage.getCache());
|
||||
|
||||
if (PvStorage.isExpired()) {
|
||||
if (PvOpts.hasLocalMeta()) {
|
||||
fetchLocalPageviews(true).then(fetchProxyPageviews);
|
||||
} else {
|
||||
fetchProxyPageviews();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (PvStorage.isFromLocal()) {
|
||||
fetchProxyPageviews();
|
||||
}
|
||||
}
|
||||
|
||||
} else { // no cached
|
||||
|
||||
if (PvOpts.hasLocalMeta()) {
|
||||
fetchLocalPageviews().then(fetchProxyPageviews);
|
||||
} else {
|
||||
fetchProxyPageviews();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1,96 +0,0 @@
|
||||
/**
|
||||
Safari doesn't support CSS `scroll-behavior: smooth`,
|
||||
so here is a compatible solution for all browser to smooth scrolling
|
||||
|
||||
See: <https://css-tricks.com/snippets/jquery/smooth-scrolling/>
|
||||
|
||||
Warning: It must be called after all `<a>` tags (e.g., the dynamic TOC) are ready.
|
||||
*/
|
||||
|
||||
$(function () {
|
||||
const $topbarTitle = $("#topbar-title");
|
||||
const REM = 16; // in pixels
|
||||
const ATTR_SCROLL_FOCUS = "scroll-focus";
|
||||
|
||||
$("a[href*='#']")
|
||||
.not("[href='#']")
|
||||
.not("[href='#0']")
|
||||
.click(function (event) {
|
||||
if (this.pathname.replace(/^\//, "") !==
|
||||
location.pathname.replace(/^\//, "")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (location.hostname !== this.hostname) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hash = decodeURI(this.hash);
|
||||
let toFootnoteRef = RegExp(/^#fnref:/).test(hash);
|
||||
let toFootnote = toFootnoteRef ? false : RegExp(/^#fn:/).test(hash);
|
||||
let selector = hash.includes(":") ? hash.replace(/:/g, "\\:") : hash;
|
||||
let $target = $(selector);
|
||||
|
||||
let isMobileViews = $topbarTitle.is(":visible");
|
||||
let isPortrait = $(window).width() < $(window).height();
|
||||
|
||||
if (typeof $target === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if (history.pushState) { /* add hash to URL */
|
||||
history.pushState(null, null, hash);
|
||||
}
|
||||
|
||||
let curOffset = $(window).scrollTop();
|
||||
let destOffset = $target.offset().top -= REM / 2;
|
||||
|
||||
if (destOffset < curOffset) { // scroll up
|
||||
ScrollHelper.hideTopbar();
|
||||
ScrollHelper.addScrollUpTask();
|
||||
|
||||
if (isMobileViews && isPortrait) {
|
||||
destOffset -= ScrollHelper.getTopbarHeight();
|
||||
}
|
||||
|
||||
} else { // scroll down
|
||||
if (isMobileViews && isPortrait) {
|
||||
destOffset -= ScrollHelper.getTopbarHeight();
|
||||
}
|
||||
}
|
||||
|
||||
$("html").animate({
|
||||
scrollTop: destOffset
|
||||
}, 500, () => {
|
||||
$target.focus();
|
||||
|
||||
/* clean up old scroll mark */
|
||||
if ($(`[${ATTR_SCROLL_FOCUS}=true]`).length) {
|
||||
$(`[${ATTR_SCROLL_FOCUS}=true]`).attr(ATTR_SCROLL_FOCUS, false);
|
||||
}
|
||||
|
||||
/* Clean :target links */
|
||||
if ($(":target").length) { /* element that visited by the URL with hash */
|
||||
$(":target").attr(ATTR_SCROLL_FOCUS, false);
|
||||
}
|
||||
|
||||
/* set scroll mark to footnotes */
|
||||
if (toFootnote || toFootnoteRef) {
|
||||
$target.attr(ATTR_SCROLL_FOCUS, true);
|
||||
}
|
||||
|
||||
if ($target.is(":focus")) { /* Checking if the target was focused */
|
||||
return false;
|
||||
} else {
|
||||
$target.attr("tabindex", "-1"); /* Adding tabindex for elements not focusable */
|
||||
$target.focus(); /* Set focus again */
|
||||
}
|
||||
|
||||
if (ScrollHelper.hasScrollUpTask()) {
|
||||
ScrollHelper.popScrollUpTask();
|
||||
}
|
||||
});
|
||||
}); /* click() */
|
||||
});
|
||||
@@ -18,7 +18,7 @@ layout: compress
|
||||
|
||||
{% include head.html %}
|
||||
|
||||
<body data-spy="scroll" data-target="#toc" data-topbar-visible="true">
|
||||
<body data-topbar-visible="true">
|
||||
|
||||
{% include sidebar.html %}
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ layout: page
|
||||
# The Home page layout
|
||||
---
|
||||
|
||||
{% assign pinned = site.posts | where: "pin", "true" %}
|
||||
{% assign default = site.posts | where_exp: "item", "item.pin != true and item.hidden != true" %}
|
||||
{% assign pinned = site.posts | where: 'pin', 'true' %}
|
||||
{% assign default = site.posts | where_exp: 'item', 'item.pin != true and item.hidden != true' %}
|
||||
|
||||
{% assign posts = "" | split: "" %}
|
||||
{% assign posts = '' | split: '' %}
|
||||
|
||||
<!-- Get pinned posts -->
|
||||
|
||||
@@ -29,7 +29,7 @@ layout: page
|
||||
{% assign default_beg = 0 %}
|
||||
{% endif %}
|
||||
|
||||
{% assign default_num = paginator.posts | size | minus: pinned_num %}
|
||||
{% assign default_num = paginator.posts | size | minus: pinned_num %}
|
||||
{% assign default_end = default_beg | plus: default_num | minus: 1 %}
|
||||
|
||||
{% if default_num > 0 %}
|
||||
@@ -39,55 +39,54 @@ layout: page
|
||||
{% endif %}
|
||||
|
||||
<div id="post-list">
|
||||
{% for post in posts %}
|
||||
<div class="card post-preview">
|
||||
<a href="{{ post.url | relative_url }}">
|
||||
<div class="card-body">
|
||||
<h1 class="card-title">
|
||||
{{ post.title }}
|
||||
</h1>
|
||||
|
||||
{% for post in posts %}
|
||||
<div class="card-text post-content">
|
||||
<p>
|
||||
{% include no-linenos.html content=post.content %}
|
||||
{{ content | markdownify | strip_html | truncate: 200 | escape }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="post-preview">
|
||||
<h1>
|
||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||
</h1>
|
||||
<div class="post-meta text-muted d-flex">
|
||||
<div class="mr-auto">
|
||||
<!-- posted date -->
|
||||
<i class="far fa-calendar fa-fw"></i>
|
||||
{% include datetime.html date=post.date %}
|
||||
|
||||
<div class="post-content">
|
||||
<p>
|
||||
{% include no-linenos.html content=post.content %}
|
||||
{{ content | markdownify | strip_html | truncate: 200 | escape }}
|
||||
</p>
|
||||
<!-- categories -->
|
||||
{% if post.categories.size > 0 %}
|
||||
<i class="far fa-folder-open fa-fw"></i>
|
||||
<span>
|
||||
{% for category in post.categories %}
|
||||
{{ category }}
|
||||
{%- unless forloop.last -%},{%- endunless -%}
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if post.pin %}
|
||||
<div class="pin">
|
||||
<i class="fas fa-thumbtack fa-fw"></i>
|
||||
<span>{{ site.data.locales[site.lang].post.pin_prompt }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<!-- .post-meta -->
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="post-meta text-muted d-flex">
|
||||
<div class="mr-auto">
|
||||
|
||||
<!-- posted date -->
|
||||
<i class="far fa-calendar fa-fw"></i>
|
||||
{% include datetime.html date=post.date %}
|
||||
|
||||
<!-- categories -->
|
||||
{% if post.categories.size > 0 %}
|
||||
<i class="far fa-folder-open fa-fw"></i>
|
||||
<span>
|
||||
{% for category in post.categories %}
|
||||
{{ category }}
|
||||
{%- unless forloop.last -%},{%- endunless -%}
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
{% if post.pin %}
|
||||
<div class="pin">
|
||||
<i class="fas fa-thumbtack fa-fw"></i>
|
||||
<span>{{ site.data.locales[site.lang].post.pin_prompt }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div> <!-- .post-meta -->
|
||||
|
||||
</div> <!-- .post-review -->
|
||||
|
||||
{% endfor %}
|
||||
|
||||
</div> <!-- #post-list -->
|
||||
<!-- .post-review -->
|
||||
{% endfor %}
|
||||
</div>
|
||||
<!-- #post-list -->
|
||||
|
||||
{% if paginator.total_pages > 0 %}
|
||||
{% include post-paginator.html %}
|
||||
|
||||
@@ -26,31 +26,22 @@ tail_includes:
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% if page.image.path %}
|
||||
{% capture bg %}
|
||||
{% unless page.image.no_bg %}{{ 'bg' }}{% endunless %}
|
||||
{% if page.image %}
|
||||
{% capture src %}src="{{ page.image.path | default: page.image }}"{% endcapture %}
|
||||
{% capture class %}class="preview-img{% if page.image.no_bg %}{{ ' no-bg' }}{% endif %}"{% endcapture %}
|
||||
{% capture alt %}alt="{{ page.image.alt | default: "Preview Image" }}"{% endcapture %}
|
||||
|
||||
{% capture lqip %}
|
||||
{% if page.image.lqip %}
|
||||
lqip="{{ page.image.lqip }}"
|
||||
{% endif %}
|
||||
{% 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 %}
|
||||
width="{{ page.image.width }}"
|
||||
{% elsif page.image.w %}
|
||||
width="{{ page.image.w }}"
|
||||
{% endif %}
|
||||
|
||||
{% if page.image.height %}
|
||||
height="{{ page.image.height }}"
|
||||
{% elsif page.image.h %}
|
||||
height="{{ page.image.h }}"
|
||||
{% endif %}>
|
||||
|
||||
{% if page.image.alt %}
|
||||
<img {{ src }} {{ class }} {{ alt }} w="1200" h="630" {{ lqip | strip }}>
|
||||
{%- if page.image.alt -%}
|
||||
<figcaption class="text-center pt-2 pb-2">{{ page.image.alt }}</figcaption>
|
||||
{% endif %}
|
||||
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -8,14 +8,12 @@ math: true
|
||||
mermaid: true
|
||||
image:
|
||||
path: /commons/devices-mockup.png
|
||||
width: 800
|
||||
height: 500
|
||||
lqip: data:image/webp;base64,UklGRpoAAABXRUJQVlA4WAoAAAAQAAAADwAABwAAQUxQSDIAAAARL0AmbZurmr57yyIiqE8oiG0bejIYEQTgqiDA9vqnsUSI6H+oAERp2HZ65qP/VIAWAFZQOCBCAAAA8AEAnQEqEAAIAAVAfCWkAALp8sF8rgRgAP7o9FDvMCkMde9PK7euH5M1m6VWoDXf2FkP3BqV0ZYbO6NA/VFIAAAA
|
||||
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.
|
||||
|
||||
|
||||
## Titles
|
||||
---
|
||||
# H1 - heading
|
||||
@@ -26,7 +24,6 @@ This post is to show Markdown syntax rendering on [**Chirpy**](https://github.co
|
||||
|
||||
<h4>H4 - heading</h4>
|
||||
---
|
||||
<br>
|
||||
|
||||
## Paragraph
|
||||
|
||||
@@ -95,56 +92,6 @@ Moon
|
||||
|
||||
Click the hook will locate the footnote[^footnote], and here is another footnote[^fn-nth-2].
|
||||
|
||||
## Images
|
||||
|
||||
- Default (with caption)
|
||||
|
||||
{: width="972" height="589" }
|
||||
_Full screen width and center alignment_
|
||||
|
||||
<br>
|
||||
|
||||
- Shadow
|
||||
|
||||
{: .shadow width="1548" height="864" .w-75 }
|
||||
_shadow effect (visible in light mode)_
|
||||
|
||||
<br>
|
||||
|
||||
- Left aligned
|
||||
|
||||
{: width="972" height="589" .w-75 .normal}
|
||||
|
||||
- Float to left
|
||||
|
||||
{: width="972" height="589" .w-50 .left}
|
||||
Praesent maximus aliquam sapien. Sed vel neque in dolor pulvinar auctor. Maecenas pharetra, sem sit amet interdum posuere, tellus lacus eleifend magna, ac lobortis felis ipsum id sapien. Proin ornare rutrum metus, ac convallis diam volutpat sit amet. Phasellus volutpat, elit sit amet tincidunt mollis, felis mi scelerisque mauris, ut facilisis leo magna accumsan sapien. In rutrum vehicula nisl eget tempor. Nullam maximus ullamcorper libero non maximus. Integer ultricies velit id convallis varius. Praesent eu nisl eu urna finibus ultrices id nec ex. Mauris ac mattis quam. Fusce aliquam est nec sapien bibendum, vitae malesuada ligula condimentum. Phasellus a tortor aliquam, tristique felis sit amet, elementum enim. Integer vestibulum vitae nulla nec pretium.
|
||||
|
||||
- Float to right
|
||||
|
||||
{: width="972" height="589" .w-50 .right}
|
||||
Praesent maximus aliquam sapien. Sed vel neque in dolor pulvinar auctor. Maecenas pharetra, sem sit amet interdum posuere, tellus lacus eleifend magna, ac lobortis felis ipsum id sapien. Proin ornare rutrum metus, ac convallis diam volutpat sit amet. Phasellus volutpat, elit sit amet tincidunt mollis, felis mi scelerisque mauris, ut facilisis leo magna accumsan sapien. In rutrum vehicula nisl eget tempor. Nullam maximus ullamcorper libero non maximus. Integer ultricies velit id convallis varius. Praesent eu nisl eu urna finibus ultrices id nec ex. Mauris ac mattis quam. Fusce aliquam est nec sapien bibendum, vitae malesuada ligula condimentum. Phasellus a tortor aliquam, tristique felis sit amet, elementum enim. Integer vestibulum vitae nulla nec pretium.
|
||||
|
||||
## Mermaid SVG
|
||||
|
||||
```mermaid
|
||||
gantt
|
||||
title Adding GANTT diagram functionality to mermaid
|
||||
apple :a, 2017-07-20, 1w
|
||||
banana :crit, b, 2017-07-23, 1d
|
||||
cherry :active, c, after b a, 1d
|
||||
```
|
||||
|
||||
## Mathematics
|
||||
|
||||
The mathematics powered by [**MathJax**](https://www.mathjax.org/):
|
||||
|
||||
$$ \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} $$
|
||||
|
||||
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
|
||||
|
||||
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
|
||||
|
||||
## Inline code
|
||||
|
||||
This is an example of `Inline Code`.
|
||||
@@ -153,7 +100,7 @@ This is an example of `Inline Code`.
|
||||
|
||||
Here is the `/path/to/the/file.extend`{: .filepath}.
|
||||
|
||||
## Code block
|
||||
## Code blocks
|
||||
|
||||
### Common
|
||||
|
||||
@@ -161,22 +108,12 @@ Here is the `/path/to/the/file.extend`{: .filepath}.
|
||||
This is a common code snippet, without syntax highlight and line number.
|
||||
```
|
||||
|
||||
### Specific Languages
|
||||
|
||||
#### Console
|
||||
|
||||
```console
|
||||
$ env |grep SHELL
|
||||
SHELL=/usr/local/bin/bash
|
||||
PYENV_SHELL=bash
|
||||
```
|
||||
|
||||
#### Shell
|
||||
### Specific Language
|
||||
|
||||
```bash
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "The command was not successful.";
|
||||
#do the needful / exit
|
||||
echo "The command was not successful.";
|
||||
#do the needful / exit
|
||||
fi;
|
||||
```
|
||||
|
||||
@@ -189,6 +126,58 @@ fi;
|
||||
```
|
||||
{: file='_sass/jekyll-theme-chirpy.scss'}
|
||||
|
||||
## Mathematics
|
||||
|
||||
The mathematics powered by [**MathJax**](https://www.mathjax.org/):
|
||||
|
||||
$$ \sum_{n=1}^\infty 1/n^2 = \frac{\pi^2}{6} $$
|
||||
|
||||
When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
|
||||
|
||||
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$
|
||||
|
||||
## Mermaid SVG
|
||||
|
||||
```mermaid
|
||||
gantt
|
||||
title Adding GANTT diagram functionality to mermaid
|
||||
apple :a, 2017-07-20, 1w
|
||||
banana :crit, b, 2017-07-23, 1d
|
||||
cherry :active, c, after b a, 1d
|
||||
```
|
||||
|
||||
## Images
|
||||
|
||||
### Default (with caption)
|
||||
|
||||
{: width="972" height="589" }
|
||||
_Full screen width and center alignment_
|
||||
|
||||
### Left aligned
|
||||
|
||||
{: width="972" height="589" .w-75 .normal}
|
||||
|
||||
### Float to left
|
||||
|
||||
{: width="972" height="589" .w-50 .left}
|
||||
Praesent maximus aliquam sapien. Sed vel neque in dolor pulvinar auctor. Maecenas pharetra, sem sit amet interdum posuere, tellus lacus eleifend magna, ac lobortis felis ipsum id sapien. Proin ornare rutrum metus, ac convallis diam volutpat sit amet. Phasellus volutpat, elit sit amet tincidunt mollis, felis mi scelerisque mauris, ut facilisis leo magna accumsan sapien. In rutrum vehicula nisl eget tempor. Nullam maximus ullamcorper libero non maximus. Integer ultricies velit id convallis varius. Praesent eu nisl eu urna finibus ultrices id nec ex. Mauris ac mattis quam. Fusce aliquam est nec sapien bibendum, vitae malesuada ligula condimentum.
|
||||
|
||||
### Float to right
|
||||
|
||||
{: width="972" height="589" .w-50 .right}
|
||||
Praesent maximus aliquam sapien. Sed vel neque in dolor pulvinar auctor. Maecenas pharetra, sem sit amet interdum posuere, tellus lacus eleifend magna, ac lobortis felis ipsum id sapien. Proin ornare rutrum metus, ac convallis diam volutpat sit amet. Phasellus volutpat, elit sit amet tincidunt mollis, felis mi scelerisque mauris, ut facilisis leo magna accumsan sapien. In rutrum vehicula nisl eget tempor. Nullam maximus ullamcorper libero non maximus. Integer ultricies velit id convallis varius. Praesent eu nisl eu urna finibus ultrices id nec ex. Mauris ac mattis quam. Fusce aliquam est nec sapien bibendum, vitae malesuada ligula condimentum.
|
||||
|
||||
### Dark/Light mode & Shadow
|
||||
|
||||
The image below will toggle dark/light mode based on theme preference, notice it has shadows.
|
||||
|
||||
{: .light .w-75 .shadow .rounded-10 w='1212' h='668' }
|
||||
{: .dark .w-75 .shadow .rounded-10 w='1212' h='668' }
|
||||
|
||||
## Video
|
||||
|
||||
{% include embed/youtube.html id='Balreaj8Yqs' %}
|
||||
|
||||
## Reverse Footnote
|
||||
|
||||
[^footnote]: The footnote source
|
||||
|
||||
@@ -7,7 +7,7 @@ tags: [writing]
|
||||
render_with_liquid: false
|
||||
---
|
||||
|
||||
This post will guide you how to write a post on _Chirpy_ theme. Even if you have previous experience with Jekyll, this article is worth reading, because many features require specific variables to be set.
|
||||
This tutorial will guide you how to write a post in the _Chirpy_ template, and it's worth reading even if you've used Jekyll before, as many features require specific variables to be set.
|
||||
|
||||
## Naming and Path
|
||||
|
||||
@@ -133,13 +133,16 @@ _Image Caption_
|
||||
|
||||
### Size
|
||||
|
||||
In order to prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image:
|
||||
In order to prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image.
|
||||
|
||||
```markdown
|
||||
{: width="700" height="400" }
|
||||
```
|
||||
{: .nolineno}
|
||||
|
||||
> For an SVG, you have to at least specify its _width_, otherwise it won't be rendered.
|
||||
{: .prompt-info }
|
||||
|
||||
Starting from _Chirpy v5.0.0_, `height` and `width` support abbreviations (`height` → `h`, `width` → `w`). The following example has the same effect as the above:
|
||||
|
||||
```markdown
|
||||
@@ -177,9 +180,18 @@ By default, the image is centered, but you can specify the position by using one
|
||||
```
|
||||
{: .nolineno}
|
||||
|
||||
### Dark/Light mode
|
||||
|
||||
You can make images follow theme preferences in dark/light mode. This requires you to prepare two images, one for dark mode and one for light mode, and then assign them a specific class (`dark` or `light`):
|
||||
|
||||
```markdown
|
||||
{: .light }
|
||||
{: .dark }
|
||||
```
|
||||
|
||||
### 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:
|
||||
|
||||
```markdown
|
||||
{: .shadow }
|
||||
@@ -209,7 +221,7 @@ The parsing result will automatically add the CDN prefix `https://cdn.com` befor
|
||||
```html
|
||||
<img src="https://cdn.com/path/to/flower.png" alt="The flower">
|
||||
```
|
||||
{: .nolineno}
|
||||
{: .nolineno }
|
||||
|
||||
### Image Path
|
||||
|
||||
@@ -220,7 +232,6 @@ When a post contains many images, it will be a time-consuming task to repeatedly
|
||||
img_path: /img/path/
|
||||
---
|
||||
```
|
||||
{: .nolineno }
|
||||
|
||||
And then, the image source of Markdown can write the file name directly:
|
||||
|
||||
@@ -238,23 +249,48 @@ The output will be:
|
||||
|
||||
### Preview Image
|
||||
|
||||
If you want to add an image to the top of the post contents, specify the attribute `path`, `width`, `height`, and `alt` for the image:
|
||||
If you want to add an image at the top of the post, please provide an image with a resolution of `1200 x 630`. Please note that if the image aspect ratio does not meet `1.91 : 1`, the image will be scaled and cropped.
|
||||
|
||||
Knowing these prerequisites, you can start setting the image's attribute:
|
||||
|
||||
```yaml
|
||||
---
|
||||
image:
|
||||
path: /path/to/image/file
|
||||
width: 1000 # in pixels
|
||||
height: 400 # in pixels
|
||||
path: /path/to/image
|
||||
alt: image alternative text
|
||||
---
|
||||
```
|
||||
|
||||
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.
|
||||
Note that the [`img_path`](#image-path) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name.
|
||||
|
||||
Starting from _Chirpy v5.0.0_, the attributes `height` and `width` can be abbreviated: `height` → `h`, `width` → `w`. In addition, the [`img_path`](#image-path) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name.
|
||||
For simple use, you can also just use `image` to define the path.
|
||||
|
||||
Starting from _Chirpy v5.2.0_, the property for the preview image is changed to `image.path`. If upgrading the theme from a prior version, you will have to update posts' metadata to use new image property.
|
||||
```yml
|
||||
---
|
||||
image: /path/to/image
|
||||
---
|
||||
```
|
||||
|
||||
### LQIP
|
||||
|
||||
For preview images:
|
||||
|
||||
```yaml
|
||||
---
|
||||
image:
|
||||
lqip: /path/to/lqip-file # or base64 URI
|
||||
---
|
||||
```
|
||||
|
||||
> You can observe LQIP in the preview image of post [_Text and Typography_](/posts/text-and-typography/).
|
||||
|
||||
|
||||
For normal images:
|
||||
|
||||
```markdown
|
||||
{: lqip="/path/to/lqip-file" }
|
||||
```
|
||||
{: .nolineno }
|
||||
|
||||
## Pinned Posts
|
||||
|
||||
@@ -353,6 +389,24 @@ If you want to display the **Liquid** snippet, surround the liquid code with `{%
|
||||
|
||||
Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block.
|
||||
|
||||
## Videos
|
||||
|
||||
You can embed a video with the following syntax:
|
||||
|
||||
```liquid
|
||||
{% include embed/{Platform}.html id='{ID}' %}
|
||||
```
|
||||
Where `Platform` is the lowercase of the platform name, and `ID` is the video ID.
|
||||
|
||||
The following table shows how to get the two parameters we need in a given video URL, and you can also know the currently supported video platforms.
|
||||
|
||||
| Video URL | Platform | ID |
|
||||
|----------------------------------------------------------------------------------------------------|-----------|:--------------|
|
||||
| [https://www.**youtube**.com/watch?v=**H-B46URT4mg**](https://www.youtube.com/watch?v=H-B46URT4mg) | `youtube` | `H-B46URT4mg` |
|
||||
| [https://www.**twitch**.tv/videos/**1634779211**](https://www.twitch.tv/videos/1634779211) | `twitch` | `1634779211` |
|
||||
|
||||
|
||||
|
||||
## Learn More
|
||||
|
||||
For more knowledge about Jekyll posts, visit the [Jekyll Docs: Posts](https://jekyllrb.com/docs/posts/).
|
||||
|
||||
@@ -9,7 +9,7 @@ pin: true
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of `Ruby`, `RubyGems`, `Jekyll`, and `Bundler`. In addition, [Git](https://git-scm.com/) is also required to be installed.
|
||||
Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of the basic environment. [Git](https://git-scm.com/) also needs to be installed.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -18,20 +18,20 @@ Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installat
|
||||
There are two ways to create a new repository for this theme:
|
||||
|
||||
- [**Using the Chirpy Starter**](#option-1-using-the-chirpy-starter) - Easy to upgrade, isolates irrelevant project files so you can focus on writing.
|
||||
- [**Forking on GitHub**](#option-2-forking-on-github) - Convenient for custom development, but difficult to upgrade. Unless you are familiar with Jekyll and are determined to tweak or contribute to this project, this approach is not recommended.
|
||||
- [**GitHub Fork**](#option-2-github-fork) - Convenient for custom development, but difficult to upgrade. Unless you are familiar with Jekyll and are determined to tweak or contribute to this project, this approach is not recommended.
|
||||
|
||||
#### Option 1. Using the Chirpy Starter
|
||||
|
||||
Create a new repository from the [**Chirpy Starter**][use-starter] and name it `<GH_USERNAME>.github.io`, where `GH_USERNAME` represents your GitHub username.
|
||||
Sign in to GitHub and browse to [**Chirpy Starter**][starter], click the button <kbd>Use this template</kbd> > <kbd>Create a new repository</kbd>, and name the new repository `USERNAME.github.io`, where `USERNAME` represents your GitHub username.
|
||||
|
||||
#### Option 2. Forking on GitHub
|
||||
#### Option 2. GitHub Fork
|
||||
|
||||
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub and rename it to `<GH_USERNAME>.github.io`. Please note that the default branch code is in development. If you want the site to be stable, please switch to the [latest tag][latest-tag] and start writing.
|
||||
Sign in to GitHub to [fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), and then rename it to `USERNAME.github.io` (`USERNAME` means your username).
|
||||
|
||||
And then execute:
|
||||
Next, clone your site to local machine. In order to build JavaScript files later, we need to install [Node.js][nodejs], and then run the tool:
|
||||
|
||||
```console
|
||||
$ bash tools/init.sh
|
||||
$ bash tools/init
|
||||
```
|
||||
|
||||
> If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command.
|
||||
@@ -39,19 +39,14 @@ $ bash tools/init.sh
|
||||
|
||||
The above command will:
|
||||
|
||||
1. Removes some files or directories from your repository:
|
||||
- `.travis.yml`{: .filepath}
|
||||
- files under `_posts`{: .filepath}
|
||||
|
||||
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`{: .filepath}.
|
||||
|
||||
4. Creates a new commit to save the changes automatically.
|
||||
1. Check out the code to the [latest tag][latest-tag] (to ensure the stability of your site: as the code for the default branch is under development).
|
||||
2. Remove non-essential sample files and take care of GitHub-related files.
|
||||
3. Build JavaScript files and export to `assets/js/dist/`{: .filepath }, then make them tracked by Git.
|
||||
4. Automatically create a new commit to save the changes above.
|
||||
|
||||
### Installing Dependencies
|
||||
|
||||
Before running for the first time, go to the root directory of your site, and install dependencies as follows:
|
||||
Before running local server for the first time, go to the root directory of your site and run:
|
||||
|
||||
```console
|
||||
$ bundle
|
||||
@@ -70,9 +65,9 @@ Update the variables of `_config.yml`{: .filepath} as needed. Some of them are t
|
||||
|
||||
### Customizing Stylesheet
|
||||
|
||||
If you need to customize the stylesheet, copy the theme's `assets/css/style.scss`{: .filepath} to the same path on your Jekyll site, and then add the custom style at the end of the style file.
|
||||
If you need to customize the stylesheet, copy the theme's `assets/css/style.scss`{: .filepath} to the same path on your Jekyll site, and then add the custom style at the end of 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.
|
||||
Starting with version `4.1.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main sass file `_sass/jekyll-theme-chirpy.scss`{: .filepath} into the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign new value.
|
||||
|
||||
### Customing Static Assets
|
||||
|
||||
@@ -97,25 +92,32 @@ $ docker run -it --rm \
|
||||
jekyll serve
|
||||
```
|
||||
|
||||
After a while, the local service will be published at _<http://127.0.0.1:4000>_.
|
||||
After a few seconds, the local service will be published at _<http://127.0.0.1:4000>_.
|
||||
|
||||
## Deployment
|
||||
|
||||
Before the deployment begins, check out the file `_config.yml`{: .filepath} and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starts with a slash, e.g, `/project-name`.
|
||||
|
||||
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
|
||||
|
||||
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. And then rename your repository to `<GH_USERNAME>.github.io` on GitHub.
|
||||
There are a few things to get ready for.
|
||||
|
||||
Now publish your Jekyll site:
|
||||
- If you're on the GitHub Free plan, keep your site repository public.
|
||||
- If you have committed `Gemfile.lock`{: .filepath} to the repository, and your local machine is not running Linux, go the the root of your site and update the platform list of the lock-file:
|
||||
|
||||
```console
|
||||
$ bundle lock --add-platform x86_64-linux
|
||||
```
|
||||
|
||||
Next, configure the _Pages_ service.
|
||||
|
||||
1. Browse to your repository on GitHub. Select the tab _Settings_, then click _Pages_ in the left navigation bar. Then, in the **Source** section (under _Build and deployment_), select [**GitHub Actions**][pages-workflow-src] from the dropdown menu.
|
||||
|
||||
2. Push any commit to remote to trigger the GitHub Actions workflow. In the _Actions_ tab of your repository, you should see the workflow _Build and Deploy_ running. Once the build is complete and successful, the site should be deployed automatically.
|
||||
2. Push any commits to GitHub to trigger the _Actions_ workflow. In the _Actions_ tab of your repository, you should see the workflow _Build and Deploy_ running. Once the build is complete and successful, the site will be deployed automatically.
|
||||
|
||||
3. Visit your website at the address indicated by GitHub.
|
||||
At this point, you can go to the URL indicated by GitHub to access your site.
|
||||
|
||||
### Manually Build and Deploy
|
||||
|
||||
@@ -139,32 +141,7 @@ $ docker run -it --rm \
|
||||
|
||||
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
|
||||
|
||||
It depends on how you use the theme:
|
||||
|
||||
- If you are using the theme gem (there will be `gem "jekyll-theme-chirpy"` in the `Gemfile`{: .filepath}), editing the `Gemfile`{: .filepath} and update the version number of the theme gem, for example:
|
||||
|
||||
```diff
|
||||
- gem "jekyll-theme-chirpy", "~> 3.2", ">= 3.2.1"
|
||||
+ gem "jekyll-theme-chirpy", "~> 3.3", ">= 3.3.0"
|
||||
```
|
||||
{: .nolineno file="Gemfile" }
|
||||
|
||||
And then execute the following command:
|
||||
|
||||
```console
|
||||
$ bundle update jekyll-theme-chirpy
|
||||
```
|
||||
|
||||
As the version upgrades, the critical files (for details, see the [Startup Template][starter]) and configuration options will change. Please refer to the [Upgrade Guide](https://github.com/cotes2020/jekyll-theme-chirpy/wiki/Upgrade-Guide) to keep your repo's files in sync with the latest version of the theme.
|
||||
|
||||
- If you forked from the source project (there will be `gemspec` in the `Gemfile`{: .filepath} of your site), then merge the [latest upstream tags][latest-tag] into your Jekyll site to complete the upgrade.
|
||||
The merge is likely to conflict with your local modifications. Please be patient and careful to resolve these conflicts.
|
||||
|
||||
[nodejs]: https://nodejs.org/
|
||||
[starter]: https://github.com/cotes2020/chirpy-starter
|
||||
[use-starter]: https://github.com/cotes2020/chirpy-starter/generate
|
||||
[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
|
||||
[chirpy-4.1.0]: https://github.com/cotes2020/jekyll-theme-chirpy/releases/tag/v4.1.0
|
||||
[pages-workflow-src]: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow
|
||||
[latest-tag]: https://github.com/cotes2020/jekyll-theme-chirpy/tags
|
||||
|
||||
@@ -5,22 +5,22 @@
|
||||
html {
|
||||
@media (prefers-color-scheme: light) {
|
||||
&:not([data-mode]),
|
||||
&[data-mode="light"] {
|
||||
&[data-mode='light'] {
|
||||
@include light-scheme;
|
||||
}
|
||||
|
||||
&[data-mode="dark"] {
|
||||
&[data-mode='dark'] {
|
||||
@include dark-scheme;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
&:not([data-mode]),
|
||||
&[data-mode="dark"] {
|
||||
&[data-mode='dark'] {
|
||||
@include dark-scheme;
|
||||
}
|
||||
|
||||
&[data-mode="light"] {
|
||||
&[data-mode='light'] {
|
||||
@include light-scheme;
|
||||
}
|
||||
}
|
||||
@@ -29,10 +29,12 @@ html {
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--body-bg);
|
||||
background: var(--main-bg);
|
||||
padding: env(safe-area-inset-top) env(safe-area-inset-right)
|
||||
env(safe-area-inset-bottom) env(safe-area-inset-left);
|
||||
color: var(--text-color);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-family: "Source Sans Pro", "Microsoft Yahei", sans-serif;
|
||||
font-family: 'Source Sans Pro', 'Microsoft Yahei', sans-serif;
|
||||
line-height: 1.75;
|
||||
}
|
||||
|
||||
@@ -83,6 +85,54 @@ a {
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
|
||||
&[data-src] {
|
||||
&.lazyloaded {
|
||||
-webkit-animation: fade-in 0.4s ease-in;
|
||||
animation: fade-in 0.4s ease-in;
|
||||
}
|
||||
|
||||
&[data-lqip='true'] {
|
||||
&.lazyload,
|
||||
&.lazyloading {
|
||||
-webkit-filter: blur(20px);
|
||||
filter: blur(20px);
|
||||
}
|
||||
}
|
||||
|
||||
&:not([data-lqip='true']) {
|
||||
&.lazyload,
|
||||
&.lazyloading {
|
||||
background: var(--img-bg);
|
||||
}
|
||||
}
|
||||
|
||||
&.shadow {
|
||||
-webkit-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;
|
||||
}
|
||||
|
||||
@-webkit-keyframes fade-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fade-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
blockquote {
|
||||
@@ -90,38 +140,33 @@ blockquote {
|
||||
padding-left: 1rem;
|
||||
color: var(--blockquote-text-color);
|
||||
|
||||
&[class^="prompt-"] {
|
||||
display: flex;
|
||||
&[class^='prompt-'] {
|
||||
border-left: 0;
|
||||
border-radius: 6px;
|
||||
padding: 1rem;
|
||||
position: relative;
|
||||
padding: 1rem 1rem 1rem 3rem;
|
||||
color: var(--prompt-text-color);
|
||||
|
||||
@extend %rounded;
|
||||
|
||||
&::before {
|
||||
font-family: "Font Awesome 5 Free";
|
||||
text-align: center;
|
||||
width: 1.25rem;
|
||||
margin-right: 0.75rem;
|
||||
width: 3rem;
|
||||
position: absolute;
|
||||
left: 0.25rem;
|
||||
margin-top: 0.4rem;
|
||||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
> div {
|
||||
max-width: calc(100% - 2rem);
|
||||
|
||||
> :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
> p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
@include prompt('tip', '\f0eb', 'regular');
|
||||
@include prompt('info', '\f06a');
|
||||
@include prompt('warning', '\f06a');
|
||||
@include prompt('danger', '\f071');
|
||||
}
|
||||
|
||||
kbd {
|
||||
@@ -173,50 +218,14 @@ footer {
|
||||
}
|
||||
}
|
||||
|
||||
i { /* fontawesome icons */
|
||||
/* fontawesome icons */
|
||||
i {
|
||||
&.far,
|
||||
&.fas {
|
||||
@extend %no-cursor;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fade-in {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes fade-in {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
img[data-src] {
|
||||
margin: 0.5rem 0;
|
||||
|
||||
&[data-loaded="true"] {
|
||||
-webkit-animation: fade-in linear 0.5s;
|
||||
animation: fade-in linear 0.5s;
|
||||
}
|
||||
|
||||
&.left {
|
||||
float: left;
|
||||
margin: 0.75rem 1rem 1rem 0;
|
||||
}
|
||||
|
||||
&.right {
|
||||
float: right;
|
||||
margin: 0.75rem 0 1rem 1rem;
|
||||
}
|
||||
|
||||
&.shadow {
|
||||
-webkit-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 --- */
|
||||
|
||||
.access {
|
||||
@@ -268,7 +277,7 @@ img[data-src] {
|
||||
}
|
||||
}
|
||||
|
||||
[data-topbar-visible="true"] & > div {
|
||||
[data-topbar-visible='true'] & > div {
|
||||
top: 6rem;
|
||||
}
|
||||
}
|
||||
@@ -312,7 +321,7 @@ img[data-src] {
|
||||
|
||||
/* [scroll-focus] added by `smooth-scroll.js` */
|
||||
&:target:not([scroll-focus]),
|
||||
&[scroll-focus="true"] > p {
|
||||
&[scroll-focus='true'] > p {
|
||||
background-color: var(--footnote-target-bg);
|
||||
width: -moz-fit-content;
|
||||
width: -webkit-fit-content;
|
||||
@@ -333,7 +342,7 @@ img[data-src] {
|
||||
|
||||
/* [scroll-focus] added by `smooth-scroll.js` */
|
||||
@at-root sup:target:not([scroll-focus]),
|
||||
sup[scroll-focus=true] > a#{&} {
|
||||
sup[scroll-focus='true'] > a#{&} {
|
||||
background-color: var(--footnote-target-bg);
|
||||
}
|
||||
}
|
||||
@@ -386,7 +395,7 @@ img[data-src] {
|
||||
}
|
||||
}
|
||||
} /* tbody */
|
||||
}/* table */
|
||||
} /* table */
|
||||
}
|
||||
|
||||
/* --- post --- */
|
||||
@@ -397,26 +406,14 @@ img[data-src] {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
a {
|
||||
&.img-link {
|
||||
@extend %no-cursor;
|
||||
}
|
||||
|
||||
/* created by `_includes/img-extra.html` */
|
||||
&.popup {
|
||||
cursor: zoom-in;
|
||||
|
||||
> img[data-src]:not(.normal):not(.left):not(.right) {
|
||||
p {
|
||||
> img[data-src],
|
||||
> a.popup {
|
||||
&:not(.normal):not(.left):not(.right) {
|
||||
@include align-center;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
code {
|
||||
@extend %link-hover;
|
||||
}
|
||||
}
|
||||
} /* a */
|
||||
}
|
||||
}
|
||||
|
||||
.pageviews .fa-spinner {
|
||||
@@ -428,10 +425,6 @@ img[data-src] {
|
||||
word-spacing: 1px;
|
||||
|
||||
a {
|
||||
&:not(:last-child) {
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
&:not([class]):hover {
|
||||
@extend %link-hover;
|
||||
}
|
||||
@@ -448,6 +441,14 @@ img[data-src] {
|
||||
overflow-wrap: break-word;
|
||||
|
||||
a {
|
||||
&.popup {
|
||||
@extend %no-cursor;
|
||||
@extend %img-caption;
|
||||
@include mt-mb(0.5rem);
|
||||
|
||||
cursor: zoom-in;
|
||||
}
|
||||
|
||||
&:not(.img-link) {
|
||||
@extend %link-underline;
|
||||
|
||||
@@ -455,27 +456,26 @@ img[data-src] {
|
||||
@extend %link-hover;
|
||||
}
|
||||
}
|
||||
|
||||
&.img-link {
|
||||
@extend %img-caption;
|
||||
}
|
||||
}
|
||||
|
||||
> ol,
|
||||
> ul {
|
||||
-webkit-padding-start: 1.75rem;
|
||||
padding-inline-start: 1.75rem;
|
||||
ol,
|
||||
ul {
|
||||
&:not([class]),
|
||||
&.task-list {
|
||||
-webkit-padding-start: 1.75rem;
|
||||
padding-inline-start: 1.75rem;
|
||||
|
||||
li {
|
||||
margin: 0.25rem 0;
|
||||
padding-left: 0.25rem;
|
||||
}
|
||||
li {
|
||||
margin: 0.25rem 0;
|
||||
padding-left: 0.25rem;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
-webkit-padding-start: 1rem;
|
||||
padding-inline-start: 1rem;
|
||||
margin: 0.5rem 0;
|
||||
ol,
|
||||
ul {
|
||||
-webkit-padding-start: 1.25rem;
|
||||
padding-inline-start: 1.25rem;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,7 +487,8 @@ img[data-src] {
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
|
||||
> i { /* checkbox icon */
|
||||
/* checkbox icon */
|
||||
> i {
|
||||
width: 2rem;
|
||||
margin-left: -1.25rem;
|
||||
color: var(--checkbox-color);
|
||||
@@ -503,7 +504,7 @@ img[data-src] {
|
||||
}
|
||||
}
|
||||
|
||||
input[type="checkbox"] {
|
||||
input[type='checkbox'] {
|
||||
margin: 0 0.5rem 0.2rem -1.3rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
@@ -541,6 +542,70 @@ img[data-src] {
|
||||
}
|
||||
}
|
||||
|
||||
.rounded-10 {
|
||||
border-radius: 10px !important;
|
||||
}
|
||||
|
||||
.img-link {
|
||||
color: transparent;
|
||||
display: inline-flex;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.shimmer {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: var(--img-bg);
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
background: var(--shimmer-bg);
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
-webkit-animation: shimmer 1s infinite;
|
||||
animation: shimmer 1s infinite;
|
||||
}
|
||||
|
||||
@-webkit-keyframes shimmer {
|
||||
0% {
|
||||
-webkit-transform: translateX(-100%);
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: translateX(100%);
|
||||
transform: translateX(100%);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
0% {
|
||||
-webkit-transform: translateX(-100%);
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: translateX(100%);
|
||||
transform: translateX(100%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.embed-video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
@extend %rounded;
|
||||
|
||||
&.youtube {
|
||||
aspect-ratio: 16 / 9;
|
||||
}
|
||||
|
||||
&.twitch {
|
||||
aspect-ratio: 310 / 189;
|
||||
}
|
||||
}
|
||||
|
||||
/* --- buttons --- */
|
||||
.btn-lang {
|
||||
border: 1px solid !important;
|
||||
@@ -587,7 +652,8 @@ img[data-src] {
|
||||
@include no-text-decoration;
|
||||
}
|
||||
|
||||
.tooltip-inner { /* Overrided BS4 Tooltip */
|
||||
/* Overrided BS4 Tooltip */
|
||||
.tooltip-inner {
|
||||
font-size: 0.7rem;
|
||||
max-width: 220px;
|
||||
text-align: left;
|
||||
@@ -610,6 +676,16 @@ img[data-src] {
|
||||
transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
margin: 0.75rem 1rem 1rem 0 !important;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
margin: 0.75rem 0 1rem 1rem !important;
|
||||
}
|
||||
|
||||
/* --- Overriding --- */
|
||||
|
||||
/* magnific-popup */
|
||||
@@ -624,9 +700,15 @@ figure .mfp-title {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* MathJax */
|
||||
mjx-container {
|
||||
overflow-y: hidden;
|
||||
min-width: auto !important;
|
||||
}
|
||||
|
||||
/* --- sidebar layout --- */
|
||||
|
||||
$sidebar-display: "sidebar-display";
|
||||
$sidebar-display: 'sidebar-display';
|
||||
|
||||
#sidebar {
|
||||
@include pl-pr(0);
|
||||
@@ -646,8 +728,8 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
|
||||
/* Hide scrollbar for IE, Edge and Firefox */
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
|
||||
a {
|
||||
@extend %sidebar-links;
|
||||
@@ -712,6 +794,7 @@ $sidebar-display: "sidebar-display";
|
||||
min-height: 3rem; /* avoid vertical shifting in multi-line words */
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@@ -751,14 +834,15 @@ $sidebar-display: "sidebar-display";
|
||||
&:last-child {
|
||||
a {
|
||||
position: relative;
|
||||
left: $cursor-width / 2;
|
||||
left: calc($cursor-width / 2);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&::after { /* the cursor */
|
||||
/* the cursor */
|
||||
&::after {
|
||||
display: table;
|
||||
visibility: hidden;
|
||||
content: "";
|
||||
content: '';
|
||||
position: relative;
|
||||
right: 1px;
|
||||
width: $cursor-width;
|
||||
@@ -777,7 +861,8 @@ $sidebar-display: "sidebar-display";
|
||||
|
||||
@for $i from 1 through $tab-count {
|
||||
$offset: $tab-count - $i;
|
||||
$top: -$offset * $tab-height + ($tab-height - $tab-cursor-height) / 2;
|
||||
$top: (-$offset * $tab-height) +
|
||||
(($tab-height - $tab-cursor-height) * 0.5);
|
||||
|
||||
@if $i < $tab-count {
|
||||
> li.active:nth-child(#{$i}),
|
||||
@@ -838,7 +923,7 @@ $sidebar-display: "sidebar-display";
|
||||
@extend %no-cursor;
|
||||
|
||||
background-color: var(--sidebar-muted-color);
|
||||
content: "";
|
||||
content: '';
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
border-radius: 50%;
|
||||
@@ -881,13 +966,14 @@ $sidebar-display: "sidebar-display";
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.07);
|
||||
background-color: var(--topbar-wrapper-bg);
|
||||
|
||||
[data-topbar-visible="false"] & {
|
||||
[data-topbar-visible='false'] & {
|
||||
top: -$topbar-height; /* same as topbar height. */
|
||||
}
|
||||
}
|
||||
|
||||
#topbar {
|
||||
i { /* icons */
|
||||
/* icons */
|
||||
i {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
@@ -903,7 +989,7 @@ $sidebar-display: "sidebar-display";
|
||||
span {
|
||||
&:not(:last-child) {
|
||||
&::after {
|
||||
content: "›";
|
||||
content: '›';
|
||||
padding: 0 0.3rem;
|
||||
}
|
||||
}
|
||||
@@ -931,7 +1017,8 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
}
|
||||
|
||||
#search-cancel { /* 'Cancel' link */
|
||||
/* 'Cancel' link */
|
||||
#search-cancel {
|
||||
color: var(--link-color);
|
||||
margin-left: 1rem;
|
||||
display: none;
|
||||
@@ -952,9 +1039,21 @@ $sidebar-display: "sidebar-display";
|
||||
background: center;
|
||||
|
||||
&.form-control {
|
||||
&::-moz-placeholder { @include input-placeholder; }
|
||||
&::-webkit-input-placeholder { @include input-placeholder; }
|
||||
&::placeholder { @include input-placeholder; }
|
||||
&::-moz-placeholder {
|
||||
@include input-placeholder;
|
||||
}
|
||||
&::-webkit-input-placeholder {
|
||||
@include input-placeholder;
|
||||
}
|
||||
&:-ms-input-placeholder {
|
||||
@include input-placeholder;
|
||||
}
|
||||
&::-ms-input-placeholder {
|
||||
@include input-placeholder;
|
||||
}
|
||||
&::placeholder {
|
||||
@include input-placeholder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -976,7 +1075,7 @@ $sidebar-display: "sidebar-display";
|
||||
margin: 0 1.25rem 1rem 0;
|
||||
|
||||
&::before {
|
||||
content: "#";
|
||||
content: '#';
|
||||
color: var(--text-muted-color);
|
||||
padding-right: 0.2rem;
|
||||
}
|
||||
@@ -1008,7 +1107,8 @@ $sidebar-display: "sidebar-display";
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
i { /* icons */
|
||||
/* icons */
|
||||
i {
|
||||
color: #818182;
|
||||
margin-right: 0.15rem;
|
||||
font-size: 80%;
|
||||
@@ -1055,10 +1155,7 @@ $sidebar-display: "sidebar-display";
|
||||
#mask {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
inset: 0 0 0 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 1;
|
||||
@@ -1190,6 +1287,7 @@ $sidebar-display: "sidebar-display";
|
||||
|
||||
div.d-flex {
|
||||
padding: 1.5rem 0;
|
||||
line-height: 1.65;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-around !important;
|
||||
}
|
||||
@@ -1205,7 +1303,9 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
|
||||
#core-wrapper {
|
||||
min-height: calc(100vh - #{$topbar-height} - #{$footer-height-mobile}) !important;
|
||||
min-height: calc(
|
||||
100vh - #{$topbar-height} - #{$footer-height-mobile}
|
||||
) !important;
|
||||
|
||||
h1 {
|
||||
margin-top: 2.2rem;
|
||||
@@ -1213,8 +1313,7 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
|
||||
.post-content {
|
||||
> blockquote[class^="prompt-"] {
|
||||
@include pl-pr(1.25rem);
|
||||
> blockquote[class^='prompt-'] {
|
||||
@include ml-mr(-1.25rem);
|
||||
|
||||
border-radius: 0;
|
||||
@@ -1350,7 +1449,7 @@ $sidebar-display: "sidebar-display";
|
||||
} /* max-width: 849px */
|
||||
|
||||
@media all and (max-width: 849px) and (orientation: portrait) {
|
||||
[data-topbar-visible="false"] #topbar-wrapper {
|
||||
[data-topbar-visible='false'] #topbar-wrapper {
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
@@ -1540,7 +1639,9 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
|
||||
#search-wrapper {
|
||||
margin-right: calc(#{$main-content-max-width} * 0.25 - #{$search-max-width});
|
||||
margin-right: calc(
|
||||
#{$main-content-max-width} * 0.25 - #{$search-max-width}
|
||||
);
|
||||
}
|
||||
|
||||
#topbar,
|
||||
@@ -1555,7 +1656,9 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
|
||||
#back-to-top {
|
||||
right: calc((100vw - #{$sidebar-width-large} - #{$main-content-max-width}) / 2 + 2rem);
|
||||
right: calc(
|
||||
(100vw - #{$sidebar-width-large} - #{$main-content-max-width}) / 2 + 2rem
|
||||
);
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
%heading {
|
||||
color: var(--heading-color);
|
||||
font-weight: 400;
|
||||
font-family: Lato, "Microsoft Yahei", sans-serif;
|
||||
font-family: Lato, 'Microsoft Yahei', sans-serif;
|
||||
}
|
||||
|
||||
%section {
|
||||
@@ -90,6 +90,10 @@
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
%rounded {
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
%img-caption {
|
||||
+ em {
|
||||
display: block;
|
||||
@@ -114,6 +118,11 @@
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@mixin mt-mb($value) {
|
||||
margin-top: $value;
|
||||
margin-bottom: $value;
|
||||
}
|
||||
|
||||
@mixin ml-mr($value) {
|
||||
margin-left: $value;
|
||||
margin-right: $value;
|
||||
@@ -141,14 +150,14 @@
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
@mixin prompt($type, $fw-icon, $icon-weight: 900) {
|
||||
@mixin prompt($type, $fa-content, $fa-style: 'solid') {
|
||||
&.prompt-#{$type} {
|
||||
background-color: var(--prompt-#{$type}-bg);
|
||||
|
||||
&::before {
|
||||
content: $fw-icon;
|
||||
content: $fa-content;
|
||||
color: var(--prompt-#{$type}-icon-color);
|
||||
font-weight: $icon-weight;
|
||||
font: var(--fa-font-#{$fa-style});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,45 +2,39 @@
|
||||
* The syntax highlight.
|
||||
*/
|
||||
|
||||
@import "colors/light-syntax";
|
||||
@import "colors/dark-syntax";
|
||||
@import 'colors/light-syntax';
|
||||
@import 'colors/dark-syntax';
|
||||
|
||||
html {
|
||||
@media (prefers-color-scheme: light) {
|
||||
&:not([data-mode]),
|
||||
&[data-mode="light"] {
|
||||
&[data-mode='light'] {
|
||||
@include light-syntax;
|
||||
}
|
||||
|
||||
&[data-mode="dark"] {
|
||||
&[data-mode='dark'] {
|
||||
@include dark-syntax;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
&:not([data-mode]),
|
||||
&[data-mode="dark"] {
|
||||
&[data-mode='dark'] {
|
||||
@include dark-syntax;
|
||||
}
|
||||
|
||||
&[data-mode="light"] {
|
||||
&[data-mode='light'] {
|
||||
@include light-syntax;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -- Codes Snippet -- */
|
||||
|
||||
$code-radius: 6px;
|
||||
/* -- code snippets -- */
|
||||
|
||||
%code-snippet-bg {
|
||||
background: var(--highlight-bg-color);
|
||||
}
|
||||
|
||||
%code-snippet-radius {
|
||||
border-radius: $code-radius;
|
||||
}
|
||||
|
||||
%code-snippet-padding {
|
||||
padding-left: 1rem;
|
||||
padding-right: 1.5rem;
|
||||
@@ -48,7 +42,7 @@ $code-radius: 6px;
|
||||
|
||||
.highlighter-rouge {
|
||||
@extend %code-snippet-bg;
|
||||
@extend %code-snippet-radius;
|
||||
@extend %rounded;
|
||||
|
||||
color: var(--highlighter-rouge-color);
|
||||
margin-top: 0.5rem;
|
||||
@@ -56,7 +50,7 @@ $code-radius: 6px;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
@extend %code-snippet-radius;
|
||||
@extend %rounded;
|
||||
@extend %code-snippet-bg;
|
||||
|
||||
@at-root figure#{&} {
|
||||
@@ -76,7 +70,7 @@ $code-radius: 6px;
|
||||
|
||||
table {
|
||||
td pre {
|
||||
overflow: visible; /* Fixed iOS safari overflow-x */
|
||||
overflow: visible; /* Fixed iOS safari overflow-x */
|
||||
word-break: normal; /* Fixed iOS safari linenos code break */
|
||||
}
|
||||
}
|
||||
@@ -89,19 +83,14 @@ $code-radius: 6px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-o-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* set the dollar sign to non-selectable */
|
||||
.gp {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
} /* .highlight */
|
||||
|
||||
code {
|
||||
-webkit-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
hyphens: none;
|
||||
|
||||
&.highlighter-rouge {
|
||||
@@ -153,7 +142,7 @@ td.rouge-code {
|
||||
|
||||
/* Hide line numbers for default, console, and terminal code snippets */
|
||||
div {
|
||||
&[class^="highlighter-rouge"],
|
||||
&[class^='highlighter-rouge'],
|
||||
&.nolineno,
|
||||
&.language-plaintext.highlighter-rouge,
|
||||
&.language-console.highlighter-rouge,
|
||||
@@ -173,8 +162,6 @@ div {
|
||||
|
||||
$code-header-height: 2.25rem;
|
||||
|
||||
border-top-left-radius: $code-radius;
|
||||
border-top-right-radius: $code-radius;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
@@ -184,15 +171,14 @@ div {
|
||||
$dot-size: 0.75rem;
|
||||
$dot-margin: 0.5rem;
|
||||
|
||||
content: "";
|
||||
content: '';
|
||||
display: inline-block;
|
||||
margin-left: 1rem;
|
||||
width: $dot-size;
|
||||
height: $dot-size;
|
||||
border-radius: 50%;
|
||||
background-color: var(--code-header-muted-color);
|
||||
box-shadow:
|
||||
($dot-size + $dot-margin) 0 0 var(--code-header-muted-color),
|
||||
box-shadow: ($dot-size + $dot-margin) 0 0 var(--code-header-muted-color),
|
||||
($dot-size + $dot-margin) * 2 0 0 var(--code-header-muted-color);
|
||||
}
|
||||
|
||||
@@ -226,9 +212,9 @@ div {
|
||||
/* clipboard */
|
||||
button {
|
||||
@extend %cursor-pointer;
|
||||
@extend %rounded;
|
||||
|
||||
border: 1px solid transparent;
|
||||
border-radius: $code-radius;
|
||||
height: $code-header-height;
|
||||
width: $code-header-height;
|
||||
padding: 0;
|
||||
@@ -264,7 +250,7 @@ div {
|
||||
|
||||
@media all and (max-width: 576px) {
|
||||
.post-content {
|
||||
> div[class^="language-"] {
|
||||
> div[class^='language-'] {
|
||||
@include ml-mr(-1.25rem);
|
||||
|
||||
border-radius: 0;
|
||||
|
||||
@@ -4,23 +4,23 @@
|
||||
|
||||
/* sidebar */
|
||||
|
||||
$sidebar-width: 260px !default; /* the basic width */
|
||||
$sidebar-width-small: 210px !default; /* screen width: >= 850px, <= 1199px (iPad landscape) */
|
||||
$sidebar-width-large: 350px !default; /* screen width: >= 1650px */
|
||||
$sidebar-width: 260px !default; /* the basic width */
|
||||
$sidebar-width-small: 210px !default; /* screen width: >= 850px, <= 1199px (iPad landscape) */
|
||||
$sidebar-width-large: 350px !default; /* screen width: >= 1650px */
|
||||
|
||||
/* 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-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 */
|
||||
|
||||
$topbar-height: 3rem !default;
|
||||
$search-max-width: 210px !default;
|
||||
$footer-height: 5rem !default;
|
||||
$footer-height-mobile: 6rem !default; /* screen width: <= 576px */
|
||||
$footer-height-mobile: 6rem !default; /* screen width: <= 576px */
|
||||
|
||||
$main-content-max-width: 1250px !default;
|
||||
$bottom-min-height: 35rem !default;
|
||||
|
||||
@@ -13,10 +13,13 @@
|
||||
--clipboard-checked-color: #2bcc2b;
|
||||
--filepath-text-color: #bdbdbd;
|
||||
|
||||
pre { color: #bfbfbf; } /* override Bootstrap */
|
||||
/* override Bootstrap */
|
||||
pre {
|
||||
color: #bfbfbf;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
.gp { color: #818c96; }
|
||||
.highlight .gp {
|
||||
color: #818c96;
|
||||
}
|
||||
|
||||
/* syntax highlight colors from https://raw.githubusercontent.com/jwarby/pygments-css/master/monokai.css */
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
|
||||
@mixin dark-scheme {
|
||||
/* Framework color */
|
||||
--body-bg: var(--main-bg);
|
||||
--mask-bg: rgb(68, 69, 70);
|
||||
--main-bg: rgb(27, 27, 30);
|
||||
--mask-bg: rgb(68, 69, 70);
|
||||
--main-border-color: rgb(44, 45, 45);
|
||||
|
||||
/* Common color */
|
||||
@@ -26,6 +25,13 @@
|
||||
--label-color: rgb(108, 117, 125);
|
||||
--checkbox-color: rgb(118, 120, 121);
|
||||
--checkbox-checked-color: var(--link-color);
|
||||
--img-bg: radial-gradient(circle, rgb(22, 22, 24) 0%, rgb(32, 32, 32) 100%);
|
||||
--shimmer-bg: linear-gradient(
|
||||
90deg,
|
||||
rgba(255, 255, 255, 0) 0%,
|
||||
rgba(58, 55, 55, 0.4) 50%,
|
||||
rgba(255, 255, 255, 0) 100%
|
||||
);
|
||||
|
||||
/* Sidebar */
|
||||
--sidebar-bg: radial-gradient(circle, #242424 0%, #1d1f27 100%);
|
||||
@@ -62,10 +68,10 @@
|
||||
--btn-share-color: #6c757d;
|
||||
--btn-share-hover-color: #bfc1ca;
|
||||
--relate-post-date: var(--text-muted-color);
|
||||
--card-bg: rgb(39, 40, 43);
|
||||
--card-bg: #212121;
|
||||
--card-hovor-bg: #3a3a3a;
|
||||
--card-border-color: rgb(53, 53, 60);
|
||||
--card-box-shadow: var(--main-bg);
|
||||
--preview-img-bg: radial-gradient(circle, rgb(22, 22, 24) 0%, rgb(32, 32, 32) 100%);
|
||||
--kbd-wrap-color: #6a6a6a;
|
||||
--kbd-text-color: #d3d3d3;
|
||||
--kbd-bg-color: #242424;
|
||||
@@ -96,24 +102,20 @@
|
||||
--timeline-year-dot-color: var(--timeline-color);
|
||||
|
||||
.post img[data-src] {
|
||||
-webkit-filter: brightness(95%);
|
||||
filter: brightness(95%);
|
||||
&.lazyloaded {
|
||||
-webkit-filter: brightness(95%);
|
||||
filter: brightness(95%);
|
||||
}
|
||||
}
|
||||
|
||||
.light {
|
||||
display: none;
|
||||
}
|
||||
|
||||
hr {
|
||||
border-color: var(--main-border-color);
|
||||
}
|
||||
|
||||
/* posts' toc, override BS */
|
||||
nav[data-toggle="toc"] .nav-link.active,
|
||||
nav[data-toggle="toc"] .nav-link.active:focus,
|
||||
nav[data-toggle="toc"] .nav-link.active:hover,
|
||||
nav[data-toggle="toc"] .nav > li > a:focus,
|
||||
nav[data-toggle="toc"] .nav > li > a:hover {
|
||||
color: var(--toc-highlight) !important;
|
||||
border-left-color: var(--toc-highlight) !important;
|
||||
}
|
||||
|
||||
/* categories */
|
||||
.categories.card,
|
||||
.list-group-item {
|
||||
@@ -138,20 +140,20 @@
|
||||
}
|
||||
|
||||
#archives li:nth-child(odd) {
|
||||
background-image:
|
||||
linear-gradient(
|
||||
to left,
|
||||
rgb(26, 26, 30),
|
||||
rgb(39, 39, 45),
|
||||
rgb(39, 39, 45),
|
||||
rgb(39, 39, 45),
|
||||
rgb(26, 26, 30)
|
||||
);
|
||||
background-image: linear-gradient(
|
||||
to left,
|
||||
rgb(26, 26, 30),
|
||||
rgb(39, 39, 45),
|
||||
rgb(39, 39, 45),
|
||||
rgb(39, 39, 45),
|
||||
rgb(26, 26, 30)
|
||||
);
|
||||
}
|
||||
|
||||
color-scheme: dark;
|
||||
|
||||
#disqus_thread { /* stylelint-disable-line selector-id-pattern */
|
||||
/* stylelint-disable-next-line selector-id-pattern */
|
||||
#disqus_thread {
|
||||
color-scheme: none;
|
||||
}
|
||||
} /* dark-scheme */
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
--code-header-icon-color: #d1d1d1;
|
||||
--clipboard-checked-color: #43c743;
|
||||
|
||||
[class^="prompt-"] {
|
||||
[class^='prompt-'] {
|
||||
--inline-code-bg: #fbfafa;
|
||||
--highlighter-rouge-color: rgb(82, 82, 82);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user