Fossil SCM

Removed some dead code. Updated some docs.

stephan 2020-12-23 08:43 UTC chatroom-dev
Commit cf789fa7e1ab0da7973ceea7109f4f057b3656a4e4ae921abba78bd503831f2b
1 file changed +6 -6
+6 -6
--- src/chat.js
+++ src/chat.js
@@ -24,13 +24,13 @@
2424
ImagePasteState.imgTag.removeAttribute('src');
2525
form.msg.value = "";
2626
form.file.value = "";
2727
form.msg.focus();
2828
});
29
- /* Handle image paste from clipboard. TODO: confirm that we only
30
- paste images here (silently ignore non-image data), or change the
31
- related code to support non-image pasting/posting. */
29
+ /* Handle image paste from clipboard. TODO: figure out how we can
30
+ paste non-image binary data as if it had been selected via the
31
+ file selection element. */
3232
document.onpaste = function(event){
3333
const items = event.clipboardData.items,
3434
item = items[0];
3535
if(!item || !item.type) return;
3636
//console.debug("pasted item =",item);
@@ -97,25 +97,25 @@
9797
// Date doesn't work, so dumb it down...
9898
D.append(this.e, this._timestamp," GMT");
9999
}
100100
}
101101
});
102
- const hidePopup = ()=>f.popup.hide();
103102
f.popup.installClickToHide();
104103
}
105104
const rect = ev.target.getBoundingClientRect();
106105
f.popup._timestamp = ev.target.dataset.timestamp;
107106
let x = rect.left, y = rect.top - 10;
108107
f.popup.show(ev.target)/*so we can get its computed size*/;
109
- // Shift to the left for right-aligned messages
110108
if('right'===ev.target.getAttribute('align')){
109
+ // Shift popup to the left for right-aligned messages to avoid
110
+ // truncation off the right edge of the page.
111111
const pRect = f.popup.e.getBoundingClientRect();
112112
x -= pRect.width/3*2;
113113
}
114114
f.popup.show(x, y);
115115
};
116
-
116
+ /** Callback for poll() to inject new content into the page. */
117117
function newcontent(jx){
118118
var i;
119119
for(i=0; i<jx.msgs.length; ++i){
120120
let m = jx.msgs[i];
121121
let row = document.createElement("fieldset");
122122
--- src/chat.js
+++ src/chat.js
@@ -24,13 +24,13 @@
24 ImagePasteState.imgTag.removeAttribute('src');
25 form.msg.value = "";
26 form.file.value = "";
27 form.msg.focus();
28 });
29 /* Handle image paste from clipboard. TODO: confirm that we only
30 paste images here (silently ignore non-image data), or change the
31 related code to support non-image pasting/posting. */
32 document.onpaste = function(event){
33 const items = event.clipboardData.items,
34 item = items[0];
35 if(!item || !item.type) return;
36 //console.debug("pasted item =",item);
@@ -97,25 +97,25 @@
97 // Date doesn't work, so dumb it down...
98 D.append(this.e, this._timestamp," GMT");
99 }
100 }
101 });
102 const hidePopup = ()=>f.popup.hide();
103 f.popup.installClickToHide();
104 }
105 const rect = ev.target.getBoundingClientRect();
106 f.popup._timestamp = ev.target.dataset.timestamp;
107 let x = rect.left, y = rect.top - 10;
108 f.popup.show(ev.target)/*so we can get its computed size*/;
109 // Shift to the left for right-aligned messages
110 if('right'===ev.target.getAttribute('align')){
 
 
111 const pRect = f.popup.e.getBoundingClientRect();
112 x -= pRect.width/3*2;
113 }
114 f.popup.show(x, y);
115 };
116
117 function newcontent(jx){
118 var i;
119 for(i=0; i<jx.msgs.length; ++i){
120 let m = jx.msgs[i];
121 let row = document.createElement("fieldset");
122
--- src/chat.js
+++ src/chat.js
@@ -24,13 +24,13 @@
24 ImagePasteState.imgTag.removeAttribute('src');
25 form.msg.value = "";
26 form.file.value = "";
27 form.msg.focus();
28 });
29 /* Handle image paste from clipboard. TODO: figure out how we can
30 paste non-image binary data as if it had been selected via the
31 file selection element. */
32 document.onpaste = function(event){
33 const items = event.clipboardData.items,
34 item = items[0];
35 if(!item || !item.type) return;
36 //console.debug("pasted item =",item);
@@ -97,25 +97,25 @@
97 // Date doesn't work, so dumb it down...
98 D.append(this.e, this._timestamp," GMT");
99 }
100 }
101 });
 
102 f.popup.installClickToHide();
103 }
104 const rect = ev.target.getBoundingClientRect();
105 f.popup._timestamp = ev.target.dataset.timestamp;
106 let x = rect.left, y = rect.top - 10;
107 f.popup.show(ev.target)/*so we can get its computed size*/;
 
108 if('right'===ev.target.getAttribute('align')){
109 // Shift popup to the left for right-aligned messages to avoid
110 // truncation off the right edge of the page.
111 const pRect = f.popup.e.getBoundingClientRect();
112 x -= pRect.width/3*2;
113 }
114 f.popup.show(x, y);
115 };
116 /** Callback for poll() to inject new content into the page. */
117 function newcontent(jx){
118 var i;
119 for(i=0; i<jx.msgs.length; ++i){
120 let m = jx.msgs[i];
121 let row = document.createElement("fieldset");
122

Keyboard Shortcuts

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