resolve #5, 使用 hexo 编译网站

This commit is contained in:
Changkun Ou
2018-05-03 11:30:28 +02:00
parent 0247488f7a
commit 497516914d
52 changed files with 16839 additions and 3 deletions

View File

@@ -32,7 +32,7 @@
1. [GitHub 在线](./book/zh-cn/toc.md) 1. [GitHub 在线](./book/zh-cn/toc.md)
2. [PDF 文档](./pdf/zh-cn/modern-cpp-tutorial.pdf) 2. [PDF 文档](./pdf/zh-cn/modern-cpp-tutorial.pdf)
3. [网站] 3. [网站](https://changkun.de/modern-cpp/)
## 相关代码 ## 相关代码

View File

@@ -1,3 +1,9 @@
---
title: 序言
type: book-zh-cn
order: 0
---
# 序言 # 序言
## 引言 ## 引言

View File

@@ -1,3 +1,9 @@
---
title: 第 1 章 迈向 C++11/14/17
type: book-zh-cn
order: 1
---
# 第 1 章 迈向 C++11/14/17 # 第 1 章 迈向 C++11/14/17
[TOC] [TOC]

View File

@@ -1,3 +1,9 @@
---
title: 第 2 章 语言可用性的强化
type: book-zh-cn
order: 2
---
# 第 2 章 语言可用性的强化 # 第 2 章 语言可用性的强化
[TOC] [TOC]

View File

@@ -1,3 +1,9 @@
---
title: 第 3 章 语言运行期的强化
type: book-zh-cn
order: 3
---
# 第 3 章 语言运行期的强化 # 第 3 章 语言运行期的强化
> 内容修订中 > 内容修订中

View File

@@ -1,3 +1,9 @@
---
title: 第 4 章 标准库:容器
type: book-zh-cn
order: 4
---
# 第 4 章 标准库:容器 # 第 4 章 标准库:容器
> 内容修订中 > 内容修订中

View File

@@ -1,3 +1,9 @@
---
title: 第 5 章 标准库:容器
type: book-zh-cn
order: 5
---
# 第 5 章 标准库:指针 # 第 5 章 标准库:指针
> 内容修订中 > 内容修订中

View File

@@ -1,3 +1,9 @@
---
title: 第 6 章 标准库:正则表达式
type: book-zh-cn
order: 6
---
# 第 6 章 标准库:正则表达式 # 第 6 章 标准库:正则表达式
> 内容修订中 > 内容修订中

View File

@@ -1,3 +1,9 @@
---
title: 第 7 章 标准库:线程与并发
type: book-zh-cn
order: 7
---
# 第 7 章 标准库:线程与并发 # 第 7 章 标准库:线程与并发
> 内容修订中 > 内容修订中

View File

@@ -1,4 +1,10 @@
# 第 8 章 标准库: 文件系统 ---
title: 第 8 章 标准库:文件系统
type: book-zh-cn
order: 8
---
# 第 8 章 标准库:文件系统
> TODO: 这部分内容为 C++17 新增 > TODO: 这部分内容为 C++17 新增

View File

@@ -1,3 +1,9 @@
---
title: 第 9 章 其他杂项
type: book-zh-cn
order: 9
---
# 第 9 章 其他杂项 # 第 9 章 其他杂项
> 内容修订中 > 内容修订中

View File

@@ -1,4 +1,10 @@
# 第 10 章 展望: C++20 简介 ---
title: 第 10 章 展望C++20 简介
type: book-zh-cn
order: 10
---
# 第 10 章 展望C++20 简介
> 内容修订中, 目前内容为第一版中对 C++17 的展望 > 内容修订中, 目前内容为第一版中对 C++17 的展望

View File

@@ -1,3 +1,9 @@
---
title: 附录:进一步阅读的学习材料
type: book-zh-cn
order: 11
---
# 附录:进一步阅读的学习材料 # 附录:进一步阅读的学习材料
首先,恭喜你阅读完本书 🎉 !笔者希望本书有提起你对现代 C++ 的兴趣。 首先,恭喜你阅读完本书 🎉 !笔者希望本书有提起你对现代 C++ 的兴趣。

15
website/Makefile Executable file
View File

@@ -0,0 +1,15 @@
all:
rm -rf public db.json
node install.js
rm -rf src/modern-cpp/book
python3 filter.py
rm -rf ./src/modern-cpp/images/cover-2nd.png
cp ../assets/cover-2nd.png ./src/modern-cpp/images/cover-2nd.png
hexo generate
mv public/index.html public/modern-cpp/index.html
s:
node_modules/serve/bin/serve.js ./public
clean:
rm ./src/modern-cpp/images/cover-2nd.png
rm -rf src/modern-cpp/book
rm -rf public db.json

39
website/README.md Executable file
View File

@@ -0,0 +1,39 @@
# changkun.de/modern-cpp
Welcome to Modern C++ Tutorial! This site is built with [hexo](http://hexo.io/). Site content is written in Markdown format located in `../book`. And all static files will be built into `./public`, which is served by a nginx server at [changkun.de](https://changkun.de).
## Requirements
- node.js
- npm
## Developing
Start from the terminal:
```
$ make # build
$ make s # start serve
```
Note that:
1. `make` command will check and install all dependencies for you, then build the website into `/public`;
2. `make s` command will serve the static files inside `/public` folder.
3. when you changed the website content, you will need re-compile the website, which means you need use `make` again.
## On Translations
The website is originally in German, but we are currently working on support more languages, such as English and Mandarin Chinese.
### Mandarin Chinese
* Translation directory - [/v2/modern-cpp/](./src/modern-cpp/cn/)
## English
- Translation directory - [/v2/en/](./src/v2/en/)
## Contributors
- [Ou Changkun](https://changkun.de)

108
website/_config.yml Executable file
View File

@@ -0,0 +1,108 @@
# Site Configuration
title: 高速上手 C++ 11/14/17
subtitle:
description: "欧长坤"
author: 欧长坤
email:
language:
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://changkun.de/modern-cpp/
root: /
permalink: :year/:month/:day/:title/
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
# Directory
source_dir: src
public_dir: public
# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
auto_spacing: false # Add spaces between asian characters and western characters
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
max_open_file: 100
multi_thread: true
filename_case: 0
render_drafts: false
post_asset_folder: false
highlight:
enable: true
line_number: false
tab_replace:
toc:
maxdepth: 3
class: toc
slugify: transliteration
decodeEntities: false
anchor:
position: after
symbol: '#'
style: header-anchor
# Category & Tag
default_category: uncategorized
category_map:
tag_map:
# Archives
## 2: Enable pagination
## 1: Disable pagination
## 0: Fully Disable
archive: 0
category: 0
tag: 0
# Server
## Hexo uses Connect as a server
## You can customize the logger format as defined in
## http://www.senchalabs.org/connect/logger.html
port: 4000
logger: false
logger_format:
# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: MMM D YYYY
time_format: H:mm:ss
# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page
# Extensions
theme: moderncpp
exclude_generator:
# Markdown
## https://github.com/chjj/marked
markdown:
gfm: true
pedantic: false
sanitize: false
tables: true
breaks: true
smartLists: true
smartypants: true
# Deployment
## Docs: http://zespia.tw/hexo/docs/deployment.html
deploy:
type: git
repository:
feed:
type: atom
path: atom.xml
limit: 20
alias:
modern-cpp/l/index.html: l/index.html

29
website/filter.py Normal file
View File

@@ -0,0 +1,29 @@
# !/usr/bin/env python3
# author: changkun<hi@changkun.us>
import os
source_dir = [
'../book/zh-cn/'
]
destination_dir = [
'./src/modern-cpp/book/'
]
chapters = ['00-preface.md', '01-intro.md', '02-usability.md', '03-runtime.md', '04-containers.md', '05-pointers.md', '06-regex.md', '07-thread.md', '08-filesystem.md', '09-others.md', '10-cpp20.md', 'appendix.md']
ignores = ['TOC', '返回目录', '许可', 'license']
for index, source in enumerate(source_dir):
for chapter in chapters:
dst_filepath = destination_dir[index] + chapter[:-3]
os.makedirs(dst_filepath)
print(dst_filepath)
print(dst_filepath + '/index.md')
with open(source+chapter, 'r') as source_file:
with open(dst_filepath + '/index.md', 'w') as output_file:
for line in source_file:
if any(keyword in line for keyword in ignores):
continue
else:
output_file.write(line)

14
website/install.js Executable file
View File

@@ -0,0 +1,14 @@
var fs = require('fs')
var execSync = require('child_process').execSync
var deps = require('./package.json').dependencies
var depFolders = Object.keys(deps)
for (var depFolder in deps) {
if (!fs.existsSync('./node_modules/' + depFolder)) {
console.log('Dependency "' + depFolder + '" is NOT installed - installing now...')
execSync('npm install')
process.exit(0)
}
}
console.log('All dependencies are already installed.')

4450
website/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

23
website/package.json Executable file
View File

@@ -0,0 +1,23 @@
{
"name": "modern-cpp",
"version": "2.0.0",
"private": true,
"hexo": {
"version": "3.2.2"
},
"dependencies": {
"hexo": "3.2.2",
"hexo-deployer-git": "0.1.0",
"hexo-generator-alias": "git+https://github.com/chrisvfritz/vuejs.org-hexo-generator-alias.git",
"hexo-generator-archive": "^0.1.4",
"hexo-generator-category": "^0.1.3",
"hexo-generator-feed": "^1.1.0",
"hexo-generator-index": "^0.2.0",
"hexo-generator-tag": "^0.2.0",
"hexo-renderer-ejs": "^0.2.0",
"hexo-renderer-marked": "^0.2.10",
"hexo-renderer-stylus": "^0.3.1",
"hexo-server": "^0.2.0",
"serve": "^6.5.3"
}
}

4
website/src/_posts/index.md Executable file
View File

@@ -0,0 +1,4 @@
---
index: true
---

View File

@@ -0,0 +1,9 @@
---
title: 版权声明
type: about
order: 1
---
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="知识共享许可协议" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/80x15.png" /></a>
本书系[欧长坤](https://github.com/changkun)著,采用[知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议](http://creativecommons.org/licenses/by-nc-nd/4.0/)许可。项目中代码使用 [MIT](https://opensource.org/licenses/MIT) 协议开源。

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

View File

@@ -0,0 +1,9 @@
<svg width="80" height="60" viewBox="0 0 80 60" xmlns="http://www.w3.org/2000/svg">
<title>
chi
</title>
<g fill-rule="nonzero" fill="none">
<path fill="#DE2910" d="M0 0h80v60H0"/>
<path d="M9.414 23.755l5.13-17.35 5.133 17.35-13.44-10.737h16.617M32.14 6.622L26.3 8.124l4.083-4.438-.77 5.682-2.845-4.752M37.76 14.405l-5.968-.88 5.485-2.507-2.912 4.94-.78-5.484M36.745 24.76l-5.088-3.238 6.03-.05-4.674 3.32 1.527-5.324M29.988 31.642l-3.444-4.95 5.583 2.28-5.594 1.26 3.463-4.324" fill="#FFDE00"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 529 B

View File

@@ -0,0 +1,10 @@
<svg width="80" height="60" viewBox="0 0 80 60" xmlns="http://www.w3.org/2000/svg">
<title>
deu
</title>
<g fill-rule="nonzero" fill="none">
<path fill="#FFE600" d="M0 40h80v20H0"/>
<path fill="#000" d="M0 0h80v20H0"/>
<path fill="#F00" d="M0 20h80v20H0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 293 B

View File

@@ -0,0 +1,17 @@
<svg width="80" height="60" viewBox="0 0 80 60" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>
ebr
</title>
<defs>
<path id="a" d="M0 0h80v60H0z"/>
</defs>
<g fill="none" fill-rule="evenodd">
<mask id="b" fill="#fff">
<use xlink:href="#a"/>
</mask>
<use fill="#006" fill-rule="nonzero" xlink:href="#a"/>
<path d="M0 0v6.708L71.056 60H80v-6.708L8.944 0H0zm80 0v6.708L8.944 60H0v-6.708L71.056 0H80z" fill="#FFF" fill-rule="nonzero" mask="url(#b)"/>
<path d="M32.873 0v60h13V0h-13zM0 22.93V37h80V22.93H0z" fill="#FFF" fill-rule="nonzero" mask="url(#b)"/>
<path d="M0 25.762v8h80v-8H0zM35 0v60h8V0h-8zM.03 59.194L28.61 37H35L6.42 59.194H.03zM.03 0l31 23h-6.932L.03 5.143V0zM46 22.194L74.58 0h6.39L52.39 22.194H46zM80 60L49 37h6.932L80 54.857V60z" fill="#C00" fill-rule="nonzero" mask="url(#b)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 894 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

View File

@@ -0,0 +1,4 @@
site_description: "现代 C++ | 高速上手 C++ 11/14/17"
google_analytics:
root_domain: changkun.de/modern-cpp
moderncpp_version: 2.0.0

View File

@@ -0,0 +1,33 @@
<div class="sidebar">
<div class="sidebar-inner-index">
<ul class="main-menu">
<%- partial('partials/main_menu', { context: 'sidebar' }) %>
</ul>
</div>
</div>
<div id="hero">
<div class="inner">
<div class="left">
<img class="hero-logo" src="<%- url_for("/modern-cpp/images/cover-2nd.png") %>">
</div><div class="right">
<h4>欧长坤 著</h4>
<h1>
高速上手<br>C++ 11/14/17
</h1>
<h2>第二版</h2>
<p>
<a class="button white" href="<%- url_for("/modern-cpp/book/00-preface/") %>">立即阅读</a>
</p>
</div>
</div>
</div>
<div id="footer">
<p>
<a href="https://changkun.de">欧长坤</a>版权所有 &copy; 2016-<%- new Date().getFullYear() %>
采用<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议许可</a>,代码使用 <a href="https://opensource.org/licenses/MIT" target="_blank">MIT</a> 协议开源。</a>
</p>
</div>
<script src="https://cdn.rawgit.com/wnda/pivot/master/pivot.js"></script>
<script>pivot.init({ selector: ".hero-logo", shine: true, shadow: true, scale: true});</script>

View File

@@ -0,0 +1,52 @@
<% var isIndex = page.path === 'index.html' %>
<!DOCTYPE html>
<html lang="en">
<head>
<title><%- page.title ? page.title + ' — ' : '' %>changkun.de</title>
<meta charset="utf-8">
<meta name="description" content="<%- theme.site_description %>">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="msapplication-TileColor" content="#ec9325">
<meta name="theme-color" content="#ec8364">
<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600|Roboto Mono' rel='stylesheet' type='text/css'>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- main page styles -->
<%- css(isIndex ? 'modern-cpp/css/index' : 'modern-cpp/css/page') %>
<!-- this needs to be loaded before guide's inline scripts -->
<script src="<%- url_for("/modern-cpp/js/vue.min.js") %>"></script>
<script>window.PAGE_TYPE = "<%- page.type %>"</script>
</head>
<body class="<%- isIndex ? '' : 'docs' -%>">
<div id="mobile-bar" data-bg-text="高速上手 C++ 11/14/17" <%- isIndex ? 'class="top"' : '' %>>
<a class="menu-button"></a>
<a class="logo" href="/modern-cpp/"></a>
</div>
<%- partial('partials/header') %>
<% if (!isIndex) { %>
<div id="main" class="fix-sidebar">
<%- body %>
</div>
<% } else { %>
<%- body %>
<% } %>
<script src="<%- url_for("/modern-cpp/js/smooth-scroll.min.js") %>"></script>
<!-- main custom script for sidebars, version selects etc. -->
<script src="<%- url_for("/modern-cpp/js/css.escape.js") %>"></script>
<script src="<%- url_for("/modern-cpp/js/common.js") %>"></script>
<!-- fastclick -->
<script src="//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
FastClick.attach(document.body)
}, false)
</script>
</body>
</html>

View File

@@ -0,0 +1,26 @@
<% if (page.type) { %>
<%- partial('partials/sidebar', { type: page.type, index: page.index }) %>
<% } else { %>
<div class="sidebar">
<ul class="main-menu">
<%- partial('partials/main_menu', { context: 'sidebar' }) %>
</ul>
</div>
<% } %>
<div class="content <%- page.type ? page.type + ' with-sidebar' : '' %> <%- page.type ? page.path.replace(/.+\//, '').replace('.html', '') + '-guide' : '' %>">
<%- page.content %>
<div class="guide-links">
<% site.pages.find({ type: page.type, order: page.order - 1 }).each(function (page) { %>
<span>← <a href="<%- url_for(page.path) %>"><%- page.title %></a></span>
<% }) %>
<% site.pages.find({ type: page.type, order: page.order + 1 }).each(function (page) { %>
<span style="float: right;"><a href="<%- url_for(page.path) %>"><%- page.title %></a> →</span>
<% }) %>
</div>
<div class="footer">
<p>
<a href="https://changkun.de">欧长坤</a>版权所有 &copy; 2016-<%- new Date().getFullYear() %>
采用<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议许可</a>,代码使用 <a href="https://opensource.org/licenses/MIT" target="_blank">MIT</a> 协议开源。</a>
</p>
</div>
</div>

View File

@@ -0,0 +1,9 @@
<div id="header">
<a id="logo" href="<%- url_for("/modern-cpp/") %>">
<img src="<%- url_for("/modern-cpp/images/cover-2nd.png") %>">
<span>高速上手 C++ 11/14/17</span><sup class="beta">beta</sup>
</a>
<ul id="nav">
<%- partial('partials/main_menu', { context: 'nav' }) %>
</ul>
</div>

View File

@@ -0,0 +1,38 @@
<li class="nav-dropdown-container resource">
<a class="nav-link">资源</a><span class="arrow"></span>
<ul class="nav-dropdown">
<li><ul>
<li><a class="nav-link" href="<%- url_for("/modern-cpp/book/00-preface/") %>" >正文</a></li>
<!-- TODO -->
<!-- <li><a class="nav-link" href="<%- url_for("/modern-cpp/code/1/") %>" >代码</a></li>
<li><a class="nav-link" href="<%- url_for("/modern-cpp/exercises/1/") %>" >习题</a></li>
<li><a class="nav-link" href="<%- url_for("/modern-cpp/answers/1/") %>" >答案</a></li> -->
</ul></li>
</ul>
</li>
<li class="nav-dropdown-container about">
<a class="nav-link">关于</a><span class="arrow"></span>
<ul class="nav-dropdown">
<li><ul>
<li><a class="nav-link" href="<%- url_for("/modern-cpp/about/copyright.html") %>" >版权声明</a></li>
</ul></li>
</ul>
</li>
<li class="nav-dropdown-container language">
<a class="nav-link">
<span style="content: url(/modern-cpp/images/lang/cn.svg); width: 15px; height: 15px; margin-right: 5px; vertical-align: middle; margin-bottom: 2px;"></span>
中文
</a>
<!-- TODO -->
<!-- <span class="arrow"></span>
<ul class="nav-dropdown">
<li>
<a class="nav-link" target="_blank">
<span style="content: url(/modern-cpp/images/lang/en.svg); width: 15px; height: 15px; margin-right: 5px; vertical-align: middle; margin-bottom: 2px;"></span>
English (soon)
</a>
</li>
</ul> -->
</li>

View File

@@ -0,0 +1,23 @@
<div class="sidebar">
<div class="sidebar-inner">
<ul class="main-menu">
<%- partial('partials/main_menu', { context: 'sidebar' }) %>
</ul>
<div class="list">
<h2>
<%-
type === 'exercises'
? '习题'
: type === 'book-zh-cn'
? '正文'
: type === 'answers'
? '参考答案'
: type === 'about'
? '关于'
: (type.charAt(0).toUpperCase() + type.slice(1))
%>
</h2>
<%- partial('partials/toc', { type: type }) %>
</div>
</div>
</div>

View File

@@ -0,0 +1,7 @@
<ul class="menu-root">
<% site.pages.find({type: type}).sort('order').each(function (p) { %>
<li>
<a href="<%- url_for(p.path) %>" class="sidebar-link<%- page.title === p.title ? ' current' : '' %><%- p.is_new ? ' new' : '' %>"><%- p.title %></a>
</li>
<% }) %>
</ul>

View File

@@ -0,0 +1,21 @@
<div class="sidebar blog">
<div class="sidebar-inner">
<ul class="main-menu">
<%- partial('partials/main_menu', { context: 'nav' }) %>
</ul>
<div class="list">
<ul style="padding: 0;">
<% site.posts.sort('date', -1).limit(10).each(function (post) { %>
<li>
<a href="/<%- post.path %>" class="sidebar-link<%- page.title === post.title ? ' current' : '' %>"><%- post.title %></a>
</li>
<% }) %>
</ul>
</div>
</div>
</div>
<div class="content with-sidebar post">
<h1><%- page.title %></h1>
<h4><%- page.date.format('MMM D[,] YYYY') %></h4>
<%- page.content %>
</div>

View File

@@ -0,0 +1,12 @@
.rotating-clockwise
animation: 3s rotating-clockwise linear infinite
i.rotating-clockwise
display: inline-block
animation-duration: 2s
@keyframes rotating-clockwise
from
transform: rotate(0)
to
transform: rotate(360deg)

View File

@@ -0,0 +1,184 @@
@import "_settings"
@import "_syntax"
body
font-family: $body-font
font-size: $body-font-size
-webkit-font-smoothing: antialiased
-moz-osx-font-smoothing: grayscale
color: $medium
background-color: white
margin: 0
&.docs
padding-top: $header-height
@media screen and (max-width: 900px)
body.docs
padding-top: 0
a
text-decoration: none
color: $medium
img
border: none
h1, h2, h3, h4, strong
font-weight: 600
color: $dark
code, pre
font-family: $code-font
font-size: $code-font-size
background-color: $codebg
-webkit-font-smoothing: initial
-moz-osx-font-smoothing: initial
code
color: #e96900
padding: 3px 5px
margin: 0 2px
border-radius: 2px
white-space: nowrap
em
color: $light
p
word-spacing: 0.05em
a.button
padding: 0.75em 2em
border-radius: 2em
display: inline-block
color: #fff
background-color: lighten($theme, 8%)
transition: all .15s ease
box-sizing: border-box
border: 1px solid lighten($theme, 8%)
&.white
background-color: #fff
color: $theme
a.button:hover
background-color: $theme
color: #fff
.highlight
overflow-x: auto
background-color: $codebg
padding: .4em 0 0
line-height: 1.1em
border-radius: $radius
position: relative
table, tr, td
width: 100%
border-collapse: collapse
padding: 0
margin: 0
.gutter
width: 1.5em
.code
$code-line-height = 1.5em
pre
padding: 1.2em 1.4em
line-height: $code-line-height
margin: 0
.line
min-height: $code-line-height
&.html, &.js, &.bash, &.css
.code:before
position: absolute
top: 0
right: 0
color: #ccc
text-align: right
font-size: .75em
padding: 5px 10px 0
line-height: 15px
height: 15px
font-weight: 600
&.html .code:before
content: "HTML"
&.js .code:before
content: "JS"
&.bash .code:before
content: "Shell"
&.css .code:before
content: "CSS"
#main
position: relative
z-index: 1
padding: 0 60px 30px
overflow-x: hidden
#nav
.nav-link
color: #fff
// cursor: pointer
.nav-dropdown-container
.nav-link
&:hover:not(.current)
border-bottom: none
&:hover
.nav-dropdown
display: block
&.language, &.ecosystem
margin-left: 20px
.arrow
pointer-events: none
.nav-dropdown
display: none
box-sizing: border-box
max-height: "calc(100vh - %s)" % $header-height
overflow-y: auto
position: absolute
top: 100%
right: -15px
background-color: $theme
padding: 10px 0
border: 1px solid #fff
border-bottom-color: $theme
text-align: left
border-radius: 4px
white-space: nowrap
li
line-height: 1.8em
margin: 0
display: block
> ul
padding-left: 0
&:first-child
h4
margin-top: 0
padding-top: 0
border-top: 0
a, h4
padding: 0 24px 0 20px
h4
margin: .45em 0 0
padding-top: .45em
border-top: 1px solid #eee
a
color: #fff
font-size: .9em
display: block
&:hover
color: $yellow
.arrow
display: inline-block
vertical-align: middle
margin-top: -1px
margin-left: 6px
margin-right: -14px
width: 0
height: 0
border-left: 4px solid transparent
border-right: 4px solid transparent
border-top: 5px solid #fff
sup.beta.beta
font-size: .6em
margin-left: .7em
text-transform: uppercase
opacity: .6

View File

@@ -0,0 +1,144 @@
$header-height = 40px
#header
background-color: $theme
height: $header-height
padding: $heading-padding-vertical 60px
position: relative
z-index: 2
body.docs
#header
position: fixed
width: 100%
top: 0
left: 0
right: 0
bottom: 0
padding: 10px
#nav
position: fixed
#logo
margin-left: 20px
margin-right: 20px
#logo span
font-size: 1.2em
#logo img
margin-top: -6px
#mobile-bar::before
content: attr(data-bg-text)
text-align: center
color: #fff
display: block
line-height: 1
position: absolute
margin-top: 12px
font-size: 2em
width: 100%
#nav
list-style-type: none
margin: 0
padding: 0
position: absolute
right: 30px
top: $heading-padding-vertical
height: $header-height
line-height: $header-height
.break
display: none
li
display: inline-block
position: relative
margin: 0 .6em
margin-right: 30px
.nav-dropdown
.nav-link
&:hover, &.current
border-bottom: none
&.current
&::after
content: ""
width: 0
height: 0
border-left: 5px solid $theme
border-top: 3px solid transparent
border-bottom: 3px solid transparent
position: absolute
top: 50%
margin-top: -4px
left: 8px
.nav-link
padding-bottom: 3px
&:hover, &.current
border-bottom: 3px solid $theme
&.team
margin-left: 10px
.new-label
position: absolute
top: 3px
left: 110%
background-color: $theme
color: #fff
line-height: 16px
height: 16px
font-size: 9px
font-weight: bold
font-family: $code-font
padding: 1px 4px 0 6px
border-radius: 4px
#logo
display: inline-block
font-size: 1.5em
line-height: $header-height
color: #fff
font-family: $logo-font
font-weight: 500
img
vertical-align: middle
margin-right: 6px
height: $header-height
border-radius: 2px;
box-shadow: 0 20px 80px rgba(0, 0, 0, 0.4);
overflow:hidden;
#mobile-bar::before
content: attr(data-bg-text)
text-align: center
color: #fff
display: block
line-height: 1
position: absolute
margin-top: 12px
font-size: 2em
width: 100%
#mobile-bar
position: fixed
top: 0
left: 0
width: 100%
height: 50px
background-color: $theme;
z-index: 100
display: none
box-shadow: 0 0 2px rgba(0,0,0,.25)
.menu-button
position: absolute
width: 24px
height: 24px
top: 14px
left: 12px
background: url(../images/menu.png) center center no-repeat
background-size: 24px
.logo
position: absolute
width: 25px
height: 30px
background: url(../images/cover-2nd.png) center center no-repeat
background-size: auto 100%
top: 12px
right: 12px
margin-left: -15px

View File

@@ -0,0 +1,32 @@
// font faces
$body-font = "Source Sans Pro", "Helvetica Neue", Arial, sans-serif
$logo-font = "Dosis", "Source Sans Pro", "Helvetica Neue", Arial, sans-serif
$code-font = "Roboto Mono", Monaco, courier, monospace
// font sizes
$body-font-size = 15px
$code-font-size = .8em
// colors
$theme = #7e2d36
$orange = #ec9325
$dark = #2c3e50
$medium = #34495e
$light = #7f8c8d
$green = #42b983
$border = #dddddd
$codebg = #f8f8f8
$red = #ff6666
$info = #1C90F3
$yellow = yellow
$radius = 2px
$content-padding-top = 30px
$header-inner-height = 41px
$heading-padding-vertical = 10px
$header-height = $header-inner-height + $heading-padding-vertical * 2
$mobile-header-height = 40px
$heading-link-padding-top = $header-height + $content-padding-top
$mobile-heading-link-padding-top = $mobile-header-height + $content-padding-top
$h2-margin-top = 45px
$h3-margin-top = 52px

View File

@@ -0,0 +1,89 @@
@import "_settings"
.sidebar
position: fixed
z-index: 10
top: $header-height
left: 0
bottom: 0
overflow-x: hidden
overflow-y: auto
-webkit-overflow-scrolling: touch
-ms-overflow-style: none
h2
margin-top: .2em
ul
list-style-type: none
margin: 0
line-height: 1.5em
padding-left: 1em
li
margin-top: .5em
.sidebar-inner
width: 260px
padding: $content-padding-top + 10px 20px 60px 60px
.version-select
vertical-align: middle
margin-left: 5px
.menu-root
padding-left: 0
.menu-sub
font-size: .85em
.sidebar-link
color: $light
&.current
font-weight: 600
color: $theme
&.new
&:after
content: "NEW"
display: inline-block
font-size: 10px
font-weight: 600
color: #fff
background-color: $theme
line-height: 14px
padding: 0 4px
border-radius: 3px
margin-left: 5px
vertical-align: middle
position: relative
top: -1px
&:hover
border-bottom: 2px solid $theme
.section-link
&.active
font-weight: bold
color: $theme
.main-menu
margin-bottom: 20px
display: none
padding-left: 0
.nav-dropdown
h4
font-weight: normal
margin: 0
@media screen and (max-width: 900px)
.sidebar
position: fixed
z-index: 10
background-color: #f9f9f9
height: 100%
top: 0
left: 0
box-shadow: 0 0 10px rgba(0,0,0,.2)
transition: all .4s cubic-bezier(0.4, 0, 0, 1)
-webkit-transform: translate(-280px, 0)
transform: translate(-280px, 0)
.sidebar-inner
padding: 50px 10px 10px 20px
box-sizing: border-box
.sidebar-inner-index
padding: 80px 40px 10px 30px
box-sizing: border-box
.main-menu
display: block
&.open
-webkit-transform: translate(0, 0)
transform: translate(0, 0)

View File

@@ -0,0 +1,77 @@
.gutter pre
color: #999
pre
color: #525252
.function .keyword,
.constant
color: #0092db
.keyword,
.attribute
color: #e96900
.number,
.literal
color: #AE81FF
.tag,
.tag .title,
.change,
.winutils,
.flow,
.lisp .title,
.clojure .built_in,
.nginx .title,
.tex .special
color: #2973b7
.class .title
color: white
.symbol,
.symbol .string,
.value,
.regexp
color: $theme
.title
color: #A6E22E
.tag .value,
.string,
.subst,
.haskell .type,
.preprocessor,
.ruby .class .parent,
.built_in,
.sql .aggregate,
.django .template_tag,
.django .variable,
.smalltalk .class,
.javadoc,
.django .filter .argument,
.smalltalk .localvars,
.smalltalk .array,
.attr_selector,
.pseudo,
.addition,
.stream,
.envvar,
.apache .tag,
.apache .cbracket,
.tex .command,
.prompt
color: $theme
.comment,
.java .annotation,
.python .decorator,
.template_comment,
.pi,
.doctype,
.deletion,
.shebang,
.apache .sqbracket,
.tex .formula
color: #b3b3b3
.coffeescript .javascript,
.javascript .xml,
.tex .formula,
.xml .javascript,
.xml .vbscript,
.xml .css,
.xml .cdata
opacity: 0.5

View File

@@ -0,0 +1,156 @@
@import "_common"
@import "_header"
@import "_sidebar"
$width = 900px
body
background-color: #fff
#logo
span
font-size: 1.2em
img
display: none
.beta
font-size: 12px;
color: #F7BA2F;
font-family: Roboto, sans-serif;
font-weight: bold;
font-style: oblique;
.sidebar
display: none
#mobile-bar
&.top
background-color: $theme
box-shadow: none
.logo
display: none
#hero
padding: 100px 40px 40px 200px
background-color: #fff
.inner
max-width: $width
margin: 0 auto
.left, .right
display: inline-block
vertical-align: top
.left
width: 45%
.right
width: 55%
.hero-logo
width: 290px
float: right
margin-right: 60px
border-radius: 5px
box-shadow: 0 20px 80px rgba(0, 0, 0, 0.4)
h1
text-transform: uppercase
font-weight: 500
margin: 10px 0px
margin-top: 0px
font-size: 3.2em
h2
text-transform: uppercase
font-weight: 300
font-size: 2.4em
margin: 0 0 10px
h4
font-style: oblique
font-weight: 200
margin-bottom: 0px
font-size: 2em
.button
margin: 1em 0
font-size: 1.05em
font-weight: 600
letter-spacing: .1em
min-width: 8em
text-align: center
&:first-child
margin-right: 1em
.social-buttons
list-style-type: none
padding: 0
li
display: inline-block
vertical-align: middle
margin-right: 15px
#highlights
background-color: #fff
padding-bottom: 70px
.inner
max-width: $width
margin: 0 auto
text-align: center
.point
width: 33%
display: inline-block
vertical-align: top
box-sizing: border-box
padding: 0 2em
h2
color: $theme
font-size: 1.5em
font-weight: 400
margin: 0
padding: .5em 0
p
color: $light
#footer
background-color: #1e2318
bottom: 0
padding: 10px 0
position: fixed
width: 100%
color: #fff
text-align: center
a
font-weight: 700
color: #fff
@media screen and (max-width: $width)
body
-webkit-text-size-adjust: none
font-size: 14px
.sidebar
display: block
#header
display: none
#mobile-bar
display: block
#hero
padding: 70px 40px 100px
.hero-logo
float: none
margin: 30px 0 30px
width: 200px
.left, .right
text-align: center
width: 100%
h1
text-transform: capitalize
font-size: 2.0em
display: block
h2
font-size: 1.0em
.button
font-size: .9em
h4
font-size: 0.9em
#highlights
.point
display: block
margin: 0 auto
width: 300px
padding: 0 40px 30px
&:before
content: ""
color: $theme

View File

@@ -0,0 +1,239 @@
@import "_common"
@import "_animations"
@import "_header"
@import "_sidebar"
#header
box-shadow: 0 0 1px rgba(0,0,0,.25)
transition: background-color .3s ease-in-out
.beta
font-size: 12px;
color: #F7BA2F;
font-family: Roboto, sans-serif;
font-weight: bold;
font-style: oblique;
.content
position: relative
padding: 2.2em 0
max-width: 600px
margin: 0 auto
padding-left: 50px
&.api
> a:first-of-type > h2
margin-top: 0
padding-top: 0
ul
padding-left: 1.25em
line-height: 1.4em
ul, p:not(.tip)
padding-bottom: 0
margin: 1.2em 0
a.button
font-size: .9em
color: #fff
margin: .2em 0
width: 180px
text-align: center
padding: 12px 24px
display: inline-block
vertical-align: middle
img
max-width: 100%
span.light
color: $light
span.info
font-size: .85em
display: inline-block
vertical-align: middle
width: 280px
margin-left: 20px
h1
margin: 0 0 1em
h2, h3
&:before
content: ""
display: block
margin-top: -1 * $heading-link-padding-top
height: $heading-link-padding-top
visibility: hidden
h2
margin: $h2-margin-top 0 .8em
padding-bottom: .7em
border-bottom: 1px solid $border
z-index: -1
h3
margin: $h3-margin-top 0 1.2em
position: relative
z-index: -1
&:after
content: "#"
color: $theme
position: absolute
left: -0.7em
bottom: -2px
font-size: 1.2em
font-weight: bold
figure
margin: 1.2em 0
p, ul, ol
line-height: 1.6em
// HACK: Create area underneath paragraphs
// and lists that will be on top of heading
// anchors, for easier text highlighting.
margin: 1.2em 0 -1.2em
padding-bottom: 1.2em
position: relative
z-index: 1
ul, ol
padding-left: 1.5em
// FIX: Some link click targets are covered without this
position: inherit
a
color: $theme
font-weight: 600
blockquote
margin: 2em 0
padding-left: 20px
border-left: 4px solid $theme
p
font-weight: 600
margin-left: 0
margin-bottom: 0
padding-bottom: 0
iframe
margin: 1em 0
> table
border-spacing: 0
border-collapse: collapse
margin: 1.2em auto
padding: 0
display: block
overflow-x: auto
td, th
line-height: 1.5em
padding: .4em .8em
border: none
border: 1px solid #ddd
th
font-weight: bold
text-align: left
th, tr:nth-child(2n)
background-color: #f8f8f8
code
background-color: #efefef
p
&.tip, &.success
padding: 12px 24px 12px 30px
margin: 2em 0
border-left-width: 4px
border-left-style: solid
background-color: $codebg
position: relative
border-bottom-right-radius: $radius
border-top-right-radius: $radius
&:before
position: absolute
top: 14px
left: -12px
color: #fff
width: 20px
height: 20px
border-radius: 100%
text-align: center
line-height: 20px
font-weight: bold
font-family: $logo-font
font-size: 14px
code
background-color: #efefef
em
color: $medium
&.tip
border-left-color: $red
&:before
content: "!"
background-color: $red
&.success
border-left-color: $theme
&:before
content: "\f00c"
font-family: FontAwesome
background-color: $theme
.guide-links
margin-top: 2em
margin-bottom: 2em
height: 1em
.footer
color: $light
margin-top: 2em
padding-top: 2em
border-top: 1px solid #e5e5e5
font-size: .9em
#main.fix-sidebar
position: static
.sidebar
position: fixed
@media screen and (min-width: 1590px)
#header
background-color: $theme
@media screen and (max-width: 1300px)
.content.with-sidebar
margin-left: 290px
#ad
z-index: 1
position: relative
padding: 0
bottom: 0
right: 0
float: right
padding: 0 0 20px 30px
@media screen and (max-width: 900px)
body
-webkit-text-size-adjust: none
font-size: 14px
#header
display: none
#logo
display: none
.nav-link
padding-bottom: 1px
&:hover, &.current
border-bottom: 2px solid $theme
#mobile-bar
display: block
#main
padding: 2em 1.4em 0
.highlight pre
padding: 1.2em 1em
.content
padding-left 0
&.with-sidebar
margin: auto
h2, h3
&:before
content: ""
display: block
margin-top: -1 * $mobile-heading-link-padding-top
height: $mobile-heading-link-padding-top
visibility: hidden
.footer
margin-left: 0
text-align: center
@media screen and (max-width: 560px)
#downloads
text-align: center
margin-bottom: 25px
.info
margin-top: 5px
margin-left: 0
iframe
margin: 0 !important

View File

@@ -0,0 +1,260 @@
(function () {
initMobileMenu()
if (PAGE_TYPE) {
initVersionSelect()
initSubHeaders()
}
/**
* Mobile burger menu button and gesture for toggling sidebar
*/
function initMobileMenu () {
var mobileBar = document.getElementById('mobile-bar')
var sidebar = document.querySelector('.sidebar')
var menuButton = mobileBar.querySelector('.menu-button')
menuButton.addEventListener('click', function () {
sidebar.classList.toggle('open')
})
document.body.addEventListener('click', function (e) {
if (e.target !== menuButton && !sidebar.contains(e.target)) {
sidebar.classList.remove('open')
}
})
// Toggle sidebar on swipe
var start = {}, end = {}
document.body.addEventListener('touchstart', function (e) {
start.x = e.changedTouches[0].clientX
start.y = e.changedTouches[0].clientY
})
document.body.addEventListener('touchend', function (e) {
end.y = e.changedTouches[0].clientY
end.x = e.changedTouches[0].clientX
var xDiff = end.x - start.x
var yDiff = end.y - start.y
if (Math.abs(xDiff) > Math.abs(yDiff)) {
if (xDiff > 0 && start.x <= 80) sidebar.classList.add('open')
else sidebar.classList.remove('open')
}
})
}
/**
* Doc version select
*/
function initVersionSelect () {
// version select
var versionSelect = document.querySelector('.version-select')
versionSelect && versionSelect.addEventListener('change', function (e) {
var version = e.target.value
var section = window.location.pathname.match(/\/v\d\/(\w+?)\//)[1]
if (version === 'SELF') return
window.location.assign(
'http://' +
version +
(version && '.') +
'changkun.de/' + section + '/'
)
})
}
/**
* Sub headers in sidebar
*/
function initSubHeaders () {
var each = [].forEach
var main = document.getElementById('main')
var header = document.getElementById('header')
var sidebar = document.querySelector('.sidebar')
var content = document.querySelector('.content')
// build sidebar
var currentPageAnchor = sidebar.querySelector('.sidebar-link.current')
var contentClasses = document.querySelector('.content').classList
var isAPIOrStyleGuide = (
contentClasses.contains('api') ||
contentClasses.contains('style-guide')
)
if (currentPageAnchor || isAPIOrStyleGuide) {
var allHeaders = []
var sectionContainer
if (isAPIOrStyleGuide) {
sectionContainer = document.querySelector('.menu-root')
} else {
sectionContainer = document.createElement('ul')
sectionContainer.className = 'menu-sub'
currentPageAnchor.parentNode.appendChild(sectionContainer)
}
var headers = content.querySelectorAll('h2')
if (headers.length) {
each.call(headers, function (h) {
sectionContainer.appendChild(makeLink(h))
var h3s = collectH3s(h)
allHeaders.push(h)
allHeaders.push.apply(allHeaders, h3s)
if (h3s.length) {
sectionContainer.appendChild(makeSubLinks(h3s, isAPIOrStyleGuide))
}
})
} else {
headers = content.querySelectorAll('h3')
each.call(headers, function (h) {
sectionContainer.appendChild(makeLink(h))
allHeaders.push(h)
})
}
var animating = false
sectionContainer.addEventListener('click', function (e) {
// Not prevent hashchange for smooth-scroll
// e.preventDefault()
if (e.target.classList.contains('section-link')) {
sidebar.classList.remove('open')
setActive(e.target)
animating = true
setTimeout(function () {
animating = false
}, 400)
}
}, true)
// make links clickable
allHeaders.forEach(makeHeaderClickable)
smoothScroll.init({
speed: 400,
offset: 0
})
}
var hoveredOverSidebar = false
sidebar.addEventListener('mouseover', function () {
hoveredOverSidebar = true
})
sidebar.addEventListener('mouseleave', function () {
hoveredOverSidebar = false
})
// listen for scroll event to do positioning & highlights
window.addEventListener('scroll', updateSidebar)
window.addEventListener('resize', updateSidebar)
function updateSidebar () {
var doc = document.documentElement
var top = doc && doc.scrollTop || document.body.scrollTop
if (animating || !allHeaders) return
var last
for (var i = 0; i < allHeaders.length; i++) {
var link = allHeaders[i]
if (link.offsetTop > top) {
if (!last) last = link
break
} else {
last = link
}
}
if (last)
setActive(last.id, !hoveredOverSidebar)
}
function makeLink (h) {
var link = document.createElement('li')
window.arst = h
var text = [].slice.call(h.childNodes).map(function (node) {
if (node.nodeType === Node.TEXT_NODE) {
return node.nodeValue
} else if (['CODE', 'SPAN'].indexOf(node.tagName) !== -1) {
return node.textContent
} else {
return ''
}
}).join('').replace(/\(.*\)$/, '')
link.innerHTML =
'<a class="section-link" data-scroll href="#' + h.id + '">' +
htmlEscape(text) +
'</a>'
return link
}
function htmlEscape (text) {
return text
.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
}
function collectH3s (h) {
var h3s = []
var next = h.nextSibling
while (next && next.tagName !== 'H2') {
if (next.tagName === 'H3') {
h3s.push(next)
}
next = next.nextSibling
}
return h3s
}
function makeSubLinks (h3s, small) {
var container = document.createElement('ul')
if (small) {
container.className = 'menu-sub'
}
h3s.forEach(function (h) {
container.appendChild(makeLink(h))
})
return container
}
function setActive (id, shouldScrollIntoView) {
var previousActive = sidebar.querySelector('.section-link.active')
var currentActive = typeof id === 'string'
? sidebar.querySelector('.section-link[href="#' + id + '"]')
: id
if (currentActive !== previousActive) {
if (previousActive) previousActive.classList.remove('active')
currentActive.classList.add('active')
if (shouldScrollIntoView) {
var currentPageOffset = currentPageAnchor
? currentPageAnchor.offsetTop - 8
: 0
var currentActiveOffset = currentActive.offsetTop + currentActive.parentNode.clientHeight
var sidebarHeight = sidebar.clientHeight
var currentActiveIsInView = (
currentActive.offsetTop >= sidebar.scrollTop &&
currentActiveOffset <= sidebar.scrollTop + sidebarHeight
)
var linkNotFurtherThanSidebarHeight = currentActiveOffset - currentPageOffset < sidebarHeight
var newScrollTop = currentActiveIsInView
? sidebar.scrollTop
: linkNotFurtherThanSidebarHeight
? currentPageOffset
: currentActiveOffset - sidebarHeight
sidebar.scrollTop = newScrollTop
}
}
}
function makeHeaderClickable (link) {
var wrapper = document.createElement('a')
wrapper.href = '#' + link.id
wrapper.setAttribute('data-scroll', '')
link.parentNode.insertBefore(wrapper, link)
wrapper.appendChild(link)
}
}
})()

View File

@@ -0,0 +1,106 @@
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
;(function(root, factory) {
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports == 'object') {
// For Node.js.
module.exports = factory(root);
} else if (typeof define == 'function' && define.amd) {
// For AMD. Register as an anonymous module.
define([], factory.bind(root, root));
} else {
// For browser globals (not exposing the function separately).
factory(root);
}
}(typeof global != 'undefined' ? global : this, function(root) {
if (root.CSS && root.CSS.escape) {
return root.CSS.escape;
}
// https://drafts.csswg.org/cssom/#serialize-an-identifier
var cssEscape = function(value) {
if (arguments.length == 0) {
throw new TypeError('`CSS.escape` requires an argument.');
}
var string = String(value);
var length = string.length;
var index = -1;
var codeUnit;
var result = '';
var firstCodeUnit = string.charCodeAt(0);
while (++index < length) {
codeUnit = string.charCodeAt(index);
// Note: theres no need to special-case astral symbols, surrogate
// pairs, or lone surrogates.
// If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
// (U+FFFD).
if (codeUnit == 0x0000) {
result += '\uFFFD';
continue;
}
if (
// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
// U+007F, […]
(codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
// If the character is the first character and is in the range [0-9]
// (U+0030 to U+0039), […]
(index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
// If the character is the second character and is in the range [0-9]
// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
(
index == 1 &&
codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
firstCodeUnit == 0x002D
)
) {
// https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
result += '\\' + codeUnit.toString(16) + ' ';
continue;
}
if (
// If the character is the first character and is a `-` (U+002D), and
// there is no second character, […]
index == 0 &&
length == 1 &&
codeUnit == 0x002D
) {
result += '\\' + string.charAt(index);
continue;
}
// If the character is not handled by one of the above rules and is
// greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
// is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
// U+005A), or [a-z] (U+0061 to U+007A), […]
if (
codeUnit >= 0x0080 ||
codeUnit == 0x002D ||
codeUnit == 0x005F ||
codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
codeUnit >= 0x0041 && codeUnit <= 0x005A ||
codeUnit >= 0x0061 && codeUnit <= 0x007A
) {
// the character itself
result += string.charAt(index);
continue;
}
// Otherwise, the escaped character.
// https://drafts.csswg.org/cssom/#escape-a-character
result += '\\' + string.charAt(index);
}
return result;
};
if (!root.CSS) {
root.CSS = {};
}
root.CSS.escape = cssEscape;
return cssEscape;
}));

View File

@@ -0,0 +1,2 @@
/*! smooth-scroll v10.2.1 | (c) 2016 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */
!(function(e,t){"function"==typeof define&&define.amd?define([],t(e)):"object"==typeof exports?module.exports=t(e):e.smoothScroll=t(e)})("undefined"!=typeof global?global:this.window||this.global,(function(e){"use strict";var t,n,o,r,a,c,l,i={},u="querySelector"in document&&"addEventListener"in e,s={selector:"[data-scroll]",selectorHeader:null,speed:500,easing:"easeInOutCubic",offset:0,callback:function(){}},d=function(){var e={},t=!1,n=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(t=arguments[0],n++);for(var r=function(n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t&&"[object Object]"===Object.prototype.toString.call(n[o])?e[o]=d(!0,e[o],n[o]):e[o]=n[o])};n<o;n++){var a=arguments[n];r(a)}return e},f=function(e){return Math.max(e.scrollHeight,e.offsetHeight,e.clientHeight)},h=function(e,t){for(Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),n=t.length;--n>=0&&t.item(n)!==this;);return n>-1});e&&e!==document;e=e.parentNode)if(e.matches(t))return e;return null},m=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,r=-1,a="",c=n.charCodeAt(0);++r<o;){if(t=n.charCodeAt(r),0===t)throw new InvalidCharacterError("Invalid character: the input contains U+0000.");a+=t>=1&&t<=31||127==t||0===r&&t>=48&&t<=57||1===r&&t>=48&&t<=57&&45===c?"\\"+t.toString(16)+" ":t>=128||45===t||95===t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?n.charAt(r):"\\"+n.charAt(r)}return"#"+a},p=function(e,t){var n;return"easeInQuad"===e&&(n=t*t),"easeOutQuad"===e&&(n=t*(2-t)),"easeInOutQuad"===e&&(n=t<.5?2*t*t:-1+(4-2*t)*t),"easeInCubic"===e&&(n=t*t*t),"easeOutCubic"===e&&(n=--t*t*t+1),"easeInOutCubic"===e&&(n=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(n=t*t*t*t),"easeOutQuart"===e&&(n=1- --t*t*t*t),"easeInOutQuart"===e&&(n=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(n=t*t*t*t*t),"easeOutQuint"===e&&(n=1+--t*t*t*t*t),"easeInOutQuint"===e&&(n=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),n||t},g=function(e,t,n){var o=0;if(e.offsetParent)do o+=e.offsetTop,e=e.offsetParent;while(e);return o=Math.max(o-t-n,0),Math.min(o,v()-b())},b=function(){return Math.max(document.documentElement.clientHeight,e.innerHeight||0)},v=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},y=function(e){return e&&"object"==typeof JSON&&"function"==typeof JSON.parse?JSON.parse(e):{}},O=function(e){return e?f(e)+e.offsetTop:0},S=function(t,n,o){o||(t.focus(),document.activeElement.id!==t.id&&(t.setAttribute("tabindex","-1"),t.focus(),t.style.outline="none"),e.scrollTo(0,n))};i.animateScroll=function(n,o,c){var i=y(o?o.getAttribute("data-options"):null),u=d(t||s,c||{},i),f="[object Number]"===Object.prototype.toString.call(n),h=f||!n.tagName?null:n;if(f||h){var m=e.pageYOffset;u.selectorHeader&&!r&&(r=document.querySelector(u.selectorHeader)),a||(a=O(r));var b,E,I=f?n:g(h,a,parseInt(u.offset,10)),H=I-m,A=v(),j=0,C=function(t,r,a){var c=e.pageYOffset;(t==r||c==r||e.innerHeight+c>=A)&&(clearInterval(a),S(n,r,f),u.callback(n,o))},M=function(){j+=16,b=j/parseInt(u.speed,10),b=b>1?1:b,E=m+H*p(u.easing,b),e.scrollTo(0,Math.floor(E)),C(E,I,l)},w=function(){clearInterval(l),l=setInterval(M,16)};0===e.pageYOffset&&e.scrollTo(0,0),w()}};var E=function(t){var r;try{r=m(decodeURIComponent(e.location.hash))}catch(t){r=m(e.location.hash)}n&&(n.id=n.getAttribute("data-scroll-id"),i.animateScroll(n,o),n=null,o=null)},I=function(r){if(0===r.button&&!r.metaKey&&!r.ctrlKey&&(o=h(r.target,t.selector),o&&"a"===o.tagName.toLowerCase()&&o.hostname===e.location.hostname&&o.pathname===e.location.pathname&&/#/.test(o.href))){var a;try{a=m(decodeURIComponent(o.hash))}catch(e){a=m(o.hash)}if("#"===a){r.preventDefault(),n=document.body;var c=n.id?n.id:"smooth-scroll-top";return n.setAttribute("data-scroll-id",c),n.id="",void(e.location.hash.substring(1)===c?E():e.location.hash=c)}n=document.querySelector(a),n&&(n.setAttribute("data-scroll-id",n.id),n.id="",o.hash===e.location.hash&&(r.preventDefault(),E()))}},H=function(e){c||(c=setTimeout((function(){c=null,a=O(r)}),66))};return i.destroy=function(){t&&(document.removeEventListener("click",I,!1),e.removeEventListener("resize",H,!1),t=null,n=null,o=null,r=null,a=null,c=null,l=null)},i.init=function(n){u&&(i.destroy(),t=d(s,n||{}),r=t.selectorHeader?document.querySelector(t.selectorHeader):null,a=O(r),document.addEventListener("click",I,!1),e.addEventListener("hashchange",E,!1),r&&e.addEventListener("resize",H,!1))},i}));

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long