Fossil SCM
/chat: re-added accidentally-disabled animation. Added a button to locally delete all messages prior to the current one in the per-message controls. The intent is to stop unbounded growth (and potential lag) in long-running chats and give the user to way to flag "have read up until this point".
Commit
fe0bcfaad1aed7d44a69541bb3d6f3f2e73046099eb042231f71e92377db960c
Parent
84d4a0e85172927…
1 file changed
+22
-6
+22
-6
| --- src/fossil.page.chat.js | ||
| +++ src/fossil.page.chat.js | ||
| @@ -997,18 +997,33 @@ | ||
| 997 | 997 | self.hide(); |
| 998 | 998 | Chat.deleteMessage(eMsg); |
| 999 | 999 | } |
| 1000 | 1000 | }); |
| 1001 | 1001 | } |
| 1002 | + const toolbar3 = D.addClass(D.div(), 'toolbar'); | |
| 1003 | + D.append(this.e, toolbar3); | |
| 1004 | + D.append(toolbar3, D.button( | |
| 1005 | + "Locally remove all previous messages", | |
| 1006 | + function(){ | |
| 1007 | + self.hide(); | |
| 1008 | + Chat.mnMsg = +eMsg.dataset.msgid; | |
| 1009 | + var e = eMsg.previousElementSibling; | |
| 1010 | + while(e && e.classList.contains('message-widget')){ | |
| 1011 | + const n = e.previousElementSibling; | |
| 1012 | + D.remove(e); | |
| 1013 | + e = n; | |
| 1014 | + } | |
| 1015 | + eMsg.scrollIntoView(); | |
| 1016 | + } | |
| 1017 | + )); | |
| 1002 | 1018 | const toolbar2 = D.addClass(D.div(), 'toolbar'); |
| 1003 | 1019 | D.append(this.e, toolbar2); |
| 1004 | - const btnToggleText = D.button("Toggle text mode"); | |
| 1005 | - btnToggleText.addEventListener('click', function(){ | |
| 1006 | - self.hide(); | |
| 1007 | - Chat.toggleTextMode(eMsg); | |
| 1008 | - },false); | |
| 1009 | - D.append(toolbar2, btnToggleText); | |
| 1020 | + D.append(toolbar2, D.button( | |
| 1021 | + "Toggle text mode", function(){ | |
| 1022 | + self.hide(); | |
| 1023 | + Chat.toggleTextMode(eMsg); | |
| 1024 | + })); | |
| 1010 | 1025 | if(eMsg.dataset.xfrom){ |
| 1011 | 1026 | /* Add a link to the /timeline filtered on this user. */ |
| 1012 | 1027 | const timelineLink = D.attr( |
| 1013 | 1028 | D.a(F.repoUrl('timeline',{ |
| 1014 | 1029 | u: eMsg.dataset.xfrom, |
| @@ -1815,8 +1830,9 @@ | ||
| 1815 | 1830 | e.addEventListener('click',flip, false); |
| 1816 | 1831 | }); |
| 1817 | 1832 | } |
| 1818 | 1833 | delete ForceResizeKludge.$disabled; |
| 1819 | 1834 | ForceResizeKludge(); |
| 1835 | + Chat.animate.$disabled = false; | |
| 1820 | 1836 | setTimeout( ()=>Chat.inputFocus(), 0 ); |
| 1821 | 1837 | F.page.chat = Chat/* enables testing the APIs via the dev tools */; |
| 1822 | 1838 | }); |
| 1823 | 1839 |
| --- src/fossil.page.chat.js | |
| +++ src/fossil.page.chat.js | |
| @@ -997,18 +997,33 @@ | |
| 997 | self.hide(); |
| 998 | Chat.deleteMessage(eMsg); |
| 999 | } |
| 1000 | }); |
| 1001 | } |
| 1002 | const toolbar2 = D.addClass(D.div(), 'toolbar'); |
| 1003 | D.append(this.e, toolbar2); |
| 1004 | const btnToggleText = D.button("Toggle text mode"); |
| 1005 | btnToggleText.addEventListener('click', function(){ |
| 1006 | self.hide(); |
| 1007 | Chat.toggleTextMode(eMsg); |
| 1008 | },false); |
| 1009 | D.append(toolbar2, btnToggleText); |
| 1010 | if(eMsg.dataset.xfrom){ |
| 1011 | /* Add a link to the /timeline filtered on this user. */ |
| 1012 | const timelineLink = D.attr( |
| 1013 | D.a(F.repoUrl('timeline',{ |
| 1014 | u: eMsg.dataset.xfrom, |
| @@ -1815,8 +1830,9 @@ | |
| 1815 | e.addEventListener('click',flip, false); |
| 1816 | }); |
| 1817 | } |
| 1818 | delete ForceResizeKludge.$disabled; |
| 1819 | ForceResizeKludge(); |
| 1820 | setTimeout( ()=>Chat.inputFocus(), 0 ); |
| 1821 | F.page.chat = Chat/* enables testing the APIs via the dev tools */; |
| 1822 | }); |
| 1823 |
| --- src/fossil.page.chat.js | |
| +++ src/fossil.page.chat.js | |
| @@ -997,18 +997,33 @@ | |
| 997 | self.hide(); |
| 998 | Chat.deleteMessage(eMsg); |
| 999 | } |
| 1000 | }); |
| 1001 | } |
| 1002 | const toolbar3 = D.addClass(D.div(), 'toolbar'); |
| 1003 | D.append(this.e, toolbar3); |
| 1004 | D.append(toolbar3, D.button( |
| 1005 | "Locally remove all previous messages", |
| 1006 | function(){ |
| 1007 | self.hide(); |
| 1008 | Chat.mnMsg = +eMsg.dataset.msgid; |
| 1009 | var e = eMsg.previousElementSibling; |
| 1010 | while(e && e.classList.contains('message-widget')){ |
| 1011 | const n = e.previousElementSibling; |
| 1012 | D.remove(e); |
| 1013 | e = n; |
| 1014 | } |
| 1015 | eMsg.scrollIntoView(); |
| 1016 | } |
| 1017 | )); |
| 1018 | const toolbar2 = D.addClass(D.div(), 'toolbar'); |
| 1019 | D.append(this.e, toolbar2); |
| 1020 | D.append(toolbar2, D.button( |
| 1021 | "Toggle text mode", function(){ |
| 1022 | self.hide(); |
| 1023 | Chat.toggleTextMode(eMsg); |
| 1024 | })); |
| 1025 | if(eMsg.dataset.xfrom){ |
| 1026 | /* Add a link to the /timeline filtered on this user. */ |
| 1027 | const timelineLink = D.attr( |
| 1028 | D.a(F.repoUrl('timeline',{ |
| 1029 | u: eMsg.dataset.xfrom, |
| @@ -1815,8 +1830,9 @@ | |
| 1830 | e.addEventListener('click',flip, false); |
| 1831 | }); |
| 1832 | } |
| 1833 | delete ForceResizeKludge.$disabled; |
| 1834 | ForceResizeKludge(); |
| 1835 | Chat.animate.$disabled = false; |
| 1836 | setTimeout( ()=>Chat.inputFocus(), 0 ); |
| 1837 | F.page.chat = Chat/* enables testing the APIs via the dev tools */; |
| 1838 | }); |
| 1839 |