Skip to content

Commit fea0265

Browse files
committed
Site updated: 2017-05-08 15:10:48
1 parent edab18d commit fea0265

File tree

45 files changed

+10488
-4197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+10488
-4197
lines changed

2017/04/15/听听,一款优雅的开源音乐播放器/index.html

Lines changed: 95 additions & 237 deletions
Large diffs are not rendered by default.

2017/04/27/Glide源码解析(一):加载流程/index.html

Lines changed: 95 additions & 237 deletions
Large diffs are not rendered by default.

2017/05/08/Glide源码解析(二):缓存机制/index.html

Lines changed: 95 additions & 237 deletions
Large diffs are not rendered by default.

archives/2017/04/index.html

Lines changed: 81 additions & 204 deletions
Large diffs are not rendered by default.

archives/2017/05/index.html

Lines changed: 79 additions & 202 deletions
Large diffs are not rendered by default.

archives/2017/index.html

Lines changed: 83 additions & 206 deletions
Large diffs are not rendered by default.

archives/index.html

Lines changed: 83 additions & 206 deletions
Large diffs are not rendered by default.

categories/index.html

Lines changed: 78 additions & 207 deletions
Large diffs are not rendered by default.

categories/开源项目/index.html

Lines changed: 81 additions & 206 deletions
Large diffs are not rendered by default.

categories/源码分析/index.html

Lines changed: 83 additions & 208 deletions
Large diffs are not rendered by default.

index.html

Lines changed: 116 additions & 296 deletions
Large diffs are not rendered by default.

js/src/algolia-search.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ $(document).ready(function () {
3737
hitsPerPage: algoliaSettings.hits.per_page || 10,
3838
templates: {
3939
item: function (data) {
40+
var link = data.permalink ? data.permalink : (CONFIG.root + data.path);
4041
return (
41-
'<a href="' + CONFIG.root + data.path + '" class="algolia-hit-item-link">' +
42+
'<a href="' + link + '" class="algolia-hit-item-link">' +
4243
data._highlightResult.title.value +
4344
'</a>'
4445
);
@@ -98,14 +99,16 @@ $(document).ready(function () {
9899

99100
$('.popup-trigger').on('click', function(e) {
100101
e.stopPropagation();
101-
$('body').append('<div class="popoverlay">').css('overflow', 'hidden');
102+
$('body')
103+
.append('<div class="search-popup-overlay algolia-pop-overlay"></div>')
104+
.css('overflow', 'hidden');
102105
$('.popup').toggle();
103106
$('#algolia-search-input').find('input').focus();
104107
});
105108

106109
$('.popup-btn-close').click(function(){
107110
$('.popup').hide();
108-
$('.popoverlay').remove();
111+
$('.algolia-pop-overlay').remove();
109112
$('body').css('overflow', '');
110113
});
111114

js/src/bootstrap.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ $(document).ready(function () {
88

99
NexT.utils.lazyLoadPostsImages();
1010

11+
NexT.utils.registerESCKeyEvent();
12+
1113
NexT.utils.registerBackToTop();
1214

1315
$('.site-nav-toggle button').on('click', function () {

js/src/exturl.js

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/src/js.cookie.js

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
/*!
2+
* JavaScript Cookie v2.1.4
3+
* https://github.com/js-cookie/js-cookie
4+
*
5+
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
6+
* Released under the MIT license
7+
*/
8+
;(function (factory) {
9+
var registeredInModuleLoader = false;
10+
if (typeof define === 'function' && define.amd) {
11+
define(factory);
12+
registeredInModuleLoader = true;
13+
}
14+
if (typeof exports === 'object') {
15+
module.exports = factory();
16+
registeredInModuleLoader = true;
17+
}
18+
if (!registeredInModuleLoader) {
19+
var OldCookies = window.Cookies;
20+
var api = window.Cookies = factory();
21+
api.noConflict = function () {
22+
window.Cookies = OldCookies;
23+
return api;
24+
};
25+
}
26+
}(function () {
27+
function extend () {
28+
var i = 0;
29+
var result = {};
30+
for (; i < arguments.length; i++) {
31+
var attributes = arguments[ i ];
32+
for (var key in attributes) {
33+
result[key] = attributes[key];
34+
}
35+
}
36+
return result;
37+
}
38+
39+
function init (converter) {
40+
function api (key, value, attributes) {
41+
var result;
42+
if (typeof document === 'undefined') {
43+
return;
44+
}
45+
46+
// Write
47+
48+
if (arguments.length > 1) {
49+
attributes = extend({
50+
path: '/'
51+
}, api.defaults, attributes);
52+
53+
if (typeof attributes.expires === 'number') {
54+
var expires = new Date();
55+
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
56+
attributes.expires = expires;
57+
}
58+
59+
// We're using "expires" because "max-age" is not supported by IE
60+
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
61+
62+
try {
63+
result = JSON.stringify(value);
64+
if (/^[\{\[]/.test(result)) {
65+
value = result;
66+
}
67+
} catch (e) {}
68+
69+
if (!converter.write) {
70+
value = encodeURIComponent(String(value))
71+
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
72+
} else {
73+
value = converter.write(value, key);
74+
}
75+
76+
key = encodeURIComponent(String(key));
77+
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
78+
key = key.replace(/[\(\)]/g, escape);
79+
80+
var stringifiedAttributes = '';
81+
82+
for (var attributeName in attributes) {
83+
if (!attributes[attributeName]) {
84+
continue;
85+
}
86+
stringifiedAttributes += '; ' + attributeName;
87+
if (attributes[attributeName] === true) {
88+
continue;
89+
}
90+
stringifiedAttributes += '=' + attributes[attributeName];
91+
}
92+
return (document.cookie = key + '=' + value + stringifiedAttributes);
93+
}
94+
95+
// Read
96+
97+
if (!key) {
98+
result = {};
99+
}
100+
101+
// To prevent the for loop in the first place assign an empty array
102+
// in case there are no cookies at all. Also prevents odd result when
103+
// calling "get()"
104+
var cookies = document.cookie ? document.cookie.split('; ') : [];
105+
var rdecode = /(%[0-9A-Z]{2})+/g;
106+
var i = 0;
107+
108+
for (; i < cookies.length; i++) {
109+
var parts = cookies[i].split('=');
110+
var cookie = parts.slice(1).join('=');
111+
112+
if (cookie.charAt(0) === '"') {
113+
cookie = cookie.slice(1, -1);
114+
}
115+
116+
try {
117+
var name = parts[0].replace(rdecode, decodeURIComponent);
118+
cookie = converter.read ?
119+
converter.read(cookie, name) : converter(cookie, name) ||
120+
cookie.replace(rdecode, decodeURIComponent);
121+
122+
if (this.json) {
123+
try {
124+
cookie = JSON.parse(cookie);
125+
} catch (e) {}
126+
}
127+
128+
if (key === name) {
129+
result = cookie;
130+
break;
131+
}
132+
133+
if (!key) {
134+
result[name] = cookie;
135+
}
136+
} catch (e) {}
137+
}
138+
139+
return result;
140+
}
141+
142+
api.set = api;
143+
api.get = function (key) {
144+
return api.call(api, key);
145+
};
146+
api.getJSON = function () {
147+
return api.apply({
148+
json: true
149+
}, [].slice.call(arguments));
150+
};
151+
api.defaults = {};
152+
153+
api.remove = function (key, attributes) {
154+
api(key, '', extend(attributes, {
155+
expires: -1
156+
}));
157+
};
158+
159+
api.withConverter = init;
160+
161+
return api;
162+
}
163+
164+
return init(function () {});
165+
}));

js/src/post-details.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@ $(document).ready(function () {
2828
}
2929
}
3030

31+
// Sidebar float
3132
function initAffix () {
3233
var headerHeight = $('.header-inner').height();
3334
var footerOffset = parseInt($('.main').css('padding-bottom'), 10);
34-
var sidebarTop = headerHeight + 10;
35+
36+
/*jshint camelcase: false */
37+
var sidebarTop = (CONFIG.sidebar.offset_float === 0) ?
38+
headerHeight + CONFIG.sidebar.offset :
39+
headerHeight;
40+
/*jshint camelcase: true */
3541

3642
$('.sidebar-inner').affix({
3743
offset: {
@@ -128,13 +134,14 @@ $(document).ready(function () {
128134
});
129135

130136
// Expand sidebar on post detail page by default, when post has a toc.
131-
NexT.motion.middleWares.sidebar = function () {
132-
var $tocContent = $('.post-toc-content');
133-
134-
if (CONFIG.sidebar.display === 'post' || CONFIG.sidebar.display === 'always') {
135-
if ($tocContent.length > 0 && $tocContent.html().trim().length > 0) {
136-
NexT.utils.displaySidebar();
137-
}
138-
}
139-
};
137+
var $tocContent = $('.post-toc-content');
138+
var isSidebarCouldDisplay = CONFIG.sidebar.display === 'post' ||
139+
CONFIG.sidebar.display === 'always';
140+
var hasTOC = $tocContent.length > 0 && $tocContent.html().trim().length > 0;
141+
if (isSidebarCouldDisplay && hasTOC) {
142+
CONFIG.motion ?
143+
(NexT.motion.middleWares.sidebar = function () {
144+
NexT.utils.displaySidebar();
145+
}) : NexT.utils.displaySidebar();
146+
}
140147
});

js/src/schemes/pisces.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ $(document).ready(function () {
22
var $headerInner = $('.header-inner');
33
var $sidebar = $('#sidebar');
44
var getSidebarTop = function(){
5-
return $headerInner.height() + 10;
5+
return $headerInner.height() + CONFIG.sidebar.offset;
66
};
77
var setSidebarMarginTop = function(sidebarTop){
88
return $sidebar.css({ 'margin-top': sidebarTop });

js/src/scroll-cookie.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
$(document).ready(function() {
2+
3+
// Set relative link path (without domain)
4+
var rpath = window.location.href.replace(window.location.origin, "");
5+
6+
// Write position in cookie
7+
var timeout;
8+
$(window).on("scroll", function() {
9+
clearTimeout(timeout);
10+
timeout = setTimeout(function () {
11+
Cookies.set("scroll-cookie", ($(window).scrollTop() + "|" + rpath), { expires: 365, path: '' });
12+
}, 250);
13+
});
14+
15+
// Read position from cookie
16+
if (Cookies.get("scroll-cookie") !== undefined) {
17+
var cvalues = Cookies.get("scroll-cookie").split('|');
18+
if (cvalues[1] == rpath) {
19+
$(window).scrollTop(cvalues[0]);
20+
}
21+
}
22+
23+
});

js/src/utils.js

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,28 @@ NexT.utils = NexT.$u = {
55
* Wrap images with fancybox support.
66
*/
77
wrapImageWithFancyBox: function () {
8-
$('.content img').not('.group-picture img, .post-gallery img').each(function () {
9-
10-
var $image = $(this);
11-
var imageTitle = $image.attr('title');
12-
var $imageWrapLink = $image.parent('a');
8+
$('.content img')
9+
.not('[hidden]')
10+
.not('.group-picture img, .post-gallery img')
11+
.each(function () {
12+
var $image = $(this);
13+
var imageTitle = $image.attr('title');
14+
var $imageWrapLink = $image.parent('a');
15+
16+
if ($imageWrapLink.size() < 1) {
17+
$imageWrapLink = $image.wrap('<a href="' + this.getAttribute('src') + '"></a>').parent('a');
18+
}
1319

14-
if ($imageWrapLink.size() < 1) {
15-
$imageWrapLink = $image.wrap('<a href="' + this.getAttribute('src') + '"></a>').parent('a');
16-
}
20+
$imageWrapLink.addClass('fancybox fancybox.image');
21+
$imageWrapLink.attr('rel', 'group');
1722

18-
$imageWrapLink.addClass('fancybox');
19-
$imageWrapLink.attr('rel', 'group');
23+
if (imageTitle) {
24+
$imageWrapLink.append('<p class="image-caption">' + imageTitle + '</p>');
2025

21-
if (imageTitle) {
22-
$imageWrapLink.append('<p class="image-caption">' + imageTitle + '</p>');
23-
$imageWrapLink.attr('title', imageTitle); //make sure img title tag will show correctly in fancybox
24-
}
25-
});
26+
//make sure img title tag will show correctly in fancybox
27+
$imageWrapLink.attr('title', imageTitle);
28+
}
29+
});
2630

2731
$('.fancybox').fancybox({
2832
helpers: {
@@ -40,12 +44,33 @@ NexT.utils = NexT.$u = {
4044
});
4145
},
4246

47+
registerESCKeyEvent: function () {
48+
$(document).on('keyup', function (event) {
49+
var shouldDismissSearchPopup = event.which === 27 &&
50+
$('.search-popup').is(':visible');
51+
if (shouldDismissSearchPopup) {
52+
$('.search-popup').hide();
53+
$('.search-popup-overlay').remove();
54+
$('body').css('overflow', '');
55+
}
56+
});
57+
},
58+
4359
registerBackToTop: function () {
4460
var THRESHOLD = 50;
4561
var $top = $('.back-to-top');
4662

4763
$(window).on('scroll', function () {
4864
$top.toggleClass('back-to-top-on', window.pageYOffset > THRESHOLD);
65+
66+
var scrollTop = $(window).scrollTop();
67+
var docHeight = $('#content').height();
68+
var winHeight = $(window).height();
69+
var contentMath = (docHeight > winHeight) ? (docHeight - winHeight) : ($(document).height() - winHeight);
70+
var scrollPercent = (scrollTop) / (contentMath);
71+
var scrollPercentRounded = Math.round(scrollPercent*100);
72+
var scrollPercentMaxed = (scrollPercentRounded > 100) ? 100 : scrollPercentRounded;
73+
$('#scrollpercent>span').html(scrollPercentMaxed);
4974
});
5075

5176
$top.on('click', function () {

lib/Han/dist/font/han-space.otf

1.71 KB
Binary file not shown.

lib/Han/dist/font/han-space.woff

1.42 KB
Binary file not shown.

lib/Han/dist/font/han.otf

25.8 KB
Binary file not shown.

lib/Han/dist/font/han.woff

20.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)