nodebb-theme-harmony 1.0.0-beta.46 → 1.0.0-beta.48

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-theme-harmony",
3
- "version": "1.0.0-beta.46",
3
+ "version": "1.0.0-beta.48",
4
4
  "nbbpm": {
5
5
  "compatibility": "^3.0.0"
6
6
  },
package/public/harmony.js CHANGED
@@ -56,18 +56,27 @@ $(document).ready(function () {
56
56
  });
57
57
 
58
58
  const bottomBar = $('[component="bottombar"]');
59
- $('body').on('shown.bs.dropdown', '.sticky-tools', function () {
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
- $('body').on('hidden.bs.dropdown', '.sticky-tools', function () {
64
+ $body.on('hidden.bs.dropdown', '.sticky-tools', function () {
63
65
  bottomBar.removeClass('hidden');
64
66
  });
65
67
 
66
68
  let lastScrollTop = 0;
67
- const $window = $(window);
69
+ let newPostsLoaded = false;
70
+
71
+
68
72
  function onWindowScroll() {
69
73
  const st = $window.scrollTop();
70
- if (st !== lastScrollTop) {
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', enableAutohide);
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
- $('body').removeClass('chat-loaded');
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
- $('body').toggleClass('chat-loaded', !!(ajaxify.data.template.chats && ajaxify.data.roomId));
117
+ $body.toggleClass('chat-loaded', !!(ajaxify.data.template.chats && ajaxify.data.roomId));
105
118
  });
106
- enableAutohide();
107
119
  });
108
120
  }
109
121
 
@@ -21,14 +21,16 @@
21
21
  <ul class="chat-content p-0 m-0 list-unstyled overflow-auto flex-grow-1">
22
22
  <!-- IMPORT partials/chats/messages.tpl -->
23
23
  </ul>
24
- <div component="chat/composer" class="d-flex gap-1 border-top pt-2">
25
- <div class="flex-grow-1 position-relative">
26
- <textarea component="chat/input" placeholder="[[modules:chat.placeholder]]" class="form-control chat-input mousetrap" rows="2" style="resize:none;"></textarea>
27
- <span component="chat/message/remaining" class="text-muted position-absolute me-1 mb-1" style="right: 0px; bottom:0px;">{maximumChatMessageLength}</span>
24
+ <div component="chat/composer" class="d-flex flex-column flex-md-row gap-2 border-top pt-2 align-items-start align-items-md-end">
25
+ <div class="w-100 flex-grow-1 position-relative">
26
+ <textarea component="chat/input" placeholder="[[modules:chat.placeholder.mobile]]" class="form-control chat-input mousetrap" style="height:0;resize:none;"></textarea>
27
+ <span component="chat/message/remaining" class="text-xs text-muted position-absolute me-1 mb-1" style="right: 0px; bottom:0px;">{maximumChatMessageLength}</span>
28
28
  </div>
29
- <button component="chat/upload/button" class="btn btn-light" type="button"><i class="fa fa-fw fa-2x fa-upload"></i></button>
30
- <button class="btn btn-primary" type="button" data-action="send"><i class="fa fa-fw fa-2x fa-paper-plane"></i></button>
31
- <form component="chat/upload" method="post" enctype="multipart/form-data">
29
+ <div class="d-flex justify-content-between align-self-stretch gap-2">
30
+ <button component="chat/upload/button" class="btn btn-light btn-sm align-self-end" type="button"><i class="fa fa-fw fa-upload"></i></button>
31
+ <button class="btn btn-primary btn-sm align-self-end" type="button" data-action="send"><i class="fa fa-fw fa-paper-plane"></i></button>
32
+ </div>
33
+ <form class="hidden" component="chat/upload" method="post" enctype="multipart/form-data">
32
34
  <input type="file" name="files[]" multiple class="hidden"/>
33
35
  </form>
34
36
  </div>