Skip to content
This repository was archived by the owner on Jan 7, 2019. It is now read-only.

Commit d8ac7cd

Browse files
committed
Add like button
1 parent 6dd19ed commit d8ac7cd

11 files changed

+350
-1
lines changed

.vscode/settings.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"prettier.printWidth": 120
2+
"prettier.printWidth": 120,
3+
"[html]": {
4+
"editor.formatOnSave": false
5+
}
36
}

_layouts/ebook/page.html

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{% extends "layout.html" %}
2+
3+
{% block title %}{{ page.title }}{% endblock %}
4+
{% block description %}{{ page.description }}{% endblock %}
5+
6+
{% block style %}
7+
{### Include theme css before plugins css ###}
8+
{% if not fileExists(config.styles.print) %}
9+
{% if options.format %}
10+
<link rel="stylesheet" href="{{ (options.format + ".css")|resolveAsset }}">
11+
{% else %}
12+
<link rel="stylesheet" href="{{ "ebook.css"|resolveAsset }}">
13+
{% endif %}
14+
{% endif %}
15+
16+
{{ super() }}
17+
18+
{### Custom stylesheets for the book ###}
19+
20+
{% for type, style in config.styles %}
21+
{% if fileExists(style) and (type == "ebook" or type == "print" or type == options.format) %}
22+
<link rel="stylesheet" href="{{ style|resolveFile }}">
23+
{% endif %}
24+
{% endfor %}
25+
{% endblock %}
26+
27+
{% block body %}
28+
<div class="page">
29+
{% block page %}
30+
<h1 class="book-chapter book-chapter-{{ page.depth }}">{{ page.title }}</h1>
31+
<div class="section">
32+
{{ page.content|safe }}
33+
</div>
34+
{% endblock %}
35+
</div>
36+
{% endblock %}

_layouts/ebook/pdf_footer.html

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% extends "./page.html" %}
2+
3+
{% block body %}
4+
<div class="pdf-footer">
5+
<span>{{ page.section }}</span>
6+
<span class="footer-pages-count">{{ page.num }}</span>
7+
</div>
8+
{% endblock %}

_layouts/ebook/pdf_header.html

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% extends "./page.html" %}
2+
3+
{% block body %}
4+
<div class="pdf-header">
5+
<span>{{ page.title }}</span>
6+
</div>
7+
{% endblock %}

_layouts/ebook/summary.html

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{% extends "./page.html" %}
2+
3+
{% block title %}{{ "SUMMARY"|t }}{% endblock %}
4+
5+
{% macro articles(_articles) %}
6+
{% for article in _articles %}
7+
<li>
8+
<span class="inner">
9+
{% if article.path or article.url %}
10+
{% if article.path %}
11+
<a href="{{ article.path|contentURL }}{{ article.anchor }}">{{ article.title }}</a>
12+
{% else %}
13+
<a target="_blank" href="{{ article.url }}">{{ article.title }}</a>
14+
{% endif %}
15+
{% else %}
16+
<span>{{ article.title }}</span>
17+
{% endif %}
18+
{% if 1 %}
19+
<span class="page">{{ article.level }}</span>
20+
{% endif %}
21+
</span>
22+
{% if article.articles.length > 0 %}
23+
<ol>
24+
{{ articles(article.articles) }}
25+
</ol>
26+
{% endif %}
27+
</li>
28+
{% endfor %}
29+
{% endmacro %}
30+
31+
{% block page %}
32+
<div class="section toc">
33+
<h1>{{ "SUMMARY"|t }}</h1>
34+
<ol>
35+
{% for part in summary.parts %}
36+
{% if part.title %}
37+
<li class="part-title">
38+
<h2>{{ part.title }}</h2>
39+
</li>
40+
{% endif %}
41+
{{ articles(part.articles) }}
42+
43+
{% if not loop.last %}
44+
<li class="divider"></li>
45+
{% endif %}
46+
{% endfor %}
47+
48+
{% if glossary.path %}
49+
<li>
50+
<span class="inner">
51+
<a href="{{ ('/' + glossary.path)|contentURL }}">{{ "GLOSSARY"|t }}</a>
52+
</span>
53+
</li>
54+
{% endif %}
55+
</ol>
56+
</div>
57+
{% endblock %}
58+

_layouts/layout.html

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE HTML>
2+
<html lang="{{ config.language }}" {% if page.dir == "rtl" %}dir="rtl"{% endif %}>
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
6+
<title>{% block title %}{{ config.title|d("GitBook", true) }}{% endblock %}</title>
7+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
8+
<meta name="description" content="{% block description %}{% endblock %}">
9+
<meta name="generator" content="GitBook {{ gitbook.version }}">
10+
{% if config.author %}<meta name="author" content="{{ config.author }}">{% endif %}
11+
{% if config.isbn %}<meta name="identifier" content="{{ config.isbn }}" scheme="ISBN">{% endif %}
12+
{% block style %}
13+
{% for resource in plugins.resources.css %}
14+
{% if resource.url %}
15+
<link rel="stylesheet" href="{{ resource.url }}">
16+
{% else %}
17+
<link rel="stylesheet" href="{{ resource.path|resolveAsset }}">
18+
{% endif %}
19+
{% endfor %}
20+
{% endblock %}
21+
{% block head %}{% endblock %}
22+
</head>
23+
<body>
24+
{% block body %}{% endblock %}
25+
{% block javascript %}{% endblock %}
26+
</body>
27+
</html>

_layouts/website/header.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{% block book_header %}
2+
<div class="book-header" role="navigation">
3+
{% if glossary.path %}
4+
<a href="{{ ('/' + glossary.path)|resolveFile }}" class="btn pull-left" aria-label="{{ "GLOSSARY_OPEN"|t }}"><i class="fa fa-sort-alpha-asc"></i></a>
5+
{% endif %}
6+
7+
<!-- Title -->
8+
<h1>
9+
<i class="fa fa-circle-o-notch fa-spin"></i>
10+
<a href="{{ "/"|resolveFile }}" >{{ page.title }}</a>
11+
</h1>
12+
</div>
13+
{% endblock %}

_layouts/website/languages.html

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{% extends "./layout.html" %}
2+
3+
{% block title %}{{ "LANGS_CHOOSE"|t }} · {{ super() }}{% endblock %}
4+
5+
{% block body %}
6+
<div class="book-langs-index" role="navigation">
7+
<div class="inner">
8+
<h3>{{ "LANGS_CHOOSE"|t }}</h3>
9+
10+
<ul class="languages">
11+
{% for lang in languages.list %}
12+
<li>
13+
<a href="{{ (lang.id + "/README.md")|contentURL }}">{{ lang.title }}</a>
14+
</li>
15+
{% endfor %}
16+
</ul>
17+
</div>
18+
</div>
19+
{% endblock %}

_layouts/website/layout.html

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{% extends "layout.html" %}
2+
3+
{% block head %}
4+
{{ super() }}
5+
<meta name="HandheldFriendly" content="true"/>
6+
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
7+
<meta name="apple-mobile-web-app-capable" content="yes">
8+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
9+
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="{{ "images/apple-touch-icon-precomposed-152.png"|resolveAsset }}">
10+
<link rel="shortcut icon" href="{{ "images/favicon.ico"|resolveAsset }}" type="image/x-icon">
11+
{% endblock %}
12+
13+
{% block style %}
14+
{### Include theme css before plugins css ###}
15+
<link rel="stylesheet" href="{{ "style.css"|resolveAsset }}">
16+
17+
{{ super() }}
18+
19+
{### Custom stylesheets for the book ###}
20+
21+
{% for type, style in config.styles %}
22+
{% if fileExists(style) and type == "website" %}
23+
<link rel="stylesheet" href="{{ style|resolveFile }}">
24+
{% endif %}
25+
{% endfor %}
26+
{% endblock %}
27+
28+
{% block body %}{% endblock %}

_layouts/website/page.html

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{% extends "./layout.html" %}
2+
3+
{% block title %}{{ page.title }} · {{ super() }}{% endblock %}
4+
5+
{% block description %}{{ page.description }}{% endblock %}
6+
7+
{% block head %}
8+
{{ super() }}
9+
{% if page.next and page.next.path %}
10+
<link rel="next" href="{{ page.next.path|resolveFile }}" />
11+
{% endif %}
12+
{% if page.previous and page.previous.path %}
13+
<link rel="prev" href="{{ page.previous.path|resolveFile }}" />
14+
{% endif %}
15+
{% endblock %}
16+
17+
{% block javascript %}
18+
<script src="{{ "gitbook.js"|resolveAsset }}"></script>
19+
<script src="{{ "theme.js"|resolveAsset }}"></script>
20+
{% for resource in plugins.resources.js %}
21+
{% if resource.url %}
22+
<script src="{{ resource.url }}"></script>
23+
{% else %}
24+
<script src="{{ resource.path|resolveAsset }}"></script>
25+
{% endif %}
26+
{% endfor %}
27+
{% endblock %}
28+
29+
{% block body %}
30+
<div class="book">
31+
<div class="book-summary">
32+
{% block book_sidebar %}
33+
{% block search_input %}{% endblock %}
34+
{% block book_summary %}
35+
<nav role="navigation">
36+
{% include "website/summary.html" %}
37+
</nav>
38+
{% endblock %}
39+
{% endblock %}
40+
</div>
41+
42+
<div class="book-body">
43+
{% block book_body %}
44+
<div class="body-inner">
45+
{% block book_inner %}
46+
{% include "website/header.html" %}
47+
48+
<div class="page-wrapper" tabindex="-1" role="main">
49+
<div class="page-inner">
50+
{% block search_results %}
51+
<section class="normal markdown-section">
52+
{% block page %}
53+
{{ page.content|safe }}
54+
{% endblock %}
55+
</section>
56+
{% endblock %}
57+
</div>
58+
</div>
59+
{% endblock %}
60+
</div>
61+
62+
<!-- LikeBtn.com BEGIN -->
63+
<span class="likebtn-wrapper" data-theme="padded" data-i18n_like="This standard helped me" data-dislike_enabled="false" data-icon_dislike_show="false"></span>
64+
<script>(function(d,e,s){if(d.getElementById("likebtn_wjs"))return;a=d.createElement(e);m=d.getElementsByTagName(e)[0];a.async=1;a.id="likebtn_wjs";a.src=s;m.parentNode.insertBefore(a, m)})(document,"script","//w.likebtn.com/js/w/widget.js");</script>
65+
<!-- LikeBtn.com END -->
66+
67+
{% block book_navigation %}
68+
{% if page.previous and page.previous.path %}
69+
<a href="{{ page.previous.path|resolveFile }}{{ page.previous.anchor }}" class="navigation navigation-prev {% if not (page.next and page.next.path) %}navigation-unique{% endif %}" aria-label="Previous page: {{ page.previous.title }}">
70+
<i class="fa fa-angle-left"></i>
71+
</a>
72+
{% endif %}
73+
{% if page.next and page.next.path %}
74+
<a href="{{ page.next.path|resolveFile }}{{ page.next.anchor }}" class="navigation navigation-next {% if not (page.previous and page.previous.path) %}navigation-unique{% endif %}" aria-label="Next page: {{ page.next.title }}">
75+
<i class="fa fa-angle-right"></i>
76+
</a>
77+
{% endif %}
78+
{% endblock %}
79+
{% endblock %}
80+
</div>
81+
82+
<script>
83+
var gitbook = gitbook || [];
84+
gitbook.push(function() {
85+
gitbook.page.hasChanged({{ template.getJSContext()|dump|safe }});
86+
});
87+
</script>
88+
</div>
89+
{% endblock %}

_layouts/website/summary.html

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{% macro articles(_articles) %}
2+
{% for article in _articles %}
3+
<li class="chapter {% if article.path == file.path and not article.anchor %}active{% endif %}" data-level="{{ article.level }}" {% if article.path %}data-path="{{ article.path|resolveFile }}"{% endif %}>
4+
{% if article.path and getPageByPath(article.path) %}
5+
<a href="{{ article.path|resolveFile }}{{ article.anchor }}">
6+
{% elif article.url %}
7+
<a target="_blank" href="{{ article.url }}">
8+
{% else %}
9+
<span>
10+
{% endif %}
11+
{% if article.level != "0" and config.pluginsConfig['theme-default'].showLevel %}
12+
<b>{{ article.level }}.</b>
13+
{% endif %}
14+
{{ article.title }}
15+
{% if article.path or article.url %}
16+
</a>
17+
{% else %}
18+
</span>
19+
{% endif %}
20+
21+
{% if article.articles.length > 0 %}
22+
<ul class="articles">
23+
{{ articles(article.articles, file, config) }}
24+
</ul>
25+
{% endif %}
26+
</li>
27+
{% endfor %}
28+
{% endmacro %}
29+
30+
<ul class="summary">
31+
{% set _divider = false %}
32+
{% if config.links.sidebar %}
33+
{% for linkTitle, link in config.links.sidebar %}
34+
{% set _divider = true %}
35+
<li>
36+
<a href="{{ link }}" target="_blank" class="custom-link">{{ linkTitle }}</a>
37+
</li>
38+
{% endfor %}
39+
{% endif %}
40+
41+
{% if _divider %}
42+
<li class="divider"></li>
43+
{% endif %}
44+
45+
{% for part in summary.parts %}
46+
{% if part.title %}
47+
<li class="header">{{ part.title }}</li>
48+
{% elif not loop.first %}
49+
<li class="divider"></li>
50+
{% endif %}
51+
{{ articles(part.articles, file, config) }}
52+
{% endfor %}
53+
54+
<li class="divider"></li>
55+
56+
<li>
57+
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
58+
{{ "GITBOOK_LINK"|t }}
59+
</a>
60+
</li>
61+
</ul>

0 commit comments

Comments
 (0)