基础版本内容
This commit is contained in:
commit
c5435ac734
|
@ -0,0 +1,37 @@
|
|||
module.exports = {
|
||||
parserPreset: 'conventional-changelog-conventionalcommits',
|
||||
rules: {
|
||||
'body-leading-blank': [1, 'always'],
|
||||
'footer-leading-blank': [1, 'always'],
|
||||
'header-max-length': [2, 'always', 72],
|
||||
'scope-case': [2, 'always', 'lower-case'],
|
||||
'subject-case': [
|
||||
2,
|
||||
'never',
|
||||
['sentence-case', 'start-case', 'pascal-case', 'upper-case']
|
||||
],
|
||||
'subject-empty': [2, 'never'],
|
||||
'subject-full-stop': [2, 'never', '.'],
|
||||
'type-case': [2, 'always', 'lower-case'],
|
||||
'type-empty': [2, 'never'],
|
||||
'type-enum': [
|
||||
2,
|
||||
'always',
|
||||
[
|
||||
'build',
|
||||
'chore',
|
||||
'ci',
|
||||
'docs',
|
||||
'feat',
|
||||
'fix',
|
||||
'improvement',
|
||||
'perf',
|
||||
'refactor',
|
||||
'release',
|
||||
'revert',
|
||||
'style',
|
||||
'test'
|
||||
]
|
||||
]
|
||||
}
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
# http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
max_line_length = 80
|
||||
trim_trailing_whitespace = true
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"jquery": true,
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
"no-console": "error",
|
||||
"semi": ["error", "always"],
|
||||
"quotes": ["error", "single"],
|
||||
"comma-dangle": ["error", "never"],
|
||||
"block-scoped-var": "error",
|
||||
"default-case": "error",
|
||||
"no-extra-bind": "error",
|
||||
"camelcase": "error",
|
||||
"indent": ["error", 2, { "SwitchCase": 1 }],
|
||||
"eol-last": ["error", "always"]
|
||||
},
|
||||
"extends": ["eslint:recommended"]
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
|
||||
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
|
||||
|
||||
on:
|
||||
# Runs on pushes targeting the default branch
|
||||
push:
|
||||
branches: ["doc"]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
# Build job
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
- name: Build with Jekyll
|
||||
uses: actions/jekyll-build-pages@v1
|
||||
with:
|
||||
source: ./
|
||||
destination: ./_site
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
|
||||
# Deployment job
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
|
@ -0,0 +1,28 @@
|
|||
*~
|
||||
~*
|
||||
*.diff
|
||||
*.patch
|
||||
*.bak
|
||||
.DS_Store
|
||||
*.swp
|
||||
*.swo
|
||||
*.log
|
||||
*.log.*
|
||||
|
||||
/.vscode/
|
||||
build/
|
||||
|
||||
node_modules/
|
||||
.sass-cache/
|
||||
|
||||
/.bundle/
|
||||
/vendor/bundle
|
||||
*.gem
|
||||
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
Gemfile.lock
|
||||
|
||||
_site/
|
||||
.jekyll-metadata
|
||||
.jekyll-cache/
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"MD033": false,
|
||||
"MD013": false,
|
||||
"MD041": false
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
/node_modules/
|
||||
/_gh_pages/
|
||||
**/dist/
|
||||
**/*.min.css
|
||||
**/vendor/
|
|
@ -0,0 +1,276 @@
|
|||
|
||||
{
|
||||
"extends": ["stylelint-config-standard", "stylelint-config-recommended-scss"],
|
||||
"plugins": [
|
||||
"stylelint-order"
|
||||
],
|
||||
"rules": {
|
||||
"at-rule-empty-line-before": null,
|
||||
"at-rule-name-space-after": "always",
|
||||
"at-rule-no-vendor-prefix": true,
|
||||
"at-rule-semicolon-space-before": "never",
|
||||
"block-closing-brace-empty-line-before": null,
|
||||
"block-closing-brace-newline-after": null,
|
||||
"block-opening-brace-space-before": null,
|
||||
"color-named": "never",
|
||||
"color-hex-case": "lower",
|
||||
"color-hex-length": "short",
|
||||
"declaration-block-semicolon-newline-after": "always-multi-line",
|
||||
"declaration-block-semicolon-newline-before": "never-multi-line",
|
||||
"declaration-block-semicolon-space-after": "always-single-line",
|
||||
"declaration-empty-line-before": null,
|
||||
"declaration-no-important": true,
|
||||
"font-family-name-quotes": "always-where-recommended",
|
||||
"font-weight-notation": null,
|
||||
"function-url-no-scheme-relative": true,
|
||||
"function-url-quotes": "always",
|
||||
"length-zero-no-unit": true,
|
||||
"max-empty-lines": 2,
|
||||
"max-line-length": null,
|
||||
"media-feature-name-no-vendor-prefix": true,
|
||||
"media-feature-parentheses-space-inside": "never",
|
||||
"media-feature-range-operator-space-after": "always",
|
||||
"media-feature-range-operator-space-before": "never",
|
||||
"no-descending-specificity": null,
|
||||
"no-duplicate-selectors": true,
|
||||
"number-leading-zero": "never",
|
||||
"media-feature-name-no-unknown": [true, {
|
||||
"ignoreMediaFeatureNames": ["prefers-reduced-motion"]
|
||||
}],
|
||||
"order/properties-order": [
|
||||
"position",
|
||||
"top",
|
||||
"right",
|
||||
"bottom",
|
||||
"left",
|
||||
"z-index",
|
||||
"box-sizing",
|
||||
"display",
|
||||
"flex",
|
||||
"flex-align",
|
||||
"flex-basis",
|
||||
"flex-direction",
|
||||
"flex-wrap",
|
||||
"flex-flow",
|
||||
"flex-shrink",
|
||||
"flex-grow",
|
||||
"flex-order",
|
||||
"flex-pack",
|
||||
"align-content",
|
||||
"align-items",
|
||||
"align-self",
|
||||
"justify-content",
|
||||
"order",
|
||||
"float",
|
||||
"width",
|
||||
"min-width",
|
||||
"max-width",
|
||||
"height",
|
||||
"min-height",
|
||||
"max-height",
|
||||
"padding",
|
||||
"padding-top",
|
||||
"padding-right",
|
||||
"padding-bottom",
|
||||
"padding-left",
|
||||
"margin",
|
||||
"margin-top",
|
||||
"margin-right",
|
||||
"margin-bottom",
|
||||
"margin-left",
|
||||
"overflow",
|
||||
"overflow-x",
|
||||
"overflow-y",
|
||||
"-webkit-overflow-scrolling",
|
||||
"-ms-overflow-x",
|
||||
"-ms-overflow-y",
|
||||
"-ms-overflow-style",
|
||||
"columns",
|
||||
"column-count",
|
||||
"column-fill",
|
||||
"column-gap",
|
||||
"column-rule",
|
||||
"column-rule-width",
|
||||
"column-rule-style",
|
||||
"column-rule-color",
|
||||
"column-span",
|
||||
"column-width",
|
||||
"orphans",
|
||||
"widows",
|
||||
"clip",
|
||||
"clear",
|
||||
"font",
|
||||
"font-family",
|
||||
"font-size",
|
||||
"font-style",
|
||||
"font-weight",
|
||||
"font-variant",
|
||||
"font-size-adjust",
|
||||
"font-stretch",
|
||||
"font-effect",
|
||||
"font-emphasize",
|
||||
"font-emphasize-position",
|
||||
"font-emphasize-style",
|
||||
"font-smooth",
|
||||
"src",
|
||||
"hyphens",
|
||||
"line-height",
|
||||
"color",
|
||||
"text-align",
|
||||
"text-align-last",
|
||||
"text-emphasis",
|
||||
"text-emphasis-color",
|
||||
"text-emphasis-style",
|
||||
"text-emphasis-position",
|
||||
"text-decoration",
|
||||
"text-indent",
|
||||
"text-justify",
|
||||
"text-outline",
|
||||
"-ms-text-overflow",
|
||||
"text-overflow",
|
||||
"text-overflow-ellipsis",
|
||||
"text-overflow-mode",
|
||||
"text-shadow",
|
||||
"text-transform",
|
||||
"text-wrap",
|
||||
"-webkit-text-size-adjust",
|
||||
"-ms-text-size-adjust",
|
||||
"letter-spacing",
|
||||
"-ms-word-break",
|
||||
"word-break",
|
||||
"word-spacing",
|
||||
"-ms-word-wrap",
|
||||
"word-wrap",
|
||||
"overflow-wrap",
|
||||
"tab-size",
|
||||
"white-space",
|
||||
"vertical-align",
|
||||
"direction",
|
||||
"unicode-bidi",
|
||||
"list-style",
|
||||
"list-style-position",
|
||||
"list-style-type",
|
||||
"list-style-image",
|
||||
"pointer-events",
|
||||
"-ms-touch-action",
|
||||
"touch-action",
|
||||
"cursor",
|
||||
"visibility",
|
||||
"zoom",
|
||||
"table-layout",
|
||||
"empty-cells",
|
||||
"caption-side",
|
||||
"border-spacing",
|
||||
"border-collapse",
|
||||
"content",
|
||||
"quotes",
|
||||
"counter-reset",
|
||||
"counter-increment",
|
||||
"resize",
|
||||
"user-select",
|
||||
"nav-index",
|
||||
"nav-up",
|
||||
"nav-right",
|
||||
"nav-down",
|
||||
"nav-left",
|
||||
"background",
|
||||
"background-color",
|
||||
"background-image",
|
||||
"filter",
|
||||
"background-repeat",
|
||||
"background-attachment",
|
||||
"background-position",
|
||||
"background-position-x",
|
||||
"background-position-y",
|
||||
"background-clip",
|
||||
"background-origin",
|
||||
"background-size",
|
||||
"border",
|
||||
"border-color",
|
||||
"border-style",
|
||||
"border-width",
|
||||
"border-top",
|
||||
"border-top-color",
|
||||
"border-top-style",
|
||||
"border-top-width",
|
||||
"border-right",
|
||||
"border-right-color",
|
||||
"border-right-style",
|
||||
"border-right-width",
|
||||
"border-bottom",
|
||||
"border-bottom-color",
|
||||
"border-bottom-style",
|
||||
"border-bottom-width",
|
||||
"border-left",
|
||||
"border-left-color",
|
||||
"border-left-style",
|
||||
"border-left-width",
|
||||
"border-radius",
|
||||
"border-top-left-radius",
|
||||
"border-top-right-radius",
|
||||
"border-bottom-right-radius",
|
||||
"border-bottom-left-radius",
|
||||
"border-image",
|
||||
"border-image-source",
|
||||
"border-image-slice",
|
||||
"border-image-width",
|
||||
"border-image-outset",
|
||||
"border-image-repeat",
|
||||
"outline",
|
||||
"outline-width",
|
||||
"outline-style",
|
||||
"outline-color",
|
||||
"outline-offset",
|
||||
"box-shadow",
|
||||
"opacity",
|
||||
"-ms-interpolation-mode",
|
||||
"page-break-after",
|
||||
"page-break-before",
|
||||
"page-break-inside",
|
||||
"transition",
|
||||
"transition-delay",
|
||||
"transition-timing-function",
|
||||
"transition-duration",
|
||||
"transition-property",
|
||||
"transform",
|
||||
"transform-origin",
|
||||
"perspective",
|
||||
"appearance",
|
||||
"animation",
|
||||
"animation-name",
|
||||
"animation-duration",
|
||||
"animation-play-state",
|
||||
"animation-timing-function",
|
||||
"animation-delay",
|
||||
"animation-iteration-count",
|
||||
"animation-direction",
|
||||
"animation-fill-mode",
|
||||
"fill",
|
||||
"stroke"
|
||||
],
|
||||
"property-no-vendor-prefix": true,
|
||||
"rule-empty-line-before": null,
|
||||
"selector-attribute-quotes": "always",
|
||||
"selector-list-comma-newline-after": "always-multi-line",
|
||||
"selector-list-comma-newline-before": "never-multi-line",
|
||||
"selector-list-comma-space-after": "always-single-line",
|
||||
"selector-list-comma-space-before": "never-single-line",
|
||||
"selector-max-attribute": 2,
|
||||
"selector-max-class": 4,
|
||||
"selector-max-combinators": 4,
|
||||
"selector-max-compound-selectors": 4,
|
||||
"selector-max-empty-lines": 1,
|
||||
"selector-max-id": 0,
|
||||
"selector-max-specificity": null,
|
||||
"selector-max-type": 2,
|
||||
"selector-max-universal": 1,
|
||||
"selector-no-qualifying-type": null,
|
||||
"selector-no-vendor-prefix": true,
|
||||
"string-quotes": "double",
|
||||
"value-keyword-case": "lower",
|
||||
"value-list-comma-newline-after": "never-multi-line",
|
||||
"value-list-comma-newline-before": "never-multi-line",
|
||||
"value-list-comma-space-after": "always",
|
||||
"value-no-vendor-prefix": true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
language: ruby
|
||||
rvm:
|
||||
- 2.4.1
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
before_script: cp -rfv docs/_includes .
|
||||
script: JEKYLL_ENV=production bundle exec jekyll build --config ./docs/_config.yml
|
||||
deploy:
|
||||
provider: pages
|
||||
skip_cleanup: true
|
||||
github_token: $GITHUB_TOKEN
|
||||
local_dir: _site
|
||||
keep-history: true
|
||||
on:
|
||||
branch: master
|
||||
target_branch: gh-pages
|
|
@ -0,0 +1,18 @@
|
|||
FROM ruby:2.7
|
||||
|
||||
# Set default locale for the environment
|
||||
ENV LC_ALL C.UTF-8
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US.UTF-8
|
||||
|
||||
# throw errors if Gemfile has been modified since Gemfile.lock
|
||||
RUN bundle config --global frozen 1
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY Gemfile Gemfile.lock jekyll-text-theme.gemspec ./
|
||||
RUN bundle install
|
||||
|
||||
EXPOSE 4000
|
||||
|
||||
CMD ["bundle", "exec", "jekyll", "help"]
|
|
@ -0,0 +1,4 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
# gem "github-pages", group: :jekyll_plugins
|
||||
gemspec
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017 Tian Qi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,9 @@
|
|||
## 说明
|
||||
|
||||
该分支存放`WingHexExplorer2`对应的网站资源,用于宣传、发布开发日志和引导、提供帮助文档。
|
||||
|
||||
如果你有意愿来撰写文档或者本土化翻译,欢迎参与!!!
|
||||
|
||||
If you are willing to write documents or localize translations, welcome to participate!!!
|
||||
|
||||
TODO:软件使用效果图、文档以及原开发日志的迁移。
|
|
@ -0,0 +1,236 @@
|
|||
# Welcome to Jekyll!
|
||||
#
|
||||
# This config file is meant for settings that affect your whole blog, values
|
||||
# which you are expected to set up once and rarely need to edit after that.
|
||||
# For technical reasons, this file is *NOT* reloaded automatically when you use
|
||||
# 'jekyll serve'. If you change this file, please restart the server process.
|
||||
#
|
||||
# ,--------. ,--. ,--. ,--.
|
||||
# '--. .--',---. \ `.' /,-' '-.
|
||||
# | | | .-. : .' \ '-. .-'
|
||||
# | | \ --. / .'. \ | |
|
||||
# `--' `----''--' '--' `--'
|
||||
|
||||
|
||||
|
||||
|
||||
## => Site Settings
|
||||
##############################
|
||||
text_skin: dark # "default" (default), "dark", "forest", "ocean", "chocolate", "orange"
|
||||
highlight_theme: tomorrow-night-eighties # "default" (default), "tomorrow", "tomorrow-night", "tomorrow-night-eighties", "tomorrow-night-blue", "tomorrow-night-bright"
|
||||
url : # the base hostname & protocol for your site e.g. https://www.someone.com
|
||||
baseurl : # does not include hostname
|
||||
title : WingHexExplorer2
|
||||
description: > # this means to ignore newlines until "Language & timezone"
|
||||
一个自由强大跨平台的十六进制编辑器
|
||||
|
||||
|
||||
## => Language and Timezone
|
||||
##############################
|
||||
lang: zh-Hans # the language of your site, default as "en"
|
||||
timezone: # see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for the available values
|
||||
|
||||
|
||||
## => Author and Social
|
||||
##############################
|
||||
author:
|
||||
type : # "person" (default), "organization"
|
||||
name : 寂静的羽夏
|
||||
url : https://www.cnblogs.com/wingsummer
|
||||
avatar : # path or url of avatar image (square)
|
||||
bio : 一个热爱计算机技术的菜鸟
|
||||
email :
|
||||
facebook : # "user_name" the last part of your profile url, e.g. https://www.facebook.com/user_name
|
||||
twitter : # "user_name" the last part of your profile url, e.g. https://twitter.com/user_name
|
||||
weibo : # "user_id" the last part of your profile url, e.g. https://www.weibo.com/user_id/profile?...
|
||||
googleplus: # "user_id" the last part of your profile url, e.g. https://plus.google.com/u/0/user_id
|
||||
telegram : # "user_name" the last part of your profile url, e.g. https://t.me/user_name
|
||||
medium : # "user_name" the last part of your profile url, e.g. https://medium.com/user_name
|
||||
zhihu : # "user_name" the last part of your profile url, e.g. https://www.zhihu.com/people/user_name
|
||||
douban : # "user_name" the last part of your profile url, e.g. https://www.douban.com/people/user_name
|
||||
linkedin : # "user_name" the last part of your profile url, e.g. https://www.linkedin.com/in/user_name
|
||||
github : Wing-summer
|
||||
npm : # "user_name" the last part of your profile url, e.g. https://www.npmjs.com/~user_name
|
||||
|
||||
|
||||
## => GitHub Repository (if the site is hosted by GitHub)
|
||||
##############################
|
||||
repository: wingsummer/WingHexExplorer2
|
||||
repository_tree: main
|
||||
|
||||
|
||||
## => Paths
|
||||
##############################
|
||||
paths:
|
||||
root : # title link url, "/" (default)
|
||||
home : # home layout url, "/" (default)
|
||||
archive : # "/archive.html" (default)
|
||||
rss : # "/feed.xml" (default)
|
||||
|
||||
|
||||
## => Post
|
||||
##############################
|
||||
## excerpt
|
||||
excerpt_separator: <!--more-->
|
||||
|
||||
## license
|
||||
license: BY-NC-SA-4.0 # "CC-BY-4.0", "CC-BY-SA-4.0", "CC-BY-NC-4.0", "CC-BY-ND-4.0", "BY-NC-SA-4.0"
|
||||
|
||||
## TOC
|
||||
toc:
|
||||
selectors: # "h1,h2,h3" (default)
|
||||
|
||||
## => Markdown Enhancements
|
||||
##############################
|
||||
## Mathjax
|
||||
mathjax: # false (default), true
|
||||
mathjax_autoNumber: # false (default), true
|
||||
|
||||
## Mermaid
|
||||
mermaid: true # false (default), true
|
||||
|
||||
## Chart
|
||||
chart: # false (default), true
|
||||
|
||||
|
||||
## => Paginate
|
||||
##############################
|
||||
paginate: 8
|
||||
paginate_path: /page:num # don't change this unless for special need
|
||||
|
||||
|
||||
## => Sources
|
||||
##############################
|
||||
sources: # bootcdn (default), unpkg
|
||||
|
||||
|
||||
## => Sharing
|
||||
##############################
|
||||
sharing:
|
||||
provider: false # false (default), "addtoany", "addthis", "custom"
|
||||
|
||||
## AddThis
|
||||
addthis:
|
||||
id: # AddThis pubid, e.g. ra-5xxxxxxxxxxx
|
||||
|
||||
|
||||
## => Comments
|
||||
##############################
|
||||
comments:
|
||||
provider: false # false (default), "disqus", "gitalk", "valine", "custom"
|
||||
|
||||
## Disqus
|
||||
disqus:
|
||||
shortname: # the Disqus shortname for the site
|
||||
|
||||
## Gitalk
|
||||
# please refer to https://github.com/gitalk/gitalk for more info.
|
||||
gitalk:
|
||||
clientID : # GitHub Application Client ID
|
||||
clientSecret: # GitHub Application Client Secret
|
||||
repository : # GitHub repo
|
||||
owner : # GitHub repo owner
|
||||
admin: # GitHub repo owner and collaborators, only these guys can initialize GitHub issues, IT IS A LIST.
|
||||
# - your GitHub Id
|
||||
|
||||
## Valine
|
||||
# please refer to https://valine.js.org/en/ for more info.
|
||||
valine:
|
||||
app_id : # LeanCloud App id
|
||||
app_key : # LeanCloud App key
|
||||
placeholder : # Prompt information
|
||||
visitor : # false (default)
|
||||
meta : # "[nick, mail, link]" (default) nickname, E-mail, Personal-site
|
||||
|
||||
|
||||
## => Pageview
|
||||
##############################
|
||||
pageview:
|
||||
provider: false # false (default), "leancloud", "custom"
|
||||
|
||||
## Leancloud
|
||||
leancloud:
|
||||
app_id : # LeanCloud App id
|
||||
app_key : # LeanCloud App key
|
||||
app_class : # LeanCloud App class
|
||||
|
||||
|
||||
## => Search
|
||||
##############################
|
||||
search:
|
||||
provider: default # "default" (default), false, "google", "custom"
|
||||
|
||||
## Google Custom Search Engine
|
||||
google:
|
||||
custom_search_engine_id: # Google Custom Search Engine ID
|
||||
|
||||
|
||||
## => Analytics
|
||||
##############################
|
||||
analytics:
|
||||
provider: false # false (default), "google", "custom"
|
||||
|
||||
## Google Analytics
|
||||
google:
|
||||
tracking_id : # Google Analytics id for the site
|
||||
anonymize_ip: false # Anonymize IP tracking for Analytics
|
||||
|
||||
|
||||
## => Build
|
||||
##############################
|
||||
markdown : kramdown
|
||||
highlighter : rouge
|
||||
permalink : date
|
||||
|
||||
exclude:
|
||||
- Gemfile
|
||||
- Gemfile.lock
|
||||
- LICENSE
|
||||
- README-*.md
|
||||
- README.md
|
||||
- gulpfile.js
|
||||
- jekyll-text-theme.gemspec
|
||||
- package-lock.json
|
||||
- package.json
|
||||
- /node_modules
|
||||
- /screenshots
|
||||
- /vendor
|
||||
- .markdownlint.json
|
||||
|
||||
defaults:
|
||||
- scope:
|
||||
path: ""
|
||||
type: posts
|
||||
values:
|
||||
layout: article
|
||||
sharing: true
|
||||
license: true
|
||||
aside:
|
||||
toc: true
|
||||
show_edit_on_github: true
|
||||
show_subscribe: true
|
||||
pageview: true
|
||||
- scope:
|
||||
path: "docs/zh"
|
||||
values:
|
||||
layout: article
|
||||
sidebar:
|
||||
nav: docs-zh
|
||||
license: true
|
||||
aside:
|
||||
toc: true
|
||||
lang: zh
|
||||
title: "文档"
|
||||
show_edit_on_github: false
|
||||
show_title: false
|
||||
show_date: false
|
||||
|
||||
|
||||
|
||||
## => Plugins
|
||||
##############################
|
||||
plugins:
|
||||
- jekyll-feed
|
||||
- jekyll-paginate
|
||||
- jekyll-sitemap
|
||||
- jemoji
|
|
@ -0,0 +1,20 @@
|
|||
CC-BY-4.0:
|
||||
name: Attribution 4.0 International
|
||||
url: https://creativecommons.org/licenses/by/4.0/
|
||||
image: https://i.creativecommons.org/l/by/4.0/88x31.png
|
||||
CC-BY-SA-4.0:
|
||||
name: Attribution-ShareAlike 4.0 International
|
||||
url: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
image: https://i.creativecommons.org/l/by-sa/4.0/88x31.png
|
||||
CC-BY-NC-4.0:
|
||||
name: Attribution-NonCommercial 4.0 International
|
||||
url: https://creativecommons.org/licenses/by-nc/4.0/
|
||||
image: https://i.creativecommons.org/l/by-nc/4.0/88x31.png
|
||||
CC-BY-ND-4.0:
|
||||
name: Attribution-NoDerivatives 4.0 International
|
||||
url: https://creativecommons.org/licenses/by-nd/4.0/
|
||||
image: https://i.creativecommons.org/l/by-nd/4.0/88x31.png
|
||||
BY-NC-SA-4.0:
|
||||
name: Attribution-NonCommercial-ShareAlike 4.0 International
|
||||
url: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
image: https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png
|
|
@ -0,0 +1,175 @@
|
|||
# @start locale config
|
||||
## => English
|
||||
########################
|
||||
en: &EN
|
||||
SUBSCRIBE : "Subscribe"
|
||||
READMORE : "Read more"
|
||||
SEARCH : "Search"
|
||||
CANCEL : "Cancel"
|
||||
VIEWS : "views"
|
||||
LAST_UPDATED : "Last updated"
|
||||
PREVIOUS : "PREVIOUS"
|
||||
NEXT : "NEXT"
|
||||
ARTICLE_DATE_FORMAT : "%b %d, %Y"
|
||||
ARTICLE_LIST_DATE_FORMAT: "%b %d"
|
||||
STATISTICS : "[POST_COUNT] post articles, [PAGE_COUNT] pages."
|
||||
LICENSE_ANNOUNCE : "This work is licensed under a [LICENSE] license."
|
||||
POST_ON_GITHUB : "Edit on Github"
|
||||
FOLLOW_ME : "Follow me on [NAME]."
|
||||
FOLLOW_US : "Follow us on [NAME]."
|
||||
EMAIL_ME : "Send me an Email."
|
||||
EMAIL_US : "Send us an Email."
|
||||
COPYRIGHT_DATES : "2021"
|
||||
DOCUMENT : "Docs"
|
||||
|
||||
en-GB:
|
||||
<<: *EN
|
||||
en-US:
|
||||
<<: *EN
|
||||
en-CA:
|
||||
<<: *EN
|
||||
en-AU:
|
||||
<<: *EN
|
||||
|
||||
## => Simplified Chinese
|
||||
########################
|
||||
zh-Hans: &ZH_HANS
|
||||
SUBSCRIBE : "订阅"
|
||||
READMORE : "阅读更多"
|
||||
SEARCH : "搜索"
|
||||
CANCEL : "取消"
|
||||
VIEWS : "阅读"
|
||||
LAST_UPDATED : "更新于"
|
||||
PREVIOUS : "上篇"
|
||||
NEXT : "下篇"
|
||||
ARTICLE_DATE_FORMAT : "%Y年 %m月%d日"
|
||||
ARTICLE_LIST_DATE_FORMAT: "%m月%d日"
|
||||
STATISTICS : "共计 [POST_COUNT] 篇文章,[PAGE_COUNT] 页。"
|
||||
LICENSE_ANNOUNCE : "本文遵守 [LICENSE] 许可协议。"
|
||||
POST_ON_GITHUB : "在 Github 上修改"
|
||||
FOLLOW_ME : "在 [NAME] 上关注我。"
|
||||
FOLLOW_US : "在 [NAME] 上关注我们。"
|
||||
EMAIL_ME : "给我发邮件。"
|
||||
EMAIL_US : "给我们发邮件。"
|
||||
COPYRIGHT_DATES : "2021"
|
||||
DOCUMENT : "文档"
|
||||
|
||||
zh:
|
||||
<<: *ZH_HANS
|
||||
zh-CN:
|
||||
<<: *ZH_HANS
|
||||
zh-SG:
|
||||
<<: *ZH_HANS
|
||||
|
||||
## => Traditional Chinese
|
||||
########################
|
||||
zh-Hant: &ZH_HANT
|
||||
SUBSCRIBE : "訂閱"
|
||||
READMORE : "閱讀更多"
|
||||
SEARCH : "搜索"
|
||||
CANCEL : "取消"
|
||||
VIEWS : "閱讀"
|
||||
LAST_UPDATED : "更新於"
|
||||
PREVIOUS : "上篇"
|
||||
NEXT : "下篇"
|
||||
ARTICLE_DATE_FORMAT : "%Y年 %m月%d日"
|
||||
ARTICLE_LIST_DATE_FORMAT: "%m月%d日"
|
||||
STATISTICS : "共計 [POST_COUNT] 篇文章,[PAGE_COUNT] 頁。"
|
||||
LICENSE_ANNOUNCE : "本文遵守 [LICENSE] 許可協議。"
|
||||
POST_ON_GITHUB : "在 Github 上修改"
|
||||
FOLLOW_ME : "在 [NAME] 上關注我。"
|
||||
FOLLOW_US : "在 [NAME] 上關注我們。"
|
||||
EMAIL_ME : "給我發郵件。"
|
||||
EMAIL_US : "給我們發郵件。"
|
||||
COPYRIGHT_DATES : "2021"
|
||||
DOCUMENT : "文檔"
|
||||
|
||||
zh-TW:
|
||||
<<: *ZH_HANT
|
||||
zh-HK:
|
||||
<<: *ZH_HANT
|
||||
|
||||
## => Korean
|
||||
########################
|
||||
ko: &KO
|
||||
SUBSCRIBE : "구독하기"
|
||||
READMORE : "더보기"
|
||||
SEARCH : "검색"
|
||||
CANCEL : "취소"
|
||||
VIEWS : "조회"
|
||||
LAST_UPDATED : "마지막 수정"
|
||||
PREVIOUS : "이전"
|
||||
NEXT : "다음"
|
||||
ARTICLE_DATE_FORMAT : "%Y년 %m월 %d일"
|
||||
ARTICLE_LIST_DATE_FORMAT: "%m월 %d일"
|
||||
STATISTICS : "전체 글 [POST_COUNT]개, [PAGE_COUNT] 페이지"
|
||||
LICENSE_ANNOUNCE : "이 글의 저작권은 [LICENSE] 라이센스를 따릅니다."
|
||||
POST_ON_GITHUB : "Github에서 확인하기"
|
||||
FOLLOW_ME : "[NAME]에서 팔로우하기"
|
||||
FOLLOW_US : "[NAME]에서 팔로우하기"
|
||||
EMAIL_ME : "이메일 보내기"
|
||||
EMAIL_US : "이메일 보내기"
|
||||
COPYRIGHT_DATES : "2021"
|
||||
DOCUMENT : "문서"
|
||||
|
||||
ko-KR:
|
||||
<<: *KO
|
||||
|
||||
## => French
|
||||
########################
|
||||
fr: &FR
|
||||
SUBSCRIBE : "S'abonner"
|
||||
READMORE : "Plus"
|
||||
SEARCH : "Recherche"
|
||||
CANCEL : "Annuler"
|
||||
VIEWS : "vues"
|
||||
LAST_UPDATED : "Dernière modification"
|
||||
PREVIOUS : "PRÉCÉDENT"
|
||||
NEXT : "SUIVANT"
|
||||
ARTICLE_DATE_FORMAT : "%d %b, %Y"
|
||||
ARTICLE_LIST_DATE_FORMAT: "%d %b"
|
||||
STATISTICS : "[POST_COUNT] articles, [PAGE_COUNT] pages."
|
||||
LICENSE_ANNOUNCE : "Ce travail est sous licence [LICENSE]."
|
||||
POST_ON_GITHUB : "Modifier sur Github"
|
||||
FOLLOW_ME : "Suivez-moi sur [NAME]."
|
||||
FOLLOW_US : "Suivez-nous sur [NAME]."
|
||||
EMAIL_ME : "Envoyez-moi un courriel."
|
||||
EMAIL_US : "Envoyez-nous un courriel"
|
||||
COPYRIGHT_DATES : "2021"
|
||||
DONATE : "Faites un don de [NAME]."
|
||||
DOCUMENT : "Docs"
|
||||
|
||||
fr-BE:
|
||||
<<: *FR
|
||||
fr-CA:
|
||||
<<: *FR
|
||||
fr-CH:
|
||||
<<: *FR
|
||||
fr-FR:
|
||||
<<: *FR
|
||||
fr-LU:
|
||||
<<: *FR
|
||||
## => Turkish
|
||||
########################
|
||||
tr: &TR
|
||||
SUBSCRIBE : "Takip et"
|
||||
READMORE : "Devamını Oku"
|
||||
SEARCH : "İçerik Ara"
|
||||
CANCEL : "İptal"
|
||||
VIEWS : "gösterim"
|
||||
LAST_UPDATED : "Son güncellenme"
|
||||
PREVIOUS : "ÖNCEKİ"
|
||||
NEXT : "SONRAKİ"
|
||||
ARTICLE_DATE_FORMAT : "%d %b, %Y"
|
||||
ARTICLE_LIST_DATE_FORMAT: "%d %b"
|
||||
STATISTICS : "Toplam [POST_COUNT] adet gönderim ve [PAGE_COUNT] adet sayfa bulunuyor."
|
||||
LICENSE_ANNOUNCE : "Bu içerik [LICENSE] ile lisanslanmıştır."
|
||||
POST_ON_GITHUB : "Github üzerinde düzenle"
|
||||
FOLLOW_ME : "Beni [NAME] üzerinden takip et."
|
||||
FOLLOW_US : "Bizi [NAME] üzerinden takip edin."
|
||||
EMAIL_ME : "Bana email ile ulaşın."
|
||||
EMAIL_US : "Bize email ile ulaşın."
|
||||
COPYRIGHT_DATES : "2021"
|
||||
DOCUMENT : "Belgeler"
|
||||
|
||||
# @end locale config
|
|
@ -0,0 +1,100 @@
|
|||
header:
|
||||
- title: GitHub
|
||||
url: https://github.com/Wing-summer/WingHexExplorer2
|
||||
|
||||
- titles:
|
||||
# @start locale config
|
||||
en : &EN Docs
|
||||
en-GB : *EN
|
||||
en-US : *EN
|
||||
en-CA : *EN
|
||||
en-AU : *EN
|
||||
zh-Hans : &ZH_HANS 文档
|
||||
zh : *ZH_HANS
|
||||
zh-CN : *ZH_HANS
|
||||
zh-SG : *ZH_HANS
|
||||
zh-Hant : &ZH_HANT 文檔
|
||||
zh-TW : *ZH_HANT
|
||||
zh-HK : *ZH_HANT
|
||||
ko : &KO 문서
|
||||
ko-KR : *KO
|
||||
fr : &FR Docs
|
||||
fr-BE : *FR
|
||||
fr-CA : *FR
|
||||
fr-CH : *FR
|
||||
fr-FR : *FR
|
||||
fr-LU : *FR
|
||||
tr : &TR Belgeler
|
||||
# @end locale config
|
||||
url: /docs/DocsIndex.html
|
||||
|
||||
- titles:
|
||||
# @start locale config
|
||||
en : &EN Archive
|
||||
en-GB : *EN
|
||||
en-US : *EN
|
||||
en-CA : *EN
|
||||
en-AU : *EN
|
||||
zh-Hans : &ZH_HANS 归档
|
||||
zh : *ZH_HANS
|
||||
zh-CN : *ZH_HANS
|
||||
zh-SG : *ZH_HANS
|
||||
zh-Hant : &ZH_HANT 歸檔
|
||||
zh-TW : *ZH_HANT
|
||||
zh-HK : *ZH_HANT
|
||||
ko : &KO 아카이브
|
||||
ko-KR : *KO
|
||||
fr : &FR Archives
|
||||
fr-BE : *FR
|
||||
fr-CA : *FR
|
||||
fr-CH : *FR
|
||||
fr-FR : *FR
|
||||
fr-LU : *FR
|
||||
tr : &TR Arşivdekiler
|
||||
# @end locale config
|
||||
url: /archive.html
|
||||
|
||||
- titles:
|
||||
# @start locale config
|
||||
en : &EN About
|
||||
en-GB : *EN
|
||||
en-US : *EN
|
||||
en-CA : *EN
|
||||
en-AU : *EN
|
||||
zh-Hans : &ZH_HANS 关于
|
||||
zh : *ZH_HANS
|
||||
zh-CN : *ZH_HANS
|
||||
zh-SG : *ZH_HANS
|
||||
zh-Hant : &ZH_HANT 關於
|
||||
zh-TW : *ZH_HANT
|
||||
zh-HK : *ZH_HANT
|
||||
ko : &KO 소개
|
||||
ko-KR : *KO
|
||||
fr : &FR À propos
|
||||
fr-BE : *FR
|
||||
fr-CA : *FR
|
||||
fr-CH : *FR
|
||||
fr-FR : *FR
|
||||
fr-LU : *FR
|
||||
tr : &TR Hakkında
|
||||
# @end locale config
|
||||
url: /about.html
|
||||
|
||||
|
||||
|
||||
docs-zh:
|
||||
- title: 鸣谢
|
||||
children:
|
||||
- title: 鸣谢与说明
|
||||
key: docs-credits
|
||||
url: /docs/zh/credits.html
|
||||
- title: 入门
|
||||
children:
|
||||
- title: 简介
|
||||
key: docs-introduction
|
||||
url: /docs/zh/introduction.html
|
||||
- title: 基础
|
||||
key: docs-basis
|
||||
url: /docs/zh/basis.html
|
||||
- title: 插件开发
|
||||
- title: 其他语言
|
|
@ -0,0 +1,64 @@
|
|||
default:
|
||||
text_skin: default
|
||||
highlight_theme: default
|
||||
lang: en
|
||||
paths:
|
||||
root: /
|
||||
home: /
|
||||
archive: /archive.html
|
||||
rss: /feed.xml
|
||||
mathjax: false
|
||||
mathjax_autoNumber: false
|
||||
mermaid: false
|
||||
chart: false
|
||||
toc:
|
||||
selectors: 'h1,h2,h3'
|
||||
sources: bootcdn
|
||||
|
||||
page:
|
||||
mode: normal
|
||||
type: webpage
|
||||
article_header:
|
||||
align: left
|
||||
theme: light
|
||||
articles:
|
||||
show_cover: true
|
||||
show_excerpt: false
|
||||
show_readmore: false
|
||||
show_info: false
|
||||
show_title: true
|
||||
show_edit_on_github: false
|
||||
show_date: true
|
||||
show_tags: true
|
||||
show_author_profile: false
|
||||
show_subscribe: false
|
||||
full_width: false
|
||||
sharing: false
|
||||
comment: true
|
||||
license: false
|
||||
pageview: false
|
||||
search: default
|
||||
|
||||
sources:
|
||||
bootcdn:
|
||||
font_awesome: 'https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.1/css/all.css'
|
||||
jquery: 'https://cdn.bootcss.com/jquery/3.1.1/jquery.min.js'
|
||||
leancloud_js_sdk: '//cdn.jsdelivr.net/npm/leancloud-storage@3.13.2/dist/av-min.js'
|
||||
chart: 'https://cdn.bootcss.com/Chart.js/2.7.2/Chart.bundle.min.js'
|
||||
gitalk:
|
||||
js: 'https://cdn.bootcss.com/gitalk/1.2.2/gitalk.min.js'
|
||||
css: 'https://cdn.bootcss.com/gitalk/1.2.2/gitalk.min.css'
|
||||
valine: 'https://unpkg.com/valine/dist/Valine.min.js' # bootcdn not available
|
||||
mathjax: 'https://cdn.bootcss.com/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML'
|
||||
mermaid: 'https://cdn.bootcss.com/mermaid/8.0.0-rc.8/mermaid.min.js'
|
||||
unpkg:
|
||||
font_awesome: 'https://use.fontawesome.com/releases/v5.15.1/css/all.css'
|
||||
jquery: 'https://unpkg.com/jquery@3.3.1/dist/jquery.min.js'
|
||||
leancloud_js_sdk: '//cdn.jsdelivr.net/npm/leancloud-storage@3.13.2/dist/av-min.js'
|
||||
chart: 'https://unpkg.com/chart.js@2.7.2/dist/Chart.min.js'
|
||||
gitalk:
|
||||
js: 'https://unpkg.com/gitalk@1.2.2/dist/gitalk.min.js'
|
||||
css: 'https://unpkg.com/gitalk@1.2.2/dist/gitalk.css'
|
||||
valine: 'https//unpkg.com/valine/dist/Valine.min.js'
|
||||
mathjax: 'https://unpkg.com/mathjax@2.7.4/unpacked/MathJax.js?config=TeX-MML-AM_CHTML'
|
||||
mermaid: 'https://unpkg.com/mermaid@8.0.0-rc.8/dist/mermaid.min.js'
|
|
@ -0,0 +1,3 @@
|
|||
<!-- start custom analytics snippet -->
|
||||
|
||||
<!-- end custom analytics snippet -->
|
|
@ -0,0 +1,14 @@
|
|||
{%- if site.analytics.google.tracking_id -%}
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google.tracking_id }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '{{ site.analytics.google.tracking_id }}');
|
||||
{% if site.analytics.google.anonymize_ip == true %}
|
||||
gtag('config', '{{ site.analytics.google.tracking_id }}', { 'anonymize_ip': true });
|
||||
{% endif %}
|
||||
</script>
|
||||
{%- endif -%}
|
|
@ -0,0 +1,7 @@
|
|||
{%- if jekyll.environment != 'development' -%}
|
||||
{%- if site.analytics.provider == 'google' -%}
|
||||
{%- include analytics-providers/google.html -%}
|
||||
{%- elsif site.analytics.provider == 'custom' -%}
|
||||
{%- include analytics-providers/custom.html -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
|
@ -0,0 +1,55 @@
|
|||
{%- include snippets/assign.html
|
||||
target=site.data.variables.default.page.show_author_profile
|
||||
source0=layout.show_author_profile source1=page.show_author_profile -%}
|
||||
{%- assign _show_author_profile = __return -%}
|
||||
|
||||
{%- include snippets/assign.html
|
||||
target=site.data.variables.default.page.show_subscribe
|
||||
source0=layout.show_subscribe source1=page.show_subscribe -%}
|
||||
{%- assign _show_subscribe = __return -%}
|
||||
|
||||
{%- include snippets/assign.html
|
||||
target=site.data.variables.default.page.license
|
||||
source0=layout.license source1=page.license -%}
|
||||
{%- assign _license = __return -%}
|
||||
|
||||
<footer class="article__footer">
|
||||
{%- if page.modify_date -%}
|
||||
{%- include snippets/get-locale-string.html key='ARTICLE_DATE_FORMAT' -%}
|
||||
{%- assign _locale_date_format = __return -%}
|
||||
|
||||
{%- include snippets/get-locale-string.html key='LAST_UPDATED' -%}
|
||||
{%- assign _locale_last_update = __return -%}
|
||||
<span>{{ _locale_last_update }}
|
||||
<time itemprop="dateModified" datetime="{{ page.modify_date | date_to_xmlschema }}">{{ page.modify_date | date: _locale_date_format }}</time>
|
||||
</span>
|
||||
{%- elsif page.date -%}
|
||||
<meta itemprop="dateModified" content="{{ page.date | date_to_xmlschema }}">
|
||||
{%- endif -%}
|
||||
|
||||
{%- include article/footer/custom.html -%}
|
||||
|
||||
{%- if _show_author_profile -%}
|
||||
{%- if page.author -%}
|
||||
{%- assign _author = site.data.authors[page.author] -%}
|
||||
{%- else -%}
|
||||
{%- assign _author = site.author -%}
|
||||
{%- endif -%}
|
||||
{%- include article/footer/author-profile.html author=_author -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _show_subscribe -%}
|
||||
<div class="article__subscribe">{%- include article/footer/subscribe.html -%}</div>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _license != false -%}
|
||||
{%- assign _data_license = site.data.licenses-%}
|
||||
{%- if site.license -%}
|
||||
{%- assign _license_data = _data_license[site.license] -%}
|
||||
{%- endif -%}
|
||||
{%- if _license != true -%}
|
||||
{%- assign _license_data = _data_license[_license] -%}
|
||||
{%- endif -%}
|
||||
<div class="article__license">{%- include article/footer/license.html license=_license_data -%}</div>
|
||||
{%- endif -%}
|
||||
</footer>
|
|
@ -0,0 +1,49 @@
|
|||
{%- include snippets/get-article-title.html article=include.article-%}
|
||||
{%- assign _article_title = __return -%}
|
||||
|
||||
{%- if include.html != false -%}
|
||||
|
||||
{%- include snippets/assign.html
|
||||
target=site.data.variables.default.page.show_title
|
||||
source0=layout.show_title source1=include.article.show_title -%}
|
||||
{%- assign _show_title = __return -%}
|
||||
|
||||
{%- include snippets/assign.html
|
||||
target=site.data.variables.default.page.show_edit_on_github
|
||||
source0=layout.show_edit_on_github source1=include.article.show_edit_on_github -%}
|
||||
{%- assign _show_edit_on_github = __return -%}
|
||||
|
||||
{%- if _show_title or _show_edit_on_github -%}
|
||||
<div class="article__header">
|
||||
{%- if _show_title -%}
|
||||
<header><h1>{{ _article_title }}</h1></header>
|
||||
{%- endif -%}
|
||||
{%- if _show_edit_on_github -%}
|
||||
{%- if site.repository and site.repository_tree -%}
|
||||
{%- include snippets/is_collection.html page=include.article -%}
|
||||
{%- assign _is_article_collection = __return -%}
|
||||
{%- include snippets/get-locale-string.html key='POST_ON_GITHUB' -%}
|
||||
{%- assign _locale_post_on_github = __return -%}
|
||||
{%- if _is_article_collection -%}
|
||||
{%- include snippets/prepend-path.html path=include.article.path prepend_path=site.collections_dir -%}
|
||||
{%- assign _article_path = __return -%}
|
||||
{%- else -%}
|
||||
{%- assign _article_path = include.article.path -%}
|
||||
{%- endif -%}
|
||||
{%- assign _github_path = site.repository | append: '/tree/' | append: site.repository_tree | append: '/' | append: _article_path | replace:'//','/' -%}
|
||||
<span class="split-space"> </span>
|
||||
<a class="edit-on-github"
|
||||
title="{{ _locale_post_on_github }}"
|
||||
href="https://github.com/{{ _github_path }}">
|
||||
<i class="far fa-edit"></i></a>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- else -%}
|
||||
<header style="display:none;"><h1>{{ _article_title }}</h1></header>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if include.semantic != false -%}
|
||||
<meta itemprop="headline" content="{{ _article_title }}">
|
||||
{%- endif -%}
|
|
@ -0,0 +1,96 @@
|
|||
{%- assign _author = site.data.authors[include.article.author] | default: site.author -%}
|
||||
|
||||
{%- if include.html != false -%}
|
||||
|
||||
{%- include snippets/assign.html
|
||||
target=site.data.variables.default.page.show_date
|
||||
source0=layout.show_date source1=include.article.show_date -%}
|
||||
{%- assign _show_date = __return -%}
|
||||
{%- if _show_date and include.article.date -%}
|
||||
{%- assign _show_date = true -%}
|
||||
{%- else -%}
|
||||
{%- assign _show_date = false -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- include snippets/assign.html
|
||||
target=site.data.variables.default.page.show_tags
|
||||
source0=layout.show_tags source1=include.article.show_tags -%}
|
||||
{%- assign _show_tags = __return -%}
|
||||
{%- if _show_tags and include.article.tags[0] -%}
|
||||
{%- assign _show_tags = true -%}
|
||||
{%- else -%}
|
||||
{%- assign _show_tags = false -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- assign _show_author = include.article.author -%}
|
||||
|
||||
{%- include snippets/assign.html target=site.data.variables.default.page.pageview
|
||||
source0=layout.pageview source1=page.pageview -%}
|
||||
{%- assign _pageview = __return -%}
|
||||
{%- if _pageview or include.show_pageview -%}
|
||||
{%- assign _pageview = true -%}
|
||||
{%- else -%}
|
||||
{%- assign _pageview = false -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- assign _paths_archive = site.paths.archive | default: site.data.variables.default.paths.archive -%}
|
||||
|
||||
{%- if _show_tags or _show_author or _show_date or _pageview -%}
|
||||
<div class="article__info clearfix">
|
||||
{%- if _show_tags -%}
|
||||
|
||||
<ul class="left-col menu">
|
||||
{%- assign _tag_path = _paths_archive | append: '?tag=' -%}
|
||||
{%- include snippets/prepend-baseurl.html path=_tag_path -%}
|
||||
|
||||
{%- for _tag in include.article.tags -%}
|
||||
{%- assign _tag_path = __return -%}
|
||||
{%- assign _tag_encode = _tag | strip | url_encode } -%}
|
||||
<li>
|
||||
<a class="button button--secondary button--pill button--sm"
|
||||
href="{{ _tag_path | append: _tag_encode | replace: '//', '/' }}">{{ _tag }}</a>
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _show_author or _show_date or _pageview -%}
|
||||
<ul class="right-col menu">
|
||||
{%- if _show_author -%}
|
||||
<li><i class="fas fa-user"></i> <span>{{ _author.name }}</span></li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _show_date -%}
|
||||
<li>
|
||||
{%- include snippets/get-locale-string.html key='ARTICLE_DATE_FORMAT' -%}
|
||||
<i class="far fa-calendar-alt"></i> <span>{{ include.article.date | date: __return }}</span>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _pageview -%}
|
||||
{%- if site.pageview.provider -%}
|
||||
{%- include snippets/get-locale-string.html key='VIEWS' -%}
|
||||
{%- assign _locale_views = __return -%}
|
||||
<li><i class="far fa-eye"></i> <span class="js-pageview" data-page-key="{{ include.article.key }}">0</span> {{ _locale_views }}</li>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
</ul>
|
||||
{%- endif -%}
|
||||
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
|
||||
{%- if include.semantic != false -%}
|
||||
{%- if _author -%}
|
||||
<meta itemprop="author" content="{{ _author.name }}"/>
|
||||
{%- endif -%}
|
||||
{%- if include.article.date -%}
|
||||
<meta itemprop="datePublished" content="{{ include.article.date | date_to_xmlschema }}">
|
||||
{%- endif -%}
|
||||
{%- if include.article.tags[0] -%}
|
||||
{%- assign _keywords = include.article.tags | join: ',' %}
|
||||
<meta itemprop="keywords" content="{{ _keywords }}">
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
|
@ -0,0 +1,144 @@
|
|||
{%- assign _excerpt_truncate = include.excerpt_truncate | default: 350 -%}
|
||||
|
||||
{%- assign _excerpt_type = include.excerpt_type -%}
|
||||
|
||||
{%- include snippets/get-locale-string.html key='READMORE' -%}
|
||||
{%- assign _locale_readmore = __return -%}
|
||||
|
||||
{%- assign _sorted_list = include.articles -%}
|
||||
{%- if include.group_by == 'year' -%}
|
||||
{%- assign _sorted_list = _sorted_list | sort: 'date' -%}
|
||||
{%- endif -%}
|
||||
{%- if include.reverse -%}
|
||||
{%- assign _sorted_list = _sorted_list | reverse -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if include.type == 'item' -%}
|
||||
<div class="article-list items items--divided">
|
||||
{%- elsif include.type == 'brief' -%}
|
||||
<div class="article-list items">
|
||||
{%- elsif include.type == 'grid' -%}
|
||||
{%- if include.size == 'sm' -%}
|
||||
<div class="article-list grid grid--sm grid--p-3">
|
||||
{%- else -%}
|
||||
<div class="article-list grid grid--p-3">
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- for _article in _sorted_list -%}
|
||||
|
||||
{%- include snippets/prepend-baseurl.html path=_article.url -%}
|
||||
{%- assign _article_url = __return -%}
|
||||
|
||||
{%- if _article.cover -%}
|
||||
{%- include snippets/get-nav-url.html path=_article.cover -%}
|
||||
{%- assign _article_cover = __return -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if include.type == 'item' -%}
|
||||
{%- if include.article_type == 'BlogPosting' -%}
|
||||
<article class="item" itemscope itemtype="http://schema.org/BlogPosting">
|
||||
{%- else -%}
|
||||
<article class="item">
|
||||
{%- endif -%}
|
||||
{%- if _article.cover and include.show_cover-%}
|
||||
{%- include snippets/get-nav-url.html path=_article.cover -%}
|
||||
{%- assign _article_cover = __return -%}
|
||||
<div class="item__image">
|
||||
{%- if include.cover_size == 'lg' -%}
|
||||
<img class="image image--lg" src="{{ _article_cover }}" />
|
||||
{%- elsif include.cover_size == 'sm' -%}
|
||||
<img class="image image--sm" src="{{ _article_cover }}" />
|
||||
{%- else -%}
|
||||
<img class="image" src="{{ _article_cover }}" />
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
<div class="item__content">
|
||||
<header><a href="{{ _article_url }}"><h2 itemprop="headline" class="item__header">{{ _article.title }}</h2></a></header>
|
||||
<div class="item__description">
|
||||
{%- if _article.excerpt and include.show_excerpt -%}
|
||||
<div class="article__content" itemprop="description articleBody">
|
||||
{%- if _excerpt_type == 'html' -%}
|
||||
{{ _article.excerpt }}
|
||||
{%- else -%}
|
||||
{{ _article.excerpt | strip_html | strip | truncate: _excerpt_truncate }}
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{%- if include.show_readmore -%}
|
||||
<p><a href="{{ _article_url }}">{{ _locale_readmore }}</a></p>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- if include.show_info -%}
|
||||
{%- include snippets/assign.html target=site.data.variables.default.page.pageview
|
||||
source0=_article.pageview -%}
|
||||
{%- assign _show_pageview = __return -%}
|
||||
{%- include article-info.html article=_article show_pageview=_show_pageview -%}
|
||||
{%- endif -%}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
|
||||
{%- elsif include.type == 'brief' -%}
|
||||
{%- assign _tags = '' -%}
|
||||
{%- for _tag in _article.tags -%}
|
||||
{%- assign _tag_encode = _tag | strip | url_encode -%}
|
||||
{%- if forloop.last -%}
|
||||
{%- assign _tags = _tags | append: _tag_encode -%}
|
||||
{%- else -%}
|
||||
{%- assign _tags = _tags | append: _tag_encode | append: ',' -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- if include.group_by == 'year' -%}
|
||||
{%- assign _currentdate = _article.date | date: '%Y' -%}
|
||||
{%- if _currentdate != _date -%}
|
||||
{%- unless forloop.first -%}</ul></section>{%- endunless -%}
|
||||
<section><h2 class="article-list__group-header">{{ _currentdate }}</h2><ul class="items">
|
||||
{%- assign _date = _currentdate -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- include snippets/get-locale-string.html key='ARTICLE_LIST_DATE_FORMAT' -%}
|
||||
<li class="item" itemscope itemtype="http://schema.org/BlogPosting" data-tags="{{ _tags }}">
|
||||
<div class="item__content">
|
||||
{%- if include.show_info -%}
|
||||
<span class="item__meta">{{ _article.date | date: __return }}</span>
|
||||
{%- endif -%}
|
||||
<a itemprop="headline" class="item__header" href="{{ _article_url }}">{{ _article.title }}</a></div>
|
||||
</li>
|
||||
|
||||
{%- elsif include.type == 'grid' -%}
|
||||
{%- if include.size == 'sm' -%}
|
||||
<div class="cell cell--12 cell--md-4 cell--lg-3">
|
||||
<div class="card card--flat">
|
||||
{%- if _article.cover -%}
|
||||
<div class="card__image">
|
||||
<img class="image" src="{{ _article_cover }}" />
|
||||
<div class="overlay overlay--bottom">
|
||||
<header>
|
||||
<a href="{{ _article_url }}"><h2 class="card__header">{{ _article.title }}</h2></a>
|
||||
</header>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
</div>
|
||||
{%- else -%}
|
||||
|
||||
<div class="cell cell--12 cell--md-6 cell--lg-4">
|
||||
<div class="card card--flat">
|
||||
{%- if _article.cover -%}
|
||||
<div class="card__image"><img src="{{ _article_cover }}" /></div>
|
||||
{%- endif -%}
|
||||
<div class="card__content">
|
||||
<header>
|
||||
<a href="{{ _article_url }}"><h2 class="card__header">{{ _article.title }}</h2></a>
|
||||
</header>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
||||
</div>
|
|
@ -0,0 +1,58 @@
|
|||
{%- if page.sidebar.nav -%}
|
||||
{%- assign _sidebar_nav = site.data.navigation[page.sidebar.nav] -%}
|
||||
{%- if _sidebar_nav -%}
|
||||
{%- assign _find_cur = false -%}
|
||||
{%- assign _find_next = false -%}
|
||||
|
||||
{%- for _item in _sidebar_nav -%}
|
||||
{%- if _find_next -%} {%- break -%} {%- endif -%}
|
||||
{%- if _item.children -%}
|
||||
|
||||
{%- for _child in _item.children -%}
|
||||
{%- assign _nav_key = _child.key -%}
|
||||
{%- assign _page_key = page.key -%}
|
||||
|
||||
{%- if _nav_key == _page_key -%}
|
||||
{%- assign _find_cur = true -%}
|
||||
{%- elsif _find_cur and _find_next != true -%}
|
||||
{%- assign _find_next = true -%}
|
||||
{%- assign _next = _child -%}
|
||||
{%- break -%}
|
||||
{%- else -%}
|
||||
{%- assign _previous = _child -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
||||
{%- if _find_cur != true -%}
|
||||
{%- assign _previous = page.previous -%}
|
||||
{%- assign _next = page.next -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- endif -%}
|
||||
|
||||
{%- else -%}
|
||||
{%- assign _previous = page.previous -%}
|
||||
{%- assign _next = page.next -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _next or _previous -%}
|
||||
<div class="article__section-navigator clearfix">
|
||||
{%- if _previous -%}
|
||||
{%- include snippets/prepend-baseurl.html path=_previous.url -%}
|
||||
{%- assign _href = __return -%}
|
||||
{%- include snippets/get-locale-string.html key='PREVIOUS' -%}
|
||||
{%- assign _locale_previous = __return -%}
|
||||
<div class="previous"><span>{{ _locale_previous }}</span><a href="{{ _href }}">{{ _previous.title }}</a></div>
|
||||
{%- endif -%}
|
||||
{%- if _next -%}
|
||||
{%- include snippets/prepend-baseurl.html path=_next.url -%}
|
||||
{%- assign _href = __return -%}
|
||||
{%- include snippets/get-locale-string.html key='NEXT' -%}
|
||||
{%- assign _locale_next = __return -%}
|
||||
<div class="next"><span>{{ _locale_next }}</span><a href="{{ _href }}">{{ _next.title }}</a></div>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- endif -%}
|
|
@ -0,0 +1,47 @@
|
|||
{%- assign _author = include.author -%}
|
||||
|
||||
{%- if _author.type == 'organization' -%}
|
||||
{%- assign _author_itemtype = 'http://schema.org/Organization' -%}
|
||||
{%- else -%}
|
||||
{%- assign _author_itemtype = 'http://schema.org/Person' -%}
|
||||
{%- endif -%}
|
||||
|
||||
<div itemscope itemtype="{{ _author_itemtype }}" class="author-profile card card--flat item">
|
||||
{%- if _author.avatar -%}
|
||||
{%- if _author.url -%}
|
||||
<a href="{{ _author.url }}" class="item__image">
|
||||
{%- endif -%}
|
||||
{%- include snippets/get-nav-url.html path=_author.avatar -%}
|
||||
{%- assign _author_avatar = __return -%}
|
||||
<img class="author-profile__avatar" itemprop="image" src="{{ _author_avatar }}" />
|
||||
{%- if _author.url -%}
|
||||
</a>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
|
||||
<div class="item__content">
|
||||
|
||||
{%- if _author.name -%}
|
||||
<meta itemprop="name" content="{{ _author.name }}">
|
||||
<p class="author-profile__name">
|
||||
{%- if _author.url -%}
|
||||
<meta itemprop="url" content="{{ _author.url }}">
|
||||
<a href="{{ _author.url }}">
|
||||
{%- endif -%}
|
||||
{{ _author.name }}
|
||||
{%- if _author.url -%}
|
||||
</a>
|
||||
{%- endif -%}
|
||||
</p>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.bio -%}
|
||||
<p itemprop="description">{{ _author.bio }}</p>
|
||||
{%- endif -%}
|
||||
<div class="author-profile__links">
|
||||
{%- include author-links.html author=_author -%}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
<!-- start custom article footer snippet -->
|
||||
|
||||
<!-- end custom article footer snippet -->
|
|
@ -0,0 +1,14 @@
|
|||
{%- include snippets/get-locale-string.html key='LICENSE_ANNOUNCE' -%}
|
||||
{%- assign _license_announce = __return -%}
|
||||
|
||||
{%- if include.license -%}
|
||||
|
||||
{%-assign _license_name = '<a itemprop="license" rel="license" href="[URL]">[NAME]</a>' | replace: "[URL]", include.license.url | replace: "[NAME]", include.license.name -%}
|
||||
<div class="license">
|
||||
<p align="center">{{ _license_announce | replace: "[LICENSE]", _license_name }}
|
||||
<a rel="license" href="{{ include.license.url }}">
|
||||
<img alt="{{ include.license.name }}" src="{{ include.license.image }}" />
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
{%- endif -%}
|
|
@ -0,0 +1,6 @@
|
|||
{%- assign _paths_rss = site.paths.rss | default: site.data.variables.default.paths.rss -%}
|
||||
{%- include snippets/get-nav-url.html path=_paths_rss -%}
|
||||
{%- assign _paths_rss = __return -%}
|
||||
{%- include snippets/get-locale-string.html key='SUBSCRIBE' -%}
|
||||
{%- assign _locale_nav_subscribe = __return -%}
|
||||
<div class="subscribe"><i class="fas fa-rss"></i> <a type="application/rss+xml" href="{{ _paths_rss }}">{{ _locale_nav_subscribe }}</a></div>
|
|
@ -0,0 +1,3 @@
|
|||
<!-- start custom article top snippet -->
|
||||
|
||||
<!-- end custom article top snippet -->
|
|
@ -0,0 +1 @@
|
|||
<div class="toc-aside js-toc-root"></div>
|
|
@ -0,0 +1,120 @@
|
|||
{%- assign _author = include.author -%}
|
||||
|
||||
<div class="author-links">
|
||||
<ul class="menu menu--nowrap menu--inline">
|
||||
|
||||
{%- if _author.url -%}
|
||||
<link itemprop="url" href="{{ _author.url }}">
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.type == 'organization' -%}
|
||||
{%- include snippets/get-locale-string.html key='EMAIL_US' -%}
|
||||
{%- assign _locale_string_email = __return -%}
|
||||
{%- include snippets/get-locale-string.html key='FOLLOW_US' -%}
|
||||
{%- assign _locale_string_follow = __return -%}
|
||||
{%- else -%}
|
||||
{%- include snippets/get-locale-string.html key='EMAIL_ME' -%}
|
||||
{%- assign _locale_string_email = __return -%}
|
||||
{%- include snippets/get-locale-string.html key='FOLLOW_ME' -%}
|
||||
{%- assign _locale_string_follow = __return -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- include snippets/get-locale-string.html key='EMAIL_ME' -%}
|
||||
{%- if _author.email -%}
|
||||
<li title="{{ _locale_string_email }}">
|
||||
<a class="button button--circle mail-button" itemprop="email" href="mailto:{{ _author.email }}" target="_blank">
|
||||
<i class="fas fa-envelope"></i>
|
||||
</a>
|
||||
{%- endif -%}
|
||||
|
||||
|
||||
{%- if _author.facebook -%}
|
||||
<li title="{{ _locale_string_follow | replace: '[NAME]', 'Facebook' }}">
|
||||
<a class="button button--circle facebook-button" itemprop="sameAs" href="https://www.facebook.com/{{ _author.facebook }}" target="_blank">
|
||||
<div class="icon">{%- include svg/icon/social/facebook.svg -%}</div>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.twitter -%}
|
||||
<li title="{{ _locale_string_follow | replace: '[NAME]', 'Twitter' }}">
|
||||
<a class="button button--circle twitter-button" itemprop="sameAs" href="https://twitter.com/{{ _author.twitter }}" target="_blank">
|
||||
<div class="icon">{%- include svg/icon/social/twitter.svg -%}</div>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.weibo -%}
|
||||
<li title="{{ _locale_string_follow | replace: '[NAME]', 'Weibo' }}">
|
||||
<a class="button button--circle weibo-button" itemprop="sameAs" href="https://weibo.com/{{ _author.weibo }}" target="_blank">
|
||||
<div class="icon">{%- include svg/icon/social/weibo.svg -%}</div>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.googleplus -%}
|
||||
<li title="{{ _locale_string_follow | replace: '[NAME]', 'Google+' }}">
|
||||
<a class="button button--circle googlepluse-button" itemprop="sameAs" href="https://plus.google.com/u/0/{{ _author.googleplus }}" target="_blank">
|
||||
<div class="icon">{%- include svg/icon/social/googleplus.svg -%}</div>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.telegram -%}
|
||||
<li title="{{ _locale_string_follow | replace: '[NAME]', 'Telegram' }}">
|
||||
<a class="button button--circle telegram-button" itemprop="sameAs" href="https://t.me/{{ _author.telegram }}" target="_blank">
|
||||
<div class="icon">{%- include svg/icon/social/telegram.svg -%}</div>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.medium -%}
|
||||
<li title="{{ _locale_string_follow | replace: '[NAME]', 'Medium' }}">
|
||||
<a class="button button--circle medium-button" itemprop="sameAs" href="https://medium.com/{{ _author.medium }}" target="_blank">
|
||||
<div class="icon">{%- include svg/icon/social/medium.svg -%}</div>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.zhihu -%}
|
||||
<li title="{{ _locale_string_follow | replace: '[NAME]', 'Zhihu' }}">
|
||||
<a class="button button--circle zhihu-button" itemprop="sameAs" href="https://www.zhihu.com/people/{{ _author.zhihu }}" target="_blank">
|
||||
<div class="icon">{%- include svg/icon/social/zhihu.svg -%}</div>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.douban -%}
|
||||
<li title="{{ _locale_string_follow | replace: '[NAME]', 'Douban' }}">
|
||||
<a class="button button--circle douban-button" itemprop="sameAs" href="https://www.douban.com/people/{{ _author.douban }}" target="_blank">
|
||||
<div class="icon">{%- include svg/icon/social/douban.svg -%}</div>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.linkedin -%}
|
||||
<li title="{{ _locale_string_follow | replace: '[NAME]', 'Linkedin' }}">
|
||||
<a class="button button--circle linkedin-button" itemprop="sameAs" href="https://www.linkedin.com/in/{{ _author.linkedin }}" target="_blank">
|
||||
<div class="icon">{%- include svg/icon/social/linkedin.svg -%}</div>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.github -%}
|
||||
<li title="{{ _locale_string_follow | replace: '[NAME]', 'Github' }}">
|
||||
<a class="button button--circle github-button" itemprop="sameAs" href="https://github.com/{{ _author.github }}" target="_blank">
|
||||
<div class="icon">{%- include svg/icon/social/github.svg -%}</div>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if _author.npm -%}
|
||||
<li title="{{ _locale_string_follow | replace: '[NAME]', 'npm' }}">
|
||||
<a class="button button--circle npm-button" itemprop="sameAs" href="https://www.npmjs.com/~{{ _author.npm }}" target="_blank">
|
||||
<div class="icon">{%- include svg/icon/social/npm.svg -%}</div>
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
</ul>
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
<!-- start custom comments snippet -->
|
||||
|
||||
<!-- end custom comments snippet -->
|
|
@ -0,0 +1,22 @@
|
|||
{%- if page.key and
|
||||
site.comments.disqus.shortname -%}
|
||||
|
||||
<div id="disqus_thread"></div>
|
||||
<script>
|
||||
/**
|
||||
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
|
||||
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
|
||||
var disqus_config = function () {
|
||||
this.page.url = '{%- include snippets/page-url.html -%}';
|
||||
this.page.identifier = '{{ page.key }}';
|
||||
};
|
||||
(function() { // DON'T EDIT BELOW THIS LINE
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
|
||||
s.setAttribute('data-timestamp', +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
|
||||
{%- endif -%}
|
|
@ -0,0 +1,39 @@
|
|||
{%- if page.key and
|
||||
site.comments.gitalk.clientID and
|
||||
site.comments.gitalk.clientSecret and
|
||||
site.comments.gitalk.repository and
|
||||
site.comments.gitalk.owner and
|
||||
site.comments.gitalk.admin -%}
|
||||
|
||||
<!-- fix text color in the input textarea of gitalk -->
|
||||
<style type="text/css">
|
||||
.gitalk-wrapper .gt-header-textarea {
|
||||
color: #333 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
{%- include snippets/get-sources.html -%}
|
||||
{%- assign _sources = __return -%}
|
||||
<div class="gitalk-wrapper" id="js-gitalk-container"></div>
|
||||
{%- assign _admin = '' -%}
|
||||
{%- for _admin_id in site.comments.gitalk.admin -%}
|
||||
{%- assign _admin = _admin | append: ", '" | append: _admin_id | append: "'" -%}
|
||||
{%- endfor -%}
|
||||
{%- assign _last = _admin | size | minus: 1 -%}
|
||||
{%- assign _admin = _admin | slice: 2, _last -%}
|
||||
<script>
|
||||
window.Lazyload.css('{{ _sources.gitalk.css }}');
|
||||
window.Lazyload.js('{{ _sources.gitalk.js }}', function() {
|
||||
var gitalk = new Gitalk({
|
||||
clientID: '{{ site.comments.gitalk.clientID }}',
|
||||
clientSecret: '{{ site.comments.gitalk.clientSecret }}',
|
||||
repo: '{{ site.comments.gitalk.repository }}',
|
||||
owner: '{{ site.comments.gitalk.owner }}',
|
||||
admin: [{{ _admin }}],
|
||||
id: '{{ page.key }}'
|
||||
});
|
||||
gitalk.render('js-gitalk-container');
|
||||
});
|
||||
</script>
|
||||
|
||||
{%- endif -%}
|
|
@ -0,0 +1,46 @@
|
|||
{%- include snippets/get-sources.html -%}
|
||||
{%- assign _sources = __return -%}
|
||||
|
||||
{%- assign _VALINE_APP_ID = site.comments.valine.app_id -%}
|
||||
{%- assign _VALINE_APP_KEY = site.comments.valine.app_key -%}
|
||||
{%- assign _VALINE_PLACEHOLDER = site.comments.valine.placeholder -%}
|
||||
{%- assign _VALINE_VISITOR = site.comments.valine.visitor -%}
|
||||
{%- assign _VALINE_META = site.comments.valine.meta -%}
|
||||
|
||||
|
||||
{%- if _VALINE_APP_ID and
|
||||
_VALINE_APP_KEY -%}
|
||||
|
||||
<div id="vcomments"></div>
|
||||
|
||||
{%- if _VALINE_VISITOR -%}
|
||||
<span id="{{page.url}}" class="leancloud-visitors" data-flag-title={{page.title}}>
|
||||
</span>
|
||||
{%- endif -%}
|
||||
|
||||
<script>
|
||||
window.Lazyload.js(['{{ _sources.leancloud_js_sdk}}', '{{ _sources.valine }}'], function() {
|
||||
var _config = {
|
||||
el: '#vcomments',
|
||||
appId: '{{ _VALINE_APP_ID }}',
|
||||
appKey: '{{ _VALINE_APP_KEY }}',
|
||||
verify: true,
|
||||
};
|
||||
{%- if _VALINE_PLACEHOLDER -%}
|
||||
_config.placeholder = '{{ _VALINE_PLACEHOLDER }}';
|
||||
{%- endif -%}
|
||||
{%- assign _page_lang_slice = page.lang | slice: 0, 2 -%}
|
||||
{%- if _page_lang_slice != 'zh' -%}
|
||||
_config.lang = 'en';
|
||||
{%- endif -%}
|
||||
{%- if _VALINE_VISITOR -%}
|
||||
_config.visitor = 'true';
|
||||
{%- endif -%}
|
||||
{%- if _VALINE_META -%}
|
||||
_config.meta = {{ _VALINE_META}};
|
||||
{%- endif -%}
|
||||
new Valine(_config);
|
||||
});
|
||||
</script>
|
||||
|
||||
{%- endif -%}
|
|
@ -0,0 +1,11 @@
|
|||
{%- if jekyll.environment != 'development' -%}
|
||||
{%- if site.comments.provider == 'disqus' -%}
|
||||
{%- include comments-providers/disqus.html -%}
|
||||
{%- elsif site.comments.provider == 'gitalk' -%}
|
||||
{%- include comments-providers/gitalk.html -%}
|
||||
{%- elsif site.comments.provider == 'valine' -%}
|
||||
{%- include comments-providers/valine.html -%}
|
||||
{%- elsif site.comments.provider == 'custom' -%}
|
||||
{%- include comments-providers/custom.html -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
|
@ -0,0 +1,5 @@
|
|||
<div class="extensions extensions--video">
|
||||
<iframe src="//player.bilibili.com/player.html?aid={{ include.id }}&page=1"
|
||||
frameborder="no" scrolling="no" allowfullscreen="true">
|
||||
</iframe>
|
||||
</div>
|
|
@ -0,0 +1,4 @@
|
|||
<div class="extensions extensions--demo">
|
||||
<iframe src='//codepen.io/{{ include.user }}/embed/{{ include.hash }}/?theme-id=0&default-tab={{ include.default_tab | default: result }}'
|
||||
frameborder="0" scrolling="no" allowfullscreen></iframe>
|
||||
</div>
|
|
@ -0,0 +1,4 @@
|
|||
<iframe class="extensions extensions--audio" width="330" height="86"
|
||||
src="//music.163.com/outchain/player?type=2&id={{ include.id }}&auto=1&height=66"
|
||||
frameborder="no" border="0" marginwidth="0" marginheight="0">
|
||||
</iframe>
|
|
@ -0,0 +1,6 @@
|
|||
<div class="extensions extensions--slide">
|
||||
<iframe src="//www.slideshare.net/slideshow/embed_code/key/{{ include.id }}"
|
||||
width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"
|
||||
style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen>
|
||||
</iframe>
|
||||
</div>
|
|
@ -0,0 +1,4 @@
|
|||
<iframe class="extensions extensions--audio" width="100%" height="166"
|
||||
src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/{{ include.id }}&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true"
|
||||
scrolling="no" frameborder="no" allow="autoplay">
|
||||
</iframe>
|
|
@ -0,0 +1,5 @@
|
|||
<div class="extensions extensions--video">
|
||||
<iframe src="https://embed.ted.com/talks/{{ include.id }}"
|
||||
frameborder="0" scrolling="no" allowfullscreen>
|
||||
</iframe>
|
||||
</div>
|
|
@ -0,0 +1,4 @@
|
|||
<div class="extensions extensions--video">
|
||||
<iframe src="https://www.youtube.com/embed/{{ include.id }}?rel=0&showinfo=0"
|
||||
frameborder="0" scrolling="no" allowfullscreen></iframe>
|
||||
</div>
|
|
@ -0,0 +1,37 @@
|
|||
|
||||
<footer class="footer py-4 js-page-footer">
|
||||
<div class="main">
|
||||
|
||||
{%- assign _site_author = site.author -%}
|
||||
{%- if _site_author.type == 'organization' -%}
|
||||
{%- assign _site_author_itemtype = 'http://schema.org/Organization' -%}
|
||||
{%- else -%}
|
||||
{%- assign _site_author_itemtype = 'http://schema.org/Person' -%}
|
||||
{%- endif -%}
|
||||
|
||||
<div itemscope itemtype="{{ _site_author_itemtype }}">
|
||||
<meta itemprop="name" content="{{ _site_author.name }}">
|
||||
{%- assign _site_author_url = _site_author.url | default: '/'-%}
|
||||
{%- include snippets/get-nav-url.html path=_site_author_url -%}
|
||||
{%- assign _site_author_url = __return -%}
|
||||
<meta itemprop="url" content="{{ _site_author_url }}">
|
||||
{%- if _site_author.bio -%}
|
||||
<meta itemprop="description" content="{{ _site_author.bio }}">
|
||||
{%- endif -%}
|
||||
<div class="footer__author-links">
|
||||
{%- include author-links.html author=_site_author -%}
|
||||
</div>
|
||||
</div>
|
||||
{%- include snippets/get-locale-string.html key='COPYRIGHT_DATES' -%}
|
||||
{%- assign _locale_copyright_dates = __return -%}
|
||||
<div class="site-info mt-2">
|
||||
<div>
|
||||
{%- include snippets/get-locale-string.html key='COPYRIGHT_DATES' -%}
|
||||
{%- assign _locale_copyright_dates = __return -%}
|
||||
© {{ site.title }} {{ _locale_copyright_dates }},
|
||||
Powered by <a title="Jekyll is a simple, blog-aware, static site generator." href="http://jekyllrb.com/">Jekyll</a> & <a
|
||||
title="TeXt is a super customizable Jekyll theme." href="https://github.com/kitian616/jekyll-TeXt-theme">TeXt Theme</a>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
|
@ -0,0 +1,24 @@
|
|||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
|
||||
{%- include snippets/get-article-title.html article=page -%}
|
||||
<title>{%- if __return -%}{{ __return }} - {{ site.title }}{%- else -%}{{ site.title }}{%- endif -%}</title>
|
||||
|
||||
<meta name="description" content="{%- if page.excerpt -%}{{ page.excerpt | strip_html | strip_newlines | strip | truncate: 160 }}{%- else -%}{{ site.description }}{%- endif -%}">
|
||||
<link rel="canonical" href="{%- include snippets/page-url.html -%}">
|
||||
|
||||
{%- assign _paths_rss = site.paths.rss | default: site.data.variables.default.paths.rss -%}
|
||||
{%- include snippets/get-nav-url.html path=_paths_rss -%}
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ __return }}">
|
||||
|
||||
{%- include head/favicon.html -%}
|
||||
|
||||
{%- include snippets/prepend-baseurl.html path='/assets/css/main.css' -%}
|
||||
<link rel="stylesheet" href="{{ __return }}">
|
||||
|
||||
{%- include snippets/get-sources.html -%}
|
||||
{%- assign _sources = __return -%}
|
||||
<link rel="stylesheet" href="{{ _sources.font_awesome }}" >
|
||||
|
||||
{%- include head/custom.html -%}
|
|
@ -0,0 +1,3 @@
|
|||
<!-- start custom head snippets -->
|
||||
|
||||
<!-- end custom head snippets -->
|
|
@ -0,0 +1,6 @@
|
|||
<link rel="icon" type="image/png" href="/assets/favicon-96x96.png" sizes="96x96" />
|
||||
<link rel="icon" type="image/svg+xml" href="/assets/favicon.svg" />
|
||||
<link rel="shortcut icon" href="/assets/favicon.ico" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon.png" />
|
||||
<meta name="apple-mobile-web-app-title" content="WingHexExplorer2" />
|
||||
<link rel="manifest" href="/assets/site.webmanifest" />
|
|
@ -0,0 +1,44 @@
|
|||
{%- if include.theme == 'dark' -%}
|
||||
<header class="header header--dark" {%- if include.background -%} style="background: {{ include.background }};" {%- endif -%}>
|
||||
{%- elsif include.theme == 'light' -%}
|
||||
<header class="header header--light" {%- if include.background -%} style="background: {{ include.background }};" {%- endif -%}>
|
||||
{%- else -%}
|
||||
<header class="header" {%- if include.background -%} style="background: {{ include.background }};" {%- endif -%}>
|
||||
{%- endif -%}
|
||||
<div class="main">
|
||||
<div class="header__title">
|
||||
<div class="header__brand">
|
||||
{%- include svg/logo.svg -%}
|
||||
{%- assign _paths_root = site.paths.root | default: site.data.variables.default.paths.root -%}
|
||||
{%- include snippets/get-nav-url.html path=_paths_root -%}
|
||||
{%- if site.title -%}
|
||||
<a title="{%- if site.description -%}{{ site.description }}{%- endif -%}" href="{{ __return }}">{{ site.title }}</a>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- if site.search.provider -%}
|
||||
<button class="button button--secondary button--circle search-button js-search-toggle"><i class="fas fa-search"></i></button>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- if site.data.navigation.header -%}
|
||||
<nav class="navigation">
|
||||
<ul>
|
||||
{%- for _item in site.data.navigation.header -%}
|
||||
{%- include snippets/get-nav-url.html path=_item.url -%}
|
||||
{%- assign _nav_url = __return -%}
|
||||
{%- include snippets/get-nav-url.html path=page.url -%}
|
||||
{%- assign _page_url = __return -%}
|
||||
{%- include snippets/get-string-from-locale-config.html locale=_item.titles -%}
|
||||
{%- if _nav_url == _page_url or page.nav_key and _item.key and page.nav_key == _item.key -%}
|
||||
<li class="navigation__item navigation__item--active"><a href="{{ _nav_url }}">{%- if _item.title -%}{{ _item.title }}{%- else -%}{{ __return }}{%- endif -%}</a></li>
|
||||
{%- else -%}
|
||||
<li class="navigation__item"><a href="{{ _nav_url }}">{%- if _item.title -%}{{ _item.title }}{%- else -%}{{ __return }}{%- endif -%}</a></li>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- if site.search.provider -%}
|
||||
<li><button class="button button--secondary button--circle search-button js-search-toggle"><i class="fas fa-search"></i></button></li>
|
||||
{%- endif -%}
|
||||
</ul>
|
||||
</nav>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
</header>
|
|
@ -0,0 +1,3 @@
|
|||
<!-- start custom main bottom snippet -->
|
||||
|
||||
<!-- end custom main bottom snippet -->
|
|
@ -0,0 +1,3 @@
|
|||
<!-- start custom main top snippet -->
|
||||
|
||||
<!-- end custom main top snippet -->
|
|
@ -0,0 +1,17 @@
|
|||
{%- include snippets/assign.html target=site.data.variables.default.chart
|
||||
source0=site.chart source1=page.chart -%}
|
||||
{%- if __return == true -%}
|
||||
{%- include markdown-enhancements/chart.html -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- include snippets/assign.html target=site.data.variables.default.mathjax
|
||||
source0=site.mathjax source1=page.mathjax -%}
|
||||
{%- if __return == true -%}
|
||||
{%- include markdown-enhancements/mathjax.html -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- include snippets/assign.html target=site.data.variables.default.mermaid
|
||||
source0=site.mermaid source1=page.mermaid -%}
|
||||
{%- if __return == true -%}
|
||||
{%- include markdown-enhancements/mermaid.html -%}
|
||||
{%- endif -%}
|
|
@ -0,0 +1,15 @@
|
|||
{%- include snippets/get-sources.html -%}
|
||||
{%- assign _sources = __return -%}
|
||||
<script>
|
||||
window.Lazyload.js(['{{ _sources.jquery }}', '{{ _sources.chart }}'], function() {
|
||||
var $canvas = null, $this = null, _ctx = null, _text = '';
|
||||
$('.language-chart').each(function(){
|
||||
$this = $(this);
|
||||
$canvas = $('<canvas></canvas>');
|
||||
_text = $this.text();
|
||||
$this.text('').append($canvas);
|
||||
_ctx = $canvas.get(0).getContext('2d');
|
||||
(_ctx && _text) && (new Chart(_ctx, JSON.parse(_text)) && $this.attr('data-processed', true));
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
{%- include snippets/get-sources.html -%}
|
||||
{%- assign _sources = __return -%}
|
||||
|
||||
{%- include snippets/assign.html target=site.data.variables.default.mathjax_autoNumber
|
||||
source0=site.mathjax_autoNumber source1=page.mathjax_autoNumber -%}
|
||||
{%- assign _mathjax_autoNumber = __return -%}
|
||||
|
||||
<script type="text/x-mathjax-config">
|
||||
var _config = { tex2jax: {
|
||||
inlineMath: [['$','$'], ['\\(','\\)']]
|
||||
}};
|
||||
{%- if _mathjax_autoNumber == true -%}
|
||||
_config.TeX = { equationNumbers: { autoNumber: "all" } };
|
||||
{%- endif -%}
|
||||
MathJax.Hub.Config(_config);
|
||||
</script>
|
||||
<script type="text/javascript" src="{{ _sources.mathjax }}" async></script>
|
|
@ -0,0 +1,10 @@
|
|||
{%- include snippets/get-sources.html -%}
|
||||
{%- assign _sources = __return -%}
|
||||
<script>
|
||||
window.Lazyload.js('{{ _sources.mermaid }}', function() {
|
||||
mermaid.initialize({
|
||||
startOnLoad: true
|
||||
});
|
||||
mermaid.init(undefined, '.language-mermaid');
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
<!-- start custom pageview snippet (for Home layout) -->
|
||||
|
||||
<!-- end custom pageview snippet (for Home layout) -->
|
|
@ -0,0 +1,3 @@
|
|||
<!-- start custom pageview snippet (for the post) -->
|
||||
|
||||
<!-- end custom pageview snippet (for the post) -->
|
|
@ -0,0 +1,35 @@
|
|||
{%- include snippets/get-sources.html -%}
|
||||
{%- assign _sources = __return -%}
|
||||
|
||||
{%- assign _LEANCLOUD_APP_ID = site.pageview.leancloud.app_id -%}
|
||||
{%- assign _LEANCLOUD_APP_KEY = site.pageview.leancloud.app_key -%}
|
||||
{%- assign _LEANCLOUD_APP_CLASS = site.pageview.leancloud.app_class -%}
|
||||
|
||||
{%- if _LEANCLOUD_APP_ID and
|
||||
_LEANCLOUD_APP_KEY and
|
||||
_LEANCLOUD_APP_CLASS -%}
|
||||
|
||||
<script>
|
||||
{%- include pageview-providers/leancloud/leancloud.js -%}
|
||||
</script>
|
||||
<script>
|
||||
window.Lazyload.js(['{{ _sources.jquery }}', '{{ _sources.leancloud_js_sdk}}'], function() {
|
||||
var pageview = window.pageview(AV, {
|
||||
appId: '{{ _LEANCLOUD_APP_ID }}',
|
||||
appKey: '{{ _LEANCLOUD_APP_KEY }}',
|
||||
appClass: '{{ _LEANCLOUD_APP_CLASS }}'
|
||||
});
|
||||
$('.js-pageview').each(function() {
|
||||
var $this = $(this);
|
||||
var key = $this.attr('data-page-key');
|
||||
pageview.get(key, function(view) {
|
||||
$this.attr('itemprop', 'userInteractionCount').attr('content', view).text(view);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{%- endif -%}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
(function() {
|
||||
function errorHandler(error, callback) {
|
||||
if (error) {
|
||||
callback && callback(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function pageview(_AV, options) {
|
||||
var AV = _AV;
|
||||
var appId, appKey, appClass;
|
||||
appId = options.appId;
|
||||
appKey = options.appKey;
|
||||
appClass = options.appClass;
|
||||
AV.init({
|
||||
serverURLs: 'https://avoscloud.com',
|
||||
appId: appId,
|
||||
appKey: appKey
|
||||
});
|
||||
return {
|
||||
get: get,
|
||||
increase: increase
|
||||
};
|
||||
|
||||
function searchKey(key) {
|
||||
var query = new AV.Query(appClass);
|
||||
query.equalTo('key', key);
|
||||
return query.first();
|
||||
}
|
||||
|
||||
function insert(key, title) {
|
||||
var Blog = AV.Object.extend(appClass);
|
||||
var blog = new Blog();
|
||||
blog.set('title', title);
|
||||
blog.set('key', key);
|
||||
blog.set('views', 0);
|
||||
return blog.save();
|
||||
}
|
||||
|
||||
function increment(result) {
|
||||
result.increment('views', 1);
|
||||
return result.save(null, {
|
||||
fetchWhenSave: true
|
||||
});
|
||||
}
|
||||
|
||||
function get(key, callback) {
|
||||
searchKey(key).then(function(result) {
|
||||
if (result) {
|
||||
callback && callback(result.attributes.views);
|
||||
}
|
||||
}, errorHandler);
|
||||
}
|
||||
|
||||
function increase(key, title, callback) {
|
||||
searchKey(key).then(function(result) {
|
||||
if (result) {
|
||||
increment(result).then(function(result) {
|
||||
callback && callback(result.attributes.views);
|
||||
});
|
||||
} else {
|
||||
insert(key, title).then(function(result) {
|
||||
increment(result).then(function(result) {
|
||||
callback && callback(result.attributes.views);
|
||||
});
|
||||
}, errorHandler);
|
||||
}
|
||||
}, errorHandler);
|
||||
}
|
||||
}
|
||||
window.pageview = pageview;
|
||||
})();
|
|
@ -0,0 +1,31 @@
|
|||
{%- include snippets/get-sources.html -%}
|
||||
{%- assign _sources = __return -%}
|
||||
|
||||
{%- assign _LEANCLOUD_APP_ID = site.pageview.leancloud.app_id -%}
|
||||
{%- assign _LEANCLOUD_APP_KEY = site.pageview.leancloud.app_key -%}
|
||||
{%- assign _LEANCLOUD_APP_CLASS = site.pageview.leancloud.app_class -%}
|
||||
|
||||
{%- if page.key and
|
||||
_LEANCLOUD_APP_ID and
|
||||
_LEANCLOUD_APP_KEY and
|
||||
_LEANCLOUD_APP_CLASS -%}
|
||||
|
||||
<script>
|
||||
{%- include pageview-providers/leancloud/leancloud.js -%}
|
||||
</script>
|
||||
<script>
|
||||
window.Lazyload.js(['{{ _sources.jquery }}', '{{ _sources.leancloud_js_sdk}}'], function() {
|
||||
var pageview = window.pageview(AV, {
|
||||
appId: '{{ _LEANCLOUD_APP_ID }}',
|
||||
appKey: '{{ _LEANCLOUD_APP_KEY }}',
|
||||
appClass: '{{ _LEANCLOUD_APP_CLASS }}'
|
||||
});
|
||||
var key = '{{ page.key }}';
|
||||
var title = {{ page.title | jsonify }};
|
||||
pageview.increase(key, title, function(view) {
|
||||
$("[data-page-key='{{ page.key }}']").text(view);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{%- endif -%}
|
|
@ -0,0 +1,29 @@
|
|||
{%- include snippets/assign.html target=site.data.variables.default.pageview source0=page.pageview -%}
|
||||
{%- assign _pageview = __return -%}
|
||||
|
||||
|
||||
{%- if page.layout == "home" -%}
|
||||
|
||||
{%- if jekyll.environment != "development" -%}
|
||||
{%- if site.pageview.provider == 'leancloud' -%}
|
||||
{%- include pageview-providers/leancloud/home.html -%}
|
||||
{%- elsif site.pageview.provider == 'custom' -%}
|
||||
{%- include pageview-providers/custom/home.html -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
|
||||
{%- elsif page.layout == "article" -%}
|
||||
{%- if _pageview -%}
|
||||
|
||||
{%- if jekyll.environment != "development" and
|
||||
jekyll.environment != "beta" -%}
|
||||
{%- if site.pageview.provider == 'leancloud' -%}
|
||||
{%- include pageview-providers/leancloud/post.html -%}
|
||||
{%- elsif site.pageview.provider == 'custom' -%}
|
||||
{%- include pageview-providers/custom/post.html -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
|
@ -0,0 +1,98 @@
|
|||
{%- if paginator.total_pages > 1 -%}
|
||||
<div class="pagination">
|
||||
|
||||
{%- include snippets/get-locale-string.html key='STATISTICS' -%}
|
||||
{%- assign _locale_statistics = __return -%}
|
||||
|
||||
{%- assign _post_count = site.posts | size -%}
|
||||
{%- assign _page_count = paginator.total_pages -%}
|
||||
<p>{{ _locale_statistics | replace: '[POST_COUNT]', _post_count | replace: '[PAGE_COUNT]', _page_count }}</p>
|
||||
<div class="pagination__menu">
|
||||
<ul class="menu menu--nowrap">
|
||||
{%- assign _max_show = 5 -%}
|
||||
{%- assign _max_show_modulo_two = _max_show | modulo: 2 -%}
|
||||
{%- assign _length = paginator.total_pages -%}
|
||||
{%- assign _length_mimus_one = _length | minus: 1 -%}
|
||||
{%- assign _cur = paginator.page -%}
|
||||
{%- assign _extra = _max_show | minus: 3 -%}
|
||||
{%- assign _extra_half = _extra | divided_by: 2 -%}
|
||||
|
||||
{%- if _max_show > 4 and _max_show_modulo_two == 1 and paginator.total_pages > _max_show -%}
|
||||
{%- assign _condition0 = _extra | divided_by: 2 | plus: 1 -%}
|
||||
{%- assign _condition1 = _length | minus: _extra_half -%}
|
||||
{%- if _cur <= _condition0 -%}
|
||||
{%- assign _n0 = 2 -%}
|
||||
{%- assign _n1 = _extra | plus: 2 -%}
|
||||
{%- elsif _cur >= _condition1 -%}
|
||||
{%- assign _n0 = _length | minus: _extra | minus: 1 -%}
|
||||
{%- assign _n1 = _length | minus: 1 -%}
|
||||
{%- else -%}
|
||||
{%- assign _n0 = _cur | minus: _extra_half -%}
|
||||
{%- assign _n1 = _cur | plus: _extra_half -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if paginator.previous_page -%}
|
||||
{%- include snippets/prepend-baseurl.html path=paginator.previous_page_path -%}
|
||||
{%- assign _href = __return -%}
|
||||
<li><a class="button button--secondary button--circle" href="{{ _href }}">
|
||||
<i class="fas fa-angle-left"></i>
|
||||
</a></li>
|
||||
{%- else -%}
|
||||
<li><div class="button button--secondary button--circle disabled">
|
||||
<i class="fas fa-angle-left"></i>
|
||||
</div></li>
|
||||
{%- endif -%}
|
||||
|
||||
{%- for page in (1.._length) -%}
|
||||
{%- if page == _cur -%}
|
||||
<li>
|
||||
<div class="button button--primary button--circle focus"><span>{{ page }}</span></div>
|
||||
</li>
|
||||
|
||||
{%- elsif page == 1 -%}
|
||||
{%- assign _home_path = site.paths.home | default: site.data.variables.default.paths.home -%}
|
||||
{%- include snippets/prepend-baseurl.html path=_home_path -%}
|
||||
{%- assign _href = __return -%}
|
||||
<li>
|
||||
<a class="button button--secondary button--circle" href="{{ _href }}"><span>{{ page }}</span></a>
|
||||
</li>
|
||||
|
||||
{%- else -%}
|
||||
{%- if _n0 and _n1 -%}
|
||||
{%- if page > 1 and page < _n0 -%}
|
||||
{%- if page == 2 -%}<li><span class="pagination__omit"><i class="fas fa-ellipsis-h"></i></span></li>{%- endif -%}
|
||||
{%- elsif page > _n1 and page < _length -%}
|
||||
{%- if page == _length_mimus_one -%}<li><span class="pagination__omit"><i class="fas fa-ellipsis-h"></i></span></li>{%- endif -%}
|
||||
{%- else -%}
|
||||
{%- include snippets/prepend-baseurl.html path=site.paginate_path -%}
|
||||
{%- assign _href = __return -%}
|
||||
<li>
|
||||
<a class="button button--secondary button--circle" href="{{ _href | replace: ':num', page }}"><span>{{ page }}</span></a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{%- else -%}
|
||||
{%- include snippets/prepend-baseurl.html path=site.paginate_path -%}
|
||||
{%- assign _href = __return -%}
|
||||
<li>
|
||||
<a class="button button--secondary button--circle" href="{{ _href | replace: ':num', page }}"><span>{{ page }}</span></a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
||||
{%- if paginator.next_page -%}
|
||||
{%- include snippets/prepend-baseurl.html path=paginator.next_page_path -%}
|
||||
{%- assign _href = __return -%}
|
||||
<li><a class="button button--secondary button--circle" href="{{ _href }}">
|
||||
<i class="fas fa-angle-right"></i>
|
||||
</a></li>
|
||||
{%- else -%}
|
||||
<li><div class="button button--secondary button--circle disabled">
|
||||
<i class="fas fa-angle-right"></i>
|
||||
</div></li>
|
||||
{%- endif -%}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{%- endif -%}
|
|
@ -0,0 +1,135 @@
|
|||
(function() {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
function queryString() {
|
||||
// This function is anonymous, is executed immediately and
|
||||
// the return value is assigned to QueryString!
|
||||
var i = 0, queryObj = {}, pair;
|
||||
var queryStr = window.location.search.substring(1);
|
||||
var queryArr = queryStr.split('&');
|
||||
for (i = 0; i < queryArr.length; i++) {
|
||||
pair = queryArr[i].split('=');
|
||||
// If first entry with this name
|
||||
if (typeof queryObj[pair[0]] === 'undefined') {
|
||||
queryObj[pair[0]] = pair[1];
|
||||
// If second entry with this name
|
||||
} else if (typeof queryObj[pair[0]] === 'string') {
|
||||
queryObj[pair[0]] = [queryObj[pair[0]], pair[1]];
|
||||
// If third or later entry with this name
|
||||
} else {
|
||||
queryObj[pair[0]].push(pair[1]);
|
||||
}
|
||||
}
|
||||
return queryObj;
|
||||
}
|
||||
|
||||
var setUrlQuery = (function() {
|
||||
var baseUrl = window.location.href.split('?')[0];
|
||||
return function(query) {
|
||||
if (typeof query === 'string') {
|
||||
window.history.replaceState(null, '', baseUrl + query);
|
||||
} else {
|
||||
window.history.replaceState(null, '', baseUrl);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
var $tags = $('.js-tags');
|
||||
var $articleTags = $tags.find('button');
|
||||
var $tagShowAll = $tags.find('.tag-button--all');
|
||||
var $result = $('.js-result');
|
||||
var $sections = $result.find('section');
|
||||
var sectionArticles = [];
|
||||
var $lastFocusButton = null;
|
||||
var sectionTopArticleIndex = [];
|
||||
var hasInit = false;
|
||||
|
||||
$sections.each(function() {
|
||||
sectionArticles.push($(this).find('.item'));
|
||||
});
|
||||
|
||||
function init() {
|
||||
var i, index = 0;
|
||||
for (i = 0; i < $sections.length; i++) {
|
||||
sectionTopArticleIndex.push(index);
|
||||
index += $sections.eq(i).find('.item').length;
|
||||
}
|
||||
sectionTopArticleIndex.push(index);
|
||||
}
|
||||
|
||||
function searchButtonsByTag(_tag/*raw tag*/) {
|
||||
if (!_tag) {
|
||||
return $tagShowAll;
|
||||
}
|
||||
var _buttons = $articleTags.filter('[data-encode="' + _tag + '"]');
|
||||
if (_buttons.length === 0) {
|
||||
return $tagShowAll;
|
||||
}
|
||||
return _buttons;
|
||||
}
|
||||
function buttonFocus(target) {
|
||||
if (target) {
|
||||
target.addClass('focus');
|
||||
$lastFocusButton && !$lastFocusButton.is(target) && $lastFocusButton.removeClass('focus');
|
||||
$lastFocusButton = target;
|
||||
}
|
||||
}
|
||||
|
||||
function tagSelect (tag/*raw tag*/, target) {
|
||||
var result = {}, $articles;
|
||||
var i, j, k, _tag;
|
||||
|
||||
for (i = 0; i < sectionArticles.length; i++) {
|
||||
$articles = sectionArticles[i];
|
||||
for (j = 0; j < $articles.length; j++) {
|
||||
if (tag === '' || tag === undefined) {
|
||||
result[i] || (result[i] = {});
|
||||
result[i][j] = true;
|
||||
} else {
|
||||
var tags = $articles.eq(j).data('tags').split(',');
|
||||
for (k = 0; k < tags.length; k++) {
|
||||
if (tags[k] === tag) {
|
||||
result[i] || (result[i] = {});
|
||||
result[i][j] = true; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < sectionArticles.length; i++) {
|
||||
result[i] && $sections.eq(i).removeClass('d-none');
|
||||
result[i] || $sections.eq(i).addClass('d-none');
|
||||
for (j = 0; j < sectionArticles[i].length; j++) {
|
||||
if (result[i] && result[i][j]) {
|
||||
sectionArticles[i].eq(j).removeClass('d-none');
|
||||
} else {
|
||||
sectionArticles[i].eq(j).addClass('d-none');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hasInit || ($result.removeClass('d-none'), hasInit = true);
|
||||
|
||||
|
||||
if (target) {
|
||||
buttonFocus(target);
|
||||
_tag = target.attr('data-encode');
|
||||
if (_tag === '' || typeof _tag !== 'string') {
|
||||
setUrlQuery();
|
||||
} else {
|
||||
setUrlQuery('?tag=' + _tag);
|
||||
}
|
||||
} else {
|
||||
buttonFocus(searchButtonsByTag(tag));
|
||||
}
|
||||
}
|
||||
|
||||
var query = queryString(), _tag = query.tag;
|
||||
init(); tagSelect(_tag);
|
||||
$tags.on('click', 'button', function() {
|
||||
tagSelect($(this).data('encode'), $(this));
|
||||
});
|
||||
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,24 @@
|
|||
(function() {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
$(function() {
|
||||
var $this ,$scroll;
|
||||
var $articleContent = $('.js-article-content');
|
||||
var hasSidebar = $('.js-page-root').hasClass('layout--page--sidebar');
|
||||
var scroll = hasSidebar ? '.js-page-main' : 'html, body';
|
||||
$scroll = $(scroll);
|
||||
|
||||
$articleContent.find('.highlight').each(function() {
|
||||
$this = $(this);
|
||||
$this.attr('data-lang', $this.find('code').attr('data-lang'));
|
||||
});
|
||||
$articleContent.find('h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]').each(function() {
|
||||
$this = $(this);
|
||||
$this.append($('<a class="anchor d-print-none" aria-hidden="true"></a>').html('<i class="fas fa-anchor"></i>'));
|
||||
});
|
||||
$articleContent.on('click', '.anchor', function() {
|
||||
$scroll.scrollToAnchor('#' + $(this).parent().attr('id'), 400);
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,26 @@
|
|||
(function() {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
var $window = $(window), $pageFooter = $('.js-page-footer');
|
||||
var $pageAside = $('.js-page-aside');
|
||||
var affix;
|
||||
var tocDisabled = false;
|
||||
var hasSidebar = $('.js-page-root').hasClass('layout--page--sidebar');
|
||||
|
||||
affix = $pageAside.affix({
|
||||
offsetBottom: $pageFooter.outerHeight(),
|
||||
scrollTarget: hasSidebar ? '.js-page-main' : null,
|
||||
scroller: hasSidebar ? '.js-page-main' : null,
|
||||
scroll: hasSidebar ? $('.js-page-main').children() : null,
|
||||
disabled: tocDisabled
|
||||
});
|
||||
|
||||
$window.on('resize', window.throttle(function() {
|
||||
affix && affix.setOptions({
|
||||
disabled: tocDisabled
|
||||
});
|
||||
}, 100));
|
||||
|
||||
window.pageAsideAffix = affix;
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,35 @@
|
|||
(function() {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
var TOC_SELECTOR = window.TEXT_VARIABLES.site.toc.selectors;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
var $window = $(window);
|
||||
var $articleContent = $('.js-article-content');
|
||||
var $tocRoot = $('.js-toc-root'), $col2 = $('.js-col-aside');
|
||||
var toc;
|
||||
var tocDisabled = false;
|
||||
var hasSidebar = $('.js-page-root').hasClass('layout--page--sidebar');
|
||||
var hasToc = $articleContent.find(TOC_SELECTOR).length > 0;
|
||||
|
||||
function disabled() {
|
||||
return $col2.css('display') === 'none' || !hasToc;
|
||||
}
|
||||
|
||||
tocDisabled = disabled();
|
||||
|
||||
toc = $tocRoot.toc({
|
||||
selectors: TOC_SELECTOR,
|
||||
container: $articleContent,
|
||||
scrollTarget: hasSidebar ? '.js-page-main' : null,
|
||||
scroller: hasSidebar ? '.js-page-main' : null,
|
||||
disabled: tocDisabled
|
||||
});
|
||||
|
||||
$window.on('resize', window.throttle(function() {
|
||||
tocDisabled = disabled();
|
||||
toc && toc.setOptions({
|
||||
disabled: tocDisabled
|
||||
});
|
||||
}, 100));
|
||||
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,7 @@
|
|||
(function () {
|
||||
var $root = document.getElementsByClassName('root')[0];
|
||||
if (window.hasEvent('touchstart')) {
|
||||
$root.dataset.isTouch = true;
|
||||
document.addEventListener('touchstart', function(){}, false);
|
||||
}
|
||||
})();
|
|
@ -0,0 +1,49 @@
|
|||
{%- include scripts/utils/imagesLoad.js -%}
|
||||
(function () {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
var $pageGalleryModal = $('.js-page-gallery-modal');
|
||||
var $images = $('.page__content').find('img:not(.lightbox-ignore)');
|
||||
window.imagesLoad($images).then(function() {
|
||||
/* global Gallery */
|
||||
var pageGalleryModal = $pageGalleryModal.modal({ onChange: handleModalChange });
|
||||
var gallery = null;
|
||||
var modalVisible = false;
|
||||
var i, items = [], image, item;
|
||||
if($images && $images.length > 0) {
|
||||
for (i = 0; i < $images.length; i++) {
|
||||
image = $images.eq(i);
|
||||
if (image.get(0).naturalWidth > 800) {
|
||||
items.push({ src: image.attr('src'), w: image.get(0).naturalWidth, h: image.get(0).naturalHeight, $el: image});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(items.length > 0) {
|
||||
gallery = new Gallery('.gallery', items);
|
||||
gallery.setOptions({ disabled: !modalVisible });
|
||||
gallery.init();
|
||||
for (i = 0; i < items.length; i++) {
|
||||
item = items[i];
|
||||
item.$el && (item.$el.addClass('popup-image'), item.$el.on('click', (function() {
|
||||
var index = i;
|
||||
return function() {
|
||||
pageGalleryModal.show();
|
||||
gallery.setOptions({ initialSlide: index });
|
||||
gallery.refresh(true, { animation: false });
|
||||
};
|
||||
})()));
|
||||
}
|
||||
}
|
||||
|
||||
function handleModalChange(visible) {
|
||||
modalVisible = visible;
|
||||
gallery && gallery.setOptions({ disabled: !modalVisible });
|
||||
}
|
||||
|
||||
$pageGalleryModal.on('click', function() {
|
||||
pageGalleryModal.hide();
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,86 @@
|
|||
|
||||
(function () {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
// search panel
|
||||
var search = (window.search || (window.search = {}));
|
||||
var useDefaultSearchBox = window.useDefaultSearchBox === undefined ?
|
||||
true : window.useDefaultSearchBox ;
|
||||
|
||||
var $searchModal = $('.js-page-search-modal');
|
||||
var $searchToggle = $('.js-search-toggle');
|
||||
var searchModal = $searchModal.modal({ onChange: handleModalChange, hideWhenWindowScroll: true });
|
||||
var modalVisible = false;
|
||||
search.searchModal = searchModal;
|
||||
|
||||
var $searchBox = null;
|
||||
var $searchInput = null;
|
||||
var $searchClear = null;
|
||||
|
||||
function getModalVisible() {
|
||||
return modalVisible;
|
||||
}
|
||||
search.getModalVisible = getModalVisible;
|
||||
|
||||
function handleModalChange(visible) {
|
||||
modalVisible = visible;
|
||||
if (visible) {
|
||||
search.onShow && search.onShow();
|
||||
useDefaultSearchBox && $searchInput[0] && $searchInput[0].focus();
|
||||
} else {
|
||||
search.onShow && search.onHide();
|
||||
useDefaultSearchBox && $searchInput[0] && $searchInput[0].blur();
|
||||
setTimeout(function() {
|
||||
useDefaultSearchBox && ($searchInput.val(''), $searchBox.removeClass('not-empty'));
|
||||
search.clear && search.clear();
|
||||
window.pageAsideAffix && window.pageAsideAffix.refresh();
|
||||
}, 400);
|
||||
}
|
||||
}
|
||||
|
||||
$searchToggle.on('click', function() {
|
||||
modalVisible ? searchModal.hide() : searchModal.show();
|
||||
});
|
||||
// Char Code: 83 S, 191 /
|
||||
$(window).on('keyup', function(e) {
|
||||
if (!modalVisible && !window.isFormElement(e.target || e.srcElement) && (e.which === 83 || e.which === 191)) {
|
||||
modalVisible || searchModal.show();
|
||||
}
|
||||
});
|
||||
|
||||
if (useDefaultSearchBox) {
|
||||
$searchBox = $('.js-search-box');
|
||||
$searchInput = $searchBox.children('input');
|
||||
$searchClear = $searchBox.children('.js-icon-clear');
|
||||
search.getSearchInput = function() {
|
||||
return $searchInput.get(0);
|
||||
};
|
||||
search.getVal = function() {
|
||||
return $searchInput.val();
|
||||
};
|
||||
search.setVal = function(val) {
|
||||
$searchInput.val(val);
|
||||
};
|
||||
|
||||
$searchInput.on('focus', function() {
|
||||
$(this).addClass('focus');
|
||||
});
|
||||
$searchInput.on('blur', function() {
|
||||
$(this).removeClass('focus');
|
||||
});
|
||||
$searchInput.on('input', window.throttle(function() {
|
||||
var val = $(this).val();
|
||||
if (val === '' || typeof val !== 'string') {
|
||||
search.clear && search.clear();
|
||||
} else {
|
||||
$searchBox.addClass('not-empty');
|
||||
search.onInputNotEmpty && search.onInputNotEmpty(val);
|
||||
}
|
||||
}, 400));
|
||||
$searchClear.on('click', function() {
|
||||
$searchInput.val(''); $searchBox.removeClass('not-empty');
|
||||
search.clear && search.clear();
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,30 @@
|
|||
(function() {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
var $pageMask = $('.js-page-mask');
|
||||
var $pageRoot = $('.js-page-root');
|
||||
var $sidebarShow = $('.js-sidebar-show');
|
||||
var $sidebarHide = $('.js-sidebar-hide');
|
||||
|
||||
function freeze(e) {
|
||||
if (e.target === $pageMask[0]) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
function stopBodyScrolling(bool) {
|
||||
if (bool === true) {
|
||||
window.addEventListener('touchmove', freeze, { passive: false });
|
||||
} else {
|
||||
window.removeEventListener('touchmove', freeze, { passive: false });
|
||||
}
|
||||
}
|
||||
|
||||
$sidebarShow.on('click', function() {
|
||||
stopBodyScrolling(true); $pageRoot.addClass('show-sidebar');
|
||||
});
|
||||
$sidebarHide.on('click', function() {
|
||||
stopBodyScrolling(false); $pageRoot.removeClass('show-sidebar');
|
||||
});
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,3 @@
|
|||
/*(function () {
|
||||
|
||||
})();*/
|
|
@ -0,0 +1,111 @@
|
|||
(function() {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
function affix(options) {
|
||||
var $root = this, $window = $(window), $scrollTarget, $scroll,
|
||||
offsetBottom = 0, scrollTarget = window, scroll = window.document, disabled = false, isOverallScroller = true,
|
||||
rootTop, rootLeft, rootHeight, scrollBottom, rootBottomTop,
|
||||
hasInit = false, curState;
|
||||
|
||||
function setOptions(options) {
|
||||
var _options = options || {};
|
||||
_options.offsetBottom && (offsetBottom = _options.offsetBottom);
|
||||
_options.scrollTarget && (scrollTarget = _options.scrollTarget);
|
||||
_options.scroll && (scroll = _options.scroll);
|
||||
_options.disabled !== undefined && (disabled = _options.disabled);
|
||||
$scrollTarget = $(scrollTarget);
|
||||
isOverallScroller = window.isOverallScroller($scrollTarget[0]);
|
||||
$scroll = $(scroll);
|
||||
}
|
||||
function preCalc() {
|
||||
top();
|
||||
rootHeight = $root.outerHeight();
|
||||
rootTop = $root.offset().top + (isOverallScroller ? 0 : $scrollTarget.scrollTop());
|
||||
rootLeft = $root.offset().left;
|
||||
}
|
||||
function calc(needPreCalc) {
|
||||
needPreCalc && preCalc();
|
||||
scrollBottom = $scroll.outerHeight() - offsetBottom - rootHeight;
|
||||
rootBottomTop = scrollBottom - rootTop;
|
||||
}
|
||||
function top() {
|
||||
if (curState !== 'top') {
|
||||
$root.removeClass('fixed').css({
|
||||
left: 0,
|
||||
top: 0
|
||||
});
|
||||
curState = 'top';
|
||||
}
|
||||
}
|
||||
function fixed() {
|
||||
if (curState !== 'fixed') {
|
||||
$root.addClass('fixed').css({
|
||||
left: rootLeft + 'px',
|
||||
top: 0
|
||||
});
|
||||
curState = 'fixed';
|
||||
}
|
||||
}
|
||||
function bottom() {
|
||||
if (curState !== 'bottom') {
|
||||
$root.removeClass('fixed').css({
|
||||
left: 0,
|
||||
top: rootBottomTop + 'px'
|
||||
});
|
||||
curState = 'bottom';
|
||||
}
|
||||
}
|
||||
function setState() {
|
||||
var scrollTop = $scrollTarget.scrollTop();
|
||||
if (scrollTop >= rootTop && scrollTop <= scrollBottom) {
|
||||
fixed();
|
||||
} else if (scrollTop < rootTop) {
|
||||
top();
|
||||
} else {
|
||||
bottom();
|
||||
}
|
||||
}
|
||||
function init() {
|
||||
if(!hasInit) {
|
||||
var interval, timeout;
|
||||
calc(true); setState();
|
||||
// run calc every 100 millisecond
|
||||
interval = setInterval(function() {
|
||||
calc();
|
||||
}, 100);
|
||||
timeout = setTimeout(function() {
|
||||
clearInterval(interval);
|
||||
}, 45000);
|
||||
window.pageLoad.then(function() {
|
||||
setTimeout(function() {
|
||||
clearInterval(interval);
|
||||
clearTimeout(timeout);
|
||||
}, 3000);
|
||||
});
|
||||
$scrollTarget.on('scroll', function() {
|
||||
disabled || setState();
|
||||
});
|
||||
$window.on('resize', function() {
|
||||
disabled || (calc(true), setState());
|
||||
});
|
||||
hasInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
setOptions(options);
|
||||
if (!disabled) {
|
||||
init();
|
||||
}
|
||||
$window.on('resize', window.throttle(function() {
|
||||
init();
|
||||
}, 200));
|
||||
return {
|
||||
setOptions: setOptions,
|
||||
refresh: function() {
|
||||
calc(true, { animation: false }); setState();
|
||||
}
|
||||
};
|
||||
}
|
||||
$.fn.affix = affix;
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,192 @@
|
|||
(function() {
|
||||
{%- include scripts/lib/swiper.js -%}
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
var template =
|
||||
'<div class="swiper gallery__swiper">' +
|
||||
'<div class="swiper__wrapper">' +
|
||||
'</div>' +
|
||||
'<div class="swiper__button swiper__button--prev fas fa-chevron-left"></div>' +
|
||||
'<div class="swiper__button swiper__button--next fas fa-chevron-right"></div>' +
|
||||
'</div>';
|
||||
function setState($item, zoom, translate) {
|
||||
$item.css('transform', 'scale(' + zoom + ') translate(' + translate.x + 'px,' + translate.y + 'px)');
|
||||
}
|
||||
function Gallery(root, items) {
|
||||
this.$root = $(root);
|
||||
this.$swiper = null;
|
||||
this.$swiperWrapper = null;
|
||||
this.$activeItem = null;
|
||||
this.$items = [];
|
||||
this.contentWidth = 0;
|
||||
this.contentHeight = 0;
|
||||
this.swiper = null;
|
||||
this.items = items;
|
||||
this.disabled = false;
|
||||
this.curIndex = 0;
|
||||
this.touchCenter = null;
|
||||
this.lastTouchCenter = null;
|
||||
this.zoomRect = null;
|
||||
this.lastZoomRect = null;
|
||||
this.lastTranslate = null;
|
||||
this.translate = null;
|
||||
this.lastZoom = 1;
|
||||
this.preZoom = 1;
|
||||
this.zoom = 1;
|
||||
}
|
||||
Gallery.prototype.init = function() {
|
||||
var i, item, items = this.items, size, self = this, touchstartFingerCount = 0;
|
||||
this.$root.append(template);
|
||||
this.$swiper = this.$root.find('.gallery__swiper');
|
||||
this.$swiperWrapper = this.$root.find('.swiper__wrapper');
|
||||
this.contentWidth = this.$swiperWrapper && this.$swiperWrapper.width();
|
||||
this.contentHeight = this.$swiperWrapper && this.$swiperWrapper.height();
|
||||
for (i = 0; i < items.length; i++) {
|
||||
item = items[i];
|
||||
size = this._calculateImageSize(item.w, item.h);
|
||||
this.$items.push($(
|
||||
'<div class="swiper__slide">' +
|
||||
'<div class="gallery-item">' +
|
||||
'<div class="gallery-item__content">' +
|
||||
'<img src="' + item.src + '" style="width:' + size.w + 'px;height:' + size.h + 'px"/>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
));
|
||||
}
|
||||
this.$swiperWrapper && this.$swiperWrapper.append(this.$items);
|
||||
this.swiper = this.$swiper && this.$swiper.swiper({
|
||||
onChangeEnd: function() {
|
||||
self._handleChangeEnd.apply(self, Array.prototype.slice.call(arguments));
|
||||
}
|
||||
});
|
||||
$(window).on('resize', function() {
|
||||
if (self.disabled) { return; }
|
||||
self._resizeImageSize();
|
||||
});
|
||||
// Char Code: 37 ⬅, 39 ➡
|
||||
$(window).on('keyup', function(e) {
|
||||
if (window.isFormElement(e.target || e.srcElement) || self.disabled) { return; }
|
||||
if (e.which === 37) {
|
||||
self.swiper && self.swiper.previous();
|
||||
} else if (e.which === 39) {
|
||||
self.swiper && self.swiper.next();
|
||||
}
|
||||
});
|
||||
function getRect(touch0, touch1) {
|
||||
return {
|
||||
o: {
|
||||
x: (touch0.pageX + touch1.pageX) / 2,
|
||||
y: (touch0.pageY + touch1.pageY) / 2
|
||||
},
|
||||
w: Math.abs(touch0.pageX - touch1.pageX),
|
||||
h: Math.abs(touch0.pageY - touch1.pageY)
|
||||
};
|
||||
}
|
||||
function getTouches(e) {
|
||||
return e.touches || e;
|
||||
}
|
||||
function getTouchesCount(e) {
|
||||
if (e.touches) {
|
||||
return e.touches.length;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
this.$swiperWrapper.on('touchstart', function(e) {
|
||||
var touch0, touch1, rect;
|
||||
touchstartFingerCount = getTouchesCount(e);
|
||||
if (touchstartFingerCount > 1) {
|
||||
touch0 = e.touches[0];
|
||||
touch1 = e.touches[1];
|
||||
rect = getRect(touch0, touch1);
|
||||
self.lastZoomRect = { w: rect.w, h: rect.h };
|
||||
self.lastTouchCenter = rect.o;
|
||||
} else {
|
||||
var touch = getTouches(e)[0];
|
||||
self.lastTouchCenter = { x: touch.pageX, y: touch.pageY };
|
||||
}
|
||||
});
|
||||
this.$swiperWrapper.on('touchmove', function(e) {
|
||||
if (touchstartFingerCount === getTouchesCount(e)) {
|
||||
if (touchstartFingerCount > 1) {
|
||||
var touch0 = e.touches[0];
|
||||
var touch1 = e.touches[1];
|
||||
var rect = getRect(touch0, touch1);
|
||||
self.zoomRect = { w: rect.w, h: rect.h };
|
||||
self.touchCenter = rect.o;
|
||||
self._zoom(); self._translate();
|
||||
setState(self.$activeItem, self.zoom, self.translate);
|
||||
} else {
|
||||
var touch = getTouches(e)[0];
|
||||
self.touchCenter = { x: touch.pageX, y: touch.pageY };
|
||||
self._translate();
|
||||
setState(self.$activeItem, self.zoom, self.translate);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.$swiperWrapper.on('touchend', function(e) {
|
||||
self.lastZoom = self.zoom;
|
||||
self.lastTranslate = self.translate;
|
||||
touchstartFingerCount = 0;
|
||||
});
|
||||
this.$root.on('touchmove', function(e) {
|
||||
if (self.disabled) { return; }
|
||||
e.preventDefault();
|
||||
});
|
||||
};
|
||||
|
||||
Gallery.prototype._translate = function() {
|
||||
this.translate = this.touchCenter && this.lastTouchCenter && this.lastTranslate ? {
|
||||
x: (this.touchCenter.x - this.lastTouchCenter.x) / this.zoom + this.lastTranslate.x,
|
||||
y: (this.touchCenter.y - this.lastTouchCenter.y) / this.zoom + this.lastTranslate.y
|
||||
} : { x: 0, y: 0 };
|
||||
}
|
||||
Gallery.prototype._zoom = function() {
|
||||
this.zoom = (this.zoomRect.w + this.zoomRect.h) / (this.lastZoomRect.w + this.lastZoomRect.h) * this.lastZoom;
|
||||
this.zoom > 1 ? this.$activeItem.addClass('zoom') : this.$activeItem.removeClass('zoom');
|
||||
this.preZoom = this.zoom;
|
||||
}
|
||||
|
||||
Gallery.prototype._calculateImageSize = function(w, h) {
|
||||
var scale = 1;
|
||||
if (this.contentWidth > 0 && this.contentHeight > 0 && w > 0 && h > 0) {
|
||||
scale = Math.min(
|
||||
Math.min(w, this.contentWidth) / w,
|
||||
Math.min(h, this.contentHeight) / h);
|
||||
}
|
||||
return { w: Math.floor(w * scale), h: Math.floor(h * scale) };
|
||||
};
|
||||
|
||||
Gallery.prototype._resizeImageSize = function() {
|
||||
var i, $item, $items = this.$items, item, size;
|
||||
this.contentWidth = this.$swiperWrapper && this.$swiperWrapper.width();
|
||||
this.contentHeight = this.$swiperWrapper && this.$swiperWrapper.height();
|
||||
if ($items.length < 1) { return; }
|
||||
for (i = 0; i < $items.length; i++) {
|
||||
item = this.items[i], $item = $items[i];
|
||||
size = this._calculateImageSize(item.w, item.h);
|
||||
item.width = size.w; item.height = size.h;
|
||||
$item && $item.find('img').css({ width: size.w, height: size.h });
|
||||
}
|
||||
};
|
||||
Gallery.prototype._handleChangeEnd = function(index, $dom, preIndex, $preDom) {
|
||||
this.curIndex = index;
|
||||
this.lastZoomRect = null; this.lastZoomRect = null;
|
||||
this.lastTranslate = this.translate = { x: 0, y:0 };
|
||||
this.lastZoom = this.preZoom = this.zoom = 1;
|
||||
this.$activeItem = $dom.find('.gallery-item__content');
|
||||
setState($preDom.find('.gallery-item__content'), this.zoom, this.translate);
|
||||
};
|
||||
|
||||
Gallery.prototype.refresh = function() {
|
||||
this.swiper && this.swiper.refresh();
|
||||
this._resizeImageSize();
|
||||
};
|
||||
Gallery.prototype.setOptions = function(options) {
|
||||
this.disabled = options.disabled;
|
||||
this.swiper && this.swiper.setOptions(options);
|
||||
};
|
||||
window.Gallery = Gallery;
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,143 @@
|
|||
(function() {
|
||||
var Set = (function() {
|
||||
var add = function(item) {
|
||||
var i, data = this._data;
|
||||
for (i = 0; i < data.length; i++) {
|
||||
if (data[i] === item) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.size ++;
|
||||
data.push(item);
|
||||
return data;
|
||||
};
|
||||
|
||||
var Set = function(data) {
|
||||
this.size = 0;
|
||||
this._data = [];
|
||||
var i;
|
||||
if (data.length > 0) {
|
||||
for (i = 0; i < data.length; i++) {
|
||||
add.call(this, data[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
Set.prototype.add = add;
|
||||
Set.prototype.get = function(index) { return this._data[index]; };
|
||||
Set.prototype.has = function(item) {
|
||||
var i, data = this._data;
|
||||
for (i = 0; i < data.length; i++) {
|
||||
if (this.get(i) === item) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
Set.prototype.is = function(map) {
|
||||
if (map._data.length !== this._data.length) { return false; }
|
||||
var i, j, flag, tData = this._data, mData = map._data;
|
||||
for (i = 0; i < tData.length; i++) {
|
||||
for (flag = false, j = 0; j < mData.length; j++) {
|
||||
if (tData[i] === mData[j]) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) { return false; }
|
||||
}
|
||||
return true;
|
||||
};
|
||||
Set.prototype.values = function() {
|
||||
return this._data;
|
||||
};
|
||||
return Set;
|
||||
})();
|
||||
|
||||
window.Lazyload = (function(doc) {
|
||||
var queue = {js: [], css: []}, sources = {js: {}, css: {}}, context = this;
|
||||
var createNode = function(name, attrs) {
|
||||
var node = doc.createElement(name), attr;
|
||||
for (attr in attrs) {
|
||||
if (attrs.hasOwnProperty(attr)) {
|
||||
node.setAttribute(attr, attrs[attr]);
|
||||
}
|
||||
}
|
||||
return node;
|
||||
};
|
||||
var end = function(type, url) {
|
||||
var s, q, qi, cbs, i, j, cur, val, flag;
|
||||
if (type === 'js' || type ==='css') {
|
||||
s = sources[type], q = queue[type];
|
||||
s[url] = true;
|
||||
for (i = 0; i < q.length; i++) {
|
||||
cur = q[i];
|
||||
if (cur.urls.has(url)) {
|
||||
qi = cur, val = qi.urls.values();
|
||||
qi && (cbs = qi.callbacks);
|
||||
for (flag = true, j = 0; j < val.length; j++) {
|
||||
cur = val[j];
|
||||
if (!s[cur]) {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
if (flag && cbs && cbs.length > 0) {
|
||||
for (j = 0; j < cbs.length; j++) {
|
||||
cbs[j].call(context);
|
||||
}
|
||||
qi.load = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var load = function(type, urls, callback) {
|
||||
var s, q, qi, node, i, cur,
|
||||
_urls = typeof urls === 'string' ? new Set([urls]) : new Set(urls), val, url;
|
||||
if (type === 'js' || type ==='css') {
|
||||
s = sources[type], q = queue[type];
|
||||
for (i = 0; i < q.length; i++) {
|
||||
cur = q[i];
|
||||
if (_urls.is(cur.urls)) {
|
||||
qi = cur;
|
||||
break;
|
||||
}
|
||||
}
|
||||
val = _urls.values();
|
||||
if (qi) {
|
||||
callback && (qi.load || qi.callbacks.push(callback));
|
||||
callback && (qi.load && callback());
|
||||
} else {
|
||||
q.push({
|
||||
urls: _urls,
|
||||
callbacks: callback ? [callback] : [],
|
||||
load: false
|
||||
});
|
||||
for (i = 0; i < val.length; i++) {
|
||||
node = null, url = val[i];
|
||||
if (s[url] === undefined) {
|
||||
(type === 'js' ) && (node = createNode('script', { src: url }));
|
||||
(type === 'css') && (node = createNode('link', { rel: 'stylesheet', href: url }));
|
||||
if (node) {
|
||||
node.onload = (function(type, url) {
|
||||
return function() {
|
||||
end(type, url);
|
||||
};
|
||||
})(type, url);
|
||||
(doc.head || doc.body).appendChild(node);
|
||||
s[url] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return {
|
||||
js: function(url, callback) {
|
||||
load('js', url, callback);
|
||||
},
|
||||
css: function(url, callback) {
|
||||
load('css', url, callback);
|
||||
}
|
||||
};
|
||||
})(this.document);
|
||||
})();
|
|
@ -0,0 +1,64 @@
|
|||
(function() {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
var $body = $('body'), $window = $(window);
|
||||
var $pageRoot = $('.js-page-root'), $pageMain = $('.js-page-main');
|
||||
var activeCount = 0;
|
||||
function modal(options) {
|
||||
var $root = this, visible, onChange, hideWhenWindowScroll = false;
|
||||
var scrollTop;
|
||||
function setOptions(options) {
|
||||
var _options = options || {};
|
||||
visible = _options.initialVisible === undefined ? false : show;
|
||||
onChange = _options.onChange;
|
||||
hideWhenWindowScroll = _options.hideWhenWindowScroll;
|
||||
}
|
||||
function init() {
|
||||
setState(visible);
|
||||
}
|
||||
function setState(isShow) {
|
||||
if (isShow === visible) {
|
||||
return;
|
||||
}
|
||||
visible = isShow;
|
||||
if (visible) {
|
||||
activeCount++;
|
||||
scrollTop = $(window).scrollTop() || $pageMain.scrollTop();
|
||||
$root.addClass('modal--show');
|
||||
$pageMain.scrollTop(scrollTop);
|
||||
activeCount === 1 && ($pageRoot.addClass('show-modal'), $body.addClass('of-hidden'));
|
||||
hideWhenWindowScroll && window.hasEvent('touchstart') && $window.on('scroll', hide);
|
||||
$window.on('keyup', handleKeyup);
|
||||
} else {
|
||||
activeCount > 0 && activeCount--;
|
||||
$root.removeClass('modal--show');
|
||||
$window.scrollTop(scrollTop);
|
||||
activeCount === 0 && ($pageRoot.removeClass('show-modal'), $body.removeClass('of-hidden'));
|
||||
hideWhenWindowScroll && window.hasEvent('touchstart') && $window.off('scroll', hide);
|
||||
$window.off('keyup', handleKeyup);
|
||||
}
|
||||
onChange && onChange(visible);
|
||||
}
|
||||
function show() {
|
||||
setState(true);
|
||||
}
|
||||
function hide() {
|
||||
setState(false);
|
||||
}
|
||||
function handleKeyup(e) {
|
||||
// Char Code: 27 ESC
|
||||
if (e.which === 27) {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
setOptions(options);
|
||||
init();
|
||||
return {
|
||||
show: show,
|
||||
hide: hide,
|
||||
$el: $root
|
||||
};
|
||||
}
|
||||
$.fn.modal = modal;
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,13 @@
|
|||
(function() {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
function scrollToAnchor(anchor, duration, callback) {
|
||||
var $root = this;
|
||||
$root.animate({ scrollTop: $(anchor).position().top }, duration, function() {
|
||||
window.history.replaceState(null, '', window.location.href.split('#')[0] + anchor);
|
||||
callback && callback();
|
||||
});
|
||||
}
|
||||
$.fn.scrollToAnchor = scrollToAnchor;
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,203 @@
|
|||
(function() {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
function swiper(options) {
|
||||
var $window = $(window), $root = this, $swiperWrapper, $swiperSlides, $swiperButtonPrev, $swiperButtonNext,
|
||||
initialSlide, animation, onChange, onChangeEnd,
|
||||
rootWidth, count, preIndex, curIndex, translateX, CRITICAL_ANGLE = Math.PI / 3;
|
||||
|
||||
function setOptions(options) {
|
||||
var _options = options || {};
|
||||
initialSlide = _options.initialSlide || 0;
|
||||
animation = _options.animation === undefined && true;
|
||||
onChange = onChange || _options.onChange;
|
||||
onChangeEnd = onChangeEnd || _options.onChangeEnd;
|
||||
}
|
||||
|
||||
function init() {
|
||||
$swiperWrapper = $root.find('.swiper__wrapper');
|
||||
$swiperSlides = $root.find('.swiper__slide');
|
||||
$swiperButtonPrev = $root.find('.swiper__button--prev');
|
||||
$swiperButtonNext = $root.find('.swiper__button--next');
|
||||
animation && $swiperWrapper.addClass('swiper__wrapper--animation');
|
||||
calc(true);
|
||||
}
|
||||
|
||||
function preCalc() {
|
||||
rootWidth = $root.width();
|
||||
count = $swiperWrapper.children('.swiper__slide').length;
|
||||
if (count < 2) {
|
||||
$swiperButtonPrev.addClass('d-none');
|
||||
$swiperButtonNext.addClass('d-none');
|
||||
}
|
||||
curIndex = initialSlide || 0;
|
||||
translateX = getTranslateXFromCurIndex();
|
||||
}
|
||||
|
||||
var calc = (function() {
|
||||
var preAnimation, $swiperSlide, $preSwiperSlide;
|
||||
return function (needPreCalc, params) {
|
||||
needPreCalc && preCalc();
|
||||
var _animation = (params && params.animation !== undefined) ? params.animation : animation;
|
||||
if (preAnimation === undefined || preAnimation !== _animation) {
|
||||
preAnimation = _animation ? $swiperWrapper.addClass('swiper__wrapper--animation') :
|
||||
$swiperWrapper.removeClass('swiper__wrapper--animation');
|
||||
}
|
||||
if (preIndex !== curIndex) {
|
||||
($preSwiperSlide = $swiperSlides.eq(preIndex)).removeClass('active');
|
||||
($swiperSlide = $swiperSlides.eq(curIndex)).addClass('active');
|
||||
onChange && onChange(curIndex, $swiperSlides.eq(curIndex), $swiperSlide, $preSwiperSlide);
|
||||
if (onChangeEnd) {
|
||||
if (_animation) {
|
||||
setTimeout(function() {
|
||||
onChangeEnd(curIndex, $swiperSlides.eq(curIndex), $swiperSlide, $preSwiperSlide);
|
||||
}, 400);
|
||||
} else {
|
||||
onChangeEnd(curIndex, $swiperSlides.eq(curIndex), $swiperSlide, $preSwiperSlide);
|
||||
}
|
||||
}
|
||||
preIndex = curIndex;
|
||||
}
|
||||
$swiperWrapper.css('transform', 'translate(' + translateX + 'px, 0)');
|
||||
if (count > 1) {
|
||||
if (curIndex <= 0) {
|
||||
$swiperButtonPrev.addClass('disabled');
|
||||
} else {
|
||||
$swiperButtonPrev.removeClass('disabled');
|
||||
}
|
||||
if (curIndex >= count - 1) {
|
||||
$swiperButtonNext.addClass('disabled');
|
||||
} else {
|
||||
$swiperButtonNext.removeClass('disabled');
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
function getTranslateXFromCurIndex() {
|
||||
return curIndex <= 0 ? 0 : - rootWidth * curIndex;
|
||||
}
|
||||
|
||||
function moveToIndex(index ,params) {
|
||||
preIndex = curIndex;
|
||||
curIndex = index;
|
||||
translateX = getTranslateXFromCurIndex();
|
||||
calc(false, params);
|
||||
}
|
||||
|
||||
function move(type) {
|
||||
var nextIndex = curIndex, unstableTranslateX;
|
||||
if (type === 'prev') {
|
||||
nextIndex > 0 && nextIndex--;
|
||||
} else if (type === 'next') {
|
||||
nextIndex < count - 1 && nextIndex++;
|
||||
}
|
||||
if (type === 'cur') {
|
||||
moveToIndex(curIndex, { animation: true });
|
||||
return;
|
||||
}
|
||||
unstableTranslateX = translateX % rootWidth !== 0;
|
||||
if (nextIndex !== curIndex || unstableTranslateX) {
|
||||
unstableTranslateX ? moveToIndex(nextIndex, { animation: true }) : moveToIndex(nextIndex);
|
||||
}
|
||||
}
|
||||
|
||||
setOptions(options);
|
||||
init();
|
||||
preIndex = curIndex;
|
||||
|
||||
$swiperButtonPrev.on('click', function(e) {
|
||||
e.stopPropagation();
|
||||
move('prev');
|
||||
});
|
||||
$swiperButtonNext.on('click', function(e) {
|
||||
e.stopPropagation();
|
||||
move('next');
|
||||
});
|
||||
$window.on('resize', function() {
|
||||
calc(true, { animation: false });
|
||||
});
|
||||
|
||||
(function() {
|
||||
var pageX, pageY, velocityX, preTranslateX = translateX, timeStamp, touching;
|
||||
function handleTouchstart(e) {
|
||||
var point = e.touches ? e.touches[0] : e;
|
||||
pageX = point.pageX;
|
||||
pageY = point.pageY;
|
||||
velocityX = 0;
|
||||
preTranslateX = translateX;
|
||||
}
|
||||
function handleTouchmove(e) {
|
||||
if (e.touches && e.touches.length > 1) {
|
||||
return;
|
||||
}
|
||||
var point = e.touches ? e.touches[0] : e;
|
||||
var deltaX = point.pageX - pageX;
|
||||
var deltaY = point.pageY - pageY;
|
||||
velocityX = deltaX / (e.timeStamp - timeStamp);
|
||||
timeStamp = e.timeStamp;
|
||||
if (e.cancelable && Math.abs(Math.atan(deltaY / deltaX)) < CRITICAL_ANGLE) {
|
||||
touching = true;
|
||||
translateX += deltaX;
|
||||
calc(false, { animation: false });
|
||||
}
|
||||
pageX = point.pageX;
|
||||
pageY = point.pageY;
|
||||
}
|
||||
function handleTouchend() {
|
||||
touching = false;
|
||||
var deltaX = translateX - preTranslateX;
|
||||
var distance = deltaX + velocityX * rootWidth;
|
||||
if (Math.abs(distance) > rootWidth / 2) {
|
||||
distance > 0 ? move('prev') : move('next');
|
||||
} else {
|
||||
move('cur');
|
||||
}
|
||||
}
|
||||
$swiperWrapper.on('touchstart', handleTouchstart);
|
||||
$swiperWrapper.on('touchmove', handleTouchmove);
|
||||
$swiperWrapper.on('touchend', handleTouchend);
|
||||
$swiperWrapper.on('touchcancel', handleTouchend);
|
||||
|
||||
(function() {
|
||||
var pressing = false, moved = false;
|
||||
$swiperWrapper.on('mousedown', function(e) {
|
||||
pressing = true; handleTouchstart(e);
|
||||
});
|
||||
$swiperWrapper.on('mousemove', function(e) {
|
||||
pressing && (e.preventDefault(), moved = true, handleTouchmove(e));
|
||||
});
|
||||
$swiperWrapper.on('mouseup', function(e) {
|
||||
pressing && (pressing = false, handleTouchend(e));
|
||||
});
|
||||
$swiperWrapper.on('mouseleave', function(e) {
|
||||
pressing && (pressing = false, handleTouchend(e));
|
||||
});
|
||||
$swiperWrapper.on('click', function(e) {
|
||||
moved && (e.stopPropagation(), moved = false);
|
||||
});
|
||||
})();
|
||||
|
||||
$root.on('touchmove', function(e) {
|
||||
if (e.cancelable & touching) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
return {
|
||||
setOptions: setOptions,
|
||||
previous: function(){
|
||||
move('prev');
|
||||
},
|
||||
next: function(){
|
||||
move('next');
|
||||
},
|
||||
refresh: function() {
|
||||
calc(true, { animation: false });
|
||||
}
|
||||
};
|
||||
}
|
||||
$.fn.swiper = swiper;
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,28 @@
|
|||
(function() {
|
||||
window.throttle = function(func, wait) {
|
||||
var args, result, thisArg, timeoutId, lastCalled = 0;
|
||||
|
||||
function trailingCall() {
|
||||
lastCalled = new Date;
|
||||
timeoutId = null;
|
||||
result = func.apply(thisArg, args);
|
||||
}
|
||||
return function() {
|
||||
var now = new Date,
|
||||
remaining = wait - (now - lastCalled);
|
||||
|
||||
args = arguments;
|
||||
thisArg = this;
|
||||
|
||||
if (remaining <= 0) {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
lastCalled = now;
|
||||
result = func.apply(thisArg, args);
|
||||
} else if (!timeoutId) {
|
||||
timeoutId = setTimeout(trailingCall, remaining);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
};
|
||||
})();
|
|
@ -0,0 +1,107 @@
|
|||
(function() {
|
||||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
function toc(options) {
|
||||
var $root = this, $window = $(window), $scrollTarget, $scroller, $tocUl = $('<ul class="toc toc--ellipsis"></ul>'), $tocLi, $headings, $activeLast, $activeCur,
|
||||
selectors = 'h1,h2,h3', container = 'body', scrollTarget = window, scroller = 'html, body', disabled = false,
|
||||
headingsPos, scrolling = false, hasRendered = false, hasInit = false;
|
||||
|
||||
function setOptions(options) {
|
||||
var _options = options || {};
|
||||
_options.selectors && (selectors = _options.selectors);
|
||||
_options.container && (container = _options.container);
|
||||
_options.scrollTarget && (scrollTarget = _options.scrollTarget);
|
||||
_options.scroller && (scroller = _options.scroller);
|
||||
_options.disabled !== undefined && (disabled = _options.disabled);
|
||||
$headings = $(container).find(selectors).filter('[id]');
|
||||
$scrollTarget = $(scrollTarget);
|
||||
$scroller = $(scroller);
|
||||
}
|
||||
function calc() {
|
||||
headingsPos = [];
|
||||
$headings.each(function() {
|
||||
headingsPos.push(Math.floor($(this).position().top));
|
||||
});
|
||||
}
|
||||
function setState(element, disabled) {
|
||||
var scrollTop = $scrollTarget.scrollTop(), i;
|
||||
if (disabled || !headingsPos || headingsPos.length < 1) { return; }
|
||||
if (element) {
|
||||
$activeCur = element;
|
||||
} else {
|
||||
for (i = 0; i < headingsPos.length; i++) {
|
||||
if (scrollTop >= headingsPos[i]) {
|
||||
$activeCur = $tocLi.eq(i);
|
||||
} else {
|
||||
$activeCur || ($activeCur = $tocLi.eq(i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$activeLast && $activeLast.removeClass('active');
|
||||
($activeLast = $activeCur).addClass('active');
|
||||
}
|
||||
function render() {
|
||||
if(!hasRendered) {
|
||||
$root.append($tocUl);
|
||||
$headings.each(function() {
|
||||
var $this = $(this);
|
||||
$tocUl.append($('<li></li>').addClass('toc-' + $this.prop('tagName').toLowerCase())
|
||||
.append($('<a></a>').text($this.text()).attr('href', '#' + $this.prop('id'))));
|
||||
});
|
||||
$tocLi = $tocUl.children('li');
|
||||
$tocUl.on('click', 'a', function(e) {
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
scrolling = true;
|
||||
setState($this.parent());
|
||||
$scroller.scrollToAnchor($this.attr('href'), 400, function() {
|
||||
scrolling = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
hasRendered = true;
|
||||
}
|
||||
function init() {
|
||||
var interval, timeout;
|
||||
if(!hasInit) {
|
||||
render(); calc(); setState(null, scrolling);
|
||||
// run calc every 100 millisecond
|
||||
interval = setInterval(function() {
|
||||
calc();
|
||||
}, 100);
|
||||
timeout = setTimeout(function() {
|
||||
clearInterval(interval);
|
||||
}, 45000);
|
||||
window.pageLoad.then(function() {
|
||||
setTimeout(function() {
|
||||
clearInterval(interval);
|
||||
clearTimeout(timeout);
|
||||
}, 3000);
|
||||
});
|
||||
$scrollTarget.on('scroll', function() {
|
||||
disabled || setState(null, scrolling);
|
||||
});
|
||||
$window.on('resize', window.throttle(function() {
|
||||
if (!disabled) {
|
||||
render(); calc(); setState(null, scrolling);
|
||||
}
|
||||
}, 100));
|
||||
}
|
||||
hasInit = true;
|
||||
}
|
||||
|
||||
setOptions(options);
|
||||
if (!disabled) {
|
||||
init();
|
||||
}
|
||||
$window.on('resize', window.throttle(function() {
|
||||
init();
|
||||
}, 200));
|
||||
return {
|
||||
setOptions: setOptions
|
||||
};
|
||||
}
|
||||
$.fn.toc = toc;
|
||||
});
|
||||
})();
|
|
@ -0,0 +1,3 @@
|
|||
/*(function () {
|
||||
|
||||
})();*/
|
|
@ -0,0 +1,28 @@
|
|||
(function() {
|
||||
window.imagesLoad = function(images) {
|
||||
images = images || document.getElementsByTagName('img');
|
||||
var imagesCount = images.length, loadedCount = 0, image;
|
||||
var i, j, loaded = false, cbs = [];
|
||||
imagesCount < 1 && (loaded = true);
|
||||
for (i = 0; i < imagesCount; i++) {
|
||||
image = images[i];
|
||||
image.complete ? handleImageLoad() : image.addEventListener('load', handleImageLoad);
|
||||
}
|
||||
function handleImageLoad() {
|
||||
loadedCount++;
|
||||
if (loadedCount === imagesCount) {
|
||||
loaded = true;
|
||||
if (cbs.length > 0) {
|
||||
for (j = 0; j < cbs.length; j++) {
|
||||
cbs[j]();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
then: function(cb) {
|
||||
cb && (loaded ? cb() : (cbs.push(cb)));
|
||||
}
|
||||
};
|
||||
};
|
||||
})();
|
|
@ -0,0 +1,39 @@
|
|||
(function() {
|
||||
window.isArray = function(val) {
|
||||
return Object.prototype.toString.call(val) === '[object Array]';
|
||||
};
|
||||
window.isString = function(val) {
|
||||
return typeof val === 'string';
|
||||
};
|
||||
|
||||
window.hasEvent = function(event) {
|
||||
return 'on'.concat(event) in window.document;
|
||||
};
|
||||
|
||||
window.isOverallScroller = function(node) {
|
||||
return node === document.documentElement || node === document.body || node === window;
|
||||
};
|
||||
|
||||
window.isFormElement = function(node) {
|
||||
var tagName = node.tagName;
|
||||
return tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA';
|
||||
};
|
||||
|
||||
window.pageLoad = (function () {
|
||||
var loaded = false, cbs = [];
|
||||
window.addEventListener('load', function () {
|
||||
var i;
|
||||
loaded = true;
|
||||
if (cbs.length > 0) {
|
||||
for (i = 0; i < cbs.length; i++) {
|
||||
cbs[i]();
|
||||
}
|
||||
}
|
||||
});
|
||||
return {
|
||||
then: function(cb) {
|
||||
cb && (loaded ? cb() : (cbs.push(cb)));
|
||||
}
|
||||
};
|
||||
})();
|
||||
})();
|
|
@ -0,0 +1,35 @@
|
|||
{%- include snippets/get-sources.html -%}
|
||||
{%- assign _sources = __return -%}
|
||||
|
||||
{%- include snippets/get-nav-url.html path="/assets/search.js" -%}
|
||||
{%- assign _paths_search_js = __return -%}
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
var TEXT_VARIABLES = {
|
||||
version: '2.2.6',
|
||||
sources: {
|
||||
font_awesome: '{{ _sources.font_awesome }}',
|
||||
jquery: '{{ _sources.jquery }}',
|
||||
leancloud_js_sdk: '{{ _sources.leancloud_js_sdk }}',
|
||||
chart: '{{ _sources.chart }}',
|
||||
gitalk: {
|
||||
js: '{{ _sources.gitalk.js }}',
|
||||
css: '{{ _sources.gitalk.css }}'
|
||||
},
|
||||
valine: '{{ _sources.valine }}',
|
||||
mathjax: '{{ _sources.mathjax }}',
|
||||
mermaid: '{{ _sources.mermaid }}'
|
||||
},
|
||||
site: {
|
||||
toc: {
|
||||
selectors: '{{ site.toc.selectors | default: site.data.variables.default.toc.selectors }}'
|
||||
}
|
||||
},
|
||||
paths: {
|
||||
search_js: '{{ _paths_search_js }}'
|
||||
}
|
||||
};
|
||||
window.TEXT_VARIABLES = TEXT_VARIABLES;
|
||||
})();
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
<!-- start custom search snippet -->
|
||||
|
||||
<!-- end custom search snippet -->
|
|
@ -0,0 +1,14 @@
|
|||
window.TEXT_SEARCH_DATA={
|
||||
{%- for _collection in site.collections -%}
|
||||
{%- unless forloop.first -%},{%- endunless -%}
|
||||
'{{ _collection.label }}':[
|
||||
{%- for _article in _collection.docs -%}
|
||||
{%- unless forloop.first -%},{%- endunless -%}
|
||||
{'title':{{ _article.title | jsonify }},
|
||||
{%- include snippets/prepend-baseurl.html path=_article.url -%}
|
||||
{%- assign _url = __return -%}
|
||||
'url':{{ _url | jsonify }}}
|
||||
{%- endfor -%}
|
||||
]
|
||||
{%- endfor -%}
|
||||
};
|
|
@ -0,0 +1,18 @@
|
|||
<div class="search search--dark">
|
||||
<div class="main">
|
||||
<div class="search__header">{{ _locale_search }}</div>
|
||||
<div class="search-bar">
|
||||
<div class="search-box js-search-box">
|
||||
<div class="search-box__icon-search"><i class="fas fa-search"></i></div>
|
||||
<input type="text" />
|
||||
<div class="search-box__icon-clear js-icon-clear">
|
||||
<a><i class="fas fa-times"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<button class="button button--theme-dark button--pill search__cancel js-search-toggle">
|
||||
{{ _locale_cancel }}</button>
|
||||
</div>
|
||||
<div class="search-result js-search-result"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>{%- include search-providers/default/search.js -%}</script>
|
|
@ -0,0 +1,112 @@
|
|||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
var PAHTS = window.TEXT_VARIABLES.paths;
|
||||
window.Lazyload.js([SOURCES.jquery, PAHTS.search_js], function() {
|
||||
var search = (window.search || (window.search = {}));
|
||||
var searchData = window.TEXT_SEARCH_DATA || {};
|
||||
|
||||
function memorize(f) {
|
||||
var cache = {};
|
||||
return function () {
|
||||
var key = Array.prototype.join.call(arguments, ',');
|
||||
if (key in cache) return cache[key];
|
||||
else return cache[key] = f.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
/// search
|
||||
function searchByQuery(query) {
|
||||
var i, j, key, keys, cur, _title, result = {};
|
||||
keys = Object.keys(searchData);
|
||||
for (i = 0; i < keys.length; i++) {
|
||||
key = keys[i];
|
||||
for (j = 0; j < searchData[key].length; j++) {
|
||||
cur = searchData[key][j], _title = cur.title;
|
||||
if ((result[key] === undefined || result[key] && result[key].length < 4 )
|
||||
&& _title.toLowerCase().indexOf(query.toLowerCase()) >= 0) {
|
||||
if (result[key] === undefined) {
|
||||
result[key] = [];
|
||||
}
|
||||
result[key].push(cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
var renderHeader = memorize(function(header) {
|
||||
return $('<p class="search-result__header">' + header + '</p>');
|
||||
});
|
||||
|
||||
var renderItem = function(index, title, url) {
|
||||
return $('<li class="search-result__item" data-index="' + index + '"><a class="button" href="' + url + '">' + title + '</a></li>');
|
||||
};
|
||||
|
||||
function render(data) {
|
||||
if (!data) { return null; }
|
||||
var $root = $('<ul></ul>'), i, j, key, keys, cur, itemIndex = 0;
|
||||
keys = Object.keys(data);
|
||||
for (i = 0; i < keys.length; i++) {
|
||||
key = keys[i];
|
||||
$root.append(renderHeader(key));
|
||||
for (j = 0; j < data[key].length; j++) {
|
||||
cur = data[key][j];
|
||||
$root.append(renderItem(itemIndex++, cur.title, cur.url));
|
||||
}
|
||||
}
|
||||
return $root;
|
||||
}
|
||||
|
||||
// search box
|
||||
var $result = $('.js-search-result'), $resultItems;
|
||||
var lastActiveIndex, activeIndex;
|
||||
|
||||
function clear() {
|
||||
$result.html(null);
|
||||
$resultItems = $('.search-result__item'); activeIndex = 0;
|
||||
}
|
||||
function onInputNotEmpty(val) {
|
||||
$result.html(render(searchByQuery(val)));
|
||||
$resultItems = $('.search-result__item'); activeIndex = 0;
|
||||
$resultItems.eq(0).addClass('active');
|
||||
}
|
||||
|
||||
search.clear = clear;
|
||||
search.onInputNotEmpty = onInputNotEmpty;
|
||||
|
||||
function updateResultItems() {
|
||||
lastActiveIndex >= 0 && $resultItems.eq(lastActiveIndex).removeClass('active');
|
||||
activeIndex >= 0 && $resultItems.eq(activeIndex).addClass('active');
|
||||
}
|
||||
|
||||
function moveActiveIndex(direction) {
|
||||
var itemsCount = $resultItems ? $resultItems.length : 0;
|
||||
if (itemsCount > 1) {
|
||||
lastActiveIndex = activeIndex;
|
||||
if (direction === 'up') {
|
||||
activeIndex = (activeIndex - 1 + itemsCount) % itemsCount;
|
||||
} else if (direction === 'down') {
|
||||
activeIndex = (activeIndex + 1 + itemsCount) % itemsCount;
|
||||
}
|
||||
updateResultItems();
|
||||
}
|
||||
}
|
||||
|
||||
// Char Code: 13 Enter, 37 ⬅, 38 ⬆, 39 ➡, 40 ⬇
|
||||
$(window).on('keyup', function(e) {
|
||||
var modalVisible = search.getModalVisible && search.getModalVisible();
|
||||
if (modalVisible) {
|
||||
if (e.which === 38) {
|
||||
modalVisible && moveActiveIndex('up');
|
||||
} else if (e.which === 40) {
|
||||
modalVisible && moveActiveIndex('down');
|
||||
} else if (e.which === 13) {
|
||||
modalVisible && $resultItems && activeIndex >= 0 && $resultItems.eq(activeIndex).children('a')[0].click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$result.on('mouseover', '.search-result__item > a', function() {
|
||||
var itemIndex = $(this).parent().data('index');
|
||||
itemIndex >= 0 && (lastActiveIndex = activeIndex, activeIndex = itemIndex, updateResultItems());
|
||||
});
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
{%- if site.search.google.custom_search_engine_id -%}
|
||||
<div class="search search--dark search--google-custom-search-engine">
|
||||
<div class="main">
|
||||
<div class="content js-gcse">
|
||||
<!-- <gcse:search enableAutoComplete="true" gname="search-box"></gcse:search>
|
||||
<gcse:searchresults-only gname="results"></gcse:searchresults-only> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var gcse = document.getElementsByClassName('js-gcse')[0];
|
||||
var gcseSearch = document.createElement('gcse:search');
|
||||
gcseSearch.setAttribute('enableAutoComplete', 'true');
|
||||
gcseSearch.setAttribute('gname', 'search-box');
|
||||
var gcseSearchresults = document.createElement('gcse:searchresults-only');
|
||||
gcseSearchresults.setAttribute('gname', 'results');
|
||||
gcse.appendChild(gcseSearch);
|
||||
gcse.appendChild(gcseSearchresults);
|
||||
</script>
|
||||
<script>{%- include search-providers/google-custom-search-engine/search.js -%}</script>
|
||||
{%- endif -%}
|
|
@ -0,0 +1,33 @@
|
|||
var SOURCES = window.TEXT_VARIABLES.sources;
|
||||
window.Lazyload.js(SOURCES.jquery, function() {
|
||||
/* global google */
|
||||
var search = (window.search || (window.search = {}));
|
||||
var searchBox, searchInput, clearIcon, searchModal;
|
||||
|
||||
search.clear = function() {
|
||||
searchBox && searchBox.clearAllResults();
|
||||
};
|
||||
search.onShow = function() {
|
||||
searchInput && searchInput.focus();
|
||||
};
|
||||
search.onHide = function() {
|
||||
searchInput && searchInput.blur();
|
||||
};
|
||||
|
||||
window.__gcse = {
|
||||
callback: function() {
|
||||
searchBox = google.search.cse.element.getElement('search-box');
|
||||
searchInput = document.getElementById('gsc-i-id1');
|
||||
clearIcon = document.getElementById('gs_cb50');
|
||||
searchModal = search.searchModal;
|
||||
searchModal && searchModal.$el && searchModal.$el.on('click', function(e) {
|
||||
(e.target === this || e.target === clearIcon || e.target.className === 'gs-title') && searchModal.hide();
|
||||
});
|
||||
}
|
||||
};
|
||||
var cx = '{{ site.search.google.custom_search_engine_id }}'; // Insert your own Custom Search Engine ID here
|
||||
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//cse.google.com/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
{%- include snippets/get-locale-string.html key='CANCEL' -%}
|
||||
{%- assign _locale_cancel = __return -%}
|
||||
{%- include snippets/get-locale-string.html key='SEARCH' -%}
|
||||
{%- assign _locale_search = __return -%}
|
||||
|
||||
{%- if site.search.provider == 'google' -%}
|
||||
<script>window.useDefaultSearchBox = false;</script>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if site.search.provider -%}
|
||||
<script>{%- include scripts/components/search.js -%}</script>
|
||||
{%- endif -%}
|
||||
|
||||
{%- if site.search.provider == 'default' -%}
|
||||
{%- include search-providers/default/search.html -%}
|
||||
{%- elsif site.search.provider == 'google' -%}
|
||||
{%- include search-providers/google-custom-search-engine/search.html -%}
|
||||
{%- elsif site.search.provider == 'custom' -%}
|
||||
{%- include search-providers/custom/search.html -%}
|
||||
{%- endif -%}
|
|
@ -0,0 +1,9 @@
|
|||
<!-- Addthis BEGIN -->
|
||||
{%- assign _SHARING_ADDTHIS_ID = site.sharing.addthis.id -%}
|
||||
|
||||
{%- if _SHARING_ADDTHIS_ID -%}
|
||||
<script type="text/javascript"
|
||||
src="//s7.addthis.com/js/300/addthis_widget.js#pubid={{ _SHARING_ADDTHIS_ID }}"></script>
|
||||
<div class="addthis_inline_share_toolbox addthis_default_style"></div>
|
||||
{%- endif -%}
|
||||
<!-- Addthis END -->
|
|
@ -0,0 +1,10 @@
|
|||
<!-- AddToAny BEGIN -->
|
||||
<div class="a2a_kit a2a_kit_size_32 a2a_default_style">
|
||||
<a class="a2a_dd" href="https://www.addtoany.com/share"></a>
|
||||
<a class="a2a_button_facebook"></a>
|
||||
<a class="a2a_button_twitter"></a>
|
||||
<a class="a2a_button_google_plus"></a>
|
||||
<a class="a2a_button_linkedin"></a>
|
||||
</div>
|
||||
<script async src="https://static.addtoany.com/menu/page.js"></script>
|
||||
<!-- AddToAny END -->
|
|
@ -0,0 +1,3 @@
|
|||
<!-- start custom sharing snippet -->
|
||||
|
||||
<!-- end custom sharing snippet -->
|
|
@ -0,0 +1,7 @@
|
|||
{%- if site.sharing.provider == 'addtoany' -%}
|
||||
{%- include sharing-providers/addtoany.html -%}
|
||||
{%- elsif site.sharing.provider == 'addthis' -%}
|
||||
{%- include sharing-providers/addthis.html -%}
|
||||
{%- elsif site.sharing.provider == 'custom' -%}
|
||||
{%- include sharing-providers/custom.html -%}
|
||||
{%- endif -%}
|
|
@ -0,0 +1,25 @@
|
|||
{%- if page.sidebar.nav -%}
|
||||
<div class="sidebar-toc">
|
||||
{%- assign _sidebar_nav = site.data.navigation[page.sidebar.nav] -%}
|
||||
{%- if _sidebar_nav -%}
|
||||
<ul class="toc toc--navigator">
|
||||
{%- for _item in _sidebar_nav -%}
|
||||
<li class="toc-h1">{{ _item.title }}</li>
|
||||
{%- if _item.children -%}
|
||||
{%- for _child in _item.children -%}
|
||||
{%- include snippets/get-nav-url.html path=_child.url -%}
|
||||
{%- assign _nav_url = __return -%}
|
||||
{%- include snippets/get-nav-url.html path=page.url -%}
|
||||
{%- assign _page_url = __return -%}
|
||||
{%- if _nav_url == _page_url -%}
|
||||
<li class="toc-h2 active"><a href="{{ _nav_url }}">{{ _child.title }}</a></li>
|
||||
{%- else -%}
|
||||
<li class="toc-h2"><a href="{{ _nav_url }}">{{ _child.title }}</a></li>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- endif -%}
|
|
@ -0,0 +1,9 @@
|
|||
{%- if include.source1 == nil -%}
|
||||
{%- if include.source0 == nil -%}
|
||||
{%- assign __return = include.target -%}
|
||||
{%- else -%}
|
||||
{%- assign __return = include.source0 -%}
|
||||
{%- endif -%}
|
||||
{%- else -%}
|
||||
{%- assign __return = include.source1 -%}
|
||||
{%- endif -%}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue