Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | When chat is in chat-only mode, the input area is now sticky at the top of the window. This required a bit of hackery involving its background color to keep it from being transparent (which causes the chat messages to be visible through it). |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
429e5a9bdece22026c007b61a552c5d6 |
| User & Date: | stephan 2020-12-25 13:00:49.495 |
Context
|
2020-12-25
| ||
| 14:36 | In the default skin, add a Chat menu item for wide screens if Chat is enabled for the user. ... (check-in: 8049da83c4 user: drh tags: trunk) | |
| 13:00 | When chat is in chat-only mode, the input area is now sticky at the top of the window. This required a bit of hackery involving its background color to keep it from being transparent (which causes the chat messages to be visible through it). ... (check-in: 429e5a9bde user: stephan tags: trunk) | |
| 12:09 | Change /chat-poll so that it times out after 7 minutes. This prevents the server from timing out the request and generating errors in the log. ... (check-in: 08533f9095 user: drh tags: trunk) | |
Changes
Changes to src/chat.js.
| ︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
};
const Chat = (function(){
const cs = {
e:{/*map of certain DOM elements.*/
messageInjectPoint: E1('#message-inject-point'),
pageTitle: E1('head title'),
loadToolbar: undefined /* the load-posts toolbar (dynamically created) */,
messagesWrapper: E1('#chat-messages-wrapper')
},
me: F.user.name,
mxMsg: F.config.chatInitSize ? -F.config.chatInitSize : -50,
mnMsg: undefined/*lowest message ID we've seen so far (for history loading)*/,
pageIsActive: 'visible'===document.visibilityState,
changesSincePageHidden: 0,
| > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
};
const Chat = (function(){
const cs = {
e:{/*map of certain DOM elements.*/
messageInjectPoint: E1('#message-inject-point'),
pageTitle: E1('head title'),
loadToolbar: undefined /* the load-posts toolbar (dynamically created) */,
inputWrapper: E1("#chat-input-area"),
messagesWrapper: E1('#chat-messages-wrapper')
},
me: F.user.name,
mxMsg: F.config.chatInitSize ? -F.config.chatInitSize : -50,
mnMsg: undefined/*lowest message ID we've seen so far (for history loading)*/,
pageIsActive: 'visible'===document.visibilityState,
changesSincePageHidden: 0,
|
| ︙ | ︙ | |||
321 322 323 324 325 326 327 |
}
const toolbar = D.addClass(D.div(), 'toolbar');
D.append(this.e, toolbar);
const btnDeleteLocal = D.button("Delete locally");
D.append(toolbar, btnDeleteLocal);
const self = this;
btnDeleteLocal.addEventListener('click', function(){
| < < | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
}
const toolbar = D.addClass(D.div(), 'toolbar');
D.append(this.e, toolbar);
const btnDeleteLocal = D.button("Delete locally");
D.append(toolbar, btnDeleteLocal);
const self = this;
btnDeleteLocal.addEventListener('click', function(){
self.hide();
Chat.deleteMessageElem(eMsg);
});
if(Chat.userMayDelete(eMsg)){
const btnDeleteGlobal = D.button("Delete globally");
D.append(toolbar, btnDeleteGlobal);
btnDeleteGlobal.addEventListener('click', function(){
self.hide();
Chat.deleteMessage(eMsg);
});
}
}/*refresh()*/
});
f.popup.installClickToHide();
|
| ︙ | ︙ | |||
382 383 384 385 386 387 388 389 |
f.elemsToToggle = [];
document.body.childNodes.forEach(function(e){
if(!e.classList) return/*TEXT nodes and such*/;
else if(!e.classList.contains('content')){
f.elemsToToggle.push(e);
}
});
}
| > > > > > > > > > > > > > > > > | | | > | | > < | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
f.elemsToToggle = [];
document.body.childNodes.forEach(function(e){
if(!e.classList) return/*TEXT nodes and such*/;
else if(!e.classList.contains('content')){
f.elemsToToggle.push(e);
}
});
/* In order to make the input area opaque, such that the
message list scrolls under it without being visible, we
have to ensure that the input area has a non-inherited
background color. Ideally we'd select the color of
div.content, but that is not necessarily set, so we fall
back to using the body's background color. If we rely on
the input area having its own color specified in CSS then
all skins would have to define an appropriate color.
Thus our selection of the body color, while slightly unfortunate,
is in the interest of keeping skins from being forced to
define an opaque bg color.
*/
f.initialBg = Chat.e.messagesWrapper.style.backgroundColor;
const cs = window.getComputedStyle(document.body);
f.inheritedBg = cs.backgroundColor;
}
const cs = Chat.e.inputWrapper.style;
if((f.isHidden = !f.isHidden)){
D.addClass(f.elemsToToggle, 'hidden');
D.addClass(document.body, 'chat-only-mode');
cs.backgroundColor = f.inheritedBg;
}else{
D.removeClass(f.elemsToToggle, 'hidden');
D.removeClass(document.body, 'chat-only-mode');
cs.backgroundColor = f.initialBg;
}
}
},{
label: "Toggle left/right layout",
callback: function f(){
if('right'===Chat.msgMyAlign) Chat.msgMyAlign = 'left';
else Chat.msgMyAlign = 'right';
const msgs = Chat.e.messagesWrapper.querySelectorAll('.message-row');
|
| ︙ | ︙ |
Changes to src/default.css.
| ︙ | ︙ | |||
1265 1266 1267 1268 1269 1270 1271 |
}
.fossil-toast-message {
/* "toast"-style popup message.
See fossil.popupwidget:toast() */
position: absolute;
display: block;
| | | 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 |
}
.fossil-toast-message {
/* "toast"-style popup message.
See fossil.popupwidget:toast() */
position: absolute;
display: block;
z-index: 1001;
text-align: left;
padding: 0.15em 0.5em;
margin: 0;
font-size: 1em;
border-width: 1px;
border-style: solid;
border-color: rgba( 127, 127, 127, 0.75 );
|
| ︙ | ︙ | |||
1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 |
font-size: 0.8em;
text-align: left;
opacity: 0.8;
display: flex;
flex-direction: column;
align-items: stretch;
padding: 0.25em;
}
body.chat .chat-message-popup > span { white-space: nowrap; }
body.chat .chat-message-popup > .toolbar {
padding: 0.2em;
margin: 0;
border: 2px inset rgba(0,0,0,0.3);
border-radius: 0.25em;
| > | 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 |
font-size: 0.8em;
text-align: left;
opacity: 0.8;
display: flex;
flex-direction: column;
align-items: stretch;
padding: 0.25em;
z-index: 200;
}
body.chat .chat-message-popup > span { white-space: nowrap; }
body.chat .chat-message-popup > .toolbar {
padding: 0.2em;
margin: 0;
border: 2px inset rgba(0,0,0,0.3);
border-radius: 0.25em;
|
| ︙ | ︙ | |||
1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 |
body.chat .chat-settings-popup {
font-size: 0.8em;
text-align: left;
display: flex;
flex-direction: column;
align-items: stretch;
padding: 0.25em;
}
body.chat .chat-settings-popup > span {
margin: 0.25em 0.2em;
padding: 0.5em;
white-space: nowrap;
cursor: pointer;
border: 1px outset;
| > | 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 |
body.chat .chat-settings-popup {
font-size: 0.8em;
text-align: left;
display: flex;
flex-direction: column;
align-items: stretch;
padding: 0.25em;
z-index: 200;
}
body.chat .chat-settings-popup > span {
margin: 0.25em 0.2em;
padding: 0.5em;
white-space: nowrap;
cursor: pointer;
border: 1px outset;
|
| ︙ | ︙ | |||
1599 1600 1601 1602 1603 1604 1605 |
}
body.chat.chat-only-mode #chat-input-area {
/* would like to pin this to the top so that it stays in place when
scrolling, but doing so causes #chat-messages-wrapper to scroll
behind it visibly, which is really ugly. Only current workaround is
to force an opaque background color on this element, but that's not
skin-friendly. */
| | | > > > > > > > > | 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 |
}
body.chat.chat-only-mode #chat-input-area {
/* would like to pin this to the top so that it stays in place when
scrolling, but doing so causes #chat-messages-wrapper to scroll
behind it visibly, which is really ugly. Only current workaround is
to force an opaque background color on this element, but that's not
skin-friendly. */
position: sticky;
top: 0;
left: 0;
padding: 0.5em 1em;
z-index: 100
/* see notes in #chat-messages-wrapper. The various popups require a
z-index higher than this one. */
}
body.chat.chat-only-mode #chat-messages-wrapper {
position: relative;
top: 0;
z-index: 99 /* so that it scrolls under input area. If it's
lower than div.content then mouse events to it
are blocked!*/;
}
body.chat #chat-input-area {
display: flex;
flex-direction: column;
border-bottom: 1px solid black;
margin-bottom: 0.5em;
|
| ︙ | ︙ |