577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
|
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
|
-
-
+
+
+
+
-
-
+
+
|
animate: function f(e,a,cb){
if(!f.$disabled){
D.addClassBriefly(e, a, 0, cb);
}
return this;
}
};
if(!D.attr(cs.e.inputField,'contenteditable','plaintext-only').isContentEditable){
/* Only the Chrome family supports contenteditable=plaintext-only,
if(D.attr(cs.e.inputField,'contenteditable','plaintext-only').isContentEditable){
cs.$browserHasPlaintextOnly = true;
}else{
/* Only the Chrome family supports contenteditable=plaintext-only */
but Chrome is the only engine for which we need this flag: */
D.attr(cs.e.inputField,'contenteditable','true');
cs.$browserHasPlaintextOnly = false;
D.attr(cs.e.inputField,'contenteditable','true');
}
cs.animate.$disabled = true;
F.fetch.beforesend = ()=>cs.ajaxStart();
F.fetch.aftersend = ()=>cs.ajaxEnd();
cs.pageTitleOrig = cs.e.pageTitle.innerText;
const qs = (e)=>document.querySelector(e);
const argsToArray = function(args){
|
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
|
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
|
+
+
+
+
+
-
-
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+
|
event.stopPropagation();
event.preventDefault(true);
return false;
}
/* else continue propagating */
};
document.addEventListener('paste', pasteListener, true);
if(window.Selection && window.Range && !Chat.$browserHasPlaintextOnly){
/* Acrobatics to keep *some* installations of Firefox
from pasting formatting into contenteditable fields.
This also works on Chrome, but chrome has the
contenteditable=plaintext-only property which does this
if(0){
const onPastePlainText = function(ev){
for us. */
Chat.inputElement().addEventListener(
'paste',
function(ev){
var pastedText = undefined;
if (window.clipboardData && window.clipboardData.getData) { // IE
pastedText = window.clipboardData.getData('Text');
}else if (ev.clipboardData && ev.clipboardData.getData) {
pastedText = ev.clipboardData.getData('text/plain');
if (ev.clipboardData && ev.clipboardData.getData) {
const pastedText = ev.clipboardData.getData('text/plain');
}
ev.target.textContent += pastedText;
ev.preventDefault();
return false;
const selection = window.getSelection();
if (!selection.rangeCount) return false;
selection.deleteFromDocument(/*remove selected content*/);
selection.getRangeAt(0).insertNode(document.createTextNode(pastedText));
selection.collapseToEnd(/*deselect pasted text and set cursor at the end*/);
ev.preventDefault();
return false;
};
Chat.e.inputField.addEventListener('paste', onPastePlainText, false);
}
}, false);
}
const noDragDropEvents = function(ev){
/* contenteditable tries to do its own thing with dropped data,
which is not compatible with how we use it, so... */
ev.dataTransfer.effectAllowed = 'none';
ev.dataTransfer.dropEffect = 'none';
ev.preventDefault();
|