Fossil SCM
Removed some dead code. Updated some docs.
Commit
cf789fa7e1ab0da7973ceea7109f4f057b3656a4e4ae921abba78bd503831f2b
Parent
02fa19aa996d44b…
1 file changed
+6
-6
+6
-6
| --- src/chat.js | ||
| +++ src/chat.js | ||
| @@ -24,13 +24,13 @@ | ||
| 24 | 24 | ImagePasteState.imgTag.removeAttribute('src'); |
| 25 | 25 | form.msg.value = ""; |
| 26 | 26 | form.file.value = ""; |
| 27 | 27 | form.msg.focus(); |
| 28 | 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. */ | |
| 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 | 32 | document.onpaste = function(event){ |
| 33 | 33 | const items = event.clipboardData.items, |
| 34 | 34 | item = items[0]; |
| 35 | 35 | if(!item || !item.type) return; |
| 36 | 36 | //console.debug("pasted item =",item); |
| @@ -97,25 +97,25 @@ | ||
| 97 | 97 | // Date doesn't work, so dumb it down... |
| 98 | 98 | D.append(this.e, this._timestamp," GMT"); |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | }); |
| 102 | - const hidePopup = ()=>f.popup.hide(); | |
| 103 | 102 | f.popup.installClickToHide(); |
| 104 | 103 | } |
| 105 | 104 | const rect = ev.target.getBoundingClientRect(); |
| 106 | 105 | f.popup._timestamp = ev.target.dataset.timestamp; |
| 107 | 106 | let x = rect.left, y = rect.top - 10; |
| 108 | 107 | f.popup.show(ev.target)/*so we can get its computed size*/; |
| 109 | - // Shift to the left for right-aligned messages | |
| 110 | 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 | 111 | const pRect = f.popup.e.getBoundingClientRect(); |
| 112 | 112 | x -= pRect.width/3*2; |
| 113 | 113 | } |
| 114 | 114 | f.popup.show(x, y); |
| 115 | 115 | }; |
| 116 | - | |
| 116 | + /** Callback for poll() to inject new content into the page. */ | |
| 117 | 117 | function newcontent(jx){ |
| 118 | 118 | var i; |
| 119 | 119 | for(i=0; i<jx.msgs.length; ++i){ |
| 120 | 120 | let m = jx.msgs[i]; |
| 121 | 121 | let row = document.createElement("fieldset"); |
| 122 | 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: 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 |