Fossil SCM

Ensure that chat search results get placed in the proper parent DOM element (this fixes some layout unsightliness). Remove the DOM elements related to loading more search result context when they have no more results to load.

stephan 2024-07-01 18:36 fts5-chat-search
Commit 2e8f1a9a15eceed342c4690007b1cbd06c1b44adeefe75f125328641c1d429fd
+2 -2
--- src/chat.c
+++ src/chat.c
@@ -218,20 +218,20 @@
218218
@ </div>
219219
@ <div id='chat-user-list'></div>
220220
@ </div>
221221
@ <div id='chat-preview' class='hidden chat-view'>
222222
@ <header>Preview: (<a href='%R/md_rules' target='_blank'>markdown reference</a>)</header>
223
- @ <div id='chat-preview-content' class='message-widget-content'></div>
223
+ @ <div id='chat-preview-content'></div>
224224
@ <div class='button-bar'><button class='action-close'>Close Preview</button></div>
225225
@ </div>
226226
@ <div id='chat-config' class='hidden chat-view'>
227227
@ <div id='chat-config-options'></div>
228228
/* ^^^populated client-side */
229229
@ <div class='button-bar'><button class='action-close'>Close Settings</button></div>
230230
@ </div>
231231
@ <div id='chat-search' class='hidden chat-view'>
232
- @ <div class='message-widget-content'></div>
232
+ @ <div id='chat-search-content'></div>
233233
/* ^^^populated client-side */
234234
@ <div class='button-bar'>
235235
@ <button class='action-clear'>Clear results</button>
236236
@ <button class='action-close'>Close Search</button>
237237
@ </div>
238238
--- src/chat.c
+++ src/chat.c
@@ -218,20 +218,20 @@
218 @ </div>
219 @ <div id='chat-user-list'></div>
220 @ </div>
221 @ <div id='chat-preview' class='hidden chat-view'>
222 @ <header>Preview: (<a href='%R/md_rules' target='_blank'>markdown reference</a>)</header>
223 @ <div id='chat-preview-content' class='message-widget-content'></div>
224 @ <div class='button-bar'><button class='action-close'>Close Preview</button></div>
225 @ </div>
226 @ <div id='chat-config' class='hidden chat-view'>
227 @ <div id='chat-config-options'></div>
228 /* ^^^populated client-side */
229 @ <div class='button-bar'><button class='action-close'>Close Settings</button></div>
230 @ </div>
231 @ <div id='chat-search' class='hidden chat-view'>
232 @ <div class='message-widget-content'></div>
233 /* ^^^populated client-side */
234 @ <div class='button-bar'>
235 @ <button class='action-clear'>Clear results</button>
236 @ <button class='action-close'>Close Search</button>
237 @ </div>
238
--- src/chat.c
+++ src/chat.c
@@ -218,20 +218,20 @@
218 @ </div>
219 @ <div id='chat-user-list'></div>
220 @ </div>
221 @ <div id='chat-preview' class='hidden chat-view'>
222 @ <header>Preview: (<a href='%R/md_rules' target='_blank'>markdown reference</a>)</header>
223 @ <div id='chat-preview-content'></div>
224 @ <div class='button-bar'><button class='action-close'>Close Preview</button></div>
225 @ </div>
226 @ <div id='chat-config' class='hidden chat-view'>
227 @ <div id='chat-config-options'></div>
228 /* ^^^populated client-side */
229 @ <div class='button-bar'><button class='action-close'>Close Settings</button></div>
230 @ </div>
231 @ <div id='chat-search' class='hidden chat-view'>
232 @ <div id='chat-search-content'></div>
233 /* ^^^populated client-side */
234 @ <div class='button-bar'>
235 @ <button class='action-clear'>Clear results</button>
236 @ <button class='action-close'>Close Search</button>
237 @ </div>
238
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -61,11 +61,11 @@
6161
if(!f.rx){
6262
f.rx = /(\s+|\s*,\s*)/;
6363
}
6464
return str ? str.split(f.rx) : [str];
6565
};
66
-
66
+
6767
dom.div = dom.createElemFactory('div');
6868
dom.p = dom.createElemFactory('p');
6969
dom.code = dom.createElemFactory('code');
7070
dom.pre = dom.createElemFactory('pre');
7171
dom.header = dom.createElemFactory('header');
@@ -549,11 +549,11 @@
549549
}
550550
if(!f.counter){
551551
old.parentNode.removeChild(old);
552552
}
553553
};
554
- dom.replaceNode.counter = 0;
554
+ dom.replaceNode.counter = 0;
555555
/**
556556
Two args == getter: (e,key), returns value
557557
558558
Three or more == setter: (e,key,val[...,keyN,valN]), returns
559559
e. If val===null or val===undefined then the attribute is
560560
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -61,11 +61,11 @@
61 if(!f.rx){
62 f.rx = /(\s+|\s*,\s*)/;
63 }
64 return str ? str.split(f.rx) : [str];
65 };
66
67 dom.div = dom.createElemFactory('div');
68 dom.p = dom.createElemFactory('p');
69 dom.code = dom.createElemFactory('code');
70 dom.pre = dom.createElemFactory('pre');
71 dom.header = dom.createElemFactory('header');
@@ -549,11 +549,11 @@
549 }
550 if(!f.counter){
551 old.parentNode.removeChild(old);
552 }
553 };
554 dom.replaceNode.counter = 0;
555 /**
556 Two args == getter: (e,key), returns value
557
558 Three or more == setter: (e,key,val[...,keyN,valN]), returns
559 e. If val===null or val===undefined then the attribute is
560
--- src/fossil.dom.js
+++ src/fossil.dom.js
@@ -61,11 +61,11 @@
61 if(!f.rx){
62 f.rx = /(\s+|\s*,\s*)/;
63 }
64 return str ? str.split(f.rx) : [str];
65 };
66
67 dom.div = dom.createElemFactory('div');
68 dom.p = dom.createElemFactory('p');
69 dom.code = dom.createElemFactory('code');
70 dom.pre = dom.createElemFactory('pre');
71 dom.header = dom.createElemFactory('header');
@@ -549,11 +549,11 @@
549 }
550 if(!f.counter){
551 old.parentNode.removeChild(old);
552 }
553 };
554 dom.replaceNode.counter = 0;
555 /**
556 Two args == getter: (e,key), returns value
557
558 Three or more == setter: (e,key,val[...,keyN,valN]), returns
559 e. If val===null or val===undefined then the attribute is
560
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -145,12 +145,13 @@
145145
inputM: E1('#chat-input-field-multi'),
146146
inputFile: E1('#chat-input-file'),
147147
contentDiv: E1('div.content'),
148148
viewConfig: E1('#chat-config'),
149149
viewPreview: E1('#chat-preview'),
150
- viewSearch: E1('#chat-search'),
151150
previewContent: E1('#chat-preview-content'),
151
+ viewSearch: E1('#chat-search'),
152
+ searchContent: E1('#chat-search-content'),
152153
btnPreview: E1('#chat-button-preview'),
153154
views: document.querySelectorAll('.chat-view'),
154155
activeUserListWrapper: E1('#chat-user-list-wrapper'),
155156
activeUserList: E1('#chat-user-list')
156157
},
@@ -1340,20 +1341,15 @@
13401341
this.o = {
13411342
iFirstInTable: o.first,
13421343
iLastInTable: o.last,
13431344
iPrevId: o.previd,
13441345
iNextId: o.nextid,
1345
- bIgnoreClick: false,
1346
+ bIgnoreClick: false
13461347
};
13471348
13481349
this.e = {
13491350
body: D.addClass(D.div(), 'spacer-widget'),
1350
-
1351
- above: D.addClass(D.div(), 'spacer-widget-above'),
1352
- buttons: D.addClass(D.div(), 'spacer-widget-buttons'),
1353
- below: D.addClass(D.div(), 'spacer-widget-below'),
1354
-
13551351
up: D.addClass(
13561352
D.button(zDownArrow+' Load '+nMsgContext+' more '+zDownArrow),
13571353
'up'
13581354
),
13591355
down: D.addClass(
@@ -1361,12 +1357,12 @@
13611357
'down'
13621358
),
13631359
all: D.addClass(D.button('Load More'), 'all')
13641360
};
13651361
1366
- D.append(this.e.buttons, this.e.up, this.e.down, this.e.all);
1367
- D.append(this.e.body, this.e.above, this.e.buttons, this.e.below);
1362
+ ;
1363
+ D.append( this.e.body, this.e.up, this.e.down, this.e.all );
13681364
13691365
const ms = this;
13701366
this.e.up.addEventListener('click', ()=>ms.load_messages(false));
13711367
this.e.down.addEventListener('click', ()=>ms.load_messages(true));
13721368
this.e.all.addEventListener('click', ()=>ms.load_messages( (ms.o.iPrevId==0) ));
@@ -1373,33 +1369,55 @@
13731369
this.set_button_visibility();
13741370
};
13751371
13761372
cf.prototype = {
13771373
set_button_visibility: function() {
1374
+ if( !this.e ) return;
13781375
const o = this.o;
13791376
13801377
const iPrevId = (o.iPrevId!=0) ? o.iPrevId : o.iFirstInTable-1;
13811378
const iNextId = (o.iNextId!=0) ? o.iNextId : o.iLastInTable+1;
1382
- var nDiff = (iNextId - iPrevId) - 1;
1379
+ let nDiff = (iNextId - iPrevId) - 1;
13831380
1384
- D.addClass([this.e.up, this.e.down, this.e.all], 'hidden');
1385
-
1381
+ for( const x of [this.e.up, this.e.down, this.e.all] ){
1382
+ if( x ) D.addClass(x, 'hidden');
1383
+ }
1384
+ let nVisible = 0;
13861385
if( nDiff>0 ){
1387
-
13881386
if( nDiff>nMsgContext && (o.iPrevId==0 || o.iNextId==0) ){
13891387
nDiff = nMsgContext;
13901388
}
13911389
13921390
if( nDiff<=nMsgContext && o.iPrevId!=0 && o.iNextId!=0 ){
13931391
D.removeClass(this.e.all, 'hidden');
1392
+ ++nVisible;
13941393
this.e.all.innerText = (
13951394
zUpArrow + " Load " + nDiff + " more " + zDownArrow
13961395
);
13971396
}else{
1398
- if( o.iPrevId!=0 ) D.removeClass(this.e.up, 'hidden');
1399
- if( o.iNextId!=0 ) D.removeClass(this.e.down, 'hidden');
1397
+ if( o.iPrevId!=0 ){
1398
+ ++nVisible;
1399
+ D.removeClass(this.e.up, 'hidden');
1400
+ }else if( this.e.up ){
1401
+ if( this.e.up.parentNode ) D.remove(this.e.up);
1402
+ delete this.e.up;
1403
+ }
1404
+ if( o.iNextId!=0 ){
1405
+ ++nVisible;
1406
+ D.removeClass(this.e.down, 'hidden');
1407
+ }else if( this.e.down ){
1408
+ if( this.e.down.parentNode ) D.remove( this.e.down );
1409
+ delete this.e.down;
1410
+ }
1411
+ }
1412
+ }
1413
+ if( !nVisible ){
1414
+ /* The DOM elements can now be disposed of. */
1415
+ for( const x of [this.e.up, this.e.down, this.e.all, this.e.body] ){
1416
+ if( x?.parentNode ) D.remove(x);
14001417
}
1418
+ delete this.e;
14011419
}
14021420
},
14031421
14041422
load_messages: function(bDown) {
14051423
if( this.bIgnoreClick ) return;
@@ -1432,17 +1450,22 @@
14321450
n: nFetch,
14331451
i: iFirst
14341452
},
14351453
responseType: "json",
14361454
onload:function(jx){
1437
- const firstChildOfBelow = e.below.firstChild;
1455
+ if( bDown ) jx.msgs.reverse();
14381456
jx.msgs.forEach((m) => {
14391457
var mw = new Chat.MessageWidget(m);
14401458
if( bDown ){
1441
- e.below.insertBefore(mw.e.body, firstChildOfBelow);
1459
+ /* Inject the message below this object's body, or
1460
+ append it to Chat.e.searchContent if this element
1461
+ is the final one in its parent (Chat.e.searchContent). */
1462
+ const eAnchor = e.body.nextElementSibling;
1463
+ if( eAnchor ) Chat.e.searchContent.insertBefore(mw.e.body, eAnchor);
1464
+ else D.append(Chat.e.searchContent, mw.e.body);
14421465
}else{
1443
- D.append(e.above, mw.e.body);
1466
+ Chat.e.searchContent.insertBefore(mw.e.body, e.body);
14441467
}
14451468
});
14461469
if( bDown ){
14471470
o.iNextId -= jx.msgs.length;
14481471
}else{
@@ -2347,15 +2370,16 @@
23472370
Clears the search result view. If addInstructions is true it adds
23482371
text to that view instructing the user to enter their query into
23492372
the message-entry widget (noting that that widget has text
23502373
implying that it's only for submitting a message, which isn't
23512374
exactly true when the search view is active).
2375
+
2376
+ Returns the DOM element which wraps all of the chat search
2377
+ result elements.
23522378
*/
2353
- Chat.clearSearch = function(addInstructions=false){
2354
- const e = D.clearElement(
2355
- this.e.viewSearch.querySelector('.message-widget-content')
2356
- );
2379
+ Chat.clearSearch = function f(addInstructions=false){
2380
+ const e = D.clearElement( this.e.searchContent );
23572381
if(addInstructions){
23582382
D.append(e, "Enter search terms in the message field.");
23592383
}
23602384
return e;
23612385
};
@@ -2382,30 +2406,31 @@
23822406
first: jx.first,
23832407
last: jx.last,
23842408
previd: previd,
23852409
nextid: m.msgid
23862410
});
2387
- D.append( eMsgTgt, spacer.e.body, mw.e.body );
2411
+ if( spacer.e ) D.append( eMsgTgt, spacer.e.body );
2412
+ D.append( eMsgTgt, mw.e.body );
23882413
previd = m.msgid;
23892414
});
23902415
if( jx.msgs.length ){
23912416
const spacer = new Chat.SearchCtxLoader({
23922417
first: jx.first,
23932418
last: jx.last,
23942419
previd: previd,
23952420
nextid: 0
23962421
});
2397
- D.append( eMsgTgt, spacer.e.body );
2422
+ if( spacer.e ) D.append( eMsgTgt, spacer.e.body );
23982423
}else{
23992424
D.append( D.clearElement(eMsgTgt),
24002425
'No search results found for: ',
24012426
term );
24022427
}
24032428
}
24042429
}
24052430
);
2406
- };
2431
+ }/*Chat.submitSearch()*/;
24072432
24082433
const afterFetch = function f(){
24092434
if(true===f.isFirstCall){
24102435
f.isFirstCall = false;
24112436
Chat.ajaxEnd();
24122437
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -145,12 +145,13 @@
145 inputM: E1('#chat-input-field-multi'),
146 inputFile: E1('#chat-input-file'),
147 contentDiv: E1('div.content'),
148 viewConfig: E1('#chat-config'),
149 viewPreview: E1('#chat-preview'),
150 viewSearch: E1('#chat-search'),
151 previewContent: E1('#chat-preview-content'),
 
 
152 btnPreview: E1('#chat-button-preview'),
153 views: document.querySelectorAll('.chat-view'),
154 activeUserListWrapper: E1('#chat-user-list-wrapper'),
155 activeUserList: E1('#chat-user-list')
156 },
@@ -1340,20 +1341,15 @@
1340 this.o = {
1341 iFirstInTable: o.first,
1342 iLastInTable: o.last,
1343 iPrevId: o.previd,
1344 iNextId: o.nextid,
1345 bIgnoreClick: false,
1346 };
1347
1348 this.e = {
1349 body: D.addClass(D.div(), 'spacer-widget'),
1350
1351 above: D.addClass(D.div(), 'spacer-widget-above'),
1352 buttons: D.addClass(D.div(), 'spacer-widget-buttons'),
1353 below: D.addClass(D.div(), 'spacer-widget-below'),
1354
1355 up: D.addClass(
1356 D.button(zDownArrow+' Load '+nMsgContext+' more '+zDownArrow),
1357 'up'
1358 ),
1359 down: D.addClass(
@@ -1361,12 +1357,12 @@
1361 'down'
1362 ),
1363 all: D.addClass(D.button('Load More'), 'all')
1364 };
1365
1366 D.append(this.e.buttons, this.e.up, this.e.down, this.e.all);
1367 D.append(this.e.body, this.e.above, this.e.buttons, this.e.below);
1368
1369 const ms = this;
1370 this.e.up.addEventListener('click', ()=>ms.load_messages(false));
1371 this.e.down.addEventListener('click', ()=>ms.load_messages(true));
1372 this.e.all.addEventListener('click', ()=>ms.load_messages( (ms.o.iPrevId==0) ));
@@ -1373,33 +1369,55 @@
1373 this.set_button_visibility();
1374 };
1375
1376 cf.prototype = {
1377 set_button_visibility: function() {
 
1378 const o = this.o;
1379
1380 const iPrevId = (o.iPrevId!=0) ? o.iPrevId : o.iFirstInTable-1;
1381 const iNextId = (o.iNextId!=0) ? o.iNextId : o.iLastInTable+1;
1382 var nDiff = (iNextId - iPrevId) - 1;
1383
1384 D.addClass([this.e.up, this.e.down, this.e.all], 'hidden');
1385
 
 
1386 if( nDiff>0 ){
1387
1388 if( nDiff>nMsgContext && (o.iPrevId==0 || o.iNextId==0) ){
1389 nDiff = nMsgContext;
1390 }
1391
1392 if( nDiff<=nMsgContext && o.iPrevId!=0 && o.iNextId!=0 ){
1393 D.removeClass(this.e.all, 'hidden');
 
1394 this.e.all.innerText = (
1395 zUpArrow + " Load " + nDiff + " more " + zDownArrow
1396 );
1397 }else{
1398 if( o.iPrevId!=0 ) D.removeClass(this.e.up, 'hidden');
1399 if( o.iNextId!=0 ) D.removeClass(this.e.down, 'hidden');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1400 }
 
1401 }
1402 },
1403
1404 load_messages: function(bDown) {
1405 if( this.bIgnoreClick ) return;
@@ -1432,17 +1450,22 @@
1432 n: nFetch,
1433 i: iFirst
1434 },
1435 responseType: "json",
1436 onload:function(jx){
1437 const firstChildOfBelow = e.below.firstChild;
1438 jx.msgs.forEach((m) => {
1439 var mw = new Chat.MessageWidget(m);
1440 if( bDown ){
1441 e.below.insertBefore(mw.e.body, firstChildOfBelow);
 
 
 
 
 
1442 }else{
1443 D.append(e.above, mw.e.body);
1444 }
1445 });
1446 if( bDown ){
1447 o.iNextId -= jx.msgs.length;
1448 }else{
@@ -2347,15 +2370,16 @@
2347 Clears the search result view. If addInstructions is true it adds
2348 text to that view instructing the user to enter their query into
2349 the message-entry widget (noting that that widget has text
2350 implying that it's only for submitting a message, which isn't
2351 exactly true when the search view is active).
 
 
 
2352 */
2353 Chat.clearSearch = function(addInstructions=false){
2354 const e = D.clearElement(
2355 this.e.viewSearch.querySelector('.message-widget-content')
2356 );
2357 if(addInstructions){
2358 D.append(e, "Enter search terms in the message field.");
2359 }
2360 return e;
2361 };
@@ -2382,30 +2406,31 @@
2382 first: jx.first,
2383 last: jx.last,
2384 previd: previd,
2385 nextid: m.msgid
2386 });
2387 D.append( eMsgTgt, spacer.e.body, mw.e.body );
 
2388 previd = m.msgid;
2389 });
2390 if( jx.msgs.length ){
2391 const spacer = new Chat.SearchCtxLoader({
2392 first: jx.first,
2393 last: jx.last,
2394 previd: previd,
2395 nextid: 0
2396 });
2397 D.append( eMsgTgt, spacer.e.body );
2398 }else{
2399 D.append( D.clearElement(eMsgTgt),
2400 'No search results found for: ',
2401 term );
2402 }
2403 }
2404 }
2405 );
2406 };
2407
2408 const afterFetch = function f(){
2409 if(true===f.isFirstCall){
2410 f.isFirstCall = false;
2411 Chat.ajaxEnd();
2412
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -145,12 +145,13 @@
145 inputM: E1('#chat-input-field-multi'),
146 inputFile: E1('#chat-input-file'),
147 contentDiv: E1('div.content'),
148 viewConfig: E1('#chat-config'),
149 viewPreview: E1('#chat-preview'),
 
150 previewContent: E1('#chat-preview-content'),
151 viewSearch: E1('#chat-search'),
152 searchContent: E1('#chat-search-content'),
153 btnPreview: E1('#chat-button-preview'),
154 views: document.querySelectorAll('.chat-view'),
155 activeUserListWrapper: E1('#chat-user-list-wrapper'),
156 activeUserList: E1('#chat-user-list')
157 },
@@ -1340,20 +1341,15 @@
1341 this.o = {
1342 iFirstInTable: o.first,
1343 iLastInTable: o.last,
1344 iPrevId: o.previd,
1345 iNextId: o.nextid,
1346 bIgnoreClick: false
1347 };
1348
1349 this.e = {
1350 body: D.addClass(D.div(), 'spacer-widget'),
 
 
 
 
 
1351 up: D.addClass(
1352 D.button(zDownArrow+' Load '+nMsgContext+' more '+zDownArrow),
1353 'up'
1354 ),
1355 down: D.addClass(
@@ -1361,12 +1357,12 @@
1357 'down'
1358 ),
1359 all: D.addClass(D.button('Load More'), 'all')
1360 };
1361
1362 ;
1363 D.append( this.e.body, this.e.up, this.e.down, this.e.all );
1364
1365 const ms = this;
1366 this.e.up.addEventListener('click', ()=>ms.load_messages(false));
1367 this.e.down.addEventListener('click', ()=>ms.load_messages(true));
1368 this.e.all.addEventListener('click', ()=>ms.load_messages( (ms.o.iPrevId==0) ));
@@ -1373,33 +1369,55 @@
1369 this.set_button_visibility();
1370 };
1371
1372 cf.prototype = {
1373 set_button_visibility: function() {
1374 if( !this.e ) return;
1375 const o = this.o;
1376
1377 const iPrevId = (o.iPrevId!=0) ? o.iPrevId : o.iFirstInTable-1;
1378 const iNextId = (o.iNextId!=0) ? o.iNextId : o.iLastInTable+1;
1379 let nDiff = (iNextId - iPrevId) - 1;
1380
1381 for( const x of [this.e.up, this.e.down, this.e.all] ){
1382 if( x ) D.addClass(x, 'hidden');
1383 }
1384 let nVisible = 0;
1385 if( nDiff>0 ){
 
1386 if( nDiff>nMsgContext && (o.iPrevId==0 || o.iNextId==0) ){
1387 nDiff = nMsgContext;
1388 }
1389
1390 if( nDiff<=nMsgContext && o.iPrevId!=0 && o.iNextId!=0 ){
1391 D.removeClass(this.e.all, 'hidden');
1392 ++nVisible;
1393 this.e.all.innerText = (
1394 zUpArrow + " Load " + nDiff + " more " + zDownArrow
1395 );
1396 }else{
1397 if( o.iPrevId!=0 ){
1398 ++nVisible;
1399 D.removeClass(this.e.up, 'hidden');
1400 }else if( this.e.up ){
1401 if( this.e.up.parentNode ) D.remove(this.e.up);
1402 delete this.e.up;
1403 }
1404 if( o.iNextId!=0 ){
1405 ++nVisible;
1406 D.removeClass(this.e.down, 'hidden');
1407 }else if( this.e.down ){
1408 if( this.e.down.parentNode ) D.remove( this.e.down );
1409 delete this.e.down;
1410 }
1411 }
1412 }
1413 if( !nVisible ){
1414 /* The DOM elements can now be disposed of. */
1415 for( const x of [this.e.up, this.e.down, this.e.all, this.e.body] ){
1416 if( x?.parentNode ) D.remove(x);
1417 }
1418 delete this.e;
1419 }
1420 },
1421
1422 load_messages: function(bDown) {
1423 if( this.bIgnoreClick ) return;
@@ -1432,17 +1450,22 @@
1450 n: nFetch,
1451 i: iFirst
1452 },
1453 responseType: "json",
1454 onload:function(jx){
1455 if( bDown ) jx.msgs.reverse();
1456 jx.msgs.forEach((m) => {
1457 var mw = new Chat.MessageWidget(m);
1458 if( bDown ){
1459 /* Inject the message below this object's body, or
1460 append it to Chat.e.searchContent if this element
1461 is the final one in its parent (Chat.e.searchContent). */
1462 const eAnchor = e.body.nextElementSibling;
1463 if( eAnchor ) Chat.e.searchContent.insertBefore(mw.e.body, eAnchor);
1464 else D.append(Chat.e.searchContent, mw.e.body);
1465 }else{
1466 Chat.e.searchContent.insertBefore(mw.e.body, e.body);
1467 }
1468 });
1469 if( bDown ){
1470 o.iNextId -= jx.msgs.length;
1471 }else{
@@ -2347,15 +2370,16 @@
2370 Clears the search result view. If addInstructions is true it adds
2371 text to that view instructing the user to enter their query into
2372 the message-entry widget (noting that that widget has text
2373 implying that it's only for submitting a message, which isn't
2374 exactly true when the search view is active).
2375
2376 Returns the DOM element which wraps all of the chat search
2377 result elements.
2378 */
2379 Chat.clearSearch = function f(addInstructions=false){
2380 const e = D.clearElement( this.e.searchContent );
 
 
2381 if(addInstructions){
2382 D.append(e, "Enter search terms in the message field.");
2383 }
2384 return e;
2385 };
@@ -2382,30 +2406,31 @@
2406 first: jx.first,
2407 last: jx.last,
2408 previd: previd,
2409 nextid: m.msgid
2410 });
2411 if( spacer.e ) D.append( eMsgTgt, spacer.e.body );
2412 D.append( eMsgTgt, mw.e.body );
2413 previd = m.msgid;
2414 });
2415 if( jx.msgs.length ){
2416 const spacer = new Chat.SearchCtxLoader({
2417 first: jx.first,
2418 last: jx.last,
2419 previd: previd,
2420 nextid: 0
2421 });
2422 if( spacer.e ) D.append( eMsgTgt, spacer.e.body );
2423 }else{
2424 D.append( D.clearElement(eMsgTgt),
2425 'No search results found for: ',
2426 term );
2427 }
2428 }
2429 }
2430 );
2431 }/*Chat.submitSearch()*/;
2432
2433 const afterFetch = function f(){
2434 if(true===f.isFirstCall){
2435 f.isFirstCall = false;
2436 Chat.ajaxEnd();
2437
--- src/style.chat.css
+++ src/style.chat.css
@@ -519,12 +519,12 @@
519519
display: inline-block;
520520
opacity: 0.85;
521521
}
522522
body.chat #chat-config #chat-config-options .menu-entry select {
523523
}
524
-body.chat #chat-preview .message-widget-content,
525
-body.chat #chat-search .message-widget-content {
524
+body.chat #chat-preview #chat-preview-content,
525
+body.chat #chat-search #chat-search-content {
526526
overflow: auto;
527527
flex: 1 1 auto;
528528
padding: 0.5em;
529529
border: 1px dotted;
530530
}
531531
--- src/style.chat.css
+++ src/style.chat.css
@@ -519,12 +519,12 @@
519 display: inline-block;
520 opacity: 0.85;
521 }
522 body.chat #chat-config #chat-config-options .menu-entry select {
523 }
524 body.chat #chat-preview .message-widget-content,
525 body.chat #chat-search .message-widget-content {
526 overflow: auto;
527 flex: 1 1 auto;
528 padding: 0.5em;
529 border: 1px dotted;
530 }
531
--- src/style.chat.css
+++ src/style.chat.css
@@ -519,12 +519,12 @@
519 display: inline-block;
520 opacity: 0.85;
521 }
522 body.chat #chat-config #chat-config-options .menu-entry select {
523 }
524 body.chat #chat-preview #chat-preview-content,
525 body.chat #chat-search #chat-search-content {
526 overflow: auto;
527 flex: 1 1 auto;
528 padding: 0.5em;
529 border: 1px dotted;
530 }
531

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button