hexo-theme-next
Advanced tools
Comparing version 6.4.1 to 6.4.2
{ | ||
"name": "theme-next", | ||
"version": "6.4.1", | ||
"version": "6.4.2", | ||
"homepage": "https://theme-next.org", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -20,5 +20,5 @@ <div align="right">Язык: <a title="Английский" href="../../README.md">:us:</a> | ||
* :heart_decoration: Muse тема: [LEAFERx](https://leaferx.online) | [XiaMo](https://notes.wanghao.work) | [OAwan](https://oawan.me) | ||
* :heart_decoration: Muse тема: [LEAFERx](https://leaferx.online) | [Alex LEE](http://saili.science) | [Miaia](https://11.tt) | ||
* :six_pointed_star: Mist тема: [Jeff](https://blog.zzbd.org) | [uchuhimo](http://uchuhimo.me) | [xirong](http://www.ixirong.com) | ||
* :pisces: Pisces тема: [Vi](http://notes.iissnan.com) | [Acris](https://acris.me) | [Rainy](https://rainylog.com) | ||
* :pisces: Pisces тема: [Vi](http://notes.iissnan.com) | [Acris](https://acris.me) | [Jiaxi He](http://jiaxi.io) | ||
* :gemini: Gemini тема: [Ivan.Nginx](https://almostover.ru) | [Raincal](https://raincal.com) | [Dandy](https://dandyxu.me) | ||
@@ -25,0 +25,0 @@ |
@@ -20,5 +20,5 @@ <div align="right">语言: <a title="英语" href="../../README.md">:us:</a> | ||
* :heart_decoration: Muse 主题: [LEAFERx](https://leaferx.online) | [XiaMo](https://notes.wanghao.work) | [OAwan](https://oawan.me) | ||
* :heart_decoration: Muse 主题: [LEAFERx](https://leaferx.online) | [Alex LEE](http://saili.science) | [Miaia](https://11.tt) | ||
* :six_pointed_star: Mist 主题: [Jeff](https://blog.zzbd.org) | [uchuhimo](http://uchuhimo.me) | [xirong](http://www.ixirong.com) | ||
* :pisces: Pisces 主题: [Vi](http://notes.iissnan.com) | [Acris](https://acris.me) | [Rainy](https://rainylog.com) | ||
* :pisces: Pisces 主题: [Vi](http://notes.iissnan.com) | [Acris](https://acris.me) | [Jiaxi He](http://jiaxi.io) | ||
* :gemini: Gemini 主题: [Ivan.Nginx](https://almostover.ru) | [Raincal](https://raincal.com) | [Dandy](https://dandyxu.me) | ||
@@ -25,0 +25,0 @@ |
{ | ||
"name": "hexo-theme-next", | ||
"version": "6.4.1", | ||
"version": "6.4.2", | ||
"description": "Elegant and powerful theme for Hexo", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,5 +20,5 @@ <div align="right">Language: :us: | ||
* :heart_decoration: Muse scheme: [LEAFERx](https://leaferx.online) | [XiaMo](https://notes.wanghao.work) | [OAwan](https://oawan.me) | ||
* :heart_decoration: Muse scheme: [LEAFERx](https://leaferx.online) | [Alex LEE](http://saili.science) | [Miaia](https://11.tt) | ||
* :six_pointed_star: Mist scheme: [Jeff](https://blog.zzbd.org) | [uchuhimo](http://uchuhimo.me) | [xirong](http://www.ixirong.com) | ||
* :pisces: Pisces scheme: [Vi](http://notes.iissnan.com) | [Acris](https://acris.me) | [Rainy](https://rainylog.com) | ||
* :pisces: Pisces scheme: [Vi](http://notes.iissnan.com) | [Acris](https://acris.me) | [Jiaxi He](http://jiaxi.io) | ||
* :gemini: Gemini scheme: [Ivan.Nginx](https://almostover.ru) | [Raincal](https://raincal.com) | [Dandy](https://dandyxu.me) | ||
@@ -25,0 +25,0 @@ |
@@ -17,765 +17,84 @@ /** | ||
var templates = { | ||
dispatch: function(pictures, group, layout) { | ||
var fn = 'group' + group + 'Layout' + layout; | ||
fn = templates[fn] || templates.defaults; | ||
return fn.call(templates, pictures); | ||
var LAYOUTS = { | ||
2: { | ||
1: [1, 1], | ||
2: [2] | ||
}, | ||
/** | ||
* 2-1 | ||
* | ||
* □ | ||
* □ | ||
* | ||
* @param pictures | ||
* @returns {string} | ||
*/ | ||
group2Layout1: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1) | ||
]); | ||
3: { | ||
1: [3], | ||
2: [1, 2], | ||
3: [2, 1] | ||
}, | ||
/** | ||
* 2-2 | ||
* | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group2Layout2: function(pictures) { | ||
return this.getHTML(pictures); | ||
4: { | ||
1: [1, 2, 1], | ||
2: [1, 3], | ||
3: [2, 2], | ||
4: [3, 1] | ||
}, | ||
/** | ||
* 3-1 | ||
* | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group3Layout1: function(pictures) { | ||
return this.getHTML(pictures); | ||
5: { | ||
1: [1, 2, 2], | ||
2: [2, 1, 2], | ||
3: [2, 3], | ||
4: [3, 2] | ||
}, | ||
/** | ||
* 3-2 | ||
* | ||
* □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group3Layout2: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1) | ||
]); | ||
6: { | ||
1: [1, 2, 3], | ||
2: [1, 3, 2], | ||
3: [2, 1, 3], | ||
4: [2, 2, 2], | ||
5: [3, 3] | ||
}, | ||
/** | ||
* 3-3 | ||
* | ||
* □ □ | ||
* □ | ||
* | ||
* @param pictures | ||
*/ | ||
group3Layout3: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2) | ||
]); | ||
7: { | ||
1: [1, 2, 2, 2], | ||
2: [1, 3, 3], | ||
3: [2, 2, 3], | ||
4: [2, 3, 2], | ||
5: [3, 2, 2] | ||
}, | ||
/** | ||
* 4-1 | ||
* | ||
* □ | ||
* □ □ | ||
* □ | ||
* | ||
* @param pictures | ||
*/ | ||
group4Layout1: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 3), | ||
pictures.slice(3) | ||
]); | ||
8: { | ||
1: [1, 2, 2, 3], | ||
2: [1, 2, 3, 2], | ||
3: [1, 3, 2, 2], | ||
4: [2, 2, 2, 2], | ||
5: [2, 3, 3], | ||
6: [3, 2, 3], | ||
7: [3, 3, 2] | ||
}, | ||
/** | ||
* 4-2 | ||
* | ||
* □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group4Layout2: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1) | ||
]); | ||
9: { | ||
1: [1, 2, 3, 3], | ||
2: [1, 3, 2, 3], | ||
3: [2, 2, 2, 3], | ||
4: [2, 2, 3, 2], | ||
5: [2, 3, 2, 2], | ||
6: [3, 2, 2, 2], | ||
7: [3, 3, 3] | ||
}, | ||
10: { | ||
1: [1, 3, 3, 3], | ||
2: [2, 2, 3, 3], | ||
3: [2, 3, 2, 3], | ||
4: [2, 3, 3, 2], | ||
5: [3, 2, 2, 3], | ||
6: [3, 2, 3, 2], | ||
7: [3, 3, 2, 2] | ||
} | ||
}; | ||
/** | ||
* 4-3 | ||
* | ||
* □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group4Layout3: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2) | ||
]); | ||
}, | ||
function groupBy(group, data) { | ||
var r = []; | ||
for (var i = 0; i < group.length; i++) { | ||
r.push(data.slice(0, group[i])); | ||
data = data.slice(group[i]); | ||
} | ||
return r; | ||
} | ||
/** | ||
* 4-4 | ||
* | ||
* □ □ □ | ||
* □ | ||
* | ||
* @param pictures | ||
*/ | ||
group4Layout4: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 3), | ||
pictures.slice(3) | ||
]); | ||
}, | ||
var templates = { | ||
/** | ||
* 5-1 | ||
* | ||
* □ | ||
* □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group5Layout1: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 3), | ||
pictures.slice(3) | ||
]); | ||
dispatch: function(pictures, group, layout) { | ||
var rule = LAYOUTS[group] ? LAYOUTS[group][layout] : null; | ||
return rule ? this.getHTML(groupBy(rule, pictures)) : templates.defaults(pictures); | ||
}, | ||
/** | ||
* 5-2 | ||
* | ||
* □ □ | ||
* □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group5Layout2: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 3), | ||
pictures.slice(3) | ||
]); | ||
}, | ||
/** | ||
* 5-3 | ||
* | ||
* □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group5Layout3: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2) | ||
]); | ||
}, | ||
/** | ||
* 5-4 | ||
* | ||
* □ □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group5Layout4: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 3), | ||
pictures.slice(3) | ||
]); | ||
}, | ||
/** | ||
* 6-1 | ||
* | ||
* □ | ||
* □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group6Layout1: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 3), | ||
pictures.slice(3) | ||
]); | ||
}, | ||
/** | ||
* 6-2 | ||
* | ||
* □ | ||
* □ □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group6Layout2: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 4), | ||
pictures.slice(4) | ||
]); | ||
}, | ||
/** | ||
* 6-3 | ||
* | ||
* □ □ | ||
* □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group6Layout3: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 3), | ||
pictures.slice(3) | ||
]); | ||
}, | ||
/** | ||
* 6-4 | ||
* | ||
* □ □ | ||
* □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group6Layout4: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 4), | ||
pictures.slice(4) | ||
]); | ||
}, | ||
/** | ||
* 6-5 | ||
* | ||
* □ □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group6Layout5: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 3), | ||
pictures.slice(3) | ||
]); | ||
}, | ||
/** | ||
* 7-1 | ||
* | ||
* □ | ||
* □ □ | ||
* □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group7Layout1: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 3), | ||
pictures.slice(3, 5), | ||
pictures.slice(5) | ||
]); | ||
}, | ||
/** | ||
* 7-2 | ||
* | ||
* □ | ||
* □ □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group7Layout2: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 4), | ||
pictures.slice(4) | ||
]); | ||
}, | ||
/** | ||
* 7-3 | ||
* | ||
* □ □ | ||
* □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group7Layout3: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 4), | ||
pictures.slice(4) | ||
]); | ||
}, | ||
/** | ||
* 7-4 | ||
* | ||
* □ □ | ||
* □ □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group7Layout4: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 5), | ||
pictures.slice(5) | ||
]); | ||
}, | ||
/** | ||
* 7-5 | ||
* | ||
* □ □ □ | ||
* □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group7Layout5: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 3), | ||
pictures.slice(3, 5), | ||
pictures.slice(5) | ||
]); | ||
}, | ||
/** | ||
* 8-1 | ||
* | ||
* □ | ||
* □ □ | ||
* □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group8Layout1: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 3), | ||
pictures.slice(3, 5), | ||
pictures.slice(5) | ||
]); | ||
}, | ||
/** | ||
* 8-2 | ||
* | ||
* □ | ||
* □ □ | ||
* □ □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group8Layout2: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 3), | ||
pictures.slice(3, 6), | ||
pictures.slice(6) | ||
]); | ||
}, | ||
/** | ||
* 8-3 | ||
* | ||
* □ | ||
* □ □ □ | ||
* □ □ | ||
* □ □ | ||
* @param pictures | ||
*/ | ||
group8Layout3: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 4), | ||
pictures.slice(4, 6), | ||
pictures.slice(6) | ||
]); | ||
}, | ||
/** | ||
* 8-4 | ||
* | ||
* □ □ | ||
* □ □ | ||
* □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group8Layout4: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 4), | ||
pictures.slice(4, 6), | ||
pictures.slice(6) | ||
]); | ||
}, | ||
/** | ||
* 8-5 | ||
* | ||
* □ □ | ||
* □ □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group8Layout5: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 5), | ||
pictures.slice(5) | ||
]); | ||
}, | ||
/** | ||
* 8-6 | ||
* | ||
* □ □ □ | ||
* □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group8Layout6: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 3), | ||
pictures.slice(3, 5), | ||
pictures.slice(5) | ||
]); | ||
}, | ||
/** | ||
* 8-7 | ||
* | ||
* □ □ □ | ||
* □ □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group8Layout7: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 3), | ||
pictures.slice(3, 6), | ||
pictures.slice(6) | ||
]); | ||
}, | ||
/** | ||
* 9-1 | ||
* | ||
* □ | ||
* □ □ | ||
* □ □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group9Layout1: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 3), | ||
pictures.slice(3, 6), | ||
pictures.slice(6) | ||
]); | ||
}, | ||
/** | ||
* 9-2 | ||
* | ||
* □ | ||
* □ □ □ | ||
* □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group9Layout2: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 4), | ||
pictures.slice(4, 6), | ||
pictures.slice(6) | ||
]); | ||
}, | ||
/** | ||
* 9-3 | ||
* | ||
* □ □ | ||
* □ □ | ||
* □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group9Layout3: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 4), | ||
pictures.slice(4, 6), | ||
pictures.slice(6) | ||
]); | ||
}, | ||
/** | ||
* 9-4 | ||
* | ||
* □ □ | ||
* □ □ | ||
* □ □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group9Layout4: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 4), | ||
pictures.slice(4, 7), | ||
pictures.slice(7) | ||
]); | ||
}, | ||
/** | ||
* 9-5 | ||
* | ||
* □ □ | ||
* □ □ □ | ||
* □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group9Layout5: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 5), | ||
pictures.slice(5, 7), | ||
pictures.slice(7) | ||
]); | ||
}, | ||
/** | ||
* 9-6 | ||
* | ||
* □ □ □ | ||
* □ □ | ||
* □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group9Layout6: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 3), | ||
pictures.slice(3, 5), | ||
pictures.slice(5, 7), | ||
pictures.slice(7) | ||
]); | ||
}, | ||
/** | ||
* 9-7 | ||
* | ||
* □ □ □ | ||
* □ □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group9Layout7: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 3), | ||
pictures.slice(3, 6), | ||
pictures.slice(6) | ||
]); | ||
}, | ||
/** | ||
* 10-1 | ||
* | ||
* □ | ||
* □ □ □ | ||
* □ □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group10Layout1: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 1), | ||
pictures.slice(1, 4), | ||
pictures.slice(4, 7), | ||
pictures.slice(7) | ||
]); | ||
}, | ||
/** | ||
* 10-2 | ||
* | ||
* □ □ | ||
* □ □ | ||
* □ □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group10Layout2: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 4), | ||
pictures.slice(4, 7), | ||
pictures.slice(7) | ||
]); | ||
}, | ||
/** | ||
* 10-3 | ||
* | ||
* □ □ | ||
* □ □ □ | ||
* □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group10Layout3: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 5), | ||
pictures.slice(5, 7), | ||
pictures.slice(7) | ||
]); | ||
}, | ||
/** | ||
* 10-4 | ||
* | ||
* □ □ | ||
* □ □ □ | ||
* □ □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group10Layout4: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 2), | ||
pictures.slice(2, 5), | ||
pictures.slice(5, 8), | ||
pictures.slice(8) | ||
]); | ||
}, | ||
/** | ||
* 10-5 | ||
* | ||
* □ □ □ | ||
* □ □ | ||
* □ □ | ||
* □ □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group10Layout5: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 3), | ||
pictures.slice(3, 5), | ||
pictures.slice(5, 7), | ||
pictures.slice(7) | ||
]); | ||
}, | ||
/** | ||
* 10-6 | ||
* | ||
* □ □ □ | ||
* □ □ | ||
* □ □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group10Layout6: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 3), | ||
pictures.slice(3, 5), | ||
pictures.slice(5, 8), | ||
pictures.slice(8) | ||
]); | ||
}, | ||
/** | ||
* 10-7 | ||
* | ||
* □ □ □ | ||
* □ □ □ | ||
* □ □ | ||
* □ □ | ||
* | ||
* @param pictures | ||
*/ | ||
group10Layout7: function(pictures) { | ||
return this.getHTML([ | ||
pictures.slice(0, 3), | ||
pictures.slice(3, 6), | ||
pictures.slice(6, 8), | ||
pictures.slice(8) | ||
]); | ||
}, | ||
/** | ||
* Defaults Layout | ||
@@ -782,0 +101,0 @@ * |
@@ -177,3 +177,3 @@ /* global NexT, CONFIG */ | ||
// Prevent adding TOC to Overview if Overview was selected when close & open sidebar. | ||
if (!$('.post-toc-wrap')) { | ||
if ($('.post-toc-wrap')) { | ||
if ($('.site-overview-wrap').css('display') === 'block') { | ||
@@ -180,0 +180,0 @@ $('.post-toc-wrap').removeClass('motion-element'); |
@@ -6,5 +6,6 @@ /* global NexT, CONFIG */ | ||
var sidebarInner = $('.sidebar-inner'); | ||
var sidebarOffset = CONFIG.sidebar.offset ? CONFIG.sidebar.offset : 12; | ||
function getHeaderOffset() { | ||
return $('.header-inner').height() + CONFIG.sidebar.offset; | ||
return $('.header-inner').height() + sidebarOffset; | ||
} | ||
@@ -19,31 +20,17 @@ | ||
function setSidebarMarginTop(headerOffset) { | ||
return $('#sidebar').css({ 'margin-top': headerOffset }); | ||
} | ||
function initAffix() { | ||
var headerOffset = getHeaderOffset(); | ||
var footerOffset = getFooterOffset(); | ||
var sidebarHeight = $('#sidebar').height() + NexT.utils.getSidebarb2tHeight(); | ||
var contentHeight = $('#content').height(); | ||
// Not affix if sidebar taller then content (to prevent bottom jumping). | ||
if (headerOffset + sidebarHeight < contentHeight) { | ||
sidebarInner.affix({ | ||
offset: { | ||
top : headerOffset - CONFIG.sidebar.offset, | ||
bottom: footerOffset | ||
} | ||
}); | ||
} | ||
sidebarInner.affix({ | ||
offset: { | ||
top : headerOffset - sidebarOffset, | ||
bottom: footerOffset | ||
} | ||
}); | ||
setSidebarMarginTop(headerOffset).css({ 'margin-left': 'initial' }); | ||
$('#sidebar').css({ 'margin-left': 'initial', 'margin-top': headerOffset }); | ||
sidebarInner.affix('checkPosition'); | ||
} | ||
function recalculateAffixPosition() { | ||
$(window).off('.affix'); | ||
sidebarInner.removeData('bs.affix').removeClass('affix affix-top affix-bottom'); | ||
initAffix(); | ||
} | ||
function resizeListener() { | ||
@@ -53,3 +40,4 @@ var mql = window.matchMedia('(min-width: 991px)'); | ||
if (e.matches) { | ||
recalculateAffixPosition(); | ||
sidebarInner.affix('checkPosition'); | ||
initAffix(); | ||
} | ||
@@ -61,3 +49,2 @@ }); | ||
resizeListener(); | ||
}); |
@@ -102,3 +102,3 @@ /* global NexT, CONFIG */ | ||
$(window).on('scroll', function() { | ||
function initBackToTop() { | ||
$top.toggleClass('back-to-top-on', window.pageYOffset > THRESHOLD); | ||
@@ -112,4 +112,13 @@ | ||
$('#scrollpercent>span').html(scrollPercentMaxed); | ||
} | ||
// For init back to top in sidebar if page was already scrolled. | ||
$(document).ready(function() { | ||
initBackToTop(); | ||
}); | ||
$(window).on('scroll', function() { | ||
initBackToTop(); | ||
}); | ||
$top.on('click', function() { | ||
@@ -116,0 +125,0 @@ $('body').velocity('scroll'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1558926
313
10878