mirror of
https://github.com/changkun/modern-cpp-tutorial.git
synced 2025-12-17 04:34:40 +03:00
resolve #5, 使用 hexo 编译网站
This commit is contained in:
4
website/themes/moderncpp/_config.yml
Executable file
4
website/themes/moderncpp/_config.yml
Executable 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
|
||||
33
website/themes/moderncpp/layout/index.ejs
Executable file
33
website/themes/moderncpp/layout/index.ejs
Executable 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>版权所有 © 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>
|
||||
52
website/themes/moderncpp/layout/layout.ejs
Executable file
52
website/themes/moderncpp/layout/layout.ejs
Executable 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>
|
||||
26
website/themes/moderncpp/layout/page.ejs
Executable file
26
website/themes/moderncpp/layout/page.ejs
Executable 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>版权所有 © 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>
|
||||
9
website/themes/moderncpp/layout/partials/header.ejs
Executable file
9
website/themes/moderncpp/layout/partials/header.ejs
Executable 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>
|
||||
38
website/themes/moderncpp/layout/partials/main_menu.ejs
Executable file
38
website/themes/moderncpp/layout/partials/main_menu.ejs
Executable 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>
|
||||
23
website/themes/moderncpp/layout/partials/sidebar.ejs
Executable file
23
website/themes/moderncpp/layout/partials/sidebar.ejs
Executable 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>
|
||||
7
website/themes/moderncpp/layout/partials/toc.ejs
Executable file
7
website/themes/moderncpp/layout/partials/toc.ejs
Executable 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>
|
||||
21
website/themes/moderncpp/layout/post.ejs
Executable file
21
website/themes/moderncpp/layout/post.ejs
Executable 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>
|
||||
12
website/themes/moderncpp/source/modern-cpp/css/_animations.styl
Executable file
12
website/themes/moderncpp/source/modern-cpp/css/_animations.styl
Executable 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)
|
||||
184
website/themes/moderncpp/source/modern-cpp/css/_common.styl
Executable file
184
website/themes/moderncpp/source/modern-cpp/css/_common.styl
Executable 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
|
||||
144
website/themes/moderncpp/source/modern-cpp/css/_header.styl
Executable file
144
website/themes/moderncpp/source/modern-cpp/css/_header.styl
Executable 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
|
||||
32
website/themes/moderncpp/source/modern-cpp/css/_settings.styl
Executable file
32
website/themes/moderncpp/source/modern-cpp/css/_settings.styl
Executable 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
|
||||
89
website/themes/moderncpp/source/modern-cpp/css/_sidebar.styl
Executable file
89
website/themes/moderncpp/source/modern-cpp/css/_sidebar.styl
Executable 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)
|
||||
77
website/themes/moderncpp/source/modern-cpp/css/_syntax.styl
Executable file
77
website/themes/moderncpp/source/modern-cpp/css/_syntax.styl
Executable 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
|
||||
156
website/themes/moderncpp/source/modern-cpp/css/index.styl
Executable file
156
website/themes/moderncpp/source/modern-cpp/css/index.styl
Executable 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
|
||||
239
website/themes/moderncpp/source/modern-cpp/css/page.styl
Executable file
239
website/themes/moderncpp/source/modern-cpp/css/page.styl
Executable 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
|
||||
260
website/themes/moderncpp/source/modern-cpp/js/common.js
Executable file
260
website/themes/moderncpp/source/modern-cpp/js/common.js
Executable 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, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
})()
|
||||
106
website/themes/moderncpp/source/modern-cpp/js/css.escape.js
Executable file
106
website/themes/moderncpp/source/modern-cpp/js/css.escape.js
Executable 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: there’s 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;
|
||||
|
||||
}));
|
||||
2
website/themes/moderncpp/source/modern-cpp/js/smooth-scroll.min.js
vendored
Executable file
2
website/themes/moderncpp/source/modern-cpp/js/smooth-scroll.min.js
vendored
Executable 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}));
|
||||
10517
website/themes/moderncpp/source/modern-cpp/js/vue.js
Executable file
10517
website/themes/moderncpp/source/modern-cpp/js/vue.js
Executable file
File diff suppressed because it is too large
Load Diff
6
website/themes/moderncpp/source/modern-cpp/js/vue.min.js
vendored
Executable file
6
website/themes/moderncpp/source/modern-cpp/js/vue.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user