Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | /chat: added client-local day-of-week to the message time strings. Y-M-D seems awful noisy, per chat room consensus, but we also have code for that if we decide otherwise. A couple code-adjacent internal cleanups. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
65be323110e9b1cb03aa8ce73b817352 |
User & Date: | stephan 2021-02-07 09:56:41 |
Context
2021-02-07
| ||
13:02 | Typo fix in alerts config page. ... (check-in: 391eb1cefb user: stephan tags: trunk) | |
09:56 | /chat: added client-local day-of-week to the message time strings. Y-M-D seems awful noisy, per chat room consensus, but we also have code for that if we decide otherwise. A couple code-adjacent internal cleanups. ... (check-in: 65be323110 user: stephan tags: trunk) | |
2021-02-06
| ||
23:35 | Add /opt/homebrew/opt/openssl to the list of directories checked for the OpenSSL library by the configure script. See [forum:/forumpost/9496e81a51|forum post 9496e81a51]. ... (check-in: 17af40efff user: drh tags: trunk) | |
Changes
Changes to src/chat.js.
︙ | ︙ | |||
582 583 584 585 586 587 588 589 | }; D.append(this.e.body, this.e.tab, this.e.content); this.e.tab.setAttribute('role', 'button'); if(arguments.length){ this.setMessage(arguments[0]); } }; const theTime = function(d){ | > > > > > > > > > > > > > | | > | > > > > > > > > > > > | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | }; D.append(this.e.body, this.e.tab, this.e.content); this.e.tab.setAttribute('role', 'button'); if(arguments.length){ this.setMessage(arguments[0]); } }; /* Left-zero-pad a number to at least 2 digits */ const pad2 = (x)=>(''+x).length>1 ? x : '0'+x; const dowMap = { /* Map of Date.getDay() values to weekday names. */ 0: "Sunday", 1: "Monday", 2: "Tuesday", 3: "Wednesday", 4: "Thursday", 5: "Friday", 6: "Saturday" }; /* Given a Date, returns the timestamp string used in the "tab" part of message widgets. */ const theTime = function(d){ return [ //d.getFullYear(),'-',pad2(d.getMonth()+1/*sigh*/), //'-',pad2(d.getDate()), ' ', d.getHours(),":", (d.getMinutes()+100).toString().slice(1,3), ' ', dowMap[d.getDay()] ].join(''); }; /** Returns the local time string of Date object d, defaulting to the current time. */ const localTimeString = function ff(d){ d || (d = new Date()); return [ d.getFullYear(),'-',pad2(d.getMonth()+1/*sigh*/), '-',pad2(d.getDate()), ' ',pad2(d.getHours()),':',pad2(d.getMinutes()), ':',pad2(d.getSeconds()) ].join(''); }; cf.prototype = { setLabel: function(label){ return this; }, scrollIntoView: function(){ this.e.content.scrollIntoView(); |
︙ | ︙ | |||
694 695 696 697 698 699 700 701 702 703 704 705 706 707 | if(eMsg.dataset.lmtime && xfrom!==Chat.me){ D.append(this.e, D.append(D.span(), localTime8601( new Date(eMsg.dataset.lmtime) ).replace('T',' ')," ",xfrom," time")); } }else{ // Date doesn't work, so dumb it down... D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," zulu")); } const toolbar = D.addClass(D.div(), 'toolbar'); D.append(this.e, toolbar); const btnDeleteLocal = D.button("Delete locally"); D.append(toolbar, btnDeleteLocal); | > > > > > | 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | if(eMsg.dataset.lmtime && xfrom!==Chat.me){ D.append(this.e, D.append(D.span(), localTime8601( new Date(eMsg.dataset.lmtime) ).replace('T',' ')," ",xfrom," time")); } }else{ /* This might not be necessary any more: it was initially caused by Safari being stricter than other browsers on its time string input, and that has since been resolved by emiting a stricter format. */ // Date doesn't work, so dumb it down... D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," zulu")); } const toolbar = D.addClass(D.div(), 'toolbar'); D.append(this.e, toolbar); const btnDeleteLocal = D.button("Delete locally"); D.append(toolbar, btnDeleteLocal); |
︙ | ︙ | |||
889 890 891 892 893 894 895 | }, false); Chat.e.btnSubmit.addEventListener('click',(e)=>{ e.preventDefault(); Chat.submitMessage(); return false; }); | < < < < < < < < < < < < < < < | 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | }, false); Chat.e.btnSubmit.addEventListener('click',(e)=>{ e.preventDefault(); Chat.submitMessage(); return false; }); /* Returns an almost-ISO8601 form of Date object d. */ const iso8601ish = function(d){ return d.toISOString() .replace('T',' ').replace(/\.\d+/,'').replace('Z', ' zulu'); }; (function(){/*Set up #chat-settings-button */ |
︙ | ︙ |