jekyll-theme-mdui 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +213 -0
- data/_includes/analytics.html +10 -0
- data/_includes/disqus.html +3 -0
- data/_includes/footer.html +28 -0
- data/_includes/head.html +28 -0
- data/_includes/header.html +22 -0
- data/_includes/main.html +6 -0
- data/_includes/note.html +6 -0
- data/_includes/script.html +144 -0
- data/_includes/tips.html +6 -0
- data/_includes/toc.html +3 -0
- data/_includes/warn.html +6 -0
- data/_layouts/category.html +26 -0
- data/_layouts/compress.html +10 -0
- data/_layouts/default.html +14 -0
- data/_layouts/friends.html +21 -0
- data/_layouts/home.html +51 -0
- data/_layouts/page.html +29 -0
- data/_layouts/post.html +32 -0
- data/_layouts/search.html +15 -0
- data/_layouts/tags.html +33 -0
- data/assets/css/main.css +231 -0
- data/assets/images/touch/apple-touch-icon.png +0 -0
- data/assets/images/touch/chrome-touch-icon-192x192.png +0 -0
- data/assets/images/touch/icon-128x128.png +0 -0
- data/assets/images/touch/ms-touch-icon-144x144-precomposed.png +0 -0
- data/assets/js/jquery.scrollToTop.js +1 -0
- data/assets/js/jquery.typeahead.min.js +11 -0
- data/assets/js/pushpin.js +1 -0
- data/assets/js/toc.min.js +15 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 37823d72bb0e12190af9bb7fee9285daeff95aa7
|
4
|
+
data.tar.gz: bd56fa645ca7589344d837c411480847d569ecf0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6dc4dac37916ee769ff5660577e0e55147d82626305f687d182c7e918a8865def8095d1e7425c5e609522b6de8e4544bf8b815685c14e27095303871b568636f
|
7
|
+
data.tar.gz: 17159d657f5a7fc3abdcdca07f359dd071414e45072bbc6785f5561c9d9be52078ba70e2af244b4a6e0e8a2a27823f45e598d2ce0d0d705f093e24caef0c401d
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
# jekyll-theme-mdui
|
2
|
+
|
3
|
+
A Jekyll theme based on mdui
|
4
|
+
|
5
|
+
[demo](https://blog.kejun.space)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
We have two ways to install themes.
|
10
|
+
|
11
|
+
### First ways
|
12
|
+
|
13
|
+
Add this line to your Jekyll site's `Gemfile`:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem "jekyll-theme-mdui"
|
17
|
+
```
|
18
|
+
|
19
|
+
And add this line to your Jekyll site's `_config.yml`:
|
20
|
+
|
21
|
+
```yaml
|
22
|
+
theme: jekyll-theme-mdui
|
23
|
+
```
|
24
|
+
|
25
|
+
And then execute:
|
26
|
+
|
27
|
+
$ bundle
|
28
|
+
|
29
|
+
Or install it yourself as:
|
30
|
+
|
31
|
+
$ gem install jekyll-theme-mdui
|
32
|
+
|
33
|
+
### Second ways
|
34
|
+
|
35
|
+
Fork this repo to your repo:
|
36
|
+
|
37
|
+
```shell
|
38
|
+
git clone https://github.com/yourname/jekyll-theme-mdui.git
|
39
|
+
cd jekyll-theme-mdui
|
40
|
+
bundle install
|
41
|
+
jekyll s -w
|
42
|
+
```
|
43
|
+
|
44
|
+
Or direct clone:
|
45
|
+
|
46
|
+
```shell
|
47
|
+
git clone https://github.com/KeJunMao/jekyll-theme-mdui.git
|
48
|
+
cd jekyll-theme-mdui
|
49
|
+
bundle install
|
50
|
+
jekyll s -w
|
51
|
+
```
|
52
|
+
|
53
|
+
## Usage
|
54
|
+
|
55
|
+
### _config
|
56
|
+
|
57
|
+
```yml
|
58
|
+
title: "My blog" # Your site title
|
59
|
+
description: "This is my blog." # Your site description
|
60
|
+
url: # Your site url
|
61
|
+
baseurl: # baseurl
|
62
|
+
author: "My" # Your name
|
63
|
+
avatar: "https://myAvatar.png" # Your avatar
|
64
|
+
lang: "zh-CN" # lang
|
65
|
+
paginate: 5 # paginate
|
66
|
+
paginate_path: "/blog/page:num/" # paginate path
|
67
|
+
|
68
|
+
disqus_shortname: "" # Your disqus shortname
|
69
|
+
|
70
|
+
google_analytics: "" # Your google analytics ID
|
71
|
+
|
72
|
+
gems: # paginate gem
|
73
|
+
- jekyll-paginate
|
74
|
+
```
|
75
|
+
|
76
|
+
### _data
|
77
|
+
|
78
|
+
* friends.yml
|
79
|
+
```yml
|
80
|
+
- name: MDUI # name
|
81
|
+
image: # avatar or logo
|
82
|
+
url: https://www.mdui.org/ # url
|
83
|
+
describe: 一套用于开发 Material Design 网页的前端框架
|
84
|
+
```
|
85
|
+
* menus.yml
|
86
|
+
```yml
|
87
|
+
- name: SEARCH # name
|
88
|
+
url: /pages/menus/search.html # path
|
89
|
+
icon: search # icon from https://www.mdui.org/docs/material_icon
|
90
|
+
```
|
91
|
+
* sns.yml
|
92
|
+
```yml
|
93
|
+
- name: bilibili # name,supported:bilibili,facebook,github,gplus,instagram,linkedin,telegram,tumblr,twitter,weibo,zhihu
|
94
|
+
url: # url , if it is empty, it is not enabled
|
95
|
+
```
|
96
|
+
|
97
|
+
|
98
|
+
### search.json
|
99
|
+
|
100
|
+
```json
|
101
|
+
---
|
102
|
+
---
|
103
|
+
[
|
104
|
+
{% for post in site.posts %}
|
105
|
+
{
|
106
|
+
"title" : "{{ post.title | escape }}",
|
107
|
+
"url" : "{{ site.baseurl }}{{ post.url }}"
|
108
|
+
} {% unless forloop.last %},{% endunless %}
|
109
|
+
{% endfor %}
|
110
|
+
]
|
111
|
+
```
|
112
|
+
|
113
|
+
### tags.json
|
114
|
+
```json
|
115
|
+
---
|
116
|
+
---
|
117
|
+
{% capture tags %}
|
118
|
+
{% for tag in site.tags %}
|
119
|
+
{{ tag[0] }}
|
120
|
+
{% endfor %}
|
121
|
+
{% endcapture %}
|
122
|
+
{% assign sortedtags = tags | split:' ' | sort %}
|
123
|
+
[
|
124
|
+
{% for tag in sortedtags %}
|
125
|
+
{
|
126
|
+
"id" : "{{ tag | escape}}",
|
127
|
+
"post": [
|
128
|
+
{% for post in site.tags[tag] %}
|
129
|
+
{
|
130
|
+
"title": "{{ post.title | escape }}",
|
131
|
+
"excerpt": "{{ post.excerpt | strip_html | escape | strip_newlines}}",
|
132
|
+
"url": "{{ site.baseurl }}{{ post.url }}"
|
133
|
+
} {% unless forloop.last %},{% endunless %}
|
134
|
+
{% endfor %}]
|
135
|
+
} {% unless forloop.last %},{% endunless %}
|
136
|
+
{% endfor %}
|
137
|
+
]
|
138
|
+
```
|
139
|
+
### manifest.json
|
140
|
+
```json
|
141
|
+
{
|
142
|
+
"name": "KeJun BLOG",
|
143
|
+
"short_name": "KeJun",
|
144
|
+
"icons": [{
|
145
|
+
"src": "assets/images/touch/icon-128x128.png",
|
146
|
+
"sizes": "128x128",
|
147
|
+
"type": "image/png"
|
148
|
+
}, {
|
149
|
+
"src": "assets/images/touch/apple-touch-icon.png",
|
150
|
+
"sizes": "152x152",
|
151
|
+
"type": "image/png"
|
152
|
+
}, {
|
153
|
+
"src": "assets/images/touch/ms-touch-icon-144x144-precomposed.png",
|
154
|
+
"sizes": "144x144",
|
155
|
+
"type": "image/png"
|
156
|
+
}, {
|
157
|
+
"src": "assets/images/touch/chrome-touch-icon-192x192.png",
|
158
|
+
"sizes": "192x192",
|
159
|
+
"type": "image/png"
|
160
|
+
}],
|
161
|
+
"start_url": "/index.html?homescreen=1",
|
162
|
+
"display": "standalone",
|
163
|
+
"background_color": "#fdfdfd",
|
164
|
+
"theme_color": "#2a7ae2"
|
165
|
+
}
|
166
|
+
```
|
167
|
+
Replace it with your logo:`assets/images/touch`
|
168
|
+
|
169
|
+
### _post
|
170
|
+
|
171
|
+
Add the following format to your posts:
|
172
|
+
|
173
|
+
```liquid
|
174
|
+
{% include tips.html content="protips" %}
|
175
|
+
{% include note.html content="note" %}
|
176
|
+
{% include warn.html content="warnings" %}
|
177
|
+
```
|
178
|
+
|
179
|
+
[demo](https://blog.kejun.space/living/2017/05/29/jekyll-theme-mdui.html)
|
180
|
+
|
181
|
+
## TODO
|
182
|
+
|
183
|
+
[TODO](https://blog.kejun.space/pages/menus/todo.html)
|
184
|
+
|
185
|
+
## Note
|
186
|
+
|
187
|
+
If you use the first method to install, you need to download the following files to your jekyll website root directory Or create a new file,And replace it with your own information:
|
188
|
+
|
189
|
+
* tags.json
|
190
|
+
* sw.js
|
191
|
+
* search.json
|
192
|
+
* feed.xml
|
193
|
+
* _data/friends.yml
|
194
|
+
* _data/menus.yml
|
195
|
+
* _data/sns.yml
|
196
|
+
|
197
|
+
How to use? See Usage.
|
198
|
+
## Contributing
|
199
|
+
|
200
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hello. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
201
|
+
|
202
|
+
## Development
|
203
|
+
|
204
|
+
To set up your environment to develop this theme, run `bundle install`.
|
205
|
+
|
206
|
+
Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
|
207
|
+
|
208
|
+
When your theme is released, only the files in `_layouts`, `_includes`, and `_sass` tracked with Git will be released.
|
209
|
+
|
210
|
+
## License
|
211
|
+
|
212
|
+
The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
213
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{% if site.google_analytics %}
|
2
|
+
<script type="text/javascript">
|
3
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
4
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
5
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
6
|
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
7
|
+
ga('create', '{{ site.google_analytics }}', 'auto');
|
8
|
+
ga('send', 'pageview');
|
9
|
+
</script>
|
10
|
+
{% endif %}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<footer class="mdui-m-t-5">
|
2
|
+
<div class="mdui-card">
|
3
|
+
<div class="mdui-card-content mdui-shadow-0 mdui-p-a-5">
|
4
|
+
<div class="mdui-container">
|
5
|
+
<div class="mdui-row-sm-3">
|
6
|
+
<div class="mdui-col">
|
7
|
+
<div class="mdui-row">
|
8
|
+
{% for sns in site.data.sns %}
|
9
|
+
{% if sns.url != null %}
|
10
|
+
<div class="mdui-col-xs-4 mdui-col-sm-3 mdui-col-md-2 ">
|
11
|
+
<a href="{{sns.url}}"><div class="mdui-center k-footer-icon k-{{ sns.name }}"></div></a>
|
12
|
+
</div>
|
13
|
+
{% endif %}
|
14
|
+
{% endfor %}
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<div class="mdui-col mdui-text-center" style="line-height:48px">
|
18
|
+
Copyright ©<script>var fd=new Date;document.write(" "+fd.getFullYear()+" ")</script> {{site.title}}
|
19
|
+
</div>
|
20
|
+
<div class="mdui-col mdui-text-center">
|
21
|
+
<div>Powered by Jekyll</div>
|
22
|
+
<div>Theme-jekyll-theme-mdui</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
</footer>
|
data/_includes/head.html
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
<head>
|
2
|
+
<meta charset="utf-8">
|
3
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
|
+
<meta name="author" content="{{site.author}}">
|
6
|
+
<link href="https://ooo.0o0.ooo/2017/05/27/59294212bc16e.png" rel="shortcut icon">
|
7
|
+
<title>{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</title>
|
8
|
+
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
|
9
|
+
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
|
10
|
+
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}">
|
11
|
+
<link rel="manifest" href="{{ "/manifest.json" | prepend: site.baseurl }}">
|
12
|
+
<link rel="preload" href="//cdnjs.cloudflare.com/ajax/libs/mdui/0.2.1/css/mdui.min.css" as="style" onload="this.rel='stylesheet'">
|
13
|
+
<link rel="preload" href="{{ "/assets/css/main.css" | prepend: site.baseurl }}" as="style" onload="this.rel='stylesheet'">
|
14
|
+
<link rel="preload" href="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css" as="style" onload="this.rel='stylesheet'">
|
15
|
+
<noscript><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/mdui/0.2.1/css/mdui.min.css"></noscript>
|
16
|
+
<noscript><link rel="stylesheet" href="{{ "/assets/css/main.css" | prepend: site.baseurl }}"></noscript>
|
17
|
+
<noscript><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css"></noscript>
|
18
|
+
{% if page.layout == "post" %}
|
19
|
+
<link rel="preload" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/styles/default.min.css" as="style" onload="this.rel='stylesheet'">
|
20
|
+
<noscript><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/styles/default.min.css"></noscript>
|
21
|
+
{% endif %}
|
22
|
+
<script>
|
23
|
+
/*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
|
24
|
+
!function(a){"use strict";var b=function(b,c,d){function e(a){return h.body?a():void setTimeout(function(){e(a)})}function f(){i.addEventListener&&i.removeEventListener("load",f),i.media=d||"all"}var g,h=a.document,i=h.createElement("link");if(c)g=c;else{var j=(h.body||h.getElementsByTagName("head")[0]).childNodes;g=j[j.length-1]}var k=h.styleSheets;i.rel="stylesheet",i.href=b,i.media="only x",e(function(){g.parentNode.insertBefore(i,c?g:g.nextSibling)});var l=function(a){for(var b=i.href,c=k.length;c--;)if(k[c].href===b)return a();setTimeout(function(){l(a)})};return i.addEventListener&&i.addEventListener("load",f),i.onloadcssdefined=l,l(f),i};"undefined"!=typeof exports?exports.loadCSS=b:a.loadCSS=b}("undefined"!=typeof global?global:this);
|
25
|
+
/*! loadCSS rel=preload polyfill. [c]2017 Filament Group, Inc. MIT License */
|
26
|
+
!function(a){if(a.loadCSS){var b=loadCSS.relpreload={};if(b.support=function(){try{return a.document.createElement("link").relList.supports("preload")}catch(b){return!1}},b.poly=function(){for(var b=a.document.getElementsByTagName("link"),c=0;c<b.length;c++){var d=b[c];"preload"===d.rel&&"style"===d.getAttribute("as")&&(a.loadCSS(d.href,d,d.getAttribute("media")),d.rel=null)}},!b.support()){b.poly();var c=a.setInterval(b.poly,300);a.addEventListener&&a.addEventListener("load",function(){b.poly(),a.clearInterval(c)}),a.attachEvent&&a.attachEvent("onload",function(){a.clearInterval(c)})}}}(this);
|
27
|
+
</script>
|
28
|
+
</head>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<header mdui-headroom class="mdui-appbar mdui-shadow-0 mdui-appbar-fixed">
|
2
|
+
<div class="mdui-toolbar">
|
3
|
+
<a href="javascript:;" class="mdui-btn mdui-btn-icon mdui-hidden-sm-up" mdui-drawer="{target: '#k-menu'}"><i class="mdui-icon material-icons"></i></a>
|
4
|
+
<a href="{{site.url}}" class="mdui-typo-title">{{site.title |upcase }}</a>
|
5
|
+
<div class="mdui-toolbar-spacer"></div>
|
6
|
+
<div class="mdui-hidden-xs-down">
|
7
|
+
{% for menu in site.data.menus %}
|
8
|
+
<a href="{{menu.url}}" class="mdui-btn {% if menu.url == page.url %}mdui-list-item-active{% endif %}">{{menu.name}}</a>
|
9
|
+
{% endfor %}
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</header>
|
13
|
+
<div class="mdui-drawer mdui-drawer-close" id="k-menu">
|
14
|
+
<ul class="mdui-list">
|
15
|
+
{% for menu in site.data.menus %}
|
16
|
+
<a href="{{menu.url}}" class="mdui-list-item mdui-ripple {% if menu.url == page.url %}mdui-list-item-active{% endif %}">
|
17
|
+
<i class="mdui-list-item-icon mdui-icon material-icons">{{menu.icon}}</i>
|
18
|
+
<div class="mdui-list-item-content">{{menu.name}}</div>
|
19
|
+
</a>
|
20
|
+
{% endfor %}
|
21
|
+
</ul>
|
22
|
+
</div>
|
data/_includes/main.html
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
<main>
|
2
|
+
{{content}}
|
3
|
+
<button id="toTop" style="display:none;z-index: 1;" mdui-headroom="{unpinnedClass:'k-mdui-headroom-unpinned-top'}" class="mdui-fab mdui-color-white mdui-fab-fixed mdui-ripple"><i class="mdui-icon material-icons">expand_less</i></button>
|
4
|
+
</main>
|
5
|
+
|
6
|
+
|
data/_includes/note.html
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
2
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/mdui/0.2.1/js/mdui.min.js"></script>
|
3
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.js"></script>
|
4
|
+
<script src="{{ "/assets/js/jquery.scrollToTop.js" | prepend: site.baseurl }}"></script>
|
5
|
+
{% if page.layout =='search' %}
|
6
|
+
<script src="{{ "/assets/js/jquery.typeahead.min.js" | prepend: site.baseurl }}"></script>
|
7
|
+
{% endif %}
|
8
|
+
<script type="text/javascript">
|
9
|
+
NProgress.configure({
|
10
|
+
showSpinner: true
|
11
|
+
});
|
12
|
+
NProgress.start();
|
13
|
+
setTimeout(function() {
|
14
|
+
NProgress.done();
|
15
|
+
},200);
|
16
|
+
var disqus = {
|
17
|
+
load : function disqus(){
|
18
|
+
var disqus_shortname = $("#load-disqus").attr("data");
|
19
|
+
if(typeof DISQUS !== 'object') {
|
20
|
+
(function () {
|
21
|
+
var s = document.createElement('script'); s.async = true;
|
22
|
+
s.type = 'text/javascript';
|
23
|
+
s.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
24
|
+
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
25
|
+
}());
|
26
|
+
$('#load-disqus').remove();
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
</script>
|
31
|
+
<script>
|
32
|
+
$(function(){
|
33
|
+
if ('serviceWorker' in navigator) {
|
34
|
+
navigator.serviceWorker.register("{{ "/sw.js" | relative_url }}").then(function() {
|
35
|
+
console.log("Service Worker Registered");
|
36
|
+
});
|
37
|
+
}
|
38
|
+
Array.prototype.forEach.call(document.querySelectorAll(".mdui-card-media"), function(a) {
|
39
|
+
var b = a.querySelector("a");
|
40
|
+
if (!b) {
|
41
|
+
return
|
42
|
+
}
|
43
|
+
var c = b.getAttribute("href");
|
44
|
+
if (!c) {
|
45
|
+
return
|
46
|
+
}
|
47
|
+
a.addEventListener("click", function() {
|
48
|
+
location.href = c
|
49
|
+
})
|
50
|
+
});
|
51
|
+
|
52
|
+
$("#toTop").scrollToTop();
|
53
|
+
{% if page.layout =='search' %}
|
54
|
+
var names = new Array();
|
55
|
+
var urls = new Array();
|
56
|
+
$.getJSON("/search.json").done(function(data){
|
57
|
+
for (var index in data){
|
58
|
+
var item = data[index];
|
59
|
+
names[index] = item.title;
|
60
|
+
urls[names[index]] = item.url
|
61
|
+
}
|
62
|
+
$.typeahead({
|
63
|
+
input: '.js-typeahead-country_v1',
|
64
|
+
order: "desc",
|
65
|
+
source: {
|
66
|
+
data: names
|
67
|
+
},
|
68
|
+
selector: {
|
69
|
+
container: "typeahead__container",
|
70
|
+
result: " mdui-card k-search-card",
|
71
|
+
list: "mdui-list",
|
72
|
+
item: "mdui-list-item"
|
73
|
+
},
|
74
|
+
callback: {
|
75
|
+
onClick: function (node,a,item,event){
|
76
|
+
window.location.href = urls[item.display];
|
77
|
+
},
|
78
|
+
}
|
79
|
+
});
|
80
|
+
});
|
81
|
+
{% endif %}
|
82
|
+
});
|
83
|
+
</script>
|
84
|
+
|
85
|
+
{% if page.layout == "tags" %}
|
86
|
+
<script>
|
87
|
+
|
88
|
+
$(function(){
|
89
|
+
var tagid;
|
90
|
+
$(".k-tagcloud").on("click",function(e){
|
91
|
+
var $this = $(this);
|
92
|
+
tagid = $this.attr("id");
|
93
|
+
if(tagid!=null){
|
94
|
+
$.ajax({
|
95
|
+
type: "GET",
|
96
|
+
url:"/tags.json",
|
97
|
+
dataType:"json",
|
98
|
+
success: function(data){
|
99
|
+
var content = "<ul class='mdui-list'>";
|
100
|
+
$.each(data,function(i,n){
|
101
|
+
if(n.id === tagid){
|
102
|
+
var posts = n.post;
|
103
|
+
$.each(posts,function(i,n){
|
104
|
+
content+="<li class='mdui-list-item mdui-ripple'><a href='"+n.url+"'><div class='mdui-list-item-content'><div class='mdui-list-item-title mdui-list-item-one-line'>"+n.title+"</div><div class='mdui-list-item-text mdui-list-item-one-line'>"+n.excerpt+"</div>
|
105
|
+
</div></li>";
|
106
|
+
});
|
107
|
+
}
|
108
|
+
});
|
109
|
+
content += "</ul>";
|
110
|
+
$('#taglist').html(content)
|
111
|
+
}
|
112
|
+
})
|
113
|
+
}
|
114
|
+
});
|
115
|
+
|
116
|
+
})
|
117
|
+
</script>
|
118
|
+
{% endif %}
|
119
|
+
|
120
|
+
{% if page.layout == "post" %}
|
121
|
+
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/highlight.min.js"></script>
|
122
|
+
<script src="{{ "/assets/js/toc.min.js" | prepend: site.baseurl }}"></script>
|
123
|
+
<script src="{{ "/assets/js/pushpin.js" | prepend: site.baseurl }}"></script>
|
124
|
+
<script>
|
125
|
+
$(function(){
|
126
|
+
$("div.k-page-col").css('margin',0);
|
127
|
+
hljs.initHighlightingOnLoad();
|
128
|
+
$('#toc').toc({
|
129
|
+
'selectors': 'h2',
|
130
|
+
'prefix': 'toc',
|
131
|
+
'highlightOffset': 64
|
132
|
+
});
|
133
|
+
$("#toc").find("ul").fadeIn(1000);
|
134
|
+
var tocBottom = $('.mdui-card-content').offset().top + $('.mdui-card-content').height() - $('#toc-card').height();
|
135
|
+
var tocOffset = $('.k-post-media').offset().top;
|
136
|
+
var tocTop = $('.mdui-card-header').offset().top;
|
137
|
+
$('#toc-card').pushpin({
|
138
|
+
top: tocTop,
|
139
|
+
bottom: 99999,
|
140
|
+
offset: tocOffset
|
141
|
+
});
|
142
|
+
})
|
143
|
+
</script>
|
144
|
+
{% endif %}
|