nodebb-plugin-chat-search 1.0.0 → 1.2.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 CHANGED
@@ -1,8 +1,16 @@
1
1
  {
2
2
  "name": "nodebb-plugin-chat-search",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "A plugin to search text within NodeBB chats",
5
5
  "main": "library.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/palmoni5/nodebb-plugin-chat-search.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/palmoni5/nodebb-plugin-chat-search/issues"
12
+ },
13
+ "homepage": "https://github.com/palmoni5/nodebb-plugin-chat-search#readme",
6
14
  "nbbpm": {
7
15
  "compatibility": "^3.0.0"
8
16
  },
package/plugin.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "id": "nodebb-plugin-chat-search",
3
+ "url": "https://github.com/palmoni5/nodebb-plugin-chat-search",
3
4
  "name": "Chat Search",
4
5
  "description": "Allows searching in chat windows",
5
6
  "library": "./library.js",
@@ -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="חפש הודעה..." style="font-size: 14px; height: 34px;">
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
- resultsContainer.show().html('<div class="text-center" style="padding:10px;"><i class="fa fa-spinner fa-spin"></i> מחפש...</div>');
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('<div class="alert alert-danger" style="margin:5px;">שגיאה</div>');
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 = '<div class="text-center" style="padding:10px; color:#777;">לא נמצאו תוצאות.</div>';
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 : 'Unknown';
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');