Fossil SCM

Replace some hard-coded /chat-search styles with project-conventional CSS classes. Minor layout tweaks.

stephan 2024-06-30 11:43 fts5-chat-search
Commit 3b84b4f8c6de64cfc5cd0ff2cbdefe10357af1cf36ff558baaf6e68b006e6bf0
--- src/fossil.page.chatsearch.js
+++ src/fossil.page.chatsearch.js
@@ -251,14 +251,14 @@
251251
const zUpArrow = '\u25B2';
252252
const zDownArrow = '\u25BC';
253253
254254
const cf = function(o){
255255
256
- /* iFirstInTable:
256
+ /* iFirstInTable:
257257
** msgid of first row in chatfts table.
258258
**
259
- ** iLastInTable:
259
+ ** iLastInTable:
260260
** msgid of last row in chatfts table.
261261
**
262262
** iPrevId:
263263
** msgid of message immediately above this spacer. Or 0 if this
264264
** spacer is above all results.
@@ -269,11 +269,11 @@
269269
**
270270
** bIgnoreClick:
271271
** ignore any clicks if this is true. This is used to ensure there
272272
** is only ever one request belonging to this widget outstanding
273273
** at any time.
274
- */
274
+ */
275275
this.o = {
276276
iFirstInTable: o.first,
277277
iLastInTable: o.last,
278278
iPrevId: o.previd,
279279
iNextId: o.nextid,
@@ -297,15 +297,10 @@
297297
D.addClass(this.e.all, 'all');
298298
299299
D.append(this.e.buttons, this.e.up, this.e.down, this.e.all);
300300
D.append(this.e.body, this.e.above, this.e.buttons, this.e.below);
301301
302
- this.e.up.style.float = 'left';
303
- this.e.down.style.float = 'left';
304
- this.e.all.style.float = 'left';
305
- this.e.below.style.clear = 'both';
306
-
307302
const ms = this;
308303
this.e.up.addEventListener('click', function(){
309304
ms.load_messages(false);
310305
});
311306
this.e.down.addEventListener('click', function(){
@@ -324,28 +319,26 @@
324319
325320
var iPrevId = (o.iPrevId!=0) ? o.iPrevId : o.iFirstInTable-1;
326321
var iNextId = (o.iNextId!=0) ? o.iNextId : o.iLastInTable+1;
327322
var nDiff = (iNextId - iPrevId) - 1;
328323
329
- this.e.up.style.display = 'none';
330
- this.e.down.style.display = 'none';
331
- this.e.all.style.display = 'none';
324
+ D.addClass([this.e.up, this.e.down, this.e.all], 'hidden');
332325
333326
if( nDiff>0 ){
334327
335328
if( nDiff>nMsgContext && (o.iPrevId==0 || o.iNextId==0) ){
336329
nDiff = nMsgContext;
337330
}
338331
339332
if( nDiff<=nMsgContext && o.iPrevId!=0 && o.iNextId!=0 ){
340
- this.e.all.style.display = 'block';
333
+ D.removeClass(this.e.all, 'hidden');
341334
this.e.all.innerText = (
342335
zUpArrow + " Load " + nDiff + " more " + zDownArrow
343336
);
344337
}else{
345
- if( o.iPrevId!=0 ) this.e.up.style.display = 'block';
346
- if( o.iNextId!=0 ) this.e.down.style.display = 'block';
338
+ if( o.iPrevId!=0 ) D.removeClass(this.e.up, 'hidden');
339
+ if( o.iNextId!=0 ) D.removeClass(this.e.down, 'hidden');
347340
}
348341
}
349342
},
350343
351344
load_messages: function(bDown) {
352345
--- src/fossil.page.chatsearch.js
+++ src/fossil.page.chatsearch.js
@@ -251,14 +251,14 @@
251 const zUpArrow = '\u25B2';
252 const zDownArrow = '\u25BC';
253
254 const cf = function(o){
255
256 /* iFirstInTable:
257 ** msgid of first row in chatfts table.
258 **
259 ** iLastInTable:
260 ** msgid of last row in chatfts table.
261 **
262 ** iPrevId:
263 ** msgid of message immediately above this spacer. Or 0 if this
264 ** spacer is above all results.
@@ -269,11 +269,11 @@
269 **
270 ** bIgnoreClick:
271 ** ignore any clicks if this is true. This is used to ensure there
272 ** is only ever one request belonging to this widget outstanding
273 ** at any time.
274 */
275 this.o = {
276 iFirstInTable: o.first,
277 iLastInTable: o.last,
278 iPrevId: o.previd,
279 iNextId: o.nextid,
@@ -297,15 +297,10 @@
297 D.addClass(this.e.all, 'all');
298
299 D.append(this.e.buttons, this.e.up, this.e.down, this.e.all);
300 D.append(this.e.body, this.e.above, this.e.buttons, this.e.below);
301
302 this.e.up.style.float = 'left';
303 this.e.down.style.float = 'left';
304 this.e.all.style.float = 'left';
305 this.e.below.style.clear = 'both';
306
307 const ms = this;
308 this.e.up.addEventListener('click', function(){
309 ms.load_messages(false);
310 });
311 this.e.down.addEventListener('click', function(){
@@ -324,28 +319,26 @@
324
325 var iPrevId = (o.iPrevId!=0) ? o.iPrevId : o.iFirstInTable-1;
326 var iNextId = (o.iNextId!=0) ? o.iNextId : o.iLastInTable+1;
327 var nDiff = (iNextId - iPrevId) - 1;
328
329 this.e.up.style.display = 'none';
330 this.e.down.style.display = 'none';
331 this.e.all.style.display = 'none';
332
333 if( nDiff>0 ){
334
335 if( nDiff>nMsgContext && (o.iPrevId==0 || o.iNextId==0) ){
336 nDiff = nMsgContext;
337 }
338
339 if( nDiff<=nMsgContext && o.iPrevId!=0 && o.iNextId!=0 ){
340 this.e.all.style.display = 'block';
341 this.e.all.innerText = (
342 zUpArrow + " Load " + nDiff + " more " + zDownArrow
343 );
344 }else{
345 if( o.iPrevId!=0 ) this.e.up.style.display = 'block';
346 if( o.iNextId!=0 ) this.e.down.style.display = 'block';
347 }
348 }
349 },
350
351 load_messages: function(bDown) {
352
--- src/fossil.page.chatsearch.js
+++ src/fossil.page.chatsearch.js
@@ -251,14 +251,14 @@
251 const zUpArrow = '\u25B2';
252 const zDownArrow = '\u25BC';
253
254 const cf = function(o){
255
256 /* iFirstInTable:
257 ** msgid of first row in chatfts table.
258 **
259 ** iLastInTable:
260 ** msgid of last row in chatfts table.
261 **
262 ** iPrevId:
263 ** msgid of message immediately above this spacer. Or 0 if this
264 ** spacer is above all results.
@@ -269,11 +269,11 @@
269 **
270 ** bIgnoreClick:
271 ** ignore any clicks if this is true. This is used to ensure there
272 ** is only ever one request belonging to this widget outstanding
273 ** at any time.
274 */
275 this.o = {
276 iFirstInTable: o.first,
277 iLastInTable: o.last,
278 iPrevId: o.previd,
279 iNextId: o.nextid,
@@ -297,15 +297,10 @@
297 D.addClass(this.e.all, 'all');
298
299 D.append(this.e.buttons, this.e.up, this.e.down, this.e.all);
300 D.append(this.e.body, this.e.above, this.e.buttons, this.e.below);
301
 
 
 
 
 
302 const ms = this;
303 this.e.up.addEventListener('click', function(){
304 ms.load_messages(false);
305 });
306 this.e.down.addEventListener('click', function(){
@@ -324,28 +319,26 @@
319
320 var iPrevId = (o.iPrevId!=0) ? o.iPrevId : o.iFirstInTable-1;
321 var iNextId = (o.iNextId!=0) ? o.iNextId : o.iLastInTable+1;
322 var nDiff = (iNextId - iPrevId) - 1;
323
324 D.addClass([this.e.up, this.e.down, this.e.all], 'hidden');
 
 
325
326 if( nDiff>0 ){
327
328 if( nDiff>nMsgContext && (o.iPrevId==0 || o.iNextId==0) ){
329 nDiff = nMsgContext;
330 }
331
332 if( nDiff<=nMsgContext && o.iPrevId!=0 && o.iNextId!=0 ){
333 D.removeClass(this.e.all, 'hidden');
334 this.e.all.innerText = (
335 zUpArrow + " Load " + nDiff + " more " + zDownArrow
336 );
337 }else{
338 if( o.iPrevId!=0 ) D.removeClass(this.e.up, 'hidden');
339 if( o.iNextId!=0 ) D.removeClass(this.e.down, 'hidden');
340 }
341 }
342 },
343
344 load_messages: function(bDown) {
345
--- src/style.chat.css
+++ src/style.chat.css
@@ -627,18 +627,20 @@
627627
margin-top: 1em;
628628
}
629629
body.cpage-chat-search .spacer-widget button {
630630
margin-left: 1ex;
631631
margin-right: 1ex;
632
+ display: block;
632633
}
633634
634635
body.cpage-chat-search .spacer-widget-buttons .up {
635
- margin-top: -0.75em;
636
+ margin-top: -0.25em;
636637
margin-bottom: 1em;
637638
}
638639
body.cpage-chat-search .spacer-widget-buttons .down {
639640
margin-top: 1em;
641
+ margin-bottom: 0.5em;
640642
}
641643
body.cpage-chat-search .spacer-widget-buttons .all {
642644
margin-bottom: 0.75em;
643645
}
644646
645647
--- src/style.chat.css
+++ src/style.chat.css
@@ -627,18 +627,20 @@
627 margin-top: 1em;
628 }
629 body.cpage-chat-search .spacer-widget button {
630 margin-left: 1ex;
631 margin-right: 1ex;
 
632 }
633
634 body.cpage-chat-search .spacer-widget-buttons .up {
635 margin-top: -0.75em;
636 margin-bottom: 1em;
637 }
638 body.cpage-chat-search .spacer-widget-buttons .down {
639 margin-top: 1em;
 
640 }
641 body.cpage-chat-search .spacer-widget-buttons .all {
642 margin-bottom: 0.75em;
643 }
644
645
--- src/style.chat.css
+++ src/style.chat.css
@@ -627,18 +627,20 @@
627 margin-top: 1em;
628 }
629 body.cpage-chat-search .spacer-widget button {
630 margin-left: 1ex;
631 margin-right: 1ex;
632 display: block;
633 }
634
635 body.cpage-chat-search .spacer-widget-buttons .up {
636 margin-top: -0.25em;
637 margin-bottom: 1em;
638 }
639 body.cpage-chat-search .spacer-widget-buttons .down {
640 margin-top: 1em;
641 margin-bottom: 0.5em;
642 }
643 body.cpage-chat-search .spacer-widget-buttons .all {
644 margin-bottom: 0.75em;
645 }
646
647

Keyboard Shortcuts

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