26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
form.file.value = "";
form.msg.focus();
});
/* Handle image paste from clipboard. TODO: confirm that we only
paste images here (silently ignore non-image data), or change the
related code to support non-image pasting/posting. */
document.onpaste = function(event){
const items = event.clipboardData.items;
ImagePasteState.blob = items[0].getAsFile();
const reader = new FileReader();
reader.onload = function(event){
ImagePasteState.imgTag.setAttribute('src', event.target.result);
};
reader.readAsDataURL(ImagePasteState.blob);
|
>
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
form.file.value = "";
form.msg.focus();
});
/* Handle image paste from clipboard. TODO: confirm that we only
paste images here (silently ignore non-image data), or change the
related code to support non-image pasting/posting. */
document.onpaste = function(event){
if(form.msg === event.target) return;
const items = event.clipboardData.items;
ImagePasteState.blob = items[0].getAsFile();
const reader = new FileReader();
reader.onload = function(event){
ImagePasteState.imgTag.setAttribute('src', event.target.result);
};
reader.readAsDataURL(ImagePasteState.blob);
|
175
176
177
178
179
180
181
182
183
184
185
186
|
}
async function poll(){
if(poll.running) return;
poll.running = true;
fetch("chat-poll/" + mxMsg)
.then(x=>x.json())
.then(y=>newcontent(y))
.finally(()=>poll.running=false)
}
poll();
setInterval(poll, 1000);
})();
|
>
|
176
177
178
179
180
181
182
183
184
185
186
187
188
|
}
async function poll(){
if(poll.running) return;
poll.running = true;
fetch("chat-poll/" + mxMsg)
.then(x=>x.json())
.then(y=>newcontent(y))
.catch(e=>console.error(e))
.finally(()=>poll.running=false)
}
poll();
setInterval(poll, 1000);
})();
|