Fossil SCM

Added file attachment widget toggle (on by default) and reversed order of config options (top-down instead of bottom-up) because that simply seems more intuitive.

stephan 2021-10-01 14:14 UTC chat-input-rework
Commit 40cdaeecd48dd7aaa5360a37a321e3a0454025f71f3440edaab91b229f6d708d
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -381,11 +381,12 @@
381381
"edit-compact-mode": true,
382382
"monospace-messages": true,
383383
"chat-only-mode": false,
384384
"audible-alert": true,
385385
"active-user-list": false,
386
- "active-user-list-timestamps": false
386
+ "active-user-list-timestamps": false,
387
+ "hide-attachment-widget": false
387388
}
388389
},
389390
/** Plays a new-message notification sound IF the audible-alert
390391
setting is true, else this is a no-op. Returns this.
391392
*/
@@ -1330,14 +1331,12 @@
13301331
if(!Chat.e.activeUserListWrapper.classList.contains('collapsed')){
13311332
Chat.animate(optAu.theList,'anim-flip-v');
13321333
}
13331334
}, false);
13341335
}/*namedOptions.activeUsers additional setup*/
1335
- /* Settings menu entries... Remember that they will be rendered in
1336
- reverse order and the most frequently-needed ones "should"
1337
- (arguably) be closer to the start of this list so that they
1338
- will be rendered within easier reach of the settings button. */
1336
+ /* Settings menu entries... the most frequently-needed ones "should"
1337
+ (arguably) be closer to the start of this list. */
13391338
/**
13401339
Settings ops structure:
13411340
13421341
label: string for the UI
13431342
@@ -1379,19 +1378,10 @@
13791378
document.body.classList[
13801379
this.checkbox.checked ? 'remove' : 'add'
13811380
]('my-messages-right');
13821381
}
13831382
},{
1384
- label: "Show images inline",
1385
- hint: "Whether to show images inline or as a hyperlink.",
1386
- boolValue: 'images-inline'
1387
- },{
1388
- label: "Timestamps in active users list",
1389
- hint: "Whether to show last-message timestamps.",
1390
- boolValue: 'active-user-list-timestamps'
1391
- },
1392
- namedOptions.activeUsers,{
13931383
label: "Monospace message font",
13941384
hint: "Use monospace font for message text?",
13951385
boolValue: 'monospace-messages',
13961386
callback: function(setting){
13971387
document.body.classList[
@@ -1400,10 +1390,24 @@
14001390
}
14011391
},{
14021392
label: "Chat-only mode",
14031393
hint: "Toggle the page between normal fossil view and chat-only view.",
14041394
boolValue: 'chat-only-mode'
1395
+ },{
1396
+ label: "Show images inline",
1397
+ hint: "Whether to show images inline or as a hyperlink.",
1398
+ boolValue: 'images-inline'
1399
+ },{
1400
+ label: "Timestamps in active users list",
1401
+ hint: "Whether to show last-message timestamps.",
1402
+ boolValue: 'active-user-list-timestamps'
1403
+ },
1404
+ namedOptions.activeUsers,{
1405
+ label: "Hide file attachment widget",
1406
+ boolValue: "hide-attachment-widget",
1407
+ hint: "Hides the file attachment widget, gaining more "+
1408
+ "screen space for messages."
14051409
}];
14061410
14071411
/** Set up selection list of notification sounds. */
14081412
if(1){
14091413
const selectSound = D.select();
@@ -1526,10 +1530,15 @@
15261530
Chat.settings.addListener('edit-compact-mode',function(s){
15271531
Chat.e.inputLine.classList[
15281532
s.value ? 'add' : 'remove'
15291533
]('compact');
15301534
});
1535
+ Chat.settings.addListener('hide-attachment-widget',function(s){
1536
+ Chat.e.fileSelectWrapper.classList[
1537
+ s.value ? 'add' : 'remove'
1538
+ ]('hidden');
1539
+ });
15311540
Chat.settings.addListener('edit-ctrl-send',function(s){
15321541
const label = (s.value ? "Ctrl-" : "")+"Enter submits messages.";
15331542
const eInput = Chat.inputElement();
15341543
eInput.dataset.placeholder = eInput.dataset.placeholder0 + " " +label;
15351544
Chat.e.btnSubmit.title = label;
15361545
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -381,11 +381,12 @@
381 "edit-compact-mode": true,
382 "monospace-messages": true,
383 "chat-only-mode": false,
384 "audible-alert": true,
385 "active-user-list": false,
386 "active-user-list-timestamps": false
 
387 }
388 },
389 /** Plays a new-message notification sound IF the audible-alert
390 setting is true, else this is a no-op. Returns this.
391 */
@@ -1330,14 +1331,12 @@
1330 if(!Chat.e.activeUserListWrapper.classList.contains('collapsed')){
1331 Chat.animate(optAu.theList,'anim-flip-v');
1332 }
1333 }, false);
1334 }/*namedOptions.activeUsers additional setup*/
1335 /* Settings menu entries... Remember that they will be rendered in
1336 reverse order and the most frequently-needed ones "should"
1337 (arguably) be closer to the start of this list so that they
1338 will be rendered within easier reach of the settings button. */
1339 /**
1340 Settings ops structure:
1341
1342 label: string for the UI
1343
@@ -1379,19 +1378,10 @@
1379 document.body.classList[
1380 this.checkbox.checked ? 'remove' : 'add'
1381 ]('my-messages-right');
1382 }
1383 },{
1384 label: "Show images inline",
1385 hint: "Whether to show images inline or as a hyperlink.",
1386 boolValue: 'images-inline'
1387 },{
1388 label: "Timestamps in active users list",
1389 hint: "Whether to show last-message timestamps.",
1390 boolValue: 'active-user-list-timestamps'
1391 },
1392 namedOptions.activeUsers,{
1393 label: "Monospace message font",
1394 hint: "Use monospace font for message text?",
1395 boolValue: 'monospace-messages',
1396 callback: function(setting){
1397 document.body.classList[
@@ -1400,10 +1390,24 @@
1400 }
1401 },{
1402 label: "Chat-only mode",
1403 hint: "Toggle the page between normal fossil view and chat-only view.",
1404 boolValue: 'chat-only-mode'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1405 }];
1406
1407 /** Set up selection list of notification sounds. */
1408 if(1){
1409 const selectSound = D.select();
@@ -1526,10 +1530,15 @@
1526 Chat.settings.addListener('edit-compact-mode',function(s){
1527 Chat.e.inputLine.classList[
1528 s.value ? 'add' : 'remove'
1529 ]('compact');
1530 });
 
 
 
 
 
1531 Chat.settings.addListener('edit-ctrl-send',function(s){
1532 const label = (s.value ? "Ctrl-" : "")+"Enter submits messages.";
1533 const eInput = Chat.inputElement();
1534 eInput.dataset.placeholder = eInput.dataset.placeholder0 + " " +label;
1535 Chat.e.btnSubmit.title = label;
1536
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -381,11 +381,12 @@
381 "edit-compact-mode": true,
382 "monospace-messages": true,
383 "chat-only-mode": false,
384 "audible-alert": true,
385 "active-user-list": false,
386 "active-user-list-timestamps": false,
387 "hide-attachment-widget": false
388 }
389 },
390 /** Plays a new-message notification sound IF the audible-alert
391 setting is true, else this is a no-op. Returns this.
392 */
@@ -1330,14 +1331,12 @@
1331 if(!Chat.e.activeUserListWrapper.classList.contains('collapsed')){
1332 Chat.animate(optAu.theList,'anim-flip-v');
1333 }
1334 }, false);
1335 }/*namedOptions.activeUsers additional setup*/
1336 /* Settings menu entries... the most frequently-needed ones "should"
1337 (arguably) be closer to the start of this list. */
 
 
1338 /**
1339 Settings ops structure:
1340
1341 label: string for the UI
1342
@@ -1379,19 +1378,10 @@
1378 document.body.classList[
1379 this.checkbox.checked ? 'remove' : 'add'
1380 ]('my-messages-right');
1381 }
1382 },{
 
 
 
 
 
 
 
 
 
1383 label: "Monospace message font",
1384 hint: "Use monospace font for message text?",
1385 boolValue: 'monospace-messages',
1386 callback: function(setting){
1387 document.body.classList[
@@ -1400,10 +1390,24 @@
1390 }
1391 },{
1392 label: "Chat-only mode",
1393 hint: "Toggle the page between normal fossil view and chat-only view.",
1394 boolValue: 'chat-only-mode'
1395 },{
1396 label: "Show images inline",
1397 hint: "Whether to show images inline or as a hyperlink.",
1398 boolValue: 'images-inline'
1399 },{
1400 label: "Timestamps in active users list",
1401 hint: "Whether to show last-message timestamps.",
1402 boolValue: 'active-user-list-timestamps'
1403 },
1404 namedOptions.activeUsers,{
1405 label: "Hide file attachment widget",
1406 boolValue: "hide-attachment-widget",
1407 hint: "Hides the file attachment widget, gaining more "+
1408 "screen space for messages."
1409 }];
1410
1411 /** Set up selection list of notification sounds. */
1412 if(1){
1413 const selectSound = D.select();
@@ -1526,10 +1530,15 @@
1530 Chat.settings.addListener('edit-compact-mode',function(s){
1531 Chat.e.inputLine.classList[
1532 s.value ? 'add' : 'remove'
1533 ]('compact');
1534 });
1535 Chat.settings.addListener('hide-attachment-widget',function(s){
1536 Chat.e.fileSelectWrapper.classList[
1537 s.value ? 'add' : 'remove'
1538 ]('hidden');
1539 });
1540 Chat.settings.addListener('edit-ctrl-send',function(s){
1541 const label = (s.value ? "Ctrl-" : "")+"Enter submits messages.";
1542 const eInput = Chat.inputElement();
1543 eInput.dataset.placeholder = eInput.dataset.placeholder0 + " " +label;
1544 Chat.e.btnSubmit.title = label;
1545
--- src/style.chat.css
+++ src/style.chat.css
@@ -357,11 +357,11 @@
357357
}
358358
body.chat #chat-config #chat-config-options {
359359
/* /chat config options go here */
360360
flex: 1 1 auto;
361361
display: flex;
362
- flex-direction: column-reverse;
362
+ flex-direction: column;
363363
overflow: auto;
364364
}
365365
body.chat #chat-config #chat-config-options .menu-entry {
366366
display: flex;
367367
align-items: baseline;
368368
--- src/style.chat.css
+++ src/style.chat.css
@@ -357,11 +357,11 @@
357 }
358 body.chat #chat-config #chat-config-options {
359 /* /chat config options go here */
360 flex: 1 1 auto;
361 display: flex;
362 flex-direction: column-reverse;
363 overflow: auto;
364 }
365 body.chat #chat-config #chat-config-options .menu-entry {
366 display: flex;
367 align-items: baseline;
368
--- src/style.chat.css
+++ src/style.chat.css
@@ -357,11 +357,11 @@
357 }
358 body.chat #chat-config #chat-config-options {
359 /* /chat config options go here */
360 flex: 1 1 auto;
361 display: flex;
362 flex-direction: column;
363 overflow: auto;
364 }
365 body.chat #chat-config #chat-config-options .menu-entry {
366 display: flex;
367 align-items: baseline;
368

Keyboard Shortcuts

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