nodebb-theme-harmony 1.0.0-beta.46 → 1.0.0-beta.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/harmony.js +21 -9
package/package.json
CHANGED
package/public/harmony.js
CHANGED
|
@@ -56,18 +56,27 @@ $(document).ready(function () {
|
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
const bottomBar = $('[component="bottombar"]');
|
|
59
|
-
$('body')
|
|
59
|
+
const $body = $('body');
|
|
60
|
+
const $window = $(window);
|
|
61
|
+
$body.on('shown.bs.dropdown', '.sticky-tools', function () {
|
|
60
62
|
bottomBar.addClass('hidden');
|
|
61
63
|
});
|
|
62
|
-
$
|
|
64
|
+
$body.on('hidden.bs.dropdown', '.sticky-tools', function () {
|
|
63
65
|
bottomBar.removeClass('hidden');
|
|
64
66
|
});
|
|
65
67
|
|
|
66
68
|
let lastScrollTop = 0;
|
|
67
|
-
|
|
69
|
+
let newPostsLoaded = false;
|
|
70
|
+
|
|
71
|
+
|
|
68
72
|
function onWindowScroll() {
|
|
69
73
|
const st = $window.scrollTop();
|
|
70
|
-
if (
|
|
74
|
+
if (newPostsLoaded) {
|
|
75
|
+
newPostsLoaded = false;
|
|
76
|
+
lastScrollTop = st;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (st !== lastScrollTop && !navigator.scrollActive) {
|
|
71
80
|
const diff = Math.abs(st - lastScrollTop);
|
|
72
81
|
const scrolledDown = st > lastScrollTop;
|
|
73
82
|
const scrolledUp = st < lastScrollTop;
|
|
@@ -77,13 +86,14 @@ $(document).ready(function () {
|
|
|
77
86
|
-bottomBar.find('.bottombar-nav').outerHeight(true) :
|
|
78
87
|
0,
|
|
79
88
|
});
|
|
80
|
-
lastScrollTop = st;
|
|
81
89
|
}
|
|
82
90
|
}
|
|
91
|
+
lastScrollTop = st;
|
|
83
92
|
}
|
|
84
93
|
|
|
85
94
|
const delayedScroll = utils.throttle(onWindowScroll, 250);
|
|
86
95
|
function enableAutohide() {
|
|
96
|
+
$window.off('scroll', delayedScroll);
|
|
87
97
|
if (config.theme.autohideBottombar) {
|
|
88
98
|
lastScrollTop = $window.scrollTop();
|
|
89
99
|
$window.on('scroll', delayedScroll);
|
|
@@ -93,17 +103,19 @@ $(document).ready(function () {
|
|
|
93
103
|
hooks.on('action:posts.loading', function () {
|
|
94
104
|
$window.off('scroll', delayedScroll);
|
|
95
105
|
});
|
|
96
|
-
hooks.on('action:posts.loaded',
|
|
106
|
+
hooks.on('action:posts.loaded', function () {
|
|
107
|
+
newPostsLoaded = true;
|
|
108
|
+
enableAutohide();
|
|
109
|
+
});
|
|
97
110
|
hooks.on('action:ajaxify.end', function () {
|
|
98
111
|
$window.off('scroll', delayedScroll);
|
|
99
|
-
$
|
|
112
|
+
$body.removeClass('chat-loaded');
|
|
100
113
|
bottomBar.css({ bottom: 0 });
|
|
101
114
|
enableAutohide();
|
|
102
115
|
});
|
|
103
116
|
hooks.on('action:chat.loaded', function () {
|
|
104
|
-
$
|
|
117
|
+
$body.toggleClass('chat-loaded', !!(ajaxify.data.template.chats && ajaxify.data.roomId));
|
|
105
118
|
});
|
|
106
|
-
enableAutohide();
|
|
107
119
|
});
|
|
108
120
|
}
|
|
109
121
|
|