Fossil SCM

Merged two near-identical lists of CSS selectors in the /chat JS into one. As far as I can tell, they _are_ supposed to be identical, since they're both concerned with calculating the "framing" elements of the chat area, being everything other than the list of messages. It looks like they slipped out of that ideal in the way duplicated code does.

wyoung 2024-02-11 10:56 trunk
Commit 1cf4a7d72862e2d7081173d2b221f6efb83fe01ca572ebe3baebf518aefd0343
1 file changed +11 -13
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -65,10 +65,19 @@
6565
/* This can inadvertently influence our flexbox layouts, so move
6666
it out of the way. */
6767
D.append(document.body,dbg);
6868
}
6969
})();
70
+ const GetFramingElements = function() {
71
+ return document.querySelectorAll([
72
+ "body > header",
73
+ "body > nav.mainmenu",
74
+ "body > footer",
75
+ "h1.page-title",
76
+ "#debugMsg"
77
+ ].join(','));
78
+ };
7079
const ForceResizeKludge = (function(){
7180
/* Workaround for Safari mayhem regarding use of vh CSS units....
7281
We tried to use vh units to set the content area size for the
7382
chat layout, but Safari chokes on that, so we calculate that
7483
height here: 85% when in "normal" mode and 95% in chat-only
@@ -76,16 +85,11 @@
7685
causing the input area to move off-screen.
7786
7887
While we're here, we also use this to cap the max-height
7988
of the input field so that pasting huge text does not scroll
8089
the upper area of the input widget off-screen. */
81
- const elemsToCount = [
82
- document.querySelector('body > header'),
83
- document.querySelector('body > nav.mainmenu'),
84
- document.querySelector('body > #hbdrop'),
85
- document.querySelector('body > footer')
86
- ];
90
+ const elemsToCount = GetFramingElements();
8791
const contentArea = E1('div.content');
8892
const bcl = document.body.classList;
8993
const resized = function f(){
9094
if(f.$disabled) return;
9195
const wh = window.innerHeight,
@@ -324,17 +328,11 @@
324328
user.
325329
*/
326330
chatOnlyMode: function f(yes){
327331
if(undefined === f.elemsToToggle){
328332
f.elemsToToggle = [];
329
- document.querySelectorAll(
330
- ["body > header",
331
- "body > nav.mainmenu",
332
- "body > footer",
333
- "#debugMsg"
334
- ].join(',')
335
- ).forEach((e)=>f.elemsToToggle.push(e));
333
+ GetFramingElements().forEach((e)=>f.elemsToToggle.push(e));
336334
}
337335
if(!arguments.length) yes = true;
338336
if(yes === this.isChatOnlyMode()) return this;
339337
if(yes){
340338
D.addClass(f.elemsToToggle, 'hidden');
341339
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -65,10 +65,19 @@
65 /* This can inadvertently influence our flexbox layouts, so move
66 it out of the way. */
67 D.append(document.body,dbg);
68 }
69 })();
 
 
 
 
 
 
 
 
 
70 const ForceResizeKludge = (function(){
71 /* Workaround for Safari mayhem regarding use of vh CSS units....
72 We tried to use vh units to set the content area size for the
73 chat layout, but Safari chokes on that, so we calculate that
74 height here: 85% when in "normal" mode and 95% in chat-only
@@ -76,16 +85,11 @@
76 causing the input area to move off-screen.
77
78 While we're here, we also use this to cap the max-height
79 of the input field so that pasting huge text does not scroll
80 the upper area of the input widget off-screen. */
81 const elemsToCount = [
82 document.querySelector('body > header'),
83 document.querySelector('body > nav.mainmenu'),
84 document.querySelector('body > #hbdrop'),
85 document.querySelector('body > footer')
86 ];
87 const contentArea = E1('div.content');
88 const bcl = document.body.classList;
89 const resized = function f(){
90 if(f.$disabled) return;
91 const wh = window.innerHeight,
@@ -324,17 +328,11 @@
324 user.
325 */
326 chatOnlyMode: function f(yes){
327 if(undefined === f.elemsToToggle){
328 f.elemsToToggle = [];
329 document.querySelectorAll(
330 ["body > header",
331 "body > nav.mainmenu",
332 "body > footer",
333 "#debugMsg"
334 ].join(',')
335 ).forEach((e)=>f.elemsToToggle.push(e));
336 }
337 if(!arguments.length) yes = true;
338 if(yes === this.isChatOnlyMode()) return this;
339 if(yes){
340 D.addClass(f.elemsToToggle, 'hidden');
341
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -65,10 +65,19 @@
65 /* This can inadvertently influence our flexbox layouts, so move
66 it out of the way. */
67 D.append(document.body,dbg);
68 }
69 })();
70 const GetFramingElements = function() {
71 return document.querySelectorAll([
72 "body > header",
73 "body > nav.mainmenu",
74 "body > footer",
75 "h1.page-title",
76 "#debugMsg"
77 ].join(','));
78 };
79 const ForceResizeKludge = (function(){
80 /* Workaround for Safari mayhem regarding use of vh CSS units....
81 We tried to use vh units to set the content area size for the
82 chat layout, but Safari chokes on that, so we calculate that
83 height here: 85% when in "normal" mode and 95% in chat-only
@@ -76,16 +85,11 @@
85 causing the input area to move off-screen.
86
87 While we're here, we also use this to cap the max-height
88 of the input field so that pasting huge text does not scroll
89 the upper area of the input widget off-screen. */
90 const elemsToCount = GetFramingElements();
 
 
 
 
 
91 const contentArea = E1('div.content');
92 const bcl = document.body.classList;
93 const resized = function f(){
94 if(f.$disabled) return;
95 const wh = window.innerHeight,
@@ -324,17 +328,11 @@
328 user.
329 */
330 chatOnlyMode: function f(yes){
331 if(undefined === f.elemsToToggle){
332 f.elemsToToggle = [];
333 GetFramingElements().forEach((e)=>f.elemsToToggle.push(e));
 
 
 
 
 
 
334 }
335 if(!arguments.length) yes = true;
336 if(yes === this.isChatOnlyMode()) return this;
337 if(yes){
338 D.addClass(f.elemsToToggle, 'hidden');
339

Keyboard Shortcuts

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