| | @@ -1413,10 +1413,17 @@ |
| 1413 | 1413 | passed to the callback is a settings object in the form {key:K, |
| 1414 | 1414 | value:V}. If this object does not have boolValue string or |
| 1415 | 1415 | persistentSetting then the callback is passed an event object |
| 1416 | 1416 | in response to the config option's UI widget being activated, |
| 1417 | 1417 | normally a 'change' event. |
| 1418 | + |
| 1419 | + children: [array of settings objects]. These get listed under |
| 1420 | + this element and indented slightly for visual grouping. Only |
| 1421 | + one level of indention is supported. |
| 1422 | + |
| 1423 | + Elements which only have a label and maybe a hint and |
| 1424 | + children can be used as headings. |
| 1418 | 1425 | |
| 1419 | 1426 | If a setting has a boolValue set, that gets rendered as a |
| 1420 | 1427 | checkbox which toggles the given persistent setting (if |
| 1421 | 1428 | boolValue is a string) AND listens for changes to that setting |
| 1422 | 1429 | fired via Chat.settings.set() so that the checkbox can stay in |
| | @@ -1469,16 +1476,10 @@ |
| 1469 | 1476 | } |
| 1470 | 1477 | },{ |
| 1471 | 1478 | label: "Show images inline", |
| 1472 | 1479 | hint: "Show attached images inline or as a download link.", |
| 1473 | 1480 | boolValue: 'images-inline' |
| 1474 | | - }, |
| 1475 | | - namedOptions.activeUsers, |
| 1476 | | - { |
| 1477 | | - label: "Timestamps in active users list", |
| 1478 | | - hint: "Show most recent message timestamps in the active user list.", |
| 1479 | | - boolValue: 'active-user-list-timestamps' |
| 1480 | 1481 | },{ |
| 1481 | 1482 | label: "Use 'contenteditable' editing mode.", |
| 1482 | 1483 | boolValue: 'edit-widget-x', |
| 1483 | 1484 | hint: [ |
| 1484 | 1485 | "When enabled, chat input uses a so-called 'contenteditable' ", |
| | @@ -1507,34 +1508,49 @@ |
| 1507 | 1508 | } |
| 1508 | 1509 | } |
| 1509 | 1510 | Chat.setNewMessageSound(selectSound.value); |
| 1510 | 1511 | settingsOps.push({ |
| 1511 | 1512 | label: "Sound Options...", |
| 1512 | | - hint: "How to enable audio playback is browser-specific!" |
| 1513 | | - },{ |
| 1514 | | - hint: "Audio alert", |
| 1515 | | - select: selectSound, |
| 1516 | | - callback: function(ev){ |
| 1517 | | - const v = ev.target.value; |
| 1518 | | - Chat.setNewMessageSound(v); |
| 1519 | | - F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+"."); |
| 1520 | | - if(v) setTimeout(()=>Chat.playNewMessageSound(), 0); |
| 1521 | | - } |
| 1513 | + hint: "How to enable audio playback is browser-specific!", |
| 1514 | + children:[{ |
| 1515 | + hint: "Audio alert", |
| 1516 | + select: selectSound, |
| 1517 | + callback: function(ev){ |
| 1518 | + const v = ev.target.value; |
| 1519 | + Chat.setNewMessageSound(v); |
| 1520 | + F.toast.message("Audio notifications "+(v ? "enabled" : "disabled")+"."); |
| 1521 | + if(v) setTimeout(()=>Chat.playNewMessageSound(), 0); |
| 1522 | + } |
| 1523 | + },{ |
| 1524 | + label: "Play notification for your own messages.", |
| 1525 | + hint: "When enabled, the audio notification will be played for all messages, "+ |
| 1526 | + "including your own. When disabled only messages from other users "+ |
| 1527 | + "will trigger a notification.", |
| 1528 | + boolValue: 'alert-own-messages' |
| 1529 | + }] |
| 1522 | 1530 | }); |
| 1523 | 1531 | }/*audio notification config*/ |
| 1524 | 1532 | settingsOps.push({ |
| 1525 | | - label: "Play notification for your own messages.", |
| 1526 | | - hint: "When enabled, the audio notification will be played for all messages, "+ |
| 1527 | | - "including your own. When disabled only messages from other users "+ |
| 1528 | | - "will trigger a notification.", |
| 1529 | | - boolValue: 'alert-own-messages' |
| 1533 | + label: "Active User List", |
| 1534 | + hint: [ |
| 1535 | + "/chat cannot track active connections, but it can tell ", |
| 1536 | + "you who has posted recently..."].join(''), |
| 1537 | + children:[ |
| 1538 | + namedOptions.activeUsers,{ |
| 1539 | + label: "Timestamps in active users list", |
| 1540 | + indent: true, |
| 1541 | + hint: "Show most recent message timestamps in the active user list.", |
| 1542 | + boolValue: 'active-user-list-timestamps' |
| 1543 | + } |
| 1544 | + ] |
| 1530 | 1545 | }); |
| 1531 | 1546 | /** |
| 1532 | 1547 | Build UI for config options... |
| 1533 | 1548 | */ |
| 1534 | | - settingsOps.forEach(function f(op){ |
| 1549 | + settingsOps.forEach(function f(op,indentOrIndex){ |
| 1535 | 1550 | const line = D.addClass(D.div(), 'menu-entry'); |
| 1551 | + if(true===indentOrIndex) D.addClass(line, 'indent'); |
| 1536 | 1552 | const label = op.label |
| 1537 | 1553 | ? D.append(D.label(),op.label) : undefined; |
| 1538 | 1554 | const labelWrapper = D.addClass(D.div(), 'label-wrapper'); |
| 1539 | 1555 | var hint; |
| 1540 | 1556 | if(op.hint){ |
| | @@ -1598,10 +1614,11 @@ |
| 1598 | 1614 | }, false); |
| 1599 | 1615 | } |
| 1600 | 1616 | }else if(op.callback && op.checkbox){ |
| 1601 | 1617 | op.checkbox.addEventListener('change', (ev)=>op.callback(ev), false); |
| 1602 | 1618 | } |
| 1619 | + if(op.children) op.children.forEach((x)=>f(x,true)); |
| 1603 | 1620 | }); |
| 1604 | 1621 | })()/*#chat-button-settings setup*/; |
| 1605 | 1622 | |
| 1606 | 1623 | (function(){ |
| 1607 | 1624 | /* Install default settings... must come after |
| 1608 | 1625 | |