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".

stephan 2021-10-05 18:43 trunk
Commit fe0bcfaad1aed7d44a69541bb3d6f3f2e73046099eb042231f71e92377db960c
1 file changed +22 -6
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -997,18 +997,33 @@
997997
self.hide();
998998
Chat.deleteMessage(eMsg);
999999
}
10001000
});
10011001
}
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
+ ));
10021018
const toolbar2 = D.addClass(D.div(), 'toolbar');
10031019
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
+ }));
10101025
if(eMsg.dataset.xfrom){
10111026
/* Add a link to the /timeline filtered on this user. */
10121027
const timelineLink = D.attr(
10131028
D.a(F.repoUrl('timeline',{
10141029
u: eMsg.dataset.xfrom,
@@ -1815,8 +1830,9 @@
18151830
e.addEventListener('click',flip, false);
18161831
});
18171832
}
18181833
delete ForceResizeKludge.$disabled;
18191834
ForceResizeKludge();
1835
+ Chat.animate.$disabled = false;
18201836
setTimeout( ()=>Chat.inputFocus(), 0 );
18211837
F.page.chat = Chat/* enables testing the APIs via the dev tools */;
18221838
});
18231839
--- 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

Keyboard Shortcuts

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