Compare commits
91 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db82f71515 | ||
|
|
6d254af55f | ||
|
|
a4dc39f70e | ||
|
|
84bb4d0c4b | ||
|
|
e8296fe2e4 | ||
|
|
6a45d7ccd1 | ||
|
|
5df67616be | ||
|
|
f0ce5ceb71 | ||
|
|
a9acaa669d | ||
|
|
72e8ffafa6 | ||
|
|
52f4012463 | ||
|
|
d5407181a4 | ||
|
|
4ed6988be3 | ||
|
|
3f2d400f16 | ||
|
|
e84331b26a | ||
|
|
efd8d44b12 | ||
|
|
a71659ed27 | ||
|
|
b14e97a92d | ||
|
|
826b7dca1a | ||
|
|
d720d0f66c | ||
|
|
c1b8e28601 | ||
|
|
aa54e901b1 | ||
|
|
a03149cd40 | ||
|
|
588fbbbec7 | ||
|
|
6341752986 | ||
|
|
11bcd7027d | ||
|
|
4a0242e496 | ||
|
|
48e4c7e6d3 | ||
|
|
991f53f8b2 | ||
|
|
7a5ad10bdc | ||
|
|
3b5441a1c2 | ||
|
|
a1fca3706f | ||
|
|
49346fd3c6 | ||
|
|
bff97df3b5 | ||
|
|
dbe4c3d42f | ||
|
|
fad8a23b87 | ||
|
|
834de0f02c | ||
|
|
1ff38722a2 | ||
|
|
1c0cd6b6b0 | ||
|
|
4973a61e39 | ||
|
|
99c12f6cd4 | ||
|
|
042cec33d8 | ||
|
|
8c940dbb96 | ||
|
|
9636612755 | ||
|
|
18f6c6ac4e | ||
|
|
88aa81dfe5 | ||
|
|
1b47c95cf6 | ||
|
|
aa7309c136 | ||
|
|
d162167580 | ||
|
|
6688e27787 | ||
|
|
89751c8e9f | ||
|
|
eae506113b | ||
|
|
3400568b09 | ||
|
|
d2bb423220 | ||
|
|
c6b0a8247b | ||
|
|
8ce8fc780f | ||
|
|
ac2ec585f6 | ||
|
|
338eddb454 | ||
|
|
3573ccb7a3 | ||
|
|
82b3d061af | ||
|
|
fc94a8e36b | ||
|
|
efc8c60b5d | ||
|
|
3e79ad6300 | ||
|
|
273f2e152d | ||
|
|
d0a23c21ee | ||
|
|
89200f3109 | ||
|
|
136773481e | ||
|
|
de7d2fab7c | ||
|
|
1b1fa93cf6 | ||
|
|
7e31ba4103 | ||
|
|
34b7a80a78 | ||
|
|
ba6c7eceec | ||
|
|
5669f792a7 | ||
|
|
f864b5c324 | ||
|
|
c8ff81e79a | ||
|
|
2bcaabdab4 | ||
|
|
4faa595b04 | ||
|
|
d7443aad5d | ||
|
|
b2beaa0f4c | ||
|
|
83a7878043 | ||
|
|
94b99350fc | ||
|
|
6dc9cdfa25 | ||
|
|
fa56ea48c3 | ||
|
|
7d3e25c90d | ||
|
|
6c9ab6e5f8 | ||
|
|
91da99282d | ||
|
|
413a86277b | ||
|
|
1879b94f3d | ||
|
|
7b5f7086b7 | ||
|
|
a8b8a379f6 | ||
|
|
eacad65cbb |
4
.github/FUNDING.yml
vendored
@@ -1 +1,3 @@
|
||||
custom: ['https://www.buymeacoffee.com/coteschung', 'https://cotes.gitee.io/alipay-wechat-donation']
|
||||
custom:
|
||||
- https://www.buymeacoffee.com/coteschung
|
||||
- https://cotes.gitee.io/alipay-wechat-donation
|
||||
|
||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -27,7 +27,7 @@ Please describe the tests that you ran to verify your changes. Provide instructi
|
||||
|
||||
### Test Configuration
|
||||
|
||||
- Browerser type & version:
|
||||
- Browser type & version:
|
||||
- Operating system:
|
||||
- Bundler version:
|
||||
- Ruby version:
|
||||
|
||||
19
.github/workflows/ci.yml
vendored
@@ -24,9 +24,6 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
|
||||
env:
|
||||
GEMS_PATH: ~/vendor/bundle
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -34,22 +31,10 @@ jobs:
|
||||
fetch-depth: 0 # for posts's lastmod
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: actions/setup-ruby@v1
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7
|
||||
|
||||
- name: Bundle Caching
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.GEMS_PATH }}
|
||||
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gems-
|
||||
|
||||
- name: Bundle Install
|
||||
run: |
|
||||
bundle config path ${{ env.GEMS_PATH }}
|
||||
bundle install --jobs 4 --retry 3
|
||||
bundler-cache: true
|
||||
|
||||
- name: Build Site
|
||||
env:
|
||||
|
||||
8
.github/workflows/issue-pr-interceptor.yml
vendored
@@ -2,9 +2,9 @@ name: "Intercept bad issue/PRs"
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened, reopened]
|
||||
types: [opened]
|
||||
pull_request:
|
||||
types: [opened, reopened]
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
autoclose:
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
uses: roots/issue-closer@v1.1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-pattern: "\\[x\\] I have read"
|
||||
issue-pattern: "(\\[x\\]|\\[X\\]) I have read"
|
||||
issue-close-message: ":wave: Hi @${issue.user.login},\n\nThis issue is being automatically closed because it does not follow the issue template."
|
||||
pr-pattern: "\\[x\\] Bug|\\[x\\] New feat|\\[x\\] Break|\\[x\\] Doc|@dependabot"
|
||||
pr-pattern: "(\\[x\\]|\\[X\\]) (Bug fix|New feature|Breaking change|Documentation update)|@dependabot"
|
||||
pr-close-message: ":wave: Hi @${pull_request.user.login},\n\nThis PR is being automatically closed because it does not follow the PR template."
|
||||
|
||||
19
.github/workflows/pages-deploy.yml.hook
vendored
@@ -13,9 +13,6 @@ jobs:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
GEMS_PATH: ~/vendor/bundle
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -23,22 +20,10 @@ jobs:
|
||||
fetch-depth: 0 # for posts's lastmod
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: actions/setup-ruby@v1
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7
|
||||
|
||||
- name: Bundle Caching
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ env.GEMS_PATH }}
|
||||
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gems-
|
||||
|
||||
- name: Bundle Install
|
||||
run: |
|
||||
bundle config path ${{ env.GEMS_PATH }}
|
||||
bundle install --jobs 4 --retry 3
|
||||
bundler-cache: true
|
||||
|
||||
- name: Check baseurl
|
||||
run: |
|
||||
|
||||
5
.gitignore
vendored
@@ -2,14 +2,13 @@
|
||||
.*
|
||||
!.github
|
||||
|
||||
# jekyll cache
|
||||
# bundler cache
|
||||
_site
|
||||
vendor
|
||||
Gemfile.lock
|
||||
|
||||
# rubygem
|
||||
*.gem
|
||||
# yard docs
|
||||
doc
|
||||
|
||||
# npm dependencies
|
||||
node_modules
|
||||
|
||||
50
.travis.yml
@@ -1,25 +1,49 @@
|
||||
os: linux
|
||||
dist: bionic
|
||||
|
||||
language: ruby
|
||||
rvm: 2.7.0
|
||||
language: minimal
|
||||
|
||||
cache: bundler
|
||||
jobs:
|
||||
include:
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libcurl4-openssl-dev # required to avoid SSL error (for htmlproofer)
|
||||
- name: CD
|
||||
language: ruby
|
||||
rvm: 2.7.0
|
||||
|
||||
script:
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
# required to avoid SSL error (for htmlproofer)
|
||||
- libcurl4-openssl-dev
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $TRAVIS_BUILD_DIR/vendor/bundle
|
||||
|
||||
before_install:
|
||||
# match the Gemfile.lock, travis' bundler is 2.1.2
|
||||
- gem install bundler:2.2.4
|
||||
- bundle config path 'vendor/bundle'
|
||||
|
||||
install:
|
||||
# overriding to drop the travis `--development` flag
|
||||
- bundle install --jobs=3 --retry=3
|
||||
|
||||
script:
|
||||
- eval "$BUILD_CMD"
|
||||
|
||||
git:
|
||||
depth: false # for posts' lastmod
|
||||
|
||||
- name: Flush Starter
|
||||
script:
|
||||
- eval "$FLUSH_STARTER"
|
||||
|
||||
before_script:
|
||||
- git -C "$HOME" clone "$BUILDER_REPO" --depth=1 -q
|
||||
- eval "$BUILD_CMD"
|
||||
|
||||
branches:
|
||||
only: production
|
||||
|
||||
git:
|
||||
depth: false # for posts lastmod
|
||||
only: /.*-stable$/
|
||||
|
||||
notifications:
|
||||
email:
|
||||
|
||||
13
Gemfile
@@ -1,15 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "jekyll", "~> 4.1"
|
||||
|
||||
# plugins
|
||||
group :jekyll_plugins do
|
||||
gem "jekyll-paginate", "~> 1.1"
|
||||
gem "jekyll-redirect-from", "~> 0.16"
|
||||
gem "jekyll-seo-tag", "~> 2.7"
|
||||
gem "jekyll-archives", "~> 2.2"
|
||||
gem "jekyll-sitemap", "~> 1.4"
|
||||
end
|
||||
gemspec
|
||||
|
||||
group :test do
|
||||
gem "html-proofer", "~> 3.18"
|
||||
|
||||
113
Gemfile.lock
@@ -1,113 +0,0 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
colorator (1.1.0)
|
||||
concurrent-ruby (1.1.7)
|
||||
em-websocket (0.5.2)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
ethon (0.12.0)
|
||||
ffi (>= 1.3.0)
|
||||
eventmachine (1.2.7)
|
||||
ffi (1.14.2)
|
||||
forwardable-extended (2.6.0)
|
||||
html-proofer (3.18.5)
|
||||
addressable (~> 2.3)
|
||||
mercenary (~> 0.3)
|
||||
nokogumbo (~> 2.0)
|
||||
parallel (~> 1.3)
|
||||
rainbow (~> 3.0)
|
||||
typhoeus (~> 1.3)
|
||||
yell (~> 2.0)
|
||||
http_parser.rb (0.6.0)
|
||||
i18n (1.8.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (4.2.0)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
i18n (~> 1.0)
|
||||
jekyll-sass-converter (~> 2.0)
|
||||
jekyll-watch (~> 2.0)
|
||||
kramdown (~> 2.3)
|
||||
kramdown-parser-gfm (~> 1.0)
|
||||
liquid (~> 4.0)
|
||||
mercenary (~> 0.4.0)
|
||||
pathutil (~> 0.9)
|
||||
rouge (~> 3.0)
|
||||
safe_yaml (~> 1.0)
|
||||
terminal-table (~> 2.0)
|
||||
jekyll-archives (2.2.1)
|
||||
jekyll (>= 3.6, < 5.0)
|
||||
jekyll-paginate (1.1.0)
|
||||
jekyll-redirect-from (0.16.0)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-sass-converter (2.1.0)
|
||||
sassc (> 2.0.1, < 3.0)
|
||||
jekyll-seo-tag (2.7.1)
|
||||
jekyll (>= 3.8, < 5.0)
|
||||
jekyll-sitemap (1.4.0)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-watch (2.2.1)
|
||||
listen (~> 3.0)
|
||||
kramdown (2.3.0)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
liquid (4.0.3)
|
||||
listen (3.3.3)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
mercenary (0.4.0)
|
||||
mini_portile2 (2.5.0)
|
||||
nokogiri (1.11.1)
|
||||
mini_portile2 (~> 2.5.0)
|
||||
racc (~> 1.4)
|
||||
nokogumbo (2.0.4)
|
||||
nokogiri (~> 1.8, >= 1.8.4)
|
||||
parallel (1.20.1)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (4.0.6)
|
||||
racc (1.5.2)
|
||||
rainbow (3.0.0)
|
||||
rb-fsevent (0.10.4)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rexml (3.2.4)
|
||||
rouge (3.26.0)
|
||||
safe_yaml (1.0.5)
|
||||
sassc (2.4.0)
|
||||
ffi (~> 1.9)
|
||||
terminal-table (2.0.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
thread_safe (0.3.6)
|
||||
typhoeus (1.4.0)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (1.2.9)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo-data (1.2020.6)
|
||||
tzinfo (>= 1.0.0)
|
||||
unicode-display_width (1.7.0)
|
||||
wdm (0.1.1)
|
||||
yell (2.2.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
html-proofer (~> 3.18)
|
||||
jekyll (~> 4.1)
|
||||
jekyll-archives (~> 2.2)
|
||||
jekyll-paginate (~> 1.1)
|
||||
jekyll-redirect-from (~> 0.16)
|
||||
jekyll-seo-tag (~> 2.7)
|
||||
jekyll-sitemap (~> 1.4)
|
||||
tzinfo (~> 1.2)
|
||||
tzinfo-data
|
||||
wdm (~> 0.1.1)
|
||||
|
||||
BUNDLED WITH
|
||||
2.2.4
|
||||
75
README.md
@@ -2,6 +2,7 @@
|
||||
|
||||
Language: English | [简体中文](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/README.zh-CN.md)
|
||||
|
||||
[](https://rubygems.org/gems/jekyll-theme-chirpy)
|
||||
[](https://github.com/cotes2020/jekyll-theme-chirpy/actions?query=branch%3Amaster+event%3Apush)
|
||||
[](https://app.codacy.com/manual/cotes2020/jekyll-theme-chirpy?utm_source=github.com&utm_medium=referral&utm_content=cotes2020/jekyll-theme-chirpy&utm_campaign=Badge_Grade_Dashboard)
|
||||
[](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE)
|
||||
@@ -11,18 +12,6 @@ A minimal, sidebar, responsive web design Jekyll theme that focuses on text pres
|
||||
|
||||
[](https://chirpy.cotes.info)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Features](#features)
|
||||
- [Prerequisites](#prerequisites)
|
||||
- [Installation](#installation)
|
||||
- [Usage](#usage)
|
||||
- [Documentation](#documentation)
|
||||
- [Contributing](#contributing)
|
||||
- [Credits](#credits)
|
||||
- [Supporting](#supporting)
|
||||
- [License](#license)
|
||||
|
||||
## Features
|
||||
|
||||
- Pinned Posts
|
||||
@@ -49,10 +38,10 @@ Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete th
|
||||
|
||||
There are two ways to get the theme:
|
||||
|
||||
- Install from [RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy)
|
||||
- Fork from GitHub
|
||||
- **Install from RubyGems** - Easy to update, isolate irrelevant project files so you can focus on writing.
|
||||
- **Fork on GitHub** - Convenient for custom development, but difficult to update, only suitable for web developers.
|
||||
|
||||
### Install From Rubygems
|
||||
### Installing the Theme Gem
|
||||
|
||||
Add this line to your Jekyll site's `Gemfile`:
|
||||
|
||||
@@ -72,19 +61,19 @@ And then execute:
|
||||
$ bundle
|
||||
```
|
||||
|
||||
Finally, copy the extra files (refer to the [starter project][starter] for the detailed file directory structure) from the theme's gem to your Jekyll site, and append all the variables of the theme's `_config.yml` to your Jekyll site.
|
||||
Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site.
|
||||
|
||||
> **Hint**: To locate the theme’s gem, execute:
|
||||
> **Hint**: To locate the installed theme’s gem, execute:
|
||||
>
|
||||
```console
|
||||
$ bundle info --path jekyll-theme-chirpy
|
||||
```
|
||||
> ```console
|
||||
> $ bundle info --path jekyll-theme-chirpy
|
||||
> ```
|
||||
|
||||
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem.
|
||||
Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from the theme's gem. We have prepared everything for you there!
|
||||
|
||||
### Fork From GitHub
|
||||
### Fork on GitHub
|
||||
|
||||
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) from GitHub and clone your fork to local.
|
||||
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub and then clone your fork to local. (Please note that the default branch code is in development. If you want the blog to be stable, please switch to the [latest tag](https://github.com/cotes2020/jekyll-theme-chirpy/tags) and start writing.)
|
||||
|
||||
Install gem dependencies by:
|
||||
|
||||
@@ -107,7 +96,7 @@ What it does is:
|
||||
- files under `_posts`
|
||||
- folder `docs`
|
||||
|
||||
2. If you use the `--no-gh` option, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in folder `.github`.
|
||||
2. If you use the `--no-gh` option, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing the extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in the folder `.github`.
|
||||
|
||||
3. Automatically create a commit to save the changes.
|
||||
|
||||
@@ -120,7 +109,7 @@ Update the variables of `_config.yml` as needed. Some of them are typical option
|
||||
- `url`
|
||||
- `avatar`
|
||||
- `timezone`
|
||||
- `theme_mode`
|
||||
- `lang`
|
||||
|
||||
### Running Local Server
|
||||
|
||||
@@ -143,7 +132,7 @@ Open a browser and visit to _<http://localhost:4000>_.
|
||||
|
||||
### Deployment
|
||||
|
||||
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
|
||||
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
|
||||
|
||||
Now you can choose ONE of the following methods to deploy your Jekyll site.
|
||||
|
||||
@@ -153,16 +142,16 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
|
||||
|
||||
Quickly check the files needed for GitHub Actions build:
|
||||
|
||||
1. Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
|
||||
2. Ensuer your Jekyll site has file `/tools/test.sh` and `/tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
|
||||
- Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
|
||||
- Ensure your Jekyll site has file `tools/test.sh` and `tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
|
||||
|
||||
Next, rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
|
||||
And then rename your repository to `<GH-USERNAME>.github.io` on GitHub.
|
||||
|
||||
And then publish your Jekyll site by:
|
||||
Now publish your Jekyll site by:
|
||||
|
||||
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
|
||||
|
||||
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings_ → _Options_ → _GitHub Pages_:
|
||||
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) through _Settings_ → _Options_ → _GitHub Pages_:
|
||||
|
||||

|
||||
|
||||
@@ -192,7 +181,7 @@ Unless you specified the output path, the generated site files will be placed in
|
||||
|
||||
## Documentation
|
||||
|
||||
For more details and the better reading experience, please check out the [tutorials on demo site](https://chirpy.cotes.info/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki).
|
||||
For more details and a better reading experience, please check out the [tutorials on the demo site](https://chirpy.cotes.info/categories/tutorial/). In the meanwhile, a copy of the tutorial is also available on the [Wiki](https://github.com/cotes2020/jekyll-theme-chirpy/wiki).
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -200,17 +189,19 @@ The old saying, "Two heads are better than one." Consequently, welcome to report
|
||||
|
||||
## 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).
|
||||
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 comes from [Clipart Max](https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/).
|
||||
|
||||
:tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas or inspired me to write more readable documentation.
|
||||
:tada: Thanks to all the volunteers who contributed to this project, their GitHub IDs are on [this list](https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors). Also, I won't forget those guys who submitted the issues or unmerged PR because they reported bugs, shared ideas, or inspired me to write more readable documentation.
|
||||
|
||||
Also, thank [JetBrains][jb] for providing the open source license.
|
||||
Last but not least, thank [JetBrains][jb] for providing the open source license.
|
||||
|
||||
[][jb]
|
||||
## Sponsoring
|
||||
|
||||
## Supporting
|
||||
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 enjoy this theme or find it helpful, please consider becoming my sponsor, I'd really appreciate it! Click the button <kbd>:heart: Sponsor</kbd> at the top of the [Home Page](https://github.com/cotes2020/jekyll-theme-chirpy) and choose a link that suits you to donate; this will encourage and help me better maintain the project.
|
||||
[](https://www.buymeacoffee.com/coteschung)
|
||||
[][cn-donation]
|
||||
[][cn-donation]
|
||||
|
||||
## License
|
||||
|
||||
@@ -218,5 +209,9 @@ This work is published under [MIT](https://github.com/cotes2020/jekyll-theme-chi
|
||||
|
||||
[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
|
||||
[jb]:https://www.jetbrains.com/?from=jekyll-theme-chirpy
|
||||
[workflow]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/.github/workflows/pages-deploy.yml.hook
|
||||
|
||||
<!-- ReadMe links -->
|
||||
|
||||
[jb]: https://www.jetbrains.com/?from=jekyll-theme-chirpy
|
||||
[cn-donation]: https://cotes.gitee.io/alipay-wechat-donation/
|
||||
|
||||
104
_config.yml
@@ -1,5 +1,18 @@
|
||||
# The Site Configuration
|
||||
|
||||
# Import the theme
|
||||
theme: jekyll-theme-chirpy
|
||||
|
||||
# Only if your site type is GitHub Project sites and doesn't have a custom domain,
|
||||
# change below value to '/projectname'.
|
||||
baseurl: ''
|
||||
|
||||
# the HTML language tag › https://www.w3.org/International/questions/qa-choosing-language-tags
|
||||
lang: en-US
|
||||
|
||||
# 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
|
||||
@@ -14,8 +27,6 @@ description: >- # used by seo meta and the atom feed
|
||||
# fill in the protocol & hostname for your site, e.g., 'https://username.github.io'
|
||||
url: ''
|
||||
|
||||
author: your_full_name # change to your full name
|
||||
|
||||
github:
|
||||
username: github_username # change to your github username
|
||||
|
||||
@@ -23,7 +34,9 @@ twitter:
|
||||
username: twitter_username # change to your twitter username
|
||||
|
||||
social:
|
||||
name: your_full_name # it will shows as the copyright owner in Footer
|
||||
# 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@doamin.com # change to your email address
|
||||
links:
|
||||
# The first element serves as the copyright owner's link
|
||||
@@ -36,29 +49,12 @@ social:
|
||||
google_site_verification: google_meta_tag_verification # change to your verification string
|
||||
# --------------------------
|
||||
|
||||
|
||||
# Only if your site type is GitHub Project sites and doesn't have a custom domain,
|
||||
# change below value to '/projectname'.
|
||||
baseurl: ''
|
||||
|
||||
# Change to your timezone › http://www.timezoneconverter.com/cgi-bin/findzone/findzone
|
||||
timezone: Asia/Shanghai
|
||||
|
||||
google_analytics:
|
||||
id: '' # Fill with your Google Analytics ID
|
||||
id: '' # fill in your Google Analytics ID
|
||||
# Google Analytics pageviews report settings
|
||||
pv:
|
||||
# The Google Analytics pageviews switch.
|
||||
# DO NOT enable it unless you know how to deploy the Google Analytics superProxy.
|
||||
enabled: false
|
||||
# the next options only valid when `google_analytics.pv` is enabled.
|
||||
proxy_url: ''
|
||||
proxy_endpoint: ''
|
||||
cache: false # pv data local cache, good for the users from GFW area.
|
||||
|
||||
disqus:
|
||||
comments: false # boolean type, the global switch for posts comments.
|
||||
shortname: '' # Fill with your Disqus shortname. › https://help.disqus.com/en/articles/1717111-what-s-a-shortname
|
||||
|
||||
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.
|
||||
#
|
||||
@@ -69,7 +65,6 @@ disqus:
|
||||
# Available options:
|
||||
#
|
||||
# light - Use the light color scheme
|
||||
#
|
||||
# dark - Use the dark color scheme
|
||||
#
|
||||
theme_mode: # [light|dark]
|
||||
@@ -87,8 +82,14 @@ avatar: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/avatar.jpg
|
||||
# boolean type, the global switch for ToC in posts.
|
||||
toc: true
|
||||
|
||||
disqus:
|
||||
comments: false # boolean type, the global switch for posts comments.
|
||||
shortname: '' # Fill with your Disqus shortname. › https://help.disqus.com/en/articles/1717111-what-s-a-shortname
|
||||
|
||||
paginate: 10
|
||||
|
||||
# ------------ The following options are not recommended to be modified ------------------
|
||||
|
||||
kramdown:
|
||||
syntax_highlighter: rouge
|
||||
syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options
|
||||
@@ -100,10 +101,6 @@ kramdown:
|
||||
line_numbers: true
|
||||
start_line: 1
|
||||
|
||||
# DO NOT change this unless you're a Pro user on Jekyll and Web development,
|
||||
# or you think you're smart enough to change other relevant URLs within this template.
|
||||
permalink: /posts/:title/
|
||||
|
||||
collections:
|
||||
tabs:
|
||||
output: true
|
||||
@@ -119,55 +116,22 @@ defaults:
|
||||
layout: post
|
||||
comments: true # Enable comments in posts.
|
||||
toc: true # Display TOC column in posts.
|
||||
breadcrumb:
|
||||
-
|
||||
label: Posts
|
||||
url: /
|
||||
# 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/
|
||||
-
|
||||
scope:
|
||||
path: _drafts
|
||||
values:
|
||||
comments: false
|
||||
-
|
||||
scope:
|
||||
path: index.html
|
||||
values:
|
||||
breadcrumb:
|
||||
-
|
||||
label: Posts
|
||||
-
|
||||
scope:
|
||||
path: tags
|
||||
values:
|
||||
breadcrumb:
|
||||
-
|
||||
label: Home
|
||||
url: /
|
||||
-
|
||||
label: Tags
|
||||
url: /tabs/tags/
|
||||
-
|
||||
scope:
|
||||
path: categories
|
||||
values:
|
||||
breadcrumb:
|
||||
-
|
||||
label: Home
|
||||
url: /
|
||||
-
|
||||
label: Categories
|
||||
url: /tabs/categories/
|
||||
-
|
||||
scope:
|
||||
path: ''
|
||||
type: tabs # see `site.collections`
|
||||
values:
|
||||
layout: page
|
||||
permalink: /:title/
|
||||
dynamic_title: true # Hide title in mobile screens.
|
||||
breadcrumb:
|
||||
-
|
||||
label: Home
|
||||
url: /
|
||||
|
||||
sass:
|
||||
style: compressed
|
||||
@@ -182,17 +146,15 @@ compress_html:
|
||||
envs: [development]
|
||||
|
||||
exclude:
|
||||
- vendor
|
||||
- Gemfile.lock
|
||||
- Gemfile
|
||||
- '*.gem'
|
||||
- '*.gemspec'
|
||||
- tools
|
||||
- docs
|
||||
- README.md
|
||||
- LICENSE
|
||||
- gulpfile.js
|
||||
- node_modules
|
||||
- package.json
|
||||
- package-lock.json
|
||||
- '*.json'
|
||||
|
||||
jekyll-archives:
|
||||
enabled: [categories, tags]
|
||||
|
||||
@@ -8,3 +8,8 @@
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@1.0.1/dist/bootstrap-toc.min.css">
|
||||
{% endif %}
|
||||
|
||||
{% if page.layout == 'page' or page.layout == 'post' %}
|
||||
<!-- Manific Popup -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/magnific-popup@1.1.0/dist/magnific-popup.min.css">
|
||||
{% endif %}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
-->
|
||||
|
||||
<div id="disqus" class="pt-2 pb-2">
|
||||
<p class="text-center text-muted pb-5">
|
||||
Loading comments from <a href="https://disqus.com/">Disqus</a> ...
|
||||
<p class="text-center text-muted small pb-5">
|
||||
Comments powered by <a href="https://disqus.com/">Disqus</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,32 +1,17 @@
|
||||
<!--
|
||||
The Favicons for Web, Android, Microsoft, and iOS (iPhone and iPad) Apps
|
||||
Generated by: https://www.favicon-generator.org/
|
||||
Generated by: https://realfavicongenerator.net/
|
||||
-->
|
||||
|
||||
{% capture icon_url %}{{ site.baseurl }}/assets/img/favicons{% endcapture %}
|
||||
{% capture favicon_path %}{{ '/assets/img/favicons' | relative_url }}{% endcapture %}
|
||||
|
||||
<link rel="shortcut icon" href="{{ icon_url }}/favicon.ico" type="image/x-icon">
|
||||
<link rel="icon" href="{{ icon_url }}/favicon.ico" type="image/x-icon">
|
||||
|
||||
<link rel="apple-touch-icon" href="{{ icon_url }}/apple-icon.png">
|
||||
<link rel="apple-touch-icon" href="{{ icon_url }}/apple-icon-precomposed.png">
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="{{ icon_url }}/apple-icon-57x57.png">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="{{ icon_url }}/apple-icon-60x60.png">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="{{ icon_url }}/apple-icon-72x72.png">
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="{{ icon_url }}/apple-icon-76x76.png">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="{{ icon_url }}/apple-icon-114x114.png">
|
||||
<link rel="apple-touch-icon" sizes="120x120" href="{{ icon_url }}/apple-icon-120x120.png">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="{{ icon_url }}/apple-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="152x152" href="{{ icon_url }}/apple-icon-152x152.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ icon_url }}/apple-icon-180x180.png">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="192x192" href="{{ icon_url }}/android-icon-192x192.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ icon_url }}/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="96x96" href="{{ icon_url }}/favicon-96x96.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ icon_url }}/favicon-16x16.png">
|
||||
|
||||
<link rel="manifest" href="{{ icon_url }}/manifest.json">
|
||||
<meta name='msapplication-config' content='{{ icon_url }}/browserconfig.xml'>
|
||||
<meta name="msapplication-TileColor" content="#ffffff">
|
||||
<meta name="msapplication-TileImage" content="{{ icon_url }}/ms-icon-144x144.png">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ favicon_path }}/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ favicon_path }}/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ favicon_path }}/favicon-16x16.png">
|
||||
<link rel="manifest" href="{{ favicon_path }}/site.webmanifest">
|
||||
<link rel="shortcut icon" href="{{ favicon_path }}/favicon.ico">
|
||||
<meta name="apple-mobile-web-app-title" content="{{ site.title }}">
|
||||
<meta name="application-name" content="{{ site.title }}">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="msapplication-config" content="{{ favicon_path }}/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
@@ -7,19 +7,15 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
{% if page.layout == 'home' or page.layout == 'post' %}
|
||||
<meta name="pv-cache-enabled" content="{{ site.google_analytics.pv.enabled }}">
|
||||
|
||||
{% if site.google_analytics.pv.enabled %}
|
||||
{% if site.google_analytics.pv.proxy_endpoint != ''
|
||||
and site.google_analytics.pv.proxy_endpoint %}
|
||||
<meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}">
|
||||
{% endif %}
|
||||
|
||||
{% if site.google_analytics.pv.cache %}
|
||||
<meta name="pv-cache-data" content="{{ '/assets/js/data/pageviews.json' | relative_url }}">
|
||||
{% endif %}
|
||||
|
||||
{% if site.google_analytics.pv.proxy_endpoint %}
|
||||
<meta name="pv-proxy-endpoint" content="{{ site.google_analytics.pv.proxy_endpoint }}">
|
||||
{% endif %}
|
||||
|
||||
{% if site.google_analytics.pv.cache_path %}
|
||||
<meta name="pv-cache-path" content="{{ site.google_analytics.pv.cache_path | relative_url }}">
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% seo title=false %}
|
||||
@@ -45,26 +41,24 @@
|
||||
<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin="anonymous">
|
||||
<link rel="dns-prefetch" href="https://www.googletagmanager.com">
|
||||
|
||||
{% if site.google_analytics.pv.proxy_url and site.google_analytics.pv.enabled %}
|
||||
<link rel="preconnect" href="{{ site.google_analytics.pv.proxy_url }}" crossorigin="use-credentials">
|
||||
<link rel="dns-prefetch" href="{{ site.google_analytics.pv.proxy_url }}">
|
||||
{% if site.google_analytics.pv.proxy_endpoint %}
|
||||
{% assign proxy_url = site.google_analytics.pv.proxy_endpoint
|
||||
| replace: "https://", "" | split: "/" | first | prepend: "https://" %}
|
||||
|
||||
<link rel="preconnect" href="{{ proxy_url }}" crossorigin="use-credentials">
|
||||
<link rel="dns-prefetch" href="{{ proxy_url }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- jsDelivr CDN -->
|
||||
<link rel="preconnect" href="cdn.jsdelivr.net">
|
||||
<link rel="dns-prefetch" href="cdn.jsdelivr.net">
|
||||
<link rel="preconnect" href="https://cdn.jsdelivr.net">
|
||||
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css"
|
||||
integrity="sha256-LA89z+k9fjgMKQ/kq4OO2Mrf8VltYml/VES+Rg0fh20=" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css">
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css"
|
||||
integrity="sha256-+N4/V/SbAFiW1MPBCXnfnP9QSN3+Keu+NlB+0ev/YKQ="
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css">
|
||||
|
||||
{% include css-selector.html %}
|
||||
|
||||
|
||||
@@ -3,19 +3,26 @@
|
||||
-->
|
||||
|
||||
{% if page.layout == 'home' or page.layout == 'post' %}
|
||||
{% if site.google_analytics.pv.enabled %}
|
||||
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
|
||||
<!-- pv-report needs countup.js -->
|
||||
<script async src="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script>
|
||||
<script async src="{{ '/assets/js/dist/pvreport.min.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.layout == 'post' or page.layout == 'page' %}
|
||||
<!-- image lazy-loading & popup -->
|
||||
<script async
|
||||
src="https://cdn.jsdelivr.net/combine/npm/lozad/dist/lozad.min.js,npm/magnific-popup@1/dist/jquery.magnific-popup.min.js"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if page.layout == 'home'
|
||||
or page.layout == 'categories'
|
||||
or page.layout == 'post'
|
||||
or page.layout == 'categories' %}
|
||||
or page.layout == 'page' %}
|
||||
{% assign type = page.layout %}
|
||||
{% else %}
|
||||
{% assign type = "page" %}
|
||||
{% assign type = "commons" %}
|
||||
{% endif %}
|
||||
|
||||
{% assign js = type | prepend: '/assets/js/dist/' | append: '.min.js' %}
|
||||
@@ -23,8 +30,25 @@
|
||||
|
||||
{% if page.math %}
|
||||
<!-- MathJax -->
|
||||
<script defer src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<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 */
|
||||
['$$', '$$'],
|
||||
['\\[', '\\]']
|
||||
]
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
|
||||
<script type="text/javascript" id="MathJax-script" async
|
||||
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% if jekyll.environment == 'production' %}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<!--
|
||||
image lazy load: https://github.com/ApoorvSaxena/lozad.js
|
||||
-->
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lozad/dist/lozad.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
const imgs = document.querySelectorAll('.post-content img');
|
||||
const observer = lozad(imgs);
|
||||
observer.observe();
|
||||
</script>
|
||||
@@ -9,7 +9,8 @@
|
||||
<p>{{ page.previous.title }}</p>
|
||||
</a>
|
||||
{% else %}
|
||||
<span class="btn btn-outline-primary disabled">
|
||||
<span class="btn btn-outline-primary disabled"
|
||||
prompt="{{ site.data.label.post.button.previous | default: 'previous' }}">
|
||||
<p>-</p>
|
||||
</span>
|
||||
{% endif %}
|
||||
@@ -20,7 +21,8 @@
|
||||
<p>{{ page.next.title }}</p>
|
||||
</a>
|
||||
{% else %}
|
||||
<span class="btn btn-outline-primary disabled">
|
||||
<span class="btn btn-outline-primary disabled"
|
||||
prompt="{{ site.data.label.post.button.next | default: 'next' }}">
|
||||
<p>-</p>
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
{% assign _content = _content | replace: '<img src="/', img_path_replacement %}
|
||||
|
||||
<!-- lazy-load images <https://github.com/ApoorvSaxena/lozad.js#usage> -->
|
||||
{% assign lozad = true %}
|
||||
{% assign img_placehodler
|
||||
= 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' %}
|
||||
|
||||
@@ -60,7 +59,3 @@
|
||||
|
||||
<!-- return -->
|
||||
{{ _content }}
|
||||
|
||||
{% if lozad %}
|
||||
{% include lozad.html %}
|
||||
{% endif %}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<!--
|
||||
Jekyll Simple Search loader
|
||||
See: <https://github.com/christian-fei/Simple-Jekyll-Search>
|
||||
-->
|
||||
|
||||
{% capture result_elem %}
|
||||
<div class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-lg-4 pr-lg-4 pl-xl-0 pr-xl-0">
|
||||
<a href="{{ site.url }}{url}">{title}</a>
|
||||
<div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
|
||||
<div class="mr-sm-4"><i class="far fa-folder fa-fw"></i>{categories}</div>
|
||||
<div><i class="fa fa-tag fa-fw"></i>{tags}</div>
|
||||
{categories}
|
||||
{tags}
|
||||
</div>
|
||||
<p>{snippet}</p>
|
||||
</div>
|
||||
@@ -23,6 +24,23 @@ SimpleJekyllSearch({
|
||||
resultsContainer: document.getElementById('search-results'),
|
||||
json: '{{ '/assets/js/data/search.json' | relative_url }}',
|
||||
searchResultTemplate: '{{ result_elem | strip_newlines }}',
|
||||
noResultsText: '{{ not_found }}'
|
||||
noResultsText: '{{ not_found }}',
|
||||
templateMiddleware: function(prop, value, template) {
|
||||
if (prop === 'categories') {
|
||||
if (value === '') {
|
||||
return `${value}`;
|
||||
} else {
|
||||
return `<div class="mr-sm-4"><i class="far fa-folder fa-fw"></i>${value}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
if (prop === 'tags') {
|
||||
if (value === '') {
|
||||
return `${value}`;
|
||||
} else {
|
||||
return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
The Search results
|
||||
-->
|
||||
<div id="search-result-wrapper" class="d-flex justify-content-center unloaded">
|
||||
<div class="col-12 col-xl-11 post-content">
|
||||
<div class="col-12 col-sm-11 post-content">
|
||||
<div id="search-hints">
|
||||
<h4 class="text-muted mb-4">{{ site.data.label.panel.trending_tags | default: 'Trending Tags' }}</h4>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<!--
|
||||
Date format snippet
|
||||
See: /assets/js/_utils/timeage.js
|
||||
-->
|
||||
|
||||
{% assign tooltip_df = site.data.date_format.tooltip | default: '%a, %b %e, %Y, %l:%M %p %z' %}
|
||||
@@ -11,7 +12,10 @@
|
||||
data-toggle="tooltip"
|
||||
data-placement="bottom"
|
||||
title="{{ include.date | date: tooltip_df }}"
|
||||
{% endif %}>
|
||||
{% endif %}
|
||||
|
||||
{% if include.prefix %}prefix="{{ include.prefix }} "{% endif%}
|
||||
{% if include.prep %}prep="{{ include.prep }}"{% endif %} >
|
||||
|
||||
{% assign this_year = site.time | date: "%Y" %}
|
||||
{% assign post_year = include.date | date: "%Y" %}
|
||||
|
||||
@@ -5,21 +5,42 @@
|
||||
<div id="topbar-wrapper" class="row justify-content-center topbar-down">
|
||||
<div id="topbar" class="col-11 d-flex h-100 align-items-center justify-content-between">
|
||||
<span id="breadcrumb">
|
||||
{% for item in page.breadcrumb %}
|
||||
{% if item.url %}
|
||||
|
||||
{% assign paths = page.url | split: '/' %}
|
||||
|
||||
{% if paths.size == 0 %}
|
||||
<!-- index page -->
|
||||
<span>{{ 'Posts' }}</span>
|
||||
{% else %}
|
||||
|
||||
{% for item in paths %}
|
||||
|
||||
{% if forloop.first %}
|
||||
{% unless page.layout == 'post' %}
|
||||
<span>
|
||||
<a href="{{ '/' | relative_url }}">{{ 'Home' }}</a>
|
||||
</span>
|
||||
{% endunless %}
|
||||
|
||||
{% elsif forloop.last %}
|
||||
<span>{{ page.title }}</span>
|
||||
|
||||
{% else %}
|
||||
<span>
|
||||
<a href="{{ site.baseurl }}{{ item.url | remove: '.html'}}">
|
||||
{{ item.label }}
|
||||
{% assign url = item %}
|
||||
{% if item == 'posts' and page.layout == 'post' %}
|
||||
{% assign url = '/' %}
|
||||
{% endif %}
|
||||
<a href="{{ url | relative_url }}">
|
||||
{{ item | capitalize }}
|
||||
</a>
|
||||
</span>
|
||||
{% else %}
|
||||
<span>{{ item.label }}</span>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% unless page.layout == "home" %}
|
||||
<span>{{ page.title }}</span>
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
|
||||
</span><!-- endof #breadcrumb -->
|
||||
|
||||
@@ -39,7 +60,7 @@
|
||||
<span id="search-wrapper" class="align-items-center">
|
||||
<i class="fas fa-search fa-fw"></i>
|
||||
<input class="form-control" id="search-input" type="search"
|
||||
aria-label="search" placeholder="{{ site.data.label.search_hint | default: 'Search' }}...">
|
||||
aria-label="search" autocomplete="off" placeholder="{{ site.data.label.search_hint | default: 'Search' }}...">
|
||||
<i class="fa fa-times-circle fa-fw" id="search-cleaner"></i>
|
||||
</span>
|
||||
<span id="search-cancel" >Cancel</span>
|
||||
|
||||
@@ -17,14 +17,12 @@ $(function() {
|
||||
const input = $("#search-input");
|
||||
const hints = $("#search-hints");
|
||||
|
||||
|
||||
/*--- Actions in small screens (Sidebar unloaded) ---*/
|
||||
|
||||
const scrollBlocker = (function () {
|
||||
let offset = 0;
|
||||
return {
|
||||
block() {
|
||||
offset = $(window).scrollTop();
|
||||
offset = window.scrollY;
|
||||
$("html,body").scrollTop(0);
|
||||
},
|
||||
release() {
|
||||
$("html,body").scrollTop(offset);
|
||||
@@ -35,6 +33,9 @@ $(function() {
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
/*--- Actions in small screens (Sidebar unloaded) ---*/
|
||||
|
||||
const mobileSearchBar = (function () {
|
||||
return {
|
||||
on() {
|
||||
@@ -60,11 +61,11 @@ $(function() {
|
||||
return {
|
||||
on() {
|
||||
if (!visible) {
|
||||
resultWrapper.removeClass("unloaded");
|
||||
main.addClass("hidden");
|
||||
|
||||
visible = true;
|
||||
// the block method must be called before $(#main) unloaded.
|
||||
scrollBlocker.block();
|
||||
resultWrapper.removeClass("unloaded");
|
||||
main.addClass("unloaded");
|
||||
visible = true;
|
||||
}
|
||||
},
|
||||
off() {
|
||||
@@ -75,12 +76,13 @@ $(function() {
|
||||
}
|
||||
resultWrapper.addClass("unloaded");
|
||||
btnClear.removeClass("visible");
|
||||
main.removeClass("hidden");
|
||||
main.removeClass("unloaded");
|
||||
|
||||
// now the release method must be called after $(#main) display
|
||||
scrollBlocker.release();
|
||||
|
||||
input.val("");
|
||||
visible = false;
|
||||
|
||||
scrollBlocker.release();
|
||||
}
|
||||
},
|
||||
isVisible() {
|
||||
5
_javascript/copyright
Normal file
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* Chirpy v4.0.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* © 2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
48
_javascript/utils/img-extra.js
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
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;
|
||||
}
|
||||
|
||||
/* lozy loading */
|
||||
|
||||
const imgs = document.querySelectorAll(`${IMG_SCOPE} img[data-src]`);
|
||||
const observer = lozad(imgs);
|
||||
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');
|
||||
|
||||
});
|
||||
|
||||
250
_javascript/utils/pageviews.js
Normal file
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -10,13 +10,14 @@ $(function() {
|
||||
|
||||
let intervalId = void 0;
|
||||
|
||||
function timeago(iso, isLastmod) {
|
||||
function timeago(iso, preposition) {
|
||||
let now = new Date();
|
||||
let past = new Date(iso);
|
||||
let prep = (typeof preposition !== "undefined" ? `${preposition} ` : "");
|
||||
|
||||
if (past.getFullYear() !== now.getFullYear()) {
|
||||
toRefresh -= 1;
|
||||
return past.toLocaleString("en-US", {
|
||||
return prep + past.toLocaleString("en-US", {
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
day: "numeric"
|
||||
@@ -25,7 +26,7 @@ $(function() {
|
||||
|
||||
if (past.getMonth() !== now.getMonth()) {
|
||||
toRefresh -= 1;
|
||||
return past.toLocaleString("en-US", {
|
||||
return prep + past.toLocaleString("en-US", {
|
||||
month: "short",
|
||||
day: "numeric"
|
||||
});
|
||||
@@ -49,17 +50,15 @@ $(function() {
|
||||
return minute + " minute" + (minute > 1 ? "s" : "") + " ago";
|
||||
}
|
||||
|
||||
return (isLastmod ? "just" : "Just") + " now";
|
||||
return "just now";
|
||||
}
|
||||
|
||||
function updateTimeago() {
|
||||
$(".timeago").each(function() {
|
||||
if ($(this).children("i").length > 0) {
|
||||
$(this).text();
|
||||
let isLastmod = $(this).hasClass("lastmod");
|
||||
let node = $(this).children("i");
|
||||
let date = node.text(); /* ISO Date: "YYYY-MM-DDTHH:MM:SSZ" */
|
||||
$(this).text(timeago(date, isLastmod));
|
||||
$(this).text(timeago(date, $(this).attr("prep")));
|
||||
$(this).append(node);
|
||||
}
|
||||
});
|
||||
@@ -11,7 +11,7 @@ layout: compress
|
||||
{% endif %}
|
||||
{% endcapture %}
|
||||
|
||||
<html lang="{{ site.lang | split: "_" | first | default: "en" }}" {{ prefer_mode }}>
|
||||
<html lang="{{ site.lang | default: "en-US" }}" {{ prefer_mode }}>
|
||||
|
||||
{% include head.html %}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ layout: page
|
||||
{% include read-time.html content=post.content %}
|
||||
|
||||
<!-- page views -->
|
||||
{% if site.google_analytics.pv.enabled %}
|
||||
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
|
||||
<i class="far fa-eye fa-fw"></i>
|
||||
<span id="pv_{{-post.title-}}" class="pageviews">
|
||||
<i class="fas fa-spinner fa-spin fa-fw"></i>
|
||||
|
||||
@@ -14,19 +14,18 @@ layout: default
|
||||
<div class="post-meta text-muted d-flex flex-column">
|
||||
<!-- Published date and author -->
|
||||
<div>
|
||||
{% include timeago.html date=page.date tooltip=true %}
|
||||
by
|
||||
<span class="author">
|
||||
{{ page.author | default: site.author }}
|
||||
<span class="semi-bold">
|
||||
{{ page.author | default: site.social.name }}
|
||||
</span>
|
||||
{% include timeago.html date=page.date prep="on" tooltip=true %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<!-- lastmod -->
|
||||
{% if page.last_modified_at %}
|
||||
<span>
|
||||
Updated
|
||||
{% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
|
||||
{% include timeago.html date=page.last_modified_at
|
||||
class="lastmod" prefix="Updated" tooltip=true %}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
@@ -34,7 +33,7 @@ layout: default
|
||||
{% include read-time.html content=content %}
|
||||
|
||||
<!-- page views -->
|
||||
{% if site.google_analytics.pv.enabled %}
|
||||
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
|
||||
<span id="pv" class="pageviews"><i class="fas fa-spinner fa-spin fa-fw"></i></span>
|
||||
{% endif %}
|
||||
|
||||
@@ -44,8 +43,8 @@ layout: default
|
||||
|
||||
<div class="post-content">
|
||||
|
||||
{% if page.image %}
|
||||
<img src="{{ page.image }}" class="preview-img" alt="Preview Image">
|
||||
{% if page.image.src %}
|
||||
<img src="{{ page.image.src }}" class="preview-img" alt="{{ page.image.alt | default: "Preview Image" }}">
|
||||
{% endif %}
|
||||
|
||||
{{ content }}
|
||||
|
||||
@@ -6,7 +6,8 @@ categories: [Blogging, Demo]
|
||||
tags: [typography]
|
||||
math: true
|
||||
mermaid: true
|
||||
image: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png
|
||||
image:
|
||||
src: https://cdn.jsdelivr.net/gh/cotes2020/chirpy-images/commons/devices-mockup.png
|
||||
---
|
||||
|
||||
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.
|
||||
@@ -56,7 +57,6 @@ Fluttering and dancing in the breeze.
|
||||
|
||||
- [ ] TODO
|
||||
- [x] Completed
|
||||
- Hold on
|
||||
- [ ] Defeat COVID-19
|
||||
- [x] Vaccine production
|
||||
- [ ] Economic recovery
|
||||
@@ -107,6 +107,11 @@ _Full screen width and center alignment_
|
||||
{: width="400"}
|
||||
_400px image width_
|
||||
|
||||
- Shadow
|
||||
|
||||
{: .shadow width="90%" }
|
||||
_shadow effect (visible in light mode)_
|
||||
|
||||
<br>
|
||||
|
||||
- Left aligned
|
||||
@@ -146,7 +151,7 @@ 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
|
||||
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} $$
|
||||
|
||||
|
||||
@@ -84,11 +84,13 @@ Then you can use it like other markdown language: surround the graph code with `
|
||||
|
||||
### Preview image
|
||||
|
||||
If you want to add an image to the top of the post contents, specify the url for the image by:
|
||||
If you want to add an image to the top of the post contents, specify the url and alt attribute for the image:
|
||||
|
||||
```yaml
|
||||
---
|
||||
image: /path/to/image-file
|
||||
image:
|
||||
src: /path/to/image/file
|
||||
alt: image alternative text
|
||||
---
|
||||
```
|
||||
|
||||
@@ -133,7 +135,16 @@ By default, the image is centered, but you can specify the position by using one
|
||||
{: .right}
|
||||
```
|
||||
|
||||
**Limitation**: Once you specify the position of an image, it is forbidden to add the image caption.
|
||||
> **Limitation**: Once you specify the position of an image, it is forbidden to add the image caption.
|
||||
|
||||
### Image 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:
|
||||
|
||||
```markdown
|
||||
{: .shadow}
|
||||
```
|
||||
|
||||
|
||||
### CDN URL
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ Follow the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete th
|
||||
|
||||
There are two ways to get the theme:
|
||||
|
||||
- Install from [RubyGems](https://rubygems.org/gems/jekyll-theme-chirpy)
|
||||
- Fork from GitHub
|
||||
- **Install from RubyGems** - Easy to update, isolate irrelevant project files so you can focus on writing.
|
||||
- **Fork on GitHub** - Convenient for custom development, but difficult to update, only suitable for web developers.
|
||||
|
||||
### Install From Rubygems
|
||||
### Installing the Theme Gem
|
||||
|
||||
Add this line to your Jekyll site's `Gemfile`:
|
||||
|
||||
@@ -38,19 +38,19 @@ And then execute:
|
||||
$ bundle
|
||||
```
|
||||
|
||||
Finally, copy the extra files (refer to the [starter project][starter] for the detailed file directory structure) from the theme's gem to your Jekyll site, and append all the variables of the theme's `_config.yml` to your Jekyll site.
|
||||
Finally, copy the required files from the theme's gem (for detailed files, see [starter project][starter]) to your Jekyll site.
|
||||
|
||||
> **Hint**: To locate the theme’s gem, execute:
|
||||
> **Hint**: To locate the installed theme’s gem, execute:
|
||||
>
|
||||
```console
|
||||
$ bundle info --path jekyll-theme-chirpy
|
||||
```
|
||||
> ```console
|
||||
> $ bundle info --path jekyll-theme-chirpy
|
||||
> ```
|
||||
|
||||
Or you can [use the starter template][use-starter] to create a Jekyll site to save time copying contents from theme's gem.
|
||||
Or you can [**use the starter template**][use-starter] to create a Jekyll site to save time copying files from the theme's gem. We have prepared everything for you there!
|
||||
|
||||
### Fork From GitHub
|
||||
### Fork on GitHub
|
||||
|
||||
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) from GitHub and clone your fork to local.
|
||||
[Fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork) on GitHub and then clone your fork to local. (Please note that the default branch code is in development. If you want the blog to be stable, please switch to the [latest tag](https://github.com/cotes2020/jekyll-theme-chirpy/tags) and start writing.)
|
||||
|
||||
Install gem dependencies by:
|
||||
|
||||
@@ -69,16 +69,14 @@ $ bash tools/init.sh
|
||||
What it does is:
|
||||
|
||||
1. Remove some files or directories from your repository:
|
||||
|
||||
- `.travis.yml`
|
||||
- files under `_posts`
|
||||
- folder `docs`
|
||||
|
||||
2. If you use the `--no-gh` option, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in folder `.github`.
|
||||
2. If you use the `--no-gh` option, the directory `.github` will be deleted. Otherwise, setup the GitHub Action workflow by removing the extension `.hook` of `.github/workflows/pages-deploy.yml.hook`, and then remove the other files and directories in the folder `.github`.
|
||||
|
||||
3. Automatically create a commit to save the changes.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Configuration
|
||||
@@ -88,7 +86,7 @@ Update the variables of `_config.yml` as needed. Some of them are typical option
|
||||
- `url`
|
||||
- `avatar`
|
||||
- `timezone`
|
||||
- `theme_mode`
|
||||
- `lang`
|
||||
|
||||
### Running Local Server
|
||||
|
||||
@@ -111,7 +109,7 @@ Open a browser and visit to _<http://localhost:4000>_.
|
||||
|
||||
### Deployment
|
||||
|
||||
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
|
||||
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [**project site**](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base URL on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash, e.g, `/project-name`.
|
||||
|
||||
Now you can choose ONE of the following methods to deploy your Jekyll site.
|
||||
|
||||
@@ -121,16 +119,16 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
|
||||
|
||||
Quickly check the files needed for GitHub Actions build:
|
||||
|
||||
1. Ensure your Jekyll site has the file `/.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
|
||||
2. Ensuer your Jekyll site has file `/tools/test.sh` and `/tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
|
||||
- Ensure your Jekyll site has the file `.github/workflows/pages-deploy.yml`. Otherwise, create a new one and fill in the contents of the [workflow file][workflow], and the value of the `on.push.branches` should be the same as your repo's default branch name.
|
||||
- Ensure your Jekyll site has file `tools/test.sh` and `tools/deploy.sh`. Otherwise, copy them from this repo to your Jekyll site.
|
||||
|
||||
Next, rename your repoistory to `<GH-USERNAME>.github.io` on GitHub.
|
||||
And then rename your repository to `<GH-USERNAME>.github.io` on GitHub.
|
||||
|
||||
And then publish your Jekyll site by:
|
||||
Now publish your Jekyll site by:
|
||||
|
||||
1. Push any commit to remote to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
|
||||
|
||||
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings_ → _Options_ → _GitHub Pages_:
|
||||
2. Browse to your repo's landing page on GitHub and select the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) through _Settings_ → _Options_ → _GitHub Pages_:
|
||||
|
||||

|
||||
|
||||
@@ -157,3 +155,7 @@ $ docker run -it --rm \
|
||||
```
|
||||
|
||||
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server.
|
||||
|
||||
[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
|
||||
|
||||
@@ -4,36 +4,34 @@ author: Cotes Chung
|
||||
date: 2019-08-11 00:34:00 +0800
|
||||
categories: [Blogging, Tutorial]
|
||||
tags: [favicon]
|
||||
toc: false
|
||||
---
|
||||
|
||||
In [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/), the image files of [Favicons](https://www.favicon-generator.org/about/) are placed in `assets/img/favicons/`. You may need to replace them with your own. So let's see how to customize these Favicons.
|
||||
The [favicons](https://www.favicon-generator.org/about/) of [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) are placed in the directory `assets/img/favicons/`. You may need to replace them with your own. The following sections will guide you how to create and replace the default favicons.
|
||||
|
||||
With a square image (PNG, JPG or GIF) in hand, open the site [*Favicon & App Icon Generator*](https://www.favicon-generator.org/) and upload your original image.
|
||||
## Generate the favicon
|
||||
|
||||

|
||||
Prepare a square image (PNG, JPG, or SVG) with a size of 512x512 or more, and then go to the online tool [**Real Favicon Generator**](https://realfavicongenerator.net/) and click button <kbd>Select your Favicon image</kbd> to upload your image file.
|
||||
|
||||
Click button <kbd>Create Favicon</kbd> and wait a moment for the website to generate the icons of various sizes automatically.
|
||||
In the next step, the webpage will show all usage scenarios. You can keep the default options, scroll to the bottom of the page, and click the button <kbd>Generate your Favicons and HTML code</kbd> to generate the favicon.
|
||||
|
||||
{: width="600"}
|
||||
## Download & Replace
|
||||
|
||||
Download the generated package, unzip and delete the following two from the extracted files:
|
||||
|
||||
- browserconfig.xml
|
||||
- manifest.json
|
||||
- `browserconfig.xml`
|
||||
- `site.webmanifest`
|
||||
|
||||
Now, copy the remaining image files (`.PNG` and `.ICO`) from the extracted `.zip` file to cover the original files in the folder `assets/img/favicons/`.
|
||||
Now, copy the remaining image files (`PNG` and `ICO`) to cover the original files in the folder `assets/img/favicons/` of your Jekyll site.
|
||||
|
||||
The following table helps you understand the changes to the icon file:
|
||||
The following table will helps you understand the changes to the favicon files:
|
||||
|
||||
> ✓ means keep, ✗ means delete.
|
||||
|
||||
| File(s) | From Favicon & App Icon Generator | From Chirpy |
|
||||
| File(s) | From Online Tool | From Chirpy |
|
||||
|---------------------|:---------------------------------:|:-----------:|
|
||||
| `*.PNG` | ✓ | ✗ |
|
||||
| `*.ICO` | ✓ | ✗ |
|
||||
| `browserconfig.xml` | ✗ | ✓ |
|
||||
| `manifest.json` | ✗ | ✓ |
|
||||
| `site.webmanifest` | ✗ | ✓ |
|
||||
|
||||
> Note: ✓ means keep, ✗ means delete.
|
||||
|
||||
The next time you build the site, the icon will be replaced with a customized edition.
|
||||
The next time you build the site, the favicon will be replaced with a customized edition.
|
||||
|
||||
@@ -7,7 +7,7 @@ tags: [google analytics, pageviews]
|
||||
---
|
||||
|
||||
|
||||
This post is to enable Page Views on the [**Chirpy**][chirpy-homepage] theme based blog that you just built. This requires technical knowledge and it's recommended to keep the `google_analytics.pv` disabled unless you have a good reason. If your website has low traffic, the page views count would discourage you to write more blogs. With that said, let's start with the setup.
|
||||
This post is to enable Page Views on the [**Chirpy**][chirpy-homepage] theme based blog that you just built. This requires technical knowledge and it's recommended to keep the `google_analytics.pv.*` empty unless you have a good reason. If your website has low traffic, the page views count would discourage you to write more blogs. With that said, let's start with the setup.
|
||||
|
||||
## Set up Google Analytics
|
||||
|
||||
@@ -39,14 +39,11 @@ Now, click on the new data stream and grab the **Measurement ID**. It should loo
|
||||
|
||||
```yaml
|
||||
google_analytics:
|
||||
id: 'G-V6XXXXXXX' # Fill with your Google Analytics ID
|
||||
id: 'G-V6XXXXXXX' # fill in your Google Analytics ID
|
||||
# Google Analytics pageviews report settings
|
||||
pv:
|
||||
# The Google Analytics pageviews switch.
|
||||
enabled: false
|
||||
# the next options only valid when `google_analytics.pv` is enabled.
|
||||
proxy_url: ''
|
||||
proxy_endpoint: ''
|
||||
cache: false # pv data local cache, good for the users from GFW area.
|
||||
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
|
||||
```
|
||||
|
||||
When you push these changes to your blog, you should start seeing the traffic on your Google Analytics. Play around with Google Analytics dashboard to get familiar with the options available as it takes like 5 mins to pickup your changes. You should now be able to monitor your traffic in realtime.
|
||||
@@ -116,11 +113,10 @@ There is a detailed [tutorial](https://developers.google.com/analytics/solutions
|
||||
1. Clone the **Google Analytics superProxy** project on Github: <https://github.com/googleanalytics/google-analytics-super-proxy> to your local.
|
||||
|
||||
2. Remove the first 2 lines in the [`src/app.yaml`](https://github.com/googleanalytics/google-analytics-super-proxy/blob/master/src/app.yaml#L1-L2) file:
|
||||
|
||||
```yaml
|
||||
-application: your-project-id
|
||||
-version: 1
|
||||
```
|
||||
```diff
|
||||
- application: your-project-id
|
||||
- version: 1
|
||||
```
|
||||
|
||||
3. In `src/config.py`, add the `OAUTH_CLIENT_ID` and `OAUTH_CLIENT_SECRET` that you gathered from you App Engine Dashboard.
|
||||
|
||||
@@ -223,17 +219,12 @@ Once all the hard part is done, it is very easy to enable the Page View on Chirp
|
||||
|
||||
Update the `_config.yml` file of [**Chirpy**][chirpy-homepage] project with the values from your dashboard, to look similar to the following:
|
||||
|
||||
|
||||
```yaml
|
||||
google_analytics:
|
||||
id: 'G-XXXXXXXXXX' # Fill with your Google Analytics ID
|
||||
id: 'G-V6XXXXXXX' # fill in your Google Analytics ID
|
||||
pv:
|
||||
# The Google Analytics pageviews switch.
|
||||
enabled: true
|
||||
# the next options only valid when `google_analytics.pv` is enabled.
|
||||
proxy_url: 'https://PROJECT_ID.REGION_ID.r.appspot.com'
|
||||
proxy_endpoint: 'https://PROJECT_ID.REGION_ID.r.appspot.com/query?id=<ID FROM SUPER PROXY>'
|
||||
cache: false # pv data local cache, good for the users from GFW area.
|
||||
cache_path: # the local PV cache data, friendly to visitors from GFW region
|
||||
```
|
||||
|
||||
Now, you should see the Page View enabled on your blog.
|
||||
|
||||
@@ -229,7 +229,7 @@ footer {
|
||||
|
||||
@extend %no-bottom-border;
|
||||
|
||||
color: #6c757d;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -357,6 +357,7 @@ footer {
|
||||
}
|
||||
|
||||
.post-content {
|
||||
font-size: 1.08rem;
|
||||
line-height: 1.8;
|
||||
margin-top: 2rem;
|
||||
overflow-wrap: break-word;
|
||||
@@ -364,37 +365,21 @@ footer {
|
||||
|
||||
img[data-src] {
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
@mixin img-caption {
|
||||
+ em {
|
||||
display: block;
|
||||
text-align: center;
|
||||
font-style: normal;
|
||||
font-size: 80%;
|
||||
padding: 0;
|
||||
color: #6d6c6c;
|
||||
&.left {
|
||||
float: left;
|
||||
margin: 0.75rem 1rem 1rem 0;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin img($caption: false) {
|
||||
|
||||
> img[data-src] {
|
||||
@if $caption {
|
||||
@include img-caption;
|
||||
}
|
||||
|
||||
&.left {
|
||||
float: left;
|
||||
margin: 0.75rem 1rem 1rem 0;
|
||||
}
|
||||
|
||||
&.right {
|
||||
float: right;
|
||||
margin: 0.75rem 0 1rem 1rem;
|
||||
}
|
||||
|
||||
&.right {
|
||||
float: right;
|
||||
margin: 0.75rem 0 1rem 1rem;
|
||||
}
|
||||
|
||||
&.shadow {
|
||||
filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
a {
|
||||
@@ -402,7 +387,7 @@ footer {
|
||||
color: var(--link-color);
|
||||
}
|
||||
|
||||
&:not(.img-hyperlink) {
|
||||
&:not(.img-link) {
|
||||
@extend %link-color;
|
||||
@extend %link-underline;
|
||||
&:hover {
|
||||
@@ -410,23 +395,26 @@ footer {
|
||||
}
|
||||
}
|
||||
|
||||
&.img-hyperlink {
|
||||
@include img;
|
||||
@include img-caption;
|
||||
&.popup { // created by `_includes/img-extra.html`
|
||||
cursor: zoom-in;
|
||||
|
||||
> img[data-src]:not(.normal):not(.left):not(.right) {
|
||||
@include align-center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> p {
|
||||
> img[data-src]:not(.normal):not(.left):not(.right) {
|
||||
@include align-center;
|
||||
&.img-link {
|
||||
+ em {
|
||||
display: block;
|
||||
text-align: center;
|
||||
font-style: normal;
|
||||
font-size: 80%;
|
||||
padding: 0;
|
||||
color: #6d6c6c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
@include img(true);
|
||||
|
||||
font-size: 1.08rem;
|
||||
}
|
||||
} // a
|
||||
|
||||
ul {
|
||||
// attribute 'hide-bullet' was added by liquid
|
||||
@@ -521,6 +509,10 @@ footer {
|
||||
|
||||
/* --- Effects classes --- */
|
||||
|
||||
.semi-bold {
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
|
||||
.loaded {
|
||||
display: block !important;
|
||||
|
||||
@@ -581,6 +573,20 @@ footer {
|
||||
transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
|
||||
}
|
||||
|
||||
/* --- Overriding --- */
|
||||
|
||||
// magnific-popup
|
||||
figure .mfp-title {
|
||||
text-align: center;
|
||||
padding-right: 0;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
// mermaid
|
||||
.mermaid {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* --- sidebar layout --- */
|
||||
|
||||
$tab-count: 5 !default;
|
||||
@@ -599,6 +605,15 @@ $sidebar-display: "sidebar-display";
|
||||
z-index: 99;
|
||||
background: var(--sidebar-bg);
|
||||
|
||||
/* Hide scrollbar for Chrome, Safari and Opera */
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Hide scrollbar for IE, Edge and Firefox */
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
|
||||
a {
|
||||
@include sidebar-links;
|
||||
|
||||
@@ -811,9 +826,6 @@ $sidebar-display: "sidebar-display";
|
||||
|
||||
#search-result-wrapper {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
padding-top: 3rem;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
.post-content {
|
||||
@@ -895,7 +907,6 @@ $sidebar-display: "sidebar-display";
|
||||
border-radius: 0;
|
||||
padding: 0.18rem 0.3rem;
|
||||
color: var(--text-color);
|
||||
font-size: 95%;
|
||||
|
||||
&:focus {
|
||||
box-shadow: none;
|
||||
@@ -944,7 +955,7 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
|
||||
> div {
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 1rem;
|
||||
@@ -1061,7 +1072,14 @@ $sidebar-display: "sidebar-display";
|
||||
-webkit-transform: translate3d(0, -5px, 0);
|
||||
}
|
||||
|
||||
/* --- Responsive Design --- */
|
||||
/*
|
||||
Responsive Design:
|
||||
|
||||
{sidebar, content, panel} >= 1120px screen width
|
||||
{sidebar, content} >= 850px screen width
|
||||
{content} <= 849px screen width
|
||||
|
||||
*/
|
||||
|
||||
@media all and (max-width: 576px) {
|
||||
|
||||
@@ -1111,8 +1129,8 @@ $sidebar-display: "sidebar-display";
|
||||
|
||||
}
|
||||
|
||||
/* Hide Sidebar and TOC */
|
||||
@media all and (max-width: 830px) {
|
||||
/* hide sidebar and panel */
|
||||
@media all and (max-width: 849px) {
|
||||
%slide {
|
||||
-webkit-transition: transform 0.4s ease;
|
||||
transition: transform 0.4s ease;
|
||||
@@ -1229,16 +1247,17 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // max-width: 849px
|
||||
|
||||
/* Phone & Pad */
|
||||
@media all and (min-width: 577px) and (max-width: 1199px) {
|
||||
footer > .d-flex > div {
|
||||
width: 312px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sidebar visible */
|
||||
@media all and (min-width: 831px) {
|
||||
/* Sidebar is visible */
|
||||
@media all and (min-width: 850px) {
|
||||
/* Solved jumping scrollbar */
|
||||
html {
|
||||
overflow-y: scroll;
|
||||
@@ -1257,6 +1276,10 @@ $sidebar-display: "sidebar-display";
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
#search-result-wrapper {
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
div.post-content .table-wrapper > table {
|
||||
min-width: 70%;
|
||||
}
|
||||
@@ -1281,9 +1304,9 @@ $sidebar-display: "sidebar-display";
|
||||
|
||||
}
|
||||
|
||||
/* iPad 9.7" horizontal */
|
||||
@media all and (min-width: 992px) and (max-width: 1024px) {
|
||||
#main-wrapper .col-lg-11 {
|
||||
/* Pad horizontal */
|
||||
@media all and (min-width: 992px) and (max-width: 1199px) {
|
||||
#main .col-lg-11 {
|
||||
-webkit-box-flex: 0;
|
||||
-ms-flex: 0 0 96%;
|
||||
flex: 0 0 96%;
|
||||
@@ -1291,11 +1314,17 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
}
|
||||
|
||||
/* Compact icons in sidebar & TOC hidden */
|
||||
@media all and (min-width: 832px) and (max-width: 1199px) {
|
||||
/* Compact icons in sidebar & panel hidden */
|
||||
@media all and (min-width: 850px) and (max-width: 1199px) {
|
||||
|
||||
#sidebar {
|
||||
width: $sidebar-width-small;
|
||||
|
||||
.site-subtitle {
|
||||
margin-left: 1rem;
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.sidebar-bottom {
|
||||
a,
|
||||
span {
|
||||
@@ -1311,10 +1340,6 @@ $sidebar-display: "sidebar-display";
|
||||
left: 210px;
|
||||
}
|
||||
|
||||
#search-result-wrapper {
|
||||
width: calc(100% - 210px);
|
||||
}
|
||||
|
||||
#search-results > div {
|
||||
max-width: 700px;
|
||||
}
|
||||
@@ -1344,7 +1369,7 @@ $sidebar-display: "sidebar-display";
|
||||
|
||||
}
|
||||
|
||||
/* Pannel hidden */
|
||||
/* panel hidden */
|
||||
@media all and (max-width: 1199px) {
|
||||
#panel-wrapper {
|
||||
display: none;
|
||||
@@ -1392,12 +1417,8 @@ $sidebar-display: "sidebar-display";
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
#search-result-wrapper {
|
||||
width: calc(100% - 260px);
|
||||
}
|
||||
|
||||
#search-results > div {
|
||||
max-width: 46%;
|
||||
width: 46%;
|
||||
&:nth-child(odd) {
|
||||
margin-right: 1.5rem;
|
||||
}
|
||||
@@ -1410,7 +1431,7 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
}
|
||||
|
||||
.post-content p {
|
||||
.post-content {
|
||||
font-size: 1.03rem;
|
||||
}
|
||||
|
||||
@@ -1603,12 +1624,11 @@ $sidebar-display: "sidebar-display";
|
||||
} // #sidebar
|
||||
|
||||
footer > div.d-flex {
|
||||
width: 87%;
|
||||
width: 92%;
|
||||
max-width: 1140px;
|
||||
}
|
||||
|
||||
#search-result-wrapper {
|
||||
width: calc(100% - #{$sidebar-width-large});
|
||||
> div {
|
||||
max-width: #{$main-content-max-width};
|
||||
}
|
||||
@@ -1651,7 +1671,7 @@ $sidebar-display: "sidebar-display";
|
||||
}
|
||||
|
||||
#search-result-wrapper {
|
||||
padding-right: calc(100% - #{$sidebar-width-large} - 1530px);
|
||||
padding-right: calc(100% - #{$sidebar-width-large} - 1180px);
|
||||
}
|
||||
|
||||
#panel-wrapper {
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
|
||||
/* ---------- scss placeholder --------- */
|
||||
|
||||
%heading {
|
||||
color: var(--heading-color);
|
||||
font-weight: 400;
|
||||
font-family: 'Lato', 'Microsoft Yahei', sans-serif;
|
||||
}
|
||||
|
||||
%tag-hover {
|
||||
background: var(--tag-hover);
|
||||
transition: background 0.35s ease-in-out;
|
||||
@@ -33,11 +39,6 @@
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
%heading {
|
||||
font-weight: 400;
|
||||
font-family: 'Lato', 'Microsoft Yahei', sans-serif;
|
||||
}
|
||||
|
||||
%section {
|
||||
#post-wrapper & {
|
||||
line-height: 1.2;
|
||||
|
||||
@@ -157,7 +157,7 @@ div {
|
||||
div[class^='language-']::before {
|
||||
content: attr(lang);
|
||||
position: absolute;
|
||||
right: 1.8rem;
|
||||
right: 2rem;
|
||||
margin-top: 3px;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 600;
|
||||
@@ -170,3 +170,9 @@ div[class^='language-']::before {
|
||||
right: 3.1rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1650px) {
|
||||
div[class^='language-']::before {
|
||||
right: 3.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
/* common color */
|
||||
--text-color: rgb(175, 176, 177);
|
||||
--heading-color: #cccccc;
|
||||
--text-muted-color: rgb(107, 116, 124);
|
||||
--link-color: rgb(138, 180, 248);
|
||||
--link-underline-color: rgb(82, 108, 150);
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
/* --- custom light colors --- */
|
||||
--highlight-bg-color: #f7f7f7;
|
||||
--highlighter-rouge-color: #353a3d;
|
||||
--highlighter-rouge-color: #2f2f2f;
|
||||
--highlight-lineno-color: #c2c6cc;
|
||||
--highlight-lineno-border-color: #e9ecef;
|
||||
--inline-code-bg: #f3f3f3;
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
--main-wrapper-bg: white;
|
||||
--main-border-color: #f3f3f3;
|
||||
--btn-border-color: #e9ecef;
|
||||
--text-color: #333333;
|
||||
--text-color: #34343c;
|
||||
--heading-color: black;
|
||||
--blockquote-border-color: #eee;
|
||||
--blockquote-text-color: #9a9a9a;
|
||||
--link-color: #2a408e;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*!
|
||||
* The styles for Jekyll theme Chirpy
|
||||
*
|
||||
* Chirpy v3.0.3 (https://github.com/cotes2020/jekyll-theme-chirpy)
|
||||
* Chirpy v4.0.0 (https://github.com/cotes2020/jekyll-theme-chirpy)
|
||||
* © 2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
padding-right: $pr;
|
||||
}
|
||||
|
||||
.timeago::before {
|
||||
content: attr(prefix);
|
||||
}
|
||||
|
||||
#post-wrapper .post-meta {
|
||||
> div:nth-child(2) {
|
||||
> span:not(:first-child)::before {
|
||||
@@ -44,7 +48,7 @@
|
||||
@include align-center;
|
||||
|
||||
margin-top: 0;
|
||||
margin-bottom: 2.5rem;
|
||||
margin-bottom: 2.5rem !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,11 +70,13 @@
|
||||
@include btn-post-nav;
|
||||
|
||||
color: var(--link-color);
|
||||
|
||||
&:hover {
|
||||
background: #2a408e;
|
||||
color: #fff;
|
||||
border-color: #2a408e;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
@include btn-post-nav;
|
||||
|
||||
@@ -78,13 +84,34 @@
|
||||
cursor: not-allowed;
|
||||
background: none;
|
||||
color: gray;
|
||||
|
||||
&:hover {
|
||||
border-color: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.btn-outline-primary.disabled:focus {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
&::before {
|
||||
color: var(--text-muted-color);
|
||||
font-size: 0.65rem;
|
||||
text-transform: uppercase;
|
||||
content: attr(prompt);
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
left: 0.5px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
right: 0.5px;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
@@ -94,24 +121,6 @@
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
a {
|
||||
&::before {
|
||||
color: var(--text-muted-color);
|
||||
font-size: 0.65rem;
|
||||
text-transform: uppercase;
|
||||
content: attr(prompt);
|
||||
}
|
||||
&:first-child {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
left: 0.5px;
|
||||
}
|
||||
&:last-child {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
right: 0.5px;
|
||||
}
|
||||
}
|
||||
} // .post-navigation
|
||||
|
||||
@keyframes fade-up {
|
||||
@@ -146,6 +155,10 @@
|
||||
line-height: 1rem;
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
|
||||
&.nav-link:not(.active) {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
/* --- Related Posts --- */
|
||||
@@ -225,10 +238,6 @@
|
||||
vertical-align: middle;
|
||||
user-select: none;
|
||||
|
||||
i {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.share-icons {
|
||||
font-size: 1.2rem;
|
||||
a {
|
||||
@@ -336,12 +345,6 @@
|
||||
} // .post
|
||||
}
|
||||
|
||||
@media all and (min-width: 768px) and (max-width: 830px) {
|
||||
.post img {
|
||||
max-width: calc(100% + 2rem);
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide SideBar and TOC */
|
||||
@media all and (max-width: 830px) {
|
||||
.post-navigation {
|
||||
|
||||
@@ -6,9 +6,6 @@ permalink: /404.html
|
||||
redirect_from:
|
||||
- /norobots/
|
||||
- /assets/
|
||||
- /tabs/
|
||||
- /categories/
|
||||
- /tags/
|
||||
- /posts/
|
||||
|
||||
dynamic_title: true
|
||||
@@ -16,5 +13,9 @@ dynamic_title: true
|
||||
|
||||
<div class="lead">
|
||||
<p>Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. </p>
|
||||
<p><a href="{{ site.baseurl }}/">Head back Home</a> to try finding it again, or search for it on the <a href="{{ site.baseurl }}/tabs/archives">Archives page</a>.</p>
|
||||
<p>
|
||||
<a href="{{ '/' | relative_url }}">Head back Home</a>
|
||||
to try finding it again, or search for it on the
|
||||
<a href="{{ 'archives' | relative_url }}">Archives page</a>.
|
||||
</p>
|
||||
</div>
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
layout: compress
|
||||
permalink: /feed.xml
|
||||
# Atom Feed, reference: https://validator.w3.org/feed/docs/atom.html
|
||||
---
|
||||
|
||||
@@ -10,14 +11,14 @@ layout: compress
|
||||
<subtitle>{{ site.description }}</subtitle>
|
||||
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
||||
<author>
|
||||
<name>{{ site.author }}</name>
|
||||
<name>{{ site.social.name }}</name>
|
||||
<uri>{{ "/" | absolute_url }}</uri>
|
||||
</author>
|
||||
<link rel="self" type="application/atom+xml" href="{{ page.url | absolute_url }}"/>
|
||||
<link rel="alternate" type="text/html" hreflang="{{ site.lang | default: 'en' }}"
|
||||
href="{{ '/' | absolute_url }}"/>
|
||||
<generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator>
|
||||
<rights> © {{ 'now' | date: '%Y' }} {{ site.author }} </rights>
|
||||
<rights> © {{ 'now' | date: '%Y' }} {{ site.social.name }} </rights>
|
||||
<icon>{{ site.baseurl }}/assets/img/favicons/favicon.ico</icon>
|
||||
<logo>{{ site.baseurl }}/assets/img/favicons/favicon-96x96.png</logo>
|
||||
|
||||
@@ -35,7 +36,7 @@ layout: compress
|
||||
<id>{{ post_absolute_url }}</id>
|
||||
<content src="{{ post_absolute_url }}" />
|
||||
<author>
|
||||
<name>{{ site.author }}</name>
|
||||
<name>{{ post.author | default: site.social.name }}</name>
|
||||
</author>
|
||||
|
||||
{% if post.categories %}
|
||||
BIN
assets/img/favicons/android-chrome-192x192.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
assets/img/favicons/android-chrome-512x512.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB |
BIN
assets/img/favicons/apple-touch-icon.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
@@ -1,16 +1,13 @@
|
||||
---
|
||||
layout: compress
|
||||
|
||||
# A part of the Favicons
|
||||
---
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<browserconfig>
|
||||
<msapplication>
|
||||
<tile>
|
||||
<square70x70logo src="{{ site.baseurl }}/assets/img/favicons/ms-icon-70x70.png" />
|
||||
<square150x150logo src="{{ site.baseurl }}/assets/img/favicons/ms-icon-150x150.png" />
|
||||
<square310x310logo src="{{ site.baseurl }}/assets/img/favicons/ms-icon-310x310.png" />
|
||||
<TileColor>#ffffff</TileColor>
|
||||
<square150x150logo src="{{ '/assets/img/favicons/mstile-150x150.png' | relative_url }}" />
|
||||
<TileColor>#da532c</TileColor>
|
||||
</tile>
|
||||
</msapplication>
|
||||
</browserconfig>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 15 KiB |
@@ -1,54 +0,0 @@
|
||||
---
|
||||
layout: compress
|
||||
#
|
||||
# A part of the Favicons
|
||||
---
|
||||
|
||||
{% assign icon_url = "/assets/img/favicons" | relative_url %}
|
||||
|
||||
{
|
||||
"name": "{{ site.title }}",
|
||||
"short_name": "{{ site.title }}",
|
||||
"description": "{{ site.description }}",
|
||||
"icons": [
|
||||
{
|
||||
"src": "{{ icon_url }}/android-icon-36x36.png",
|
||||
"sizes": "36x36",
|
||||
"type": "image/png",
|
||||
"density": "0.75"
|
||||
},
|
||||
{
|
||||
"src": "{{ icon_url }}/android-icon-48x48.png",
|
||||
"sizes": "48x48",
|
||||
"type": "image/png",
|
||||
"density": "1.0"
|
||||
},
|
||||
{
|
||||
"src": "{{ icon_url }}/android-icon-72x72.png",
|
||||
"sizes": "72x72",
|
||||
"type": "image/png",
|
||||
"density": "1.5"
|
||||
},
|
||||
{
|
||||
"src": "{{ icon_url }}/android-icon-96x96.png",
|
||||
"sizes": "96x96",
|
||||
"type": "image/png",
|
||||
"density": "2.0"
|
||||
},
|
||||
{
|
||||
"src": "{{ icon_url }}/android-icon-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image/png",
|
||||
"density": "3.0"
|
||||
},
|
||||
{
|
||||
"src": "{{ icon_url }}/android-icon-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"density": "4.0"
|
||||
}],
|
||||
"start_url": "{{ '/index.html' | relative_url }}",
|
||||
"display": "fullscreen",
|
||||
"theme_color": "#2a1e6b",
|
||||
"background_color": "white"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
BIN
assets/img/favicons/mstile-150x150.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
26
assets/img/favicons/site.webmanifest
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
layout: compress
|
||||
---
|
||||
|
||||
{% assign favicon_path = "/assets/img/favicons" | relative_url %}
|
||||
|
||||
{
|
||||
"name": "{{ site.title }}",
|
||||
"short_name": "{{ site.title }}",
|
||||
"description": "{{ site.description }}",
|
||||
"icons": [
|
||||
{
|
||||
"src": "{{ favicon_path }}/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "{{ favicon_path }}/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}],
|
||||
"start_url": "{{ '/index.html' | relative_url }}",
|
||||
"theme_color": "#2a1e6b",
|
||||
"background_color": "#ffffff",
|
||||
"display": "fullscreen"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
/*!
|
||||
* Chirpy v3.0.3 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* © 2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
* Find out the <a> tag contains an image and mark it.
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
const MARK = "img-hyperlink";
|
||||
$("a:has(img)").addClass(MARK);
|
||||
});
|
||||
@@ -1,232 +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 () {
|
||||
return {
|
||||
isEnabled() {
|
||||
return "true" === $("meta[name=pv-cache-enabled]").attr("content");
|
||||
},
|
||||
getProxyEndpoint() {
|
||||
return $("meta[name=pv-proxy-endpoint]").attr("content");
|
||||
},
|
||||
getLocalData() {
|
||||
return $("meta[name=pv-cache-data]").attr("content");
|
||||
}
|
||||
}
|
||||
}());
|
||||
|
||||
const PvCache = (function () {
|
||||
const KEY_PV = "pv";
|
||||
const KEY_CREATION = "pv_created_date";
|
||||
const KEY_PV_SRC = "pv_source";
|
||||
|
||||
const Source = {
|
||||
ORIGIN: "origin",
|
||||
PROXY: "proxy"
|
||||
};
|
||||
|
||||
function get(key) {
|
||||
return localStorage.getItem(key);
|
||||
}
|
||||
|
||||
function set(key, val) {
|
||||
localStorage.setItem(key, val);
|
||||
}
|
||||
|
||||
return {
|
||||
getData() {
|
||||
// get data from browser cache
|
||||
return JSON.parse(localStorage.getItem(KEY_PV));
|
||||
},
|
||||
saveOriginCache(pv) {
|
||||
set(KEY_PV, pv);
|
||||
set(KEY_PV_SRC, Source.ORIGIN);
|
||||
set(KEY_CREATION, new Date().toJSON());
|
||||
},
|
||||
saveProxyCache(pv) {
|
||||
set(KEY_PV, pv);
|
||||
set(KEY_PV_SRC, Source.PROXY);
|
||||
set(KEY_CREATION, new Date().toJSON());
|
||||
},
|
||||
isFromOrigin() {
|
||||
return get(KEY_PV_SRC) === Source.ORIGIN;
|
||||
},
|
||||
isFromProxy() {
|
||||
return get(KEY_PV_SRC) === Source.PROXY;
|
||||
},
|
||||
isExpired() {
|
||||
if (PvCache.isFromOrigin()) {
|
||||
let date = new Date(get(KEY_CREATION));
|
||||
date.setDate(date.getDate() + 1); /* update origin records every day */
|
||||
return Date.now() >= date.getTime();
|
||||
|
||||
} else if (PvCache.isFromProxy()) {
|
||||
let date = new Date(get(KEY_CREATION));
|
||||
date.setHours(date.getHours() + 1); /* update proxy records per hour */
|
||||
return Date.now() >= date.getTime();
|
||||
}
|
||||
return false;
|
||||
},
|
||||
getAllPageviews() {
|
||||
return PvCache.getData().totalsForAllResults["ga:pageviews"];
|
||||
},
|
||||
newerThan(pv) {
|
||||
return PvCache.getAllPageviews() > pv.totalsForAllResults["ga:pageviews"];
|
||||
},
|
||||
inspectKeys() {
|
||||
if (localStorage.getItem(KEY_PV) === null
|
||||
|| localStorage.getItem(KEY_PV_SRC) === null
|
||||
|| localStorage.getItem(KEY_CREATION) === null) {
|
||||
localStorage.clear();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}()); /* PvCache */
|
||||
|
||||
|
||||
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() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: PvOpts.getProxyEndpoint(),
|
||||
dataType: "jsonp",
|
||||
jsonpCallback: "displayPageviews",
|
||||
success: (data, textStatus, jqXHR) => {
|
||||
PvCache.saveProxyCache(JSON.stringify(data));
|
||||
},
|
||||
error: (jqXHR, textStatus, errorThrown) => {
|
||||
console.log("Failed to load pageviews from proxy server: " + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function fetchPageviews(fetchOrigin = true, filterOrigin = false) {
|
||||
if (PvOpts.isEnabled() && fetchOrigin) {
|
||||
fetch(PvOpts.getLocalData())
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (filterOrigin) {
|
||||
if (PvCache.newerThan(data)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
displayPageviews(data);
|
||||
PvCache.saveOriginCache(JSON.stringify(data));
|
||||
})
|
||||
.then(() => fetchProxyPageviews());
|
||||
|
||||
} else {
|
||||
fetchProxyPageviews();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(function() {
|
||||
if ($(".pageviews").length > 0) {
|
||||
PvCache.inspectKeys();
|
||||
let cache = PvCache.getData();
|
||||
|
||||
if (cache) {
|
||||
displayPageviews(cache);
|
||||
|
||||
if (PvCache.isExpired()) {
|
||||
fetchPageviews(true, PvCache.isFromProxy());
|
||||
|
||||
} else {
|
||||
|
||||
if (PvCache.isFromOrigin()) {
|
||||
fetchPageviews(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
fetchPageviews();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1,65 +0,0 @@
|
||||
---
|
||||
layout: compress
|
||||
|
||||
# The list to be cached by PWA
|
||||
---
|
||||
|
||||
const include = [
|
||||
|
||||
/*--- CSS ---*/
|
||||
'{{ "/assets/css/style.css" | relative_url }}',
|
||||
|
||||
/*--- Javascripts ---*/
|
||||
'{{ "/assets/js/dist/home.min.js" | relative_url }}',
|
||||
'{{ "/assets/js/dist/page.min.js" | relative_url }}',
|
||||
'{{ "/assets/js/dist/post.min.js" | relative_url }}',
|
||||
'{{ "/assets/js/dist/categories.min.js" | relative_url }}',
|
||||
|
||||
/*--- HTML ---*/
|
||||
|
||||
/* Tabs */
|
||||
{% for tab in site.tabs %}
|
||||
'{{ tab.url }}',
|
||||
{% endfor %}
|
||||
|
||||
/*--- Icons ---*/
|
||||
|
||||
{%- capture icon_url -%}
|
||||
{{ "/assets/img/favicons" | relative_url }}
|
||||
{%- endcapture -%}
|
||||
'{{ icon_url }}/favicon.ico',
|
||||
'{{ icon_url }}/apple-icon.png',
|
||||
'{{ icon_url }}/apple-icon-precomposed.png',
|
||||
'{{ icon_url }}/apple-icon-57x57.png',
|
||||
'{{ icon_url }}/apple-icon-60x60.png',
|
||||
'{{ icon_url }}/apple-icon-72x72.png',
|
||||
'{{ icon_url }}/apple-icon-76x76.png',
|
||||
'{{ icon_url }}/apple-icon-114x114.png',
|
||||
'{{ icon_url }}/apple-icon-120x120.png',
|
||||
'{{ icon_url }}/apple-icon-144x144.png',
|
||||
'{{ icon_url }}/apple-icon-152x152.png',
|
||||
'{{ icon_url }}/apple-icon-180x180.png',
|
||||
'{{ icon_url }}/android-icon-192x192.png',
|
||||
'{{ icon_url }}/favicon-32x32.png',
|
||||
'{{ icon_url }}/favicon-96x96.png',
|
||||
'{{ icon_url }}/favicon-16x16.png',
|
||||
'{{ icon_url }}/ms-icon-144x144.png',
|
||||
'{{ icon_url }}/manifest.json',
|
||||
'{{ icon_url }}/browserconfig.xml',
|
||||
|
||||
/*--- Others ---*/
|
||||
|
||||
'{{ "/assets/js/data/search.json" | relative_url }}',
|
||||
'{{ "/404.html" | relative_url }}',
|
||||
|
||||
'{{ "/app.js" | relative_url }}',
|
||||
'{{ "/sw.js" | relative_url }}'
|
||||
];
|
||||
|
||||
const exclude = [
|
||||
{%- if site.google_analytics.pv.proxy_url and site.google_analytics.pv.enabled -%}
|
||||
'{{ site.google_analytics.pv.proxy_url }}',
|
||||
{%- endif -%}
|
||||
'/assets/js/data/pageviews.json',
|
||||
'/img.shields.io/'
|
||||
];
|
||||
64
assets/js/data/swcache.js
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
layout: compress
|
||||
|
||||
# The list to be cached by PWA
|
||||
---
|
||||
|
||||
const resource = [
|
||||
|
||||
/* --- CSS --- */
|
||||
'{{ "/assets/css/style.css" | relative_url }}',
|
||||
|
||||
/* --- JavaScripts --- */
|
||||
{% assign js_path = "/assets/js" | relative_url %}
|
||||
'{{ js_path }}/dist/home.min.js',
|
||||
'{{ js_path }}/dist/page.min.js',
|
||||
'{{ js_path }}/dist/post.min.js',
|
||||
'{{ js_path }}/dist/categories.min.js',
|
||||
'{{ js_path }}/data/search.json',
|
||||
'{{ "/app.js" | relative_url }}',
|
||||
'{{ "/sw.js" | relative_url }}',
|
||||
|
||||
/* --- HTML --- */
|
||||
'{{ "/index.html" | relative_url }}',
|
||||
'{{ "/404.html" | relative_url }}',
|
||||
{% for tab in site.tabs %}
|
||||
'{{ tab.url | relative_url }}',
|
||||
{% endfor %}
|
||||
|
||||
/* --- Favicons --- */
|
||||
{% assign favicon_path = "/assets/img/favicons" | relative_url %}
|
||||
|
||||
'{{ favicon_path }}/android-chrome-192x192.png',
|
||||
'{{ favicon_path }}/android-chrome-512x512.png',
|
||||
'{{ favicon_path }}/apple-touch-icon.png',
|
||||
'{{ favicon_path }}/favicon-16x16.png',
|
||||
'{{ favicon_path }}/favicon-32x32.png',
|
||||
'{{ favicon_path }}/favicon.ico',
|
||||
'{{ favicon_path }}/mstile-150x150.png',
|
||||
'{{ favicon_path }}/site.webmanifest',
|
||||
'{{ favicon_path }}/browserconfig.xml'
|
||||
|
||||
];
|
||||
|
||||
/* The request url with below domain will be cached */
|
||||
const allowedDomains = [
|
||||
{% if site.google_analytics.id != '' %}
|
||||
'www.googletagmanager.com',
|
||||
'www.google-analytics.com',
|
||||
{% endif %}
|
||||
|
||||
'{{ site.url | split: "//" | last }}',
|
||||
|
||||
'fonts.gstatic.com',
|
||||
'fonts.googleapis.com',
|
||||
'cdn.jsdelivr.net',
|
||||
'polyfill.io'
|
||||
];
|
||||
|
||||
/* Requests that include the following path will be banned */
|
||||
const denyUrls = [
|
||||
{% if site.google_analytics.pv.cache_path %}
|
||||
'{{ site.google_analytics.pv.cache_path | absolute_url }}'
|
||||
{% endif %}
|
||||
];
|
||||
4
assets/js/dist/categories.min.js
vendored
@@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* Chirpy v3.0.3 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* Chirpy v4.0.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* © 2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
function copyLink(e){e&&0!==e.length||(e=window.location.href);const o=$("<input>");$("body").append(o),o.val(e).select(),document.execCommand("copy"),o.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),s=$("#search-cancel"),t=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),d=$("#search-result-wrapper"),r=$("#search-results"),c=$("#search-input"),i=$("#search-hints"),f=function(){let e=0;return{block(){e=$(window).scrollTop()},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),u={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),s.addClass("loaded")},off(){s.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},p=function(){let e=!1;return{on(){e||(d.removeClass("unloaded"),a.addClass("hidden"),e=!0,f.block())},off(){e&&(r.empty(),i.hasClass("unloaded")&&i.removeClass("unloaded"),d.addClass("unloaded"),t.removeClass("visible"),a.removeClass("hidden"),c.val(""),e=!1,f.release())},isVisible:()=>e}}();function h(){return s.hasClass("loaded")}o.click(function(){u.on(),p.on(),c.focus()}),s.click(function(){u.off(),p.off()}),c.focus(function(){n.addClass("input-focus")}),c.focusout(function(){n.removeClass("input-focus")}),c.on("keyup",function(e){8===e.keyCode&&""===c.val()?h()?i.removeClass("unloaded"):p.off():""!==c.val()&&(p.on(),t.hasClass("visible")||t.addClass("visible"),h()&&i.addClass("unloaded"))}),t.on("click",function(){c.val(""),h()?(i.removeClass("unloaded"),r.empty()):p.off(),c.focus(),t.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const o=$("body");return{toggle(){!1===e?o.attr("sidebar-display",""):o.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),o=$("#toc-wrapper"),s=$(".access"),t=$("#search-input");let a,l=0;const n=5,d=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(a=!0)}),setInterval(function(){a&&(!function(){var a=$(this).scrollTop();Math.abs(l-a)<=n||(a>l&&a>d?(e.removeClass("topbar-down").addClass("topbar-up"),o.length>0&&o.removeClass("topbar-down"),s.length>0&&s.removeClass("topbar-down"),t.is(":focus")&&t.blur()):a+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),o.length>0&&o.addClass("topbar-down"),s.length>0&&s.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),s=e.text().trim();let t=o.length>0?o.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(t)&&(t=t.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==t&&e.text(t):e.text()!==s&&e.text(s)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){const e=$(".collapse");e.on("hide.bs.collapse",function(){const e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder-open`).attr("class","far fa-folder fa-fw"),$(`#${e} i.fas`).addClass("rotate"),$(`#${e}`).removeClass("hide-border-bottom"))}),e.on("show.bs.collapse",function(){const e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder`).attr("class","far fa-folder-open fa-fw"),$(`#${e} i.fas`).removeClass("rotate"),$(`#${e}`).addClass("hide-border-bottom"))})});
|
||||
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),s=$("#search-cancel"),t=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),r=$("#search-result-wrapper"),d=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),f={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),s.addClass("loaded")},off(){s.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},p=function(){let e=!1;return{on(){e||(u.block(),r.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(d.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),t.removeClass("visible"),a.removeClass("unloaded"),u.release(),i.val(""),e=!1)},isVisible(){return e}}}();function h(){return s.hasClass("loaded")}o.click(function(){f.on(),p.on(),i.focus()}),s.click(function(){f.off(),p.off()}),i.focus(function(){n.addClass("input-focus")}),i.focusout(function(){n.removeClass("input-focus")}),i.on("keyup",function(e){8===e.keyCode&&""===i.val()?h()?c.removeClass("unloaded"):p.off():""!==i.val()&&(p.on(),t.hasClass("visible")||t.addClass("visible"),h()&&c.addClass("unloaded"))}),t.on("click",function(){i.val(""),h()?(c.removeClass("unloaded"),d.empty()):p.off(),i.focus(),t.removeClass("visible")})}),$(function(){var e=function(){const e="sidebar-display";let o=!1;const s=$("body");return{toggle(){!1===o?s.attr(e,""):s.removeAttr(e),o=!o}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const o=$("#topbar-wrapper"),s=$("#toc-wrapper"),t=$(".access"),a=$("#search-input");let l,n=0;const r=o.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(l=!0)}),setInterval(function(){l&&(function(){var e=$(this).scrollTop();Math.abs(n-e)<=5||(e>n&&e>r?(o.removeClass("topbar-down").addClass("topbar-up"),0<s.length&&s.removeClass("topbar-down"),0<t.length&&t.removeClass("topbar-down"),a.is(":focus")&&a.blur()):e+$(window).height()<$(document).height()&&(o.removeClass("topbar-up").addClass("topbar-down"),0<s.length&&s.addClass("topbar-down"),0<t.length&&t.addClass("topbar-down")),n=e)}(),l=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),s=e.text().trim();let t=(0<o.length?o:$("h1")).text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(t)&&(t=t.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){return!($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)&&void(95<=$(this).scrollTop()?e.text()!==t&&e.text(t):e.text()!==s&&e.text(s))}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){const e=$(".collapse");e.on("hide.bs.collapse",function(){var e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder-open`).attr("class","far fa-folder fa-fw"),$(`#${e} i.fas`).addClass("rotate"),$(`#${e}`).removeClass("hide-border-bottom"))}),e.on("show.bs.collapse",function(){var e="h_"+$(this).attr("id").substring("l_".length);e&&($(`#${e} .far.fa-folder`).attr("class","far fa-folder-open fa-fw"),$(`#${e} i.fas`).removeClass("rotate"),$(`#${e}`).addClass("hide-border-bottom"))})});
|
||||
6
assets/js/dist/commons.min.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Chirpy v4.0.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* © 2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),s=$("#search-cancel"),t=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),d=$("#search-result-wrapper"),r=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),p={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),s.addClass("loaded")},off(){s.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),d.removeClass("unloaded"),a.addClass("unloaded"),e=!0)},off(){e&&(r.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),d.addClass("unloaded"),t.removeClass("visible"),a.removeClass("unloaded"),u.release(),i.val(""),e=!1)},isVisible(){return e}}}();function h(){return s.hasClass("loaded")}o.click(function(){p.on(),f.on(),i.focus()}),s.click(function(){p.off(),f.off()}),i.focus(function(){n.addClass("input-focus")}),i.focusout(function(){n.removeClass("input-focus")}),i.on("keyup",function(e){8===e.keyCode&&""===i.val()?h()?c.removeClass("unloaded"):f.off():""!==i.val()&&(f.on(),t.hasClass("visible")||t.addClass("visible"),h()&&c.addClass("unloaded"))}),t.on("click",function(){i.val(""),h()?(c.removeClass("unloaded"),r.empty()):f.off(),i.focus(),t.removeClass("visible")})}),$(function(){var e=function(){const e="sidebar-display";let o=!1;const s=$("body");return{toggle(){!1===o?s.attr(e,""):s.removeAttr(e),o=!o}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const o=$("#topbar-wrapper"),s=$("#toc-wrapper"),t=$(".access"),a=$("#search-input");let l,n=0;const d=o.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(l=!0)}),setInterval(function(){l&&(function(){var e=$(this).scrollTop();Math.abs(n-e)<=5||(e>n&&e>d?(o.removeClass("topbar-down").addClass("topbar-up"),0<s.length&&s.removeClass("topbar-down"),0<t.length&&t.removeClass("topbar-down"),a.is(":focus")&&a.blur()):e+$(window).height()<$(document).height()&&(o.removeClass("topbar-up").addClass("topbar-down"),0<s.length&&s.addClass("topbar-down"),0<t.length&&t.addClass("topbar-down")),n=e)}(),l=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),s=e.text().trim();let t=(0<o.length?o:$("h1")).text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(t)&&(t=t.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){return!($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)&&void(95<=$(this).scrollTop()?e.text()!==t&&e.text(t):e.text()!==s&&e.text(s))}),e.click(function(){$("body,html").animate({scrollTop:0},800)})});
|
||||
4
assets/js/dist/home.min.js
vendored
@@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* Chirpy v3.0.3 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* Chirpy v4.0.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* © 2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
function copyLink(e){e&&0!==e.length||(e=window.location.href);const t=$("<input>");$("body").append(t),t.val(e).select(),document.execCommand("copy"),t.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),s=$("#main"),n=$("#topbar-title"),l=$("#search-wrapper"),i=$("#search-result-wrapper"),r=$("#search-results"),c=$("#search-input"),d=$("#search-hints"),u=function(){let e=0;return{block(){e=$(window).scrollTop()},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),h={on(){e.addClass("unloaded"),n.addClass("unloaded"),t.addClass("unloaded"),l.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),l.removeClass("d-flex"),e.removeClass("unloaded"),n.removeClass("unloaded"),t.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(i.removeClass("unloaded"),s.addClass("hidden"),e=!0,u.block())},off(){e&&(r.empty(),d.hasClass("unloaded")&&d.removeClass("unloaded"),i.addClass("unloaded"),a.removeClass("visible"),s.removeClass("hidden"),c.val(""),e=!1,u.release())},isVisible:()=>e}}();function p(){return o.hasClass("loaded")}t.click(function(){h.on(),f.on(),c.focus()}),o.click(function(){h.off(),f.off()}),c.focus(function(){l.addClass("input-focus")}),c.focusout(function(){l.removeClass("input-focus")}),c.on("keyup",function(e){8===e.keyCode&&""===c.val()?p()?d.removeClass("unloaded"):f.off():""!==c.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),p()&&d.addClass("unloaded"))}),a.on("click",function(){c.val(""),p()?(d.removeClass("unloaded"),r.empty()):f.off(),c.focus(),a.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const t=$("body");return{toggle(){!1===e?t.attr("sidebar-display",""):t.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),t=$("#toc-wrapper"),o=$(".access"),a=$("#search-input");let s,n=0;const l=5,i=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(s=!0)}),setInterval(function(){s&&(!function(){var s=$(this).scrollTop();Math.abs(n-s)<=l||(s>n&&s>i?(e.removeClass("topbar-down").addClass("topbar-up"),t.length>0&&t.removeClass("topbar-down"),o.length>0&&o.removeClass("topbar-down"),a.is(":focus")&&a.blur()):s+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),t.length>0&&t.addClass("topbar-down"),o.length>0&&o.addClass("topbar-down")),n=s)}(),s=!1)},250)}),$(function(){const e=$("#topbar-title"),t=$("div.post>h1"),o=e.text().trim();let a=t.length>0?t.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||t.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==a&&e.text(a):e.text()!==o&&e.text(o)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){let e=$(".timeago").length,t=void 0;function o(){return $(".timeago").each(function(){if($(this).children("i").length>0){$(this).text();let t=$(this).hasClass("lastmod"),o=$(this).children("i"),a=o.text();$(this).text(function(t,o){let a=new Date,s=new Date(t);if(s.getFullYear()!==a.getFullYear())return e-=1,s.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric"});if(s.getMonth()!==a.getMonth())return e-=1,s.toLocaleString("en-US",{month:"short",day:"numeric"});let n=Math.floor((a-s)/1e3),l=Math.floor(n/86400);if(l>=1)return e-=1,l+" day"+(l>1?"s":"")+" ago";let i=Math.floor(n/3600);if(i>=1)return i+" hour"+(i>1?"s":"")+" ago";let r=Math.floor(n/60);return r>=1?r+" minute"+(r>1?"s":"")+" ago":(o?"just":"Just")+" now"}(a,t)),$(this).append(o)}}),0===e&&void 0!==t&&clearInterval(t),e}0!==e&&o()>0&&(t=setInterval(o,6e4))});
|
||||
$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),a=$("#search-cleaner"),s=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),r=$("#search-result-wrapper"),d=$("#search-results"),i=$("#search-input"),c=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),h={on(){e.addClass("unloaded"),l.addClass("unloaded"),t.addClass("unloaded"),n.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),t.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),r.removeClass("unloaded"),s.addClass("unloaded"),e=!0)},off(){e&&(d.empty(),c.hasClass("unloaded")&&c.removeClass("unloaded"),r.addClass("unloaded"),a.removeClass("visible"),s.removeClass("unloaded"),u.release(),i.val(""),e=!1)},isVisible(){return e}}}();function p(){return o.hasClass("loaded")}t.click(function(){h.on(),f.on(),i.focus()}),o.click(function(){h.off(),f.off()}),i.focus(function(){n.addClass("input-focus")}),i.focusout(function(){n.removeClass("input-focus")}),i.on("keyup",function(e){8===e.keyCode&&""===i.val()?p()?c.removeClass("unloaded"):f.off():""!==i.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),p()&&c.addClass("unloaded"))}),a.on("click",function(){i.val(""),p()?(c.removeClass("unloaded"),d.empty()):f.off(),i.focus(),a.removeClass("visible")})}),$(function(){var e=function(){const e="sidebar-display";let t=!1;const o=$("body");return{toggle(){!1===t?o.attr(e,""):o.removeAttr(e),t=!t}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const t=$("#topbar-wrapper"),o=$("#toc-wrapper"),a=$(".access"),s=$("#search-input");let l,n=0;const r=t.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(l=!0)}),setInterval(function(){l&&(function(){var e=$(this).scrollTop();Math.abs(n-e)<=5||(e>n&&e>r?(t.removeClass("topbar-down").addClass("topbar-up"),0<o.length&&o.removeClass("topbar-down"),0<a.length&&a.removeClass("topbar-down"),s.is(":focus")&&s.blur()):e+$(window).height()<$(document).height()&&(t.removeClass("topbar-up").addClass("topbar-down"),0<o.length&&o.addClass("topbar-down"),0<a.length&&a.addClass("topbar-down")),n=e)}(),l=!1)},250)}),$(function(){const e=$("#topbar-title"),t=$("div.post>h1"),o=e.text().trim();let a=(0<t.length?t:$("h1")).text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){return!($("#post-list").length||t.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)&&void(95<=$(this).scrollTop()?e.text()!==a&&e.text(a):e.text()!==o&&e.text(o))}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){let s=$(".timeago").length,e=void 0;function t(){return $(".timeago").each(function(){if(0<$(this).children("i").length){let e=$(this).children("i");var t=e.text();$(this).text(function(e,t){let o=new Date,a=new Date(e);return e=void 0!==t?`${t} `:"",a.getFullYear()!==o.getFullYear()?(--s,e+a.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric"})):a.getMonth()!==o.getMonth()?(--s,e+a.toLocaleString("en-US",{month:"short",day:"numeric"})):(t=Math.floor((o-a)/1e3),1<=(e=Math.floor(t/86400))?(--s,e+" day"+(1<e?"s":"")+" ago"):1<=(e=Math.floor(t/3600))?e+" hour"+(1<e?"s":"")+" ago":1<=(t=Math.floor(t/60))?t+" minute"+(1<t?"s":"")+" ago":"just now")}(t,$(this).attr("prep"))),$(this).append(e)}}),0===s&&void 0!==e&&clearInterval(e),s}0!==s&&0<t()&&(e=setInterval(t,6e4))});
|
||||
4
assets/js/dist/page.min.js
vendored
@@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* Chirpy v3.0.3 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* Chirpy v4.0.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* © 2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
function copyLink(e){e&&0!==e.length||(e=window.location.href);const t=$("<input>");$("body").append(t),t.val(e).select(),document.execCommand("copy"),t.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{$(this).scrollTop()>50&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){const e=$("#sidebar-trigger"),t=$("#search-trigger"),o=$("#search-cancel"),s=$("#search-cleaner"),a=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),c=$("#search-result-wrapper"),r=$("#search-results"),i=$("#search-input"),d=$("#search-hints"),u=function(){let e=0;return{block(){e=$(window).scrollTop()},release(){$("html,body").scrollTop(e)},getOffset:()=>e}}(),f={on(){e.addClass("unloaded"),l.addClass("unloaded"),t.addClass("unloaded"),n.addClass("d-flex"),o.addClass("loaded")},off(){o.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),t.removeClass("unloaded")}},p=function(){let e=!1;return{on(){e||(c.removeClass("unloaded"),a.addClass("hidden"),e=!0,u.block())},off(){e&&(r.empty(),d.hasClass("unloaded")&&d.removeClass("unloaded"),c.addClass("unloaded"),s.removeClass("visible"),a.removeClass("hidden"),i.val(""),e=!1,u.release())},isVisible:()=>e}}();function h(){return o.hasClass("loaded")}t.click(function(){f.on(),p.on(),i.focus()}),o.click(function(){f.off(),p.off()}),i.focus(function(){n.addClass("input-focus")}),i.focusout(function(){n.removeClass("input-focus")}),i.on("keyup",function(e){8===e.keyCode&&""===i.val()?h()?d.removeClass("unloaded"):p.off():""!==i.val()&&(p.on(),s.hasClass("visible")||s.addClass("visible"),h()&&d.addClass("unloaded"))}),s.on("click",function(){i.val(""),h()?(d.removeClass("unloaded"),r.empty()):p.off(),i.focus(),s.removeClass("visible")})}),$(function(){const e=function(){let e=!1;const t=$("body");return{toggle(){!1===e?t.attr("sidebar-display",""):t.removeAttr("sidebar-display"),e=!e}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const e=$("#topbar-wrapper"),t=$("#toc-wrapper"),o=$(".access"),s=$("#search-input");let a,l=0;const n=5,c=e.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(a=!0)}),setInterval(function(){a&&(!function(){var a=$(this).scrollTop();Math.abs(l-a)<=n||(a>l&&a>c?(e.removeClass("topbar-down").addClass("topbar-up"),t.length>0&&t.removeClass("topbar-down"),o.length>0&&o.removeClass("topbar-down"),s.is(":focus")&&s.blur()):a+$(window).height()<$(document).height()&&(e.removeClass("topbar-up").addClass("topbar-down"),t.length>0&&t.addClass("topbar-down"),o.length>0&&o.addClass("topbar-down")),l=a)}(),a=!1)},250)}),$(function(){const e=$("#topbar-title"),t=$("div.post>h1"),o=e.text().trim();let s=t.length>0?t.text().trim():$("h1").text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(s)&&(s=s.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){if($("#post-list").length||t.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)return!1;$(this).scrollTop()>=95?e.text()!==s&&e.text(s):e.text()!==o&&e.text(o)}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){$("a[href*='#']").not("[href='#']").not("[href='#0']").click(function(e){if(this.pathname.replace(/^\//,"")===location.pathname.replace(/^\//,"")&&location.hostname===this.hostname){const t=16,o=decodeURI(this.hash);let s=RegExp(/^#fnref:/).test(o),a=RegExp(/^#fn:/).test(o),l=o.includes(":")?o.replace(/\:/,"\\:"):o,n=$(l);if(n.length){e.preventDefault(),history.pushState&&history.pushState(null,null,o);let l=$(this).offset().top,c=n.offset().top;const r=c<l,i=$("#topbar-wrapper").outerHeight();r&&s&&(c-=i+t/2),$("html,body").animate({scrollTop:c},800,()=>{const e=$(n);e.focus();if($("[scroll-focus=true]").length&&$("[scroll-focus=true]").attr("scroll-focus",!1),$(":target").length&&$(":target").attr("scroll-focus",!1),(a||s)&&e.attr("scroll-focus",!0),e.is(":focus"))return!1;e.attr("tabindex","-1"),e.focus()})}}})});
|
||||
function copyLink(e){e&&0!==e.length||(e=window.location.href);const o=$("<input>");$("body").append(o),o.val(e).select(),document.execCommand("copy"),o.remove(),alert("Link copied successfully!")}$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){const e=$("#sidebar-trigger"),o=$("#search-trigger"),t=$("#search-cancel"),a=$("#search-cleaner"),s=$("#main"),l=$("#topbar-title"),n=$("#search-wrapper"),i=$("#search-result-wrapper"),c=$("#search-results"),d=$("#search-input"),r=$("#search-hints"),u=function(){let e=0;return{block(){e=window.scrollY,$("html,body").scrollTop(0)},release(){$("html,body").scrollTop(e)},getOffset(){return e}}}(),p={on(){e.addClass("unloaded"),l.addClass("unloaded"),o.addClass("unloaded"),n.addClass("d-flex"),t.addClass("loaded")},off(){t.removeClass("loaded"),n.removeClass("d-flex"),e.removeClass("unloaded"),l.removeClass("unloaded"),o.removeClass("unloaded")}},f=function(){let e=!1;return{on(){e||(u.block(),i.removeClass("unloaded"),s.addClass("unloaded"),e=!0)},off(){e&&(c.empty(),r.hasClass("unloaded")&&r.removeClass("unloaded"),i.addClass("unloaded"),a.removeClass("visible"),s.removeClass("unloaded"),u.release(),d.val(""),e=!1)},isVisible(){return e}}}();function h(){return t.hasClass("loaded")}o.click(function(){p.on(),f.on(),d.focus()}),t.click(function(){p.off(),f.off()}),d.focus(function(){n.addClass("input-focus")}),d.focusout(function(){n.removeClass("input-focus")}),d.on("keyup",function(e){8===e.keyCode&&""===d.val()?h()?r.removeClass("unloaded"):f.off():""!==d.val()&&(f.on(),a.hasClass("visible")||a.addClass("visible"),h()&&r.addClass("unloaded"))}),a.on("click",function(){d.val(""),h()?(r.removeClass("unloaded"),c.empty()):f.off(),d.focus(),a.removeClass("visible")})}),$(function(){var e=function(){const e="sidebar-display";let o=!1;const t=$("body");return{toggle(){!1===o?t.attr(e,""):t.removeAttr(e),o=!o}}}();$("#sidebar-trigger").click(e.toggle),$("#mask").click(e.toggle)}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(function(){const o=$("#topbar-wrapper"),t=$("#toc-wrapper"),a=$(".access"),s=$("#search-input");let l,n=0;const i=o.outerHeight();$(window).scroll(function(e){$("#topbar-title").is(":hidden")&&(l=!0)}),setInterval(function(){l&&(function(){var e=$(this).scrollTop();Math.abs(n-e)<=5||(e>n&&e>i?(o.removeClass("topbar-down").addClass("topbar-up"),0<t.length&&t.removeClass("topbar-down"),0<a.length&&a.removeClass("topbar-down"),s.is(":focus")&&s.blur()):e+$(window).height()<$(document).height()&&(o.removeClass("topbar-up").addClass("topbar-down"),0<t.length&&t.addClass("topbar-down"),0<a.length&&a.addClass("topbar-down")),n=e)}(),l=!1)},250)}),$(function(){const e=$("#topbar-title"),o=$("div.post>h1"),t=e.text().trim();let a=(0<o.length?o:$("h1")).text().trim();($("#page-category").length||$("#page-tag").length)&&/\s/.test(a)&&(a=a.replace(/[0-9]/g,"").trim()),$(window).scroll(function(){return!($("#post-list").length||o.is(":hidden")||e.is(":hidden")||$("#sidebar.sidebar-expand").length)&&void(95<=$(this).scrollTop()?e.text()!==a&&e.text(a):e.text()!==t&&e.text(t))}),e.click(function(){$("body,html").animate({scrollTop:0},800)})}),$(function(){$("input[type=checkbox]").addClass("unloaded"),$("input[type=checkbox][checked]").before('<i class="fas fa-check-circle checked"></i>'),$("input[type=checkbox]:not([checked])").before('<i class="far fa-circle"></i>')}),$(function(){var e="#main > div.row:first-child > div:first-child";if(!($(`${e} img`).length<=0)){var o=document.querySelectorAll(`${e} img[data-src]`);const t=lozad(o);t.observe(),$(`${e} p > img[data-src],${e} img[data-src].preview-img`).each(function(){let e=$(this).next();var o="EM"===e.prop("tagName")?e.text():"",t=$(this).attr("data-src");$(this).wrap(`<a href="${t}" title="${o}" class="popup"></a>`)}),$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),$(`${e} a`).has("img").addClass("img-link")}});
|
||||
4
assets/js/dist/post.min.js
vendored
4
assets/js/dist/pvreport.min.js
vendored
@@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* Chirpy v3.0.3 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* Chirpy v4.0.0 (https://github.com/cotes2020/jekyll-theme-chirpy/)
|
||||
* © 2019 Cotes Chung
|
||||
* MIT Licensed
|
||||
*/
|
||||
const getInitStatus=function(){let e=!1;return()=>{let t=e;return e||(e=!0),t}}(),PvOpts={isEnabled:()=>"true"===$("meta[name=pv-cache-enabled]").attr("content"),getProxyEndpoint:()=>$("meta[name=pv-proxy-endpoint]").attr("content"),getLocalData:()=>$("meta[name=pv-cache-data]").attr("content")},PvCache=function(){const e="origin",t="proxy";function a(e){return localStorage.getItem(e)}function n(e,t){localStorage.setItem(e,t)}return{getData:()=>JSON.parse(localStorage.getItem("pv")),saveOriginCache(t){n("pv",t),n("pv_source",e),n("pv_created_date",(new Date).toJSON())},saveProxyCache(e){n("pv",e),n("pv_source",t),n("pv_created_date",(new Date).toJSON())},isFromOrigin:()=>a("pv_source")===e,isFromProxy:()=>a("pv_source")===t,isExpired(){if(PvCache.isFromOrigin()){let e=new Date(a("pv_created_date"));return e.setDate(e.getDate()+1),Date.now()>=e.getTime()}if(PvCache.isFromProxy()){let e=new Date(a("pv_created_date"));return e.setHours(e.getHours()+1),Date.now()>=e.getTime()}return!1},getAllPageviews:()=>PvCache.getData().totalsForAllResults["ga:pageviews"],newerThan:e=>PvCache.getAllPageviews()>e.totalsForAllResults["ga:pageviews"],inspectKeys(){null!==localStorage.getItem("pv")&&null!==localStorage.getItem("pv_source")&&null!==localStorage.getItem("pv_created_date")||localStorage.clear()}}}();function countUp(e,t,a){if(e<t){let n=new CountUp(a,e,t);n.error?console.error(n.error):n.start()}}function countPV(e,t){let a=0;if(void 0!==t)for(let n=0;n<t.length;++n){if(t[parseInt(n,10)][0]===e){a+=parseInt(t[parseInt(n,10)][1],10);break}}return a}function tacklePV(e,t,a,n){let r=countPV(t,e);if(r=0===r?1:r,n){const e=parseInt(a.text().replace(/,/g,""),10);r>e&&countUp(e,r,a.attr("id"))}else a.text((new Intl.NumberFormat).format(r))}function displayPageviews(e){if(void 0===e)return;let t=getInitStatus();const a=e.rows;if($("#post-list").length>0)$(".post-preview").each(function(){const e=$(this).find("a").attr("href");tacklePV(a,e,$(this).find(".pageviews"),t)});else if($(".post").length>0){const e=window.location.pathname;tacklePV(a,e,$("#pv"),t)}}function fetchProxyPageviews(){$.ajax({type:"GET",url:PvOpts.getProxyEndpoint(),dataType:"jsonp",jsonpCallback:"displayPageviews",success:(e,t,a)=>{PvCache.saveProxyCache(JSON.stringify(e))},error:(e,t,a)=>{console.log("Failed to load pageviews from proxy server: "+a)}})}function fetchPageviews(e=!0,t=!1){PvOpts.isEnabled()&&e?fetch(PvOpts.getLocalData()).then(e=>e.json()).then(e=>{t&&PvCache.newerThan(e)||(displayPageviews(e),PvCache.saveOriginCache(JSON.stringify(e)))}).then(()=>fetchProxyPageviews()):fetchProxyPageviews()}$(function(){if($(".pageviews").length>0){PvCache.inspectKeys();let e=PvCache.getData();e?(displayPageviews(e),PvCache.isExpired()?fetchPageviews(!0,PvCache.isFromProxy()):PvCache.isFromOrigin()&&fetchPageviews(!1)):fetchPageviews()}});
|
||||
const getInitStatus=function(){let t=!1;return()=>{var e=t;return t=t||!0,e}}(),PvOpts=function(){function t(e){return $(e).attr("content")}function e(e){e=t(e);return void 0!==e&&!1!==e}return{getProxyMeta(){return t("meta[name=pv-proxy-endpoint]")},getLocalMeta(){return t("meta[name=pv-cache-path]")},hasProxyMeta(){return e("meta[name=pv-proxy-endpoint]")},hasLocalMeta(){return e("meta[name=pv-cache-path]")}}}(),PvStorage=function(){const a={KEY_PV:"pv",KEY_PV_SRC:"pv_src",KEY_CREATION:"pv_created_date"},t={LOCAL:"same-origin",PROXY:"cors"};function r(e){return localStorage.getItem(e)}function o(e,t){localStorage.setItem(e,t)}function n(e,t){o(a.KEY_PV,e),o(a.KEY_PV_SRC,t),o(a.KEY_CREATION,(new Date).toJSON())}return{keysCount(){return Object.keys(a).length},hasCache(){return null!==localStorage.getItem(a.KEY_PV)},getCache(){return JSON.parse(localStorage.getItem(a.KEY_PV))},saveLocalCache(e){n(e,t.LOCAL)},saveProxyCache(e){n(e,t.PROXY)},isExpired(){let e=new Date(r(a.KEY_CREATION));return e.setHours(e.getHours()+1),Date.now()>=e.getTime()},isFromLocal(){return r(a.KEY_PV_SRC)===t.LOCAL},isFromProxy(){return r(a.KEY_PV_SRC)===t.PROXY},newerThan(e){return PvStorage.getCache().totalsForAllResults["ga:pageviews"]>e.totalsForAllResults["ga:pageviews"]},inspectKeys(){if(localStorage.length===PvStorage.keysCount())for(let e=0;e<localStorage.length;e++)switch(localStorage.key(e)){case a.KEY_PV:case a.KEY_PV_SRC:case a.KEY_CREATION:break;default:return void localStorage.clear()}else localStorage.clear()}}}();function countUp(t,a,r){if(t<a){let e=new CountUp(r,t,a);e.error?console.error(e.error):e.start()}}function countPV(t,a){let r=0;if(void 0!==a)for(let e=0;e<a.length;++e)if(a[parseInt(e,10)][0]===t){r+=parseInt(a[parseInt(e,10)][1],10);break}return r}function tacklePV(e,t,a,r){let o=countPV(t,e);o=0===o?1:o,r?(r=parseInt(a.text().replace(/,/g,""),10),o>r&&countUp(r,o,a.attr("id"))):a.text((new Intl.NumberFormat).format(o))}function displayPageviews(e){if(void 0!==e){let t=getInitStatus();const a=e.rows;0<$("#post-list").length?$(".post-preview").each(function(){var e=$(this).find("a").attr("href");tacklePV(a,e,$(this).find(".pageviews"),t)}):0<$(".post").length&&(e=window.location.pathname,tacklePV(a,e,$("#pv"),t))}}function fetchProxyPageviews(){PvOpts.hasProxyMeta()&&$.ajax({type:"GET",url:PvOpts.getProxyMeta(),dataType:"jsonp",jsonpCallback:"displayPageviews",success:e=>{PvStorage.saveProxyCache(JSON.stringify(e))},error:(e,t,a)=>{console.log("Failed to load pageviews from proxy server: "+a)}})}function fetchLocalPageviews(t=!1){return fetch(PvOpts.getLocalMeta()).then(e=>e.json()).then(e=>{t&&PvStorage.isFromProxy()&&PvStorage.newerThan(e)||(displayPageviews(e),PvStorage.saveLocalCache(JSON.stringify(e)))})}$(function(){$(".pageviews").length<=0||(PvStorage.inspectKeys(),PvStorage.hasCache()?(displayPageviews(PvStorage.getCache()),PvStorage.isExpired()?PvOpts.hasLocalMeta()?fetchLocalPageviews(!0).then(fetchProxyPageviews):fetchProxyPageviews():PvStorage.isFromLocal()&&fetchProxyPageviews()):PvOpts.hasLocalMeta()?fetchLocalPageviews().then(fetchProxyPageviews):fetchProxyPageviews())});
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
layout: compress
|
||||
permalink: '/app.js'
|
||||
---
|
||||
|
||||
/* Registering Service Worker */
|
||||