nodebb-plugin-chat-search 1.0.0 → 1.1.0
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/static/lib/main.js +16 -5
package/package.json
CHANGED
package/static/lib/main.js
CHANGED
|
@@ -8,6 +8,16 @@ window.chatSearchState = window.chatSearchState || {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
$(document).ready(function () {
|
|
11
|
+
const isHebrew = (document.documentElement.lang || 'en').startsWith('he');
|
|
12
|
+
|
|
13
|
+
const txt = {
|
|
14
|
+
placeholder: isHebrew ? 'חפש הודעה...' : 'Search messages...',
|
|
15
|
+
searching: isHebrew ? 'מחפש...' : 'Searching...',
|
|
16
|
+
error: isHebrew ? 'שגיאה' : 'Error',
|
|
17
|
+
noResults: isHebrew ? 'לא נמצאו תוצאות.' : 'No results found.',
|
|
18
|
+
unknownUser: isHebrew ? 'לא ידוע' : 'Unknown'
|
|
19
|
+
};
|
|
20
|
+
|
|
11
21
|
let observer = null;
|
|
12
22
|
|
|
13
23
|
$(window).on('action:ajaxify.end', function (ev, data) {
|
|
@@ -61,7 +71,7 @@ $(document).ready(function () {
|
|
|
61
71
|
const searchHtml = `
|
|
62
72
|
<div id="global-chat-search-container" style="padding: 10px; background: #fff; border-bottom: 1px solid #ddd; margin-bottom: 5px;">
|
|
63
73
|
<div class="input-group">
|
|
64
|
-
<input type="text" id="global-chat-search" class="form-control" placeholder="
|
|
74
|
+
<input type="text" id="global-chat-search" class="form-control" placeholder="${txt.placeholder}" style="font-size: 14px; height: 34px;">
|
|
65
75
|
<span class="input-group-btn">
|
|
66
76
|
<button class="btn btn-primary" id="btn-chat-search" type="button" style="height: 34px;"><i class="fa fa-search"></i></button>
|
|
67
77
|
</span>
|
|
@@ -145,16 +155,17 @@ $(document).ready(function () {
|
|
|
145
155
|
}
|
|
146
156
|
|
|
147
157
|
let targetUid = ajaxify.data.uid || app.user.uid;
|
|
148
|
-
|
|
158
|
+
|
|
159
|
+
resultsContainer.show().html(`<div class="text-center" style="padding:10px;"><i class="fa fa-spinner fa-spin"></i> ${txt.searching}</div>`);
|
|
149
160
|
window.chatSearchState.isOpen = true;
|
|
150
161
|
|
|
151
162
|
socket.emit('plugins.chatSearch.searchGlobal', { query: query, targetUid: targetUid }, function (err, messages) {
|
|
152
163
|
if (err) {
|
|
153
|
-
resultsContainer.html(
|
|
164
|
+
resultsContainer.html(`<div class="alert alert-danger" style="margin:5px;">${txt.error}</div>`);
|
|
154
165
|
return;
|
|
155
166
|
}
|
|
156
167
|
if (!messages || messages.length === 0) {
|
|
157
|
-
const noRes =
|
|
168
|
+
const noRes = `<div class="text-center" style="padding:10px; color:#777;">${txt.noResults}</div>`;
|
|
158
169
|
resultsContainer.html(noRes);
|
|
159
170
|
window.chatSearchState.resultsHtml = noRes;
|
|
160
171
|
return;
|
|
@@ -168,7 +179,7 @@ $(document).ready(function () {
|
|
|
168
179
|
if (baseUrl.endsWith('/')) baseUrl = baseUrl.slice(0, -1);
|
|
169
180
|
|
|
170
181
|
const chatLink = baseUrl + '/' + msg.roomId + '?mid=' + msg.mid;
|
|
171
|
-
const senderName = (msg.user && msg.user.username) ? msg.user.username :
|
|
182
|
+
const senderName = (msg.user && msg.user.username) ? msg.user.username : txt.unknownUser;
|
|
172
183
|
|
|
173
184
|
const mainAvatarHtml = renderMainAvatars(msg.participants);
|
|
174
185
|
const senderSmallAvatar = buildAvatarHtml(msg.user, 14, 'vertical-align: text-bottom;', 'align-middle');
|