Skip to content

Commit 23d59f0

Browse files
authored
1.3.3 (#270)
* refactor(mathjax): save mathjax.js to local * feat(head): add support for dns-prefetch * refactor(search): let the search dependencies only load on home page * refactor(language): zh-CN * feat(head): add support for dns-prefetch Add dns-prefetch support for: - Changyan - Busuanzi - Google-Analytics - Baidu-Analytics - busuanzi - Leancloud * refactor(lazyload): use lazyload on all Thumbnail * refactor(lazyload): update lazyload * remove lazyload of daily_pic * use 'show' effect instead of 'fadeIn' * refactor(disqus_click): update button style and remove ripple (#261) * refactor(disqus_click): update button style and remove ripple * refactor(disqus_click): remove the height * refactor(disqus_click): use theme_button_color * fix(toc):fix toc menu list (#266) * fix(toc):fix #167 * fix(toc):use max-height instead * fix(toc): set a custom scroll style * fix(toc): move css to style.css and minify * fix(top post): fix pin on top (#257) * fix(topPost):fix Pin on top * fix(topPost): fix theme.topPost
2 parents ed2aaf7 + 77a48af commit 23d59f0

17 files changed

+606
-111
lines changed

_config.template.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ sidebar:
146146
# Qrcode for redirect at other device
147147
qrcode: false
148148

149-
# Support Pin posts on the top of the list
150-
topPost: false
151-
152149
# ---------------------------------------------------------------
153150
# Integrated Services
154151
# ---------------------------------------------------------------

languages/zh-CN.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
post:
66
visitor: "访客"
77
views: "浏览量"
8-
continue: "继续阅读"
8+
continue: "阅读全文"
99
older: "旧篇"
1010
newer: "新篇"
1111
private: "私有文章,暂不公开"
@@ -26,4 +26,4 @@ title:
2626
tag: "标签"
2727
misc:
2828
home: "主页"
29-
theme: "主题"
29+
theme: "主题"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script>
22
var randomNum = Math.floor(Math.random() * <%= theme.thumbnail.random_amount %> + 1);
33
4-
$('.post_thumbnail-random').css('background-image', 'url(' + '<%= theme.img.random_thumbnail %>' + randomNum + '.png' + ')');
4+
$('.post_thumbnail-random').attr('data-original', '<%= theme.img.random_thumbnail %>' + randomNum + '.png');
5+
$('.post_thumbnail-random').addClass('lazy');
56
</script>

layout/_partial/Paradox-post_entry-thumbnail.ejs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
randomNum = Math.floor(Math.random() * <%= theme.thumbnail.random_amount %> + 1);
77
88
locatePost.children('.post_thumbnail-random').attr('id', 'random_thumbnail-'+randomNum);
9-
locatePost.children('.post_thumbnail-random').css('background-image', 'url(' + '<%= theme.img.random_thumbnail %>' + randomNum + '.png' + ')')
9+
locatePost.children('.post_thumbnail-random').attr('data-original', '<%= theme.img.random_thumbnail %>' + randomNum + '.png');
10+
$('.post_thumbnail-random').addClass('lazy');
1011
1112
locatePost = locatePost.next();
1213
}

layout/_partial/Paradox-post_entry.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<% } %>
1111
<% } else { %>
1212
<!-- Custom Thumbnail -->
13-
<div class="post_thumbnail-custom mdl-card__media mdl-color-text--grey-50" style="background-image:url(<%= post.thumbnail %>)">
13+
<div class="post_thumbnail-custom mdl-card__media mdl-color-text--grey-50 lazy" data-original="<%= post.thumbnail %>">
1414
<% } %>
1515

1616
<!-- Post Title -->

layout/_partial/config_css.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
color: <%= theme.uiux.hyperlink_color %>;
6363
text-decoration: underline;
6464
}
65+
6566
</style>
6667

6768

layout/_partial/head.ejs

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,42 @@
3232
<%= config.title %>
3333
</title>
3434

35-
<!-- Favicons -->
36-
<link rel="icon shortcut" type="image/ico" href="<%= theme.head.favicon %>">
37-
<link rel="icon" sizes="192x192" href="<%= theme.head.high_res_favicon %>">
38-
<link rel="apple-touch-icon" href="<%= theme.head.apple_touch_icon %>">
39-
4035
<!-- Meta & Info -->
4136
<meta charset="utf-8">
37+
38+
<!-- dns prefetch -->
39+
<meta http-equiv="x-dns-prefetch-control" content="on">
40+
<% if(theme.materialcdn.use === true) { %>
41+
<link rel="dns-prefetch" href="<%= theme.materialcdn.base %>"/>
42+
<%}%>
43+
<% if(theme.leancloud.enable === true) { %>
44+
<link rel="dns-prefetch" href="<%= theme.leancloud.av_core_mini %>"/>
45+
<% } %>
46+
<% if(theme.comment.use == "changyan"){ %>
47+
<link rel="dns-prefetch" href="https://changyan.sohu.com"/>
48+
<% } %>
49+
<% if(theme.analytics.baidu_id) { %>
50+
<link rel="dns-prefetch" href="https://hm.baidu.com"/>
51+
<% } %>
52+
<% if(theme.analytics.google_id) { %>
53+
<link rel="dns-prefetch" href="https://www.google-analytics.com"/>
54+
<% } %>
55+
<% if(theme.busuanzi.enable === true) { %>
56+
<link rel="dns-prefetch" href="https://busuanzi.ibruce.info"/>
57+
<% } %>
58+
4259
<meta http-equiv="X-UA-Compatible">
4360
<meta name="viewport" content="width=device-width, initial-scale=1">
4461
<meta name="theme-color" content="<%= theme.uiux.android_chrome_color %>">
4562
<meta name="author" content="<%= config.author %>">
4663
<meta name="description" content="<%= config.description %>">
4764
<meta name="keywords" content="<%= theme.head.keywords %><% if(page.tags && page.tags.each) { page.tags.each(function(tag) { %><%- ',' + tag.name %><% })} %>">
4865

66+
<!-- Favicons -->
67+
<link rel="icon shortcut" type="image/ico" href="<%= theme.head.favicon %>">
68+
<link rel="icon" sizes="192x192" href="<%= theme.head.high_res_favicon %>">
69+
<link rel="apple-touch-icon" href="<%= theme.head.apple_touch_icon %>">
70+
4971
<!--iOS -->
5072
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
5173
<meta name="apple-mobile-web-app-title" content="Title">
@@ -126,12 +148,12 @@
126148
</script>
127149
<% } %>
128150
151+
129152
<!-- Bing Background -->
130153
<% if(theme.background.bing.enable) { %>
131154
<script type="text/javascript">
132155
queue.offer(function(){
133156
$('body').attr('data-original', 'https://api.i-meto.com/bing?<%= theme.background.bing.parameter %>');
134-
$('body.lazy').lazyload();
135157
});
136158
</script>
137159
<% } %>

layout/_partial/import_js.ejs

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,30 @@
1919

2020
<%- partial('_partial/footer-option') %>
2121

22-
<!-- Swiftye -->
23-
<% if( theme.search.use === 'swiftype' ) { %>
24-
<%- partial('_widget/search-swiftype-js') %>
25-
<% } %>
22+
<% if( (page.current === 1) && (is_home()) ) { %>
23+
<!-- Swiftye -->
24+
<% if( theme.search.use === 'swiftype' ) { %>
25+
<%- partial('_widget/search-swiftype-js') %>
26+
<% } %>
2627
27-
<!-- Local Search-->
28-
<% if( theme.search.use === 'local' ) { %>
29-
<%- partial('_widget/search-local-js') %>
28+
<!-- Local Search-->
29+
<% if( theme.search.use === 'local' ) { %>
30+
<%- partial('_widget/search-local-js') %>
3031
31-
<script>
32-
var inputArea = document.querySelector('#search');
33-
var getSearchFile = function() {
34-
var path = '<%= config.search.path %>';
35-
searchFunc(path, 'search', 'local-search-result');
36-
}
32+
<script>
33+
var inputArea = document.querySelector('#search');
34+
var getSearchFile = function() {
35+
var path = '<%= config.search.path %>';
36+
searchFunc(path, 'search', 'local-search-result');
37+
}
3738
38-
if(inputArea) {
39-
inputArea.onfocus = function() {
40-
getSearchFile();
39+
if(inputArea) {
40+
inputArea.onfocus = function() {
41+
getSearchFile();
42+
}
4143
}
42-
}
43-
</script>
44+
</script>
45+
<% } %>
4446
<% } %>
4547

4648
<!-- Window Load-->
@@ -55,3 +57,20 @@
5557
<% if (page.mathjax) { %>
5658
<%- partial('_widget/mathjax') %>
5759
<% } %>
60+
<script>
61+
<!-- Offer LazyLoad -->
62+
queue.offer(function(){
63+
$('.lazy').lazyload({
64+
effect : 'show'
65+
});
66+
});
67+
68+
<!-- Start Queue -->
69+
$(document).ready(function(){
70+
setTimeout(function(){
71+
setInterval(function(){
72+
queue.execNext();
73+
},200);
74+
},3000);
75+
});
76+
</script>

layout/_partial/toc_button.ejs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
<i class="material-icons">format_list_numbered</i>
2222
</button>
2323
24-
<ul class="post-toc-wrap mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect" for="post-toc-trigger-btn">
24+
<ul class="post-toc-wrap mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect" for="post-toc-trigger-btn" style="max-height:80vh; overflow-y:scroll;">
2525
<%- toc(page.content, {
2626
class: 'post-toc',
27-
list_number: true
27+
list_number: true,
28+
style: 'max-height:80vh; overflow-y:scroll;'
2829
}) %>
2930
3031
<!--

layout/_widget/disqus_click.ejs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<div id="disqus_thread"></div>
2-
<!-- include js -->
3-
<script src="/js/ripple.js"></script>
42

53
<!-- add animation -->
64
<style>
@@ -22,19 +20,37 @@
2220
opacity: 0;
2321
}
2422
}
25-
.disqus_click_btn {
26-
background-color: dodgerblue;
27-
color: white;
28-
padding: 10px 20px;
29-
border:0;
23+
.disqus_click_btn {
24+
line-height: 30px;
25+
margin: 0;
26+
min-width: 50px;
27+
padding: 0 14px;
28+
display: inline-block;
29+
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
3030
font-size: 14px;
31-
cursor: pointer
31+
font-weight: 400;
32+
text-transform: uppercase;
33+
letter-spacing: 0;
34+
overflow: hidden;
35+
will-change: box-shadow;
36+
transition: box-shadow .2s cubic-bezier(.4, 0, 1, 1), background-color .2s cubic-bezier(.4, 0, .2, 1), color .2s cubic-bezier(.4, 0, .2, 1);
37+
outline: 0;
38+
cursor: pointer;
39+
text-decoration: none;
40+
text-align: center;
41+
vertical-align: middle;
42+
border: 0;
43+
background: rgba(158, 158, 158, .2);
44+
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
45+
color: #fff;
46+
background-color: <%= theme.uiux.button_color %>;
47+
text-shadow: 0
3248
}
3349
</style>
3450

3551
<!-- add data-ripple attribute -->
3652
<div class="btn_click_load">
37-
<button class="disqus_click_btn" data-ripple><%= __('post.comments_load_button') %></button>
53+
<button class="disqus_click_btn"><%= __('post.comments_load_button') %></button>
3854
</div>
3955

4056
<script>

0 commit comments

Comments
 (0)