solid-ui 2.4.26-029ae1f9 → 2.4.26-30b05927
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +932 -1546
- package/dist/main.js.map +1 -1
- package/lib/chat/bookmarks.js +7 -6
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +61 -227
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/infinite.js +408 -585
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +158 -286
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +271 -423
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +144 -166
- package/lib/chat/thread.js.map +1 -1
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +11 -9
- package/lib/login/login.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/package.json +1 -2
package/lib/chat/infinite.js
CHANGED
|
@@ -20,9 +20,19 @@ var _chatLogic = require("./chatLogic");
|
|
|
20
20
|
var _message = require("./message");
|
|
21
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Contains the [[infiniteMessageArea]] class
|
|
25
|
+
* @packageDocumentation
|
|
26
|
+
*/
|
|
27
|
+
// import { findBookmarkDocument } from './bookmarks'
|
|
28
|
+
// pull in first avoid cross-refs
|
|
29
|
+
|
|
30
|
+
// import * as style from '../style'
|
|
31
|
+
// import * as utils from '../utils'
|
|
32
|
+
|
|
33
|
+
// import * as pad from '../pad'
|
|
34
|
+
// import { DateFolder } from './dateFolder'
|
|
35
|
+
|
|
26
36
|
// const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
|
|
27
37
|
|
|
28
38
|
function desktopNotification(str) {
|
|
@@ -50,9 +60,34 @@ function desktopNotification(str) {
|
|
|
50
60
|
/**
|
|
51
61
|
* Renders a chat message inside a `messageTable`
|
|
52
62
|
*/
|
|
53
|
-
function insertMessageIntoTable(
|
|
54
|
-
|
|
63
|
+
function insertMessageIntoTable(channelObject, messageTable, message, fresh, options, userContext) {
|
|
64
|
+
var messageRow = (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext);
|
|
65
|
+
|
|
66
|
+
// const message = messageRow.AJAR_subject
|
|
67
|
+
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
68
|
+
messageRow.style.backgroundColor = 'yellow';
|
|
69
|
+
options.selectedElement = messageRow;
|
|
70
|
+
messageTable.selectedElement = messageRow;
|
|
71
|
+
}
|
|
72
|
+
var done = false;
|
|
73
|
+
for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
|
|
74
|
+
if (!ele) {
|
|
75
|
+
// empty
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
var newestFirst = options.newestfirst === true;
|
|
79
|
+
var dateString = messageRow.AJAR_date;
|
|
80
|
+
if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
|
|
81
|
+
messageTable.insertBefore(messageRow, ele);
|
|
82
|
+
done = true;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!done) {
|
|
87
|
+
messageTable.appendChild(messageRow);
|
|
88
|
+
}
|
|
55
89
|
}
|
|
90
|
+
|
|
56
91
|
/**
|
|
57
92
|
* Common code for a chat (discussion area of messages about something)
|
|
58
93
|
* This version runs over a series of files for different time periods
|
|
@@ -75,70 +110,20 @@ function insertMessageIntoTable(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
|
75
110
|
- inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
|
|
76
111
|
|
|
77
112
|
*/
|
|
78
|
-
function
|
|
79
|
-
_insertMessageIntoTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(channelObject, messageTable, message, fresh, options, userContext) {
|
|
80
|
-
var messageRow, done, ele, newestFirst, dateString;
|
|
81
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
82
|
-
while (1) switch (_context.prev = _context.next) {
|
|
83
|
-
case 0:
|
|
84
|
-
_context.next = 2;
|
|
85
|
-
return (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext);
|
|
86
|
-
case 2:
|
|
87
|
-
messageRow = _context.sent;
|
|
88
|
-
// const message = messageRow.AJAR_subject
|
|
89
|
-
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
90
|
-
messageRow.style.backgroundColor = 'yellow';
|
|
91
|
-
options.selectedElement = messageRow;
|
|
92
|
-
messageTable.selectedElement = messageRow;
|
|
93
|
-
}
|
|
94
|
-
done = false;
|
|
95
|
-
ele = messageTable.firstChild;
|
|
96
|
-
case 6:
|
|
97
|
-
if (ele) {
|
|
98
|
-
_context.next = 8;
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
return _context.abrupt("break", 17);
|
|
102
|
-
case 8:
|
|
103
|
-
newestFirst = options.newestfirst === true;
|
|
104
|
-
dateString = messageRow.AJAR_date;
|
|
105
|
-
if (!(dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst)) {
|
|
106
|
-
_context.next = 14;
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
messageTable.insertBefore(messageRow, ele);
|
|
110
|
-
done = true;
|
|
111
|
-
return _context.abrupt("break", 17);
|
|
112
|
-
case 14:
|
|
113
|
-
ele = ele.nextSibling;
|
|
114
|
-
_context.next = 6;
|
|
115
|
-
break;
|
|
116
|
-
case 17:
|
|
117
|
-
if (!done) {
|
|
118
|
-
messageTable.appendChild(messageRow);
|
|
119
|
-
}
|
|
120
|
-
case 18:
|
|
121
|
-
case "end":
|
|
122
|
-
return _context.stop();
|
|
123
|
-
}
|
|
124
|
-
}, _callee);
|
|
125
|
-
}));
|
|
126
|
-
return _insertMessageIntoTable.apply(this, arguments);
|
|
127
|
-
}
|
|
128
|
-
function infiniteMessageArea(_x7, _x8, _x9, _x10) {
|
|
113
|
+
function infiniteMessageArea(_x, _x2, _x3, _x4) {
|
|
129
114
|
return _infiniteMessageArea.apply(this, arguments);
|
|
130
115
|
}
|
|
131
116
|
function _infiniteMessageArea() {
|
|
132
|
-
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
133
|
-
var syncMessages,
|
|
134
|
-
return _regenerator["default"].wrap(function
|
|
135
|
-
while (1) switch (
|
|
117
|
+
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(dom, wasStore, chatChannel, options) {
|
|
118
|
+
var syncMessages, addMessage, insertPreviousMessages, _insertPreviousMessages, removePreviousMessages, createMessageTable, _createMessageTable, renderMessageTable, addNewChatDocumentIfNewDay, _addNewChatDocumentIfNewDay, appendCurrentMessages, _appendCurrentMessages, loadMoreWhereNeeded, _loadMoreWhereNeeded, loadInitialContent, _loadInitialContent, newestFirst, channelObject, dateFolder, div, statusArea, userContext, liveMessageTable, earliest, latest, lock;
|
|
119
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
120
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
136
121
|
case 0:
|
|
137
122
|
_loadInitialContent = function _loadInitialContent3() {
|
|
138
|
-
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
123
|
+
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
139
124
|
var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
|
|
140
|
-
return _regenerator["default"].wrap(function
|
|
141
|
-
while (1) switch (
|
|
125
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
126
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
142
127
|
case 0:
|
|
143
128
|
fixScroll = function _fixScroll() {
|
|
144
129
|
if (options.selectedElement) {
|
|
@@ -163,29 +148,29 @@ function _infiniteMessageArea() {
|
|
|
163
148
|
live = todayDocument.sameTerm(selectedDocument);
|
|
164
149
|
}
|
|
165
150
|
if (!(options.selectedMessage && !live)) {
|
|
166
|
-
|
|
151
|
+
_context11.next = 15;
|
|
167
152
|
break;
|
|
168
153
|
}
|
|
169
154
|
selectedDate = dateFolder.dateFromLeafDocument(selectedDocument);
|
|
170
|
-
|
|
155
|
+
_context11.next = 7;
|
|
171
156
|
return createMessageTable(selectedDate, live);
|
|
172
157
|
case 7:
|
|
173
|
-
selectedMessageTable =
|
|
158
|
+
selectedMessageTable = _context11.sent;
|
|
174
159
|
div.appendChild(selectedMessageTable);
|
|
175
160
|
earliest.messageTable = selectedMessageTable;
|
|
176
161
|
latest.messageTable = selectedMessageTable;
|
|
177
162
|
yank();
|
|
178
163
|
setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
|
|
179
|
-
|
|
164
|
+
_context11.next = 19;
|
|
180
165
|
break;
|
|
181
166
|
case 15:
|
|
182
|
-
|
|
167
|
+
_context11.next = 17;
|
|
183
168
|
return appendCurrentMessages();
|
|
184
169
|
case 17:
|
|
185
170
|
earliest.messageTable = liveMessageTable;
|
|
186
171
|
latest.messageTable = liveMessageTable;
|
|
187
172
|
case 19:
|
|
188
|
-
|
|
173
|
+
_context11.next = 21;
|
|
189
174
|
return loadMoreWhereNeeded(null, fixScroll);
|
|
190
175
|
case 21:
|
|
191
176
|
div.addEventListener('scroll', loadMoreWhereNeeded);
|
|
@@ -194,9 +179,9 @@ function _infiniteMessageArea() {
|
|
|
194
179
|
}
|
|
195
180
|
case 23:
|
|
196
181
|
case "end":
|
|
197
|
-
return
|
|
182
|
+
return _context11.stop();
|
|
198
183
|
}
|
|
199
|
-
},
|
|
184
|
+
}, _callee11);
|
|
200
185
|
}));
|
|
201
186
|
return _loadInitialContent.apply(this, arguments);
|
|
202
187
|
};
|
|
@@ -204,16 +189,16 @@ function _infiniteMessageArea() {
|
|
|
204
189
|
return _loadInitialContent.apply(this, arguments);
|
|
205
190
|
};
|
|
206
191
|
_loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
|
|
207
|
-
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
192
|
+
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(event, fixScroll) {
|
|
208
193
|
var freeze, magicZone, done, scrollBottom, scrollTop;
|
|
209
|
-
return _regenerator["default"].wrap(function
|
|
210
|
-
while (1) switch (
|
|
194
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
195
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
211
196
|
case 0:
|
|
212
197
|
if (!lock) {
|
|
213
|
-
|
|
198
|
+
_context10.next = 2;
|
|
214
199
|
break;
|
|
215
200
|
}
|
|
216
|
-
return
|
|
201
|
+
return _context10.abrupt("return");
|
|
217
202
|
case 2:
|
|
218
203
|
lock = true;
|
|
219
204
|
freeze = !fixScroll;
|
|
@@ -221,36 +206,36 @@ function _infiniteMessageArea() {
|
|
|
221
206
|
// const bottom = div.scrollHeight - top - div.clientHeight
|
|
222
207
|
case 5:
|
|
223
208
|
if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
|
|
224
|
-
|
|
209
|
+
_context10.next = 21;
|
|
225
210
|
break;
|
|
226
211
|
}
|
|
227
212
|
if (!(div.scrollHeight === 0)) {
|
|
228
|
-
|
|
213
|
+
_context10.next = 10;
|
|
229
214
|
break;
|
|
230
215
|
}
|
|
231
|
-
//
|
|
216
|
+
// console.log(' chat/loadMoreWhereNeeded: trying later...')
|
|
232
217
|
setTimeout(loadMoreWhereNeeded, 2000); // couple be less
|
|
233
218
|
lock = false;
|
|
234
|
-
return
|
|
219
|
+
return _context10.abrupt("return");
|
|
235
220
|
case 10:
|
|
236
|
-
//
|
|
221
|
+
// console.log(' chat/loadMoreWhereNeeded: Going now')
|
|
237
222
|
scrollBottom = div.scrollHeight - div.scrollTop;
|
|
238
223
|
debug.log('infinite scroll: adding above: top ' + div.scrollTop);
|
|
239
|
-
|
|
224
|
+
_context10.next = 14;
|
|
240
225
|
return earliest.messageTable.extendBackwards();
|
|
241
226
|
case 14:
|
|
242
|
-
done =
|
|
227
|
+
done = _context10.sent;
|
|
243
228
|
if (freeze) {
|
|
244
229
|
div.scrollTop = div.scrollHeight - scrollBottom;
|
|
245
230
|
}
|
|
246
231
|
if (fixScroll) fixScroll();
|
|
247
232
|
if (!done) {
|
|
248
|
-
|
|
233
|
+
_context10.next = 19;
|
|
249
234
|
break;
|
|
250
235
|
}
|
|
251
|
-
return
|
|
236
|
+
return _context10.abrupt("break", 21);
|
|
252
237
|
case 19:
|
|
253
|
-
|
|
238
|
+
_context10.next = 5;
|
|
254
239
|
break;
|
|
255
240
|
case 21:
|
|
256
241
|
if (!(options.selectedMessage &&
|
|
@@ -260,15 +245,15 @@ function _infiniteMessageArea() {
|
|
|
260
245
|
latest.messageTable && !latest.messageTable["final"] &&
|
|
261
246
|
// there is more data to come
|
|
262
247
|
latest.messageTable.extendForwards)) {
|
|
263
|
-
|
|
248
|
+
_context10.next = 33;
|
|
264
249
|
break;
|
|
265
250
|
}
|
|
266
251
|
scrollTop = div.scrollTop;
|
|
267
252
|
debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
|
|
268
|
-
|
|
253
|
+
_context10.next = 26;
|
|
269
254
|
return latest.messageTable.extendForwards();
|
|
270
255
|
case 26:
|
|
271
|
-
done =
|
|
256
|
+
done = _context10.sent;
|
|
272
257
|
// then add more data on the bottom
|
|
273
258
|
if (freeze) {
|
|
274
259
|
div.scrollTop = scrollTop; // while adding below keep same things in view
|
|
@@ -276,66 +261,63 @@ function _infiniteMessageArea() {
|
|
|
276
261
|
|
|
277
262
|
if (fixScroll) fixScroll();
|
|
278
263
|
if (!done) {
|
|
279
|
-
|
|
264
|
+
_context10.next = 31;
|
|
280
265
|
break;
|
|
281
266
|
}
|
|
282
|
-
return
|
|
267
|
+
return _context10.abrupt("break", 33);
|
|
283
268
|
case 31:
|
|
284
|
-
|
|
269
|
+
_context10.next = 21;
|
|
285
270
|
break;
|
|
286
271
|
case 33:
|
|
287
272
|
lock = false;
|
|
288
273
|
case 34:
|
|
289
274
|
case "end":
|
|
290
|
-
return
|
|
275
|
+
return _context10.stop();
|
|
291
276
|
}
|
|
292
|
-
},
|
|
277
|
+
}, _callee10);
|
|
293
278
|
}));
|
|
294
279
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
295
280
|
};
|
|
296
|
-
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(
|
|
281
|
+
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x10, _x11) {
|
|
297
282
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
298
283
|
};
|
|
299
284
|
_appendCurrentMessages = function _appendCurrentMessage2() {
|
|
300
|
-
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
285
|
+
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
|
|
301
286
|
var now, chatDocument, messageTable;
|
|
302
|
-
return _regenerator["default"].wrap(function
|
|
303
|
-
while (1) switch (
|
|
287
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
288
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
304
289
|
case 0:
|
|
305
290
|
now = new Date();
|
|
306
291
|
chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
|
|
307
|
-
|
|
292
|
+
_context9.next = 4;
|
|
308
293
|
return createMessageTable(now, true);
|
|
309
294
|
case 4:
|
|
310
|
-
messageTable =
|
|
295
|
+
messageTable = _context9.sent;
|
|
311
296
|
div.appendChild(messageTable);
|
|
312
|
-
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
313
|
-
return _regenerator["default"].wrap(function
|
|
314
|
-
while (1) switch (
|
|
297
|
+
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
298
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
299
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
315
300
|
case 0:
|
|
316
|
-
|
|
301
|
+
_context8.next = 2;
|
|
317
302
|
return addNewChatDocumentIfNewDay(new Date());
|
|
318
303
|
case 2:
|
|
319
|
-
|
|
320
|
-
return syncMessages(chatChannel, messageTable);
|
|
321
|
-
case 4:
|
|
322
|
-
// @@ livemessagetable??
|
|
304
|
+
syncMessages(chatChannel, messageTable); // @@ livemessagetable??
|
|
323
305
|
desktopNotification(chatChannel);
|
|
324
|
-
case
|
|
306
|
+
case 4:
|
|
325
307
|
case "end":
|
|
326
|
-
return
|
|
308
|
+
return _context8.stop();
|
|
327
309
|
}
|
|
328
|
-
},
|
|
310
|
+
}, _callee8);
|
|
329
311
|
})); // The short chat version the live update listening is done in the pane but we do it in the widget @@
|
|
330
312
|
_solidLogic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
331
313
|
liveMessageTable = messageTable;
|
|
332
314
|
latest.messageTable = liveMessageTable;
|
|
333
|
-
return
|
|
315
|
+
return _context9.abrupt("return", messageTable);
|
|
334
316
|
case 11:
|
|
335
317
|
case "end":
|
|
336
|
-
return
|
|
318
|
+
return _context9.stop();
|
|
337
319
|
}
|
|
338
|
-
},
|
|
320
|
+
}, _callee9);
|
|
339
321
|
}));
|
|
340
322
|
return _appendCurrentMessages.apply(this, arguments);
|
|
341
323
|
};
|
|
@@ -343,15 +325,15 @@ function _infiniteMessageArea() {
|
|
|
343
325
|
return _appendCurrentMessages.apply(this, arguments);
|
|
344
326
|
};
|
|
345
327
|
_addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
|
|
346
|
-
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
328
|
+
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
347
329
|
var newChatDocument, oldChatDocument, sts;
|
|
348
|
-
return _regenerator["default"].wrap(function
|
|
349
|
-
while (1) switch (
|
|
330
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
331
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
350
332
|
case 0:
|
|
351
333
|
// @@ Remove listener from previous table as it is now static
|
|
352
334
|
newChatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
353
335
|
if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
|
|
354
|
-
|
|
336
|
+
_context7.next = 7;
|
|
355
337
|
break;
|
|
356
338
|
}
|
|
357
339
|
// It is a new day
|
|
@@ -360,7 +342,7 @@ function _infiniteMessageArea() {
|
|
|
360
342
|
delete liveMessageTable.inputRow;
|
|
361
343
|
}
|
|
362
344
|
oldChatDocument = latest.messageTable.chatDocument;
|
|
363
|
-
|
|
345
|
+
_context7.next = 6;
|
|
364
346
|
return appendCurrentMessages();
|
|
365
347
|
case 6:
|
|
366
348
|
// Adding a link in the document will ping listeners to add the new block too
|
|
@@ -374,350 +356,286 @@ function _infiniteMessageArea() {
|
|
|
374
356
|
}
|
|
375
357
|
case 7:
|
|
376
358
|
case "end":
|
|
377
|
-
return
|
|
359
|
+
return _context7.stop();
|
|
378
360
|
}
|
|
379
|
-
},
|
|
361
|
+
}, _callee7);
|
|
380
362
|
}));
|
|
381
363
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
382
364
|
};
|
|
383
365
|
addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
|
|
384
366
|
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
385
367
|
};
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
390
|
-
while (1) switch (_context10.prev = _context10.next) {
|
|
391
|
-
case 0:
|
|
392
|
-
_scrollForwardButtonHandler = function _scrollForwardButtonH2() {
|
|
393
|
-
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(_event) {
|
|
394
|
-
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
395
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
396
|
-
case 0:
|
|
397
|
-
if (!messageTable.extendedForwards) {
|
|
398
|
-
_context9.next = 6;
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
401
|
-
removePreviousMessages(false, messageTable);
|
|
402
|
-
messageTable.extendedForwards = false;
|
|
403
|
-
setScrollForwardButtonIcon();
|
|
404
|
-
_context9.next = 9;
|
|
405
|
-
break;
|
|
406
|
-
case 6:
|
|
407
|
-
_context9.next = 8;
|
|
408
|
-
return extendForwards();
|
|
409
|
-
case 8:
|
|
410
|
-
// async
|
|
411
|
-
latest.messageTable.scrollIntoView(newestFirst);
|
|
412
|
-
case 9:
|
|
413
|
-
case "end":
|
|
414
|
-
return _context9.stop();
|
|
415
|
-
}
|
|
416
|
-
}, _callee9);
|
|
417
|
-
}));
|
|
418
|
-
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
419
|
-
};
|
|
420
|
-
scrollForwardButtonHandler = function _scrollForwardButtonH(_x23) {
|
|
421
|
-
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
422
|
-
};
|
|
423
|
-
setScrollForwardButtonIcon = function _setScrollForwardButt() {
|
|
424
|
-
if (!scrollForwardButton) return;
|
|
425
|
-
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
426
|
-
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
427
|
-
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
428
|
-
function getScrollForwardButtonIcon(sense) {
|
|
429
|
-
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
430
|
-
}
|
|
431
|
-
};
|
|
432
|
-
_extendForwards = function _extendForwards3() {
|
|
433
|
-
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
434
|
-
var done;
|
|
435
|
-
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
436
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
437
|
-
case 0:
|
|
438
|
-
_context8.next = 2;
|
|
439
|
-
return insertPreviousMessages(false);
|
|
440
|
-
case 2:
|
|
441
|
-
done = _context8.sent;
|
|
442
|
-
return _context8.abrupt("return", done);
|
|
443
|
-
case 4:
|
|
444
|
-
case "end":
|
|
445
|
-
return _context8.stop();
|
|
446
|
-
}
|
|
447
|
-
}, _callee8);
|
|
448
|
-
}));
|
|
449
|
-
return _extendForwards.apply(this, arguments);
|
|
450
|
-
};
|
|
451
|
-
extendForwards = function _extendForwards2() {
|
|
452
|
-
return _extendForwards.apply(this, arguments);
|
|
453
|
-
};
|
|
454
|
-
_scrollBackbuttonHandler = function _scrollBackbuttonHand2() {
|
|
455
|
-
_scrollBackbuttonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(_event) {
|
|
456
|
-
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
457
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
458
|
-
case 0:
|
|
459
|
-
if (!messageTable.extendedBack) {
|
|
460
|
-
_context7.next = 6;
|
|
461
|
-
break;
|
|
462
|
-
}
|
|
463
|
-
removePreviousMessages(true, messageTable);
|
|
464
|
-
messageTable.extendedBack = false;
|
|
465
|
-
setScrollBackbuttonIcon();
|
|
466
|
-
_context7.next = 8;
|
|
467
|
-
break;
|
|
468
|
-
case 6:
|
|
469
|
-
_context7.next = 8;
|
|
470
|
-
return extendBackwards();
|
|
471
|
-
case 8:
|
|
472
|
-
case "end":
|
|
473
|
-
return _context7.stop();
|
|
474
|
-
}
|
|
475
|
-
}, _callee7);
|
|
476
|
-
}));
|
|
477
|
-
return _scrollBackbuttonHandler.apply(this, arguments);
|
|
478
|
-
};
|
|
479
|
-
scrollBackbuttonHandler = function _scrollBackbuttonHand(_x22) {
|
|
480
|
-
return _scrollBackbuttonHandler.apply(this, arguments);
|
|
481
|
-
};
|
|
482
|
-
setScrollBackbuttonIcon = function _setScrollBackbuttonI() {
|
|
483
|
-
if (!scrollBackbutton) {
|
|
484
|
-
return;
|
|
485
|
-
}
|
|
486
|
-
var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
|
|
487
|
-
var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
|
|
488
|
-
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
|
|
489
|
-
function getScrollbackIcon(sense) {
|
|
490
|
-
return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
_extendBackwards = function _extendBackwards3() {
|
|
494
|
-
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
495
|
-
var done;
|
|
496
|
-
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
497
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
498
|
-
case 0:
|
|
499
|
-
_context6.next = 2;
|
|
500
|
-
return insertPreviousMessages(true);
|
|
501
|
-
case 2:
|
|
502
|
-
done = _context6.sent;
|
|
503
|
-
if (done) {
|
|
504
|
-
if (scrollBackbutton) {
|
|
505
|
-
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
|
|
506
|
-
scrollBackbutton.disabled = true;
|
|
507
|
-
}
|
|
508
|
-
messageTable.initial = true;
|
|
509
|
-
} else {
|
|
510
|
-
messageTable.extendedBack = true;
|
|
511
|
-
}
|
|
512
|
-
setScrollBackbuttonIcon();
|
|
513
|
-
return _context6.abrupt("return", done);
|
|
514
|
-
case 6:
|
|
515
|
-
case "end":
|
|
516
|
-
return _context6.stop();
|
|
517
|
-
}
|
|
518
|
-
}, _callee6);
|
|
519
|
-
}));
|
|
520
|
-
return _extendBackwards.apply(this, arguments);
|
|
521
|
-
};
|
|
522
|
-
extendBackwards = function _extendBackwards2() {
|
|
523
|
-
return _extendBackwards.apply(this, arguments);
|
|
524
|
-
};
|
|
525
|
-
scrollBackbutton = null; // was let
|
|
526
|
-
scrollForwardButton = null; // was let
|
|
527
|
-
/// ///////////////// Scroll down adding more above
|
|
528
|
-
/// ///////////////////////
|
|
529
|
-
/*
|
|
530
|
-
options = options || {}
|
|
531
|
-
options.authorDateOnLeft = true
|
|
532
|
-
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
533
|
-
const channelObject = new ChatChannel(chatChannel, options)
|
|
534
|
-
const dateFolder = channelObject.dateFolder
|
|
535
|
-
const div = dom.createElement('div')
|
|
536
|
-
const statusArea = div.appendChild(dom.createElement('div'))
|
|
537
|
-
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
538
|
-
*/
|
|
539
|
-
debug.log('Options for called message Area', options);
|
|
540
|
-
messageTable = dom.createElement('table');
|
|
541
|
-
messageTable.style.width = '100%'; // fill the pane div
|
|
542
|
-
messageTable.extendBackwards = extendBackwards; // Make function available to scroll stuff
|
|
543
|
-
messageTable.extendForwards = extendForwards; // Make function available to scroll stuff
|
|
368
|
+
renderMessageTable = function _renderMessageTable(date, live) {
|
|
369
|
+
var scrollBackbutton;
|
|
370
|
+
var scrollForwardButton;
|
|
544
371
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
372
|
+
/// ///////////////// Scroll down adding more above
|
|
373
|
+
function extendBackwards() {
|
|
374
|
+
return _extendBackwards.apply(this, arguments);
|
|
375
|
+
}
|
|
376
|
+
function _extendBackwards() {
|
|
377
|
+
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
378
|
+
var done;
|
|
379
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
380
|
+
while (1) switch (_context.prev = _context.next) {
|
|
381
|
+
case 0:
|
|
382
|
+
_context.next = 2;
|
|
383
|
+
return insertPreviousMessages(true);
|
|
384
|
+
case 2:
|
|
385
|
+
done = _context.sent;
|
|
386
|
+
if (done) {
|
|
387
|
+
if (scrollBackbutton) {
|
|
388
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
|
|
389
|
+
scrollBackbutton.disabled = true;
|
|
390
|
+
}
|
|
391
|
+
messageTable.initial = true;
|
|
557
392
|
} else {
|
|
558
|
-
messageTable.
|
|
393
|
+
messageTable.extendedBack = true;
|
|
559
394
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
593
|
-
scrollForwardButtonCell = titleTR.appendChild(dom.createElement('td'));
|
|
594
|
-
if (options.includeRemoveButton) {
|
|
595
|
-
scrollForwardButtonCell.appendChild(widgets.cancelButton(dom, function (_e) {
|
|
596
|
-
div.parentNode.removeChild(div);
|
|
597
|
-
}));
|
|
395
|
+
setScrollBackbuttonIcon();
|
|
396
|
+
return _context.abrupt("return", done);
|
|
397
|
+
case 6:
|
|
398
|
+
case "end":
|
|
399
|
+
return _context.stop();
|
|
400
|
+
}
|
|
401
|
+
}, _callee);
|
|
402
|
+
}));
|
|
403
|
+
return _extendBackwards.apply(this, arguments);
|
|
404
|
+
}
|
|
405
|
+
function setScrollBackbuttonIcon() {
|
|
406
|
+
if (!scrollBackbutton) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
|
|
410
|
+
var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
|
|
411
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
|
|
412
|
+
function getScrollbackIcon(sense) {
|
|
413
|
+
return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
function scrollBackbuttonHandler(_x8) {
|
|
417
|
+
return _scrollBackbuttonHandler.apply(this, arguments);
|
|
418
|
+
} /// ////////////// Scroll up adding more below
|
|
419
|
+
function _scrollBackbuttonHandler() {
|
|
420
|
+
_scrollBackbuttonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_event) {
|
|
421
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
422
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
423
|
+
case 0:
|
|
424
|
+
if (!messageTable.extendedBack) {
|
|
425
|
+
_context2.next = 6;
|
|
426
|
+
break;
|
|
598
427
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
428
|
+
removePreviousMessages(true, messageTable);
|
|
429
|
+
messageTable.extendedBack = false;
|
|
430
|
+
setScrollBackbuttonIcon();
|
|
431
|
+
_context2.next = 8;
|
|
432
|
+
break;
|
|
433
|
+
case 6:
|
|
434
|
+
_context2.next = 8;
|
|
435
|
+
return extendBackwards();
|
|
436
|
+
case 8:
|
|
437
|
+
case "end":
|
|
438
|
+
return _context2.stop();
|
|
439
|
+
}
|
|
440
|
+
}, _callee2);
|
|
441
|
+
}));
|
|
442
|
+
return _scrollBackbuttonHandler.apply(this, arguments);
|
|
443
|
+
}
|
|
444
|
+
function extendForwards() {
|
|
445
|
+
return _extendForwards.apply(this, arguments);
|
|
446
|
+
}
|
|
447
|
+
function _extendForwards() {
|
|
448
|
+
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
449
|
+
var done;
|
|
450
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
451
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
452
|
+
case 0:
|
|
453
|
+
_context3.next = 2;
|
|
454
|
+
return insertPreviousMessages(false);
|
|
455
|
+
case 2:
|
|
456
|
+
done = _context3.sent;
|
|
457
|
+
if (done) {
|
|
458
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg');
|
|
459
|
+
scrollForwardButton.disabled = true;
|
|
460
|
+
messageTable["final"] = true;
|
|
622
461
|
} else {
|
|
623
|
-
messageTable.
|
|
462
|
+
messageTable.extendedForwards = true;
|
|
624
463
|
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
464
|
+
setScrollForwardButtonIcon();
|
|
465
|
+
return _context3.abrupt("return", done);
|
|
466
|
+
case 6:
|
|
467
|
+
case "end":
|
|
468
|
+
return _context3.stop();
|
|
469
|
+
}
|
|
470
|
+
}, _callee3);
|
|
471
|
+
}));
|
|
472
|
+
return _extendForwards.apply(this, arguments);
|
|
473
|
+
}
|
|
474
|
+
function setScrollForwardButtonIcon() {
|
|
475
|
+
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
476
|
+
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
477
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
478
|
+
function getScrollForwardButtonIcon(sense) {
|
|
479
|
+
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
function scrollForwardButtonHandler(_x9) {
|
|
483
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
484
|
+
} /// ///////////////////////
|
|
485
|
+
/*
|
|
486
|
+
options = options || {}
|
|
487
|
+
options.authorDateOnLeft = true
|
|
488
|
+
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
489
|
+
const channelObject = new ChatChannel(chatChannel, options)
|
|
490
|
+
const dateFolder = channelObject.dateFolder
|
|
491
|
+
const div = dom.createElement('div')
|
|
492
|
+
const statusArea = div.appendChild(dom.createElement('div'))
|
|
493
|
+
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
494
|
+
*/
|
|
495
|
+
function _scrollForwardButtonHandler() {
|
|
496
|
+
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
497
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
498
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
499
|
+
case 0:
|
|
500
|
+
if (!messageTable.extendedForwards) {
|
|
501
|
+
_context4.next = 6;
|
|
502
|
+
break;
|
|
503
|
+
}
|
|
504
|
+
removePreviousMessages(false, messageTable);
|
|
505
|
+
messageTable.extendedForwards = false;
|
|
506
|
+
setScrollForwardButtonIcon();
|
|
507
|
+
_context4.next = 9;
|
|
638
508
|
break;
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
return _context10.finish(41);
|
|
657
|
-
case 44:
|
|
658
|
-
messageTable.fresh = true;
|
|
509
|
+
case 6:
|
|
510
|
+
_context4.next = 8;
|
|
511
|
+
return extendForwards();
|
|
512
|
+
case 8:
|
|
513
|
+
// async
|
|
514
|
+
latest.messageTable.scrollIntoView(newestFirst);
|
|
515
|
+
case 9:
|
|
516
|
+
case "end":
|
|
517
|
+
return _context4.stop();
|
|
518
|
+
}
|
|
519
|
+
}, _callee4);
|
|
520
|
+
}));
|
|
521
|
+
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
522
|
+
}
|
|
523
|
+
var messageTable = dom.createElement('table');
|
|
524
|
+
messageTable.extendBackwards = extendBackwards; // Make function available to scroll stuff
|
|
525
|
+
messageTable.extendForwards = extendForwards; // Make function available to scroll stuff
|
|
659
526
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
527
|
+
messageTable.date = date;
|
|
528
|
+
var chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
529
|
+
messageTable.chatDocument = chatDocument;
|
|
530
|
+
messageTable.fresh = false;
|
|
531
|
+
messageTable.setAttribute('style', 'width: 100%;'); // fill that div!
|
|
532
|
+
if (live) {
|
|
533
|
+
messageTable["final"] = true;
|
|
534
|
+
liveMessageTable = messageTable;
|
|
535
|
+
latest.messageTable = messageTable;
|
|
536
|
+
var tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
|
|
537
|
+
if (newestFirst) {
|
|
538
|
+
messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
|
|
539
|
+
} else {
|
|
540
|
+
messageTable.appendChild(tr); // not newestFirst
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
messageTable.inputRow = tr;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/// ///// Infinite scroll
|
|
547
|
+
//
|
|
548
|
+
// @@ listen for swipe past end event not just button
|
|
549
|
+
if (options.infinite) {
|
|
550
|
+
var scrollBackbuttonTR = dom.createElement('tr');
|
|
551
|
+
var scrollBackbuttonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
552
|
+
// up traingles: noun_1369237.svg
|
|
553
|
+
// down triangles: noun_1369241.svg
|
|
554
|
+
var scrollBackIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
555
|
+
scrollBackbutton = widgets.button(dom, _iconBase.icons.iconBase + scrollBackIcon, 'Previous messages ...');
|
|
556
|
+
scrollBackbuttonCell.style = 'width:3em; height:3em;';
|
|
557
|
+
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false);
|
|
558
|
+
messageTable.extendedBack = false;
|
|
559
|
+
scrollBackbuttonCell.appendChild(scrollBackbutton);
|
|
560
|
+
setScrollBackbuttonIcon();
|
|
561
|
+
var dateCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
562
|
+
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
563
|
+
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
564
|
+
|
|
565
|
+
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
566
|
+
var scrollForwardButtonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
567
|
+
var scrollForwardIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
568
|
+
scrollForwardButton = widgets.button(dom, _iconBase.icons.iconBase + scrollForwardIcon, 'Later messages ...');
|
|
569
|
+
scrollForwardButtonCell.appendChild(scrollForwardButton);
|
|
570
|
+
scrollForwardButtonCell.style = 'width:3em; height:3em;';
|
|
571
|
+
scrollForwardButton.addEventListener('click', scrollForwardButtonHandler, false);
|
|
572
|
+
messageTable.extendedForward = false;
|
|
573
|
+
setScrollForwardButtonIcon();
|
|
574
|
+
messageTable.extendedForwards = false;
|
|
575
|
+
if (!newestFirst) {
|
|
576
|
+
// opposite end from the entry field
|
|
577
|
+
messageTable.insertBefore(scrollBackbuttonTR, messageTable.firstChild); // If not newestFirst
|
|
578
|
+
} else {
|
|
579
|
+
messageTable.appendChild(scrollBackbuttonTR); // newestFirst
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
var sts = _solidLogic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
584
|
+
if (!live && sts.length === 0) {
|
|
585
|
+
// not todays
|
|
586
|
+
// no need buttomns at the moment
|
|
587
|
+
// messageTable.style.visibility = 'collapse' // Hide files with no messages
|
|
588
|
+
}
|
|
589
|
+
sts.forEach(function (st) {
|
|
590
|
+
addMessage(st.object, messageTable);
|
|
591
|
+
});
|
|
592
|
+
messageTable.fresh = true;
|
|
593
|
+
|
|
594
|
+
// loadMessageTable(messageTable, chatDocument)
|
|
595
|
+
messageTable.fresh = false;
|
|
596
|
+
return messageTable;
|
|
673
597
|
};
|
|
674
598
|
_createMessageTable = function _createMessageTable3() {
|
|
675
|
-
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
599
|
+
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(date, live) {
|
|
676
600
|
var chatDocument, messageTable, statusTR;
|
|
677
|
-
return _regenerator["default"].wrap(function
|
|
678
|
-
while (1) switch (
|
|
601
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
602
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
679
603
|
case 0:
|
|
680
604
|
debug.log(' createMessageTable for ' + date);
|
|
681
605
|
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
682
|
-
|
|
683
|
-
|
|
606
|
+
_context6.prev = 2;
|
|
607
|
+
_context6.next = 5;
|
|
684
608
|
return _solidLogic.store.fetcher.load(chatDocument);
|
|
685
609
|
case 5:
|
|
686
|
-
|
|
610
|
+
_context6.next = 19;
|
|
687
611
|
break;
|
|
688
612
|
case 7:
|
|
689
|
-
|
|
690
|
-
|
|
613
|
+
_context6.prev = 7;
|
|
614
|
+
_context6.t0 = _context6["catch"](2);
|
|
691
615
|
messageTable = dom.createElement('table');
|
|
692
616
|
statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
|
|
693
|
-
if (!(
|
|
694
|
-
|
|
617
|
+
if (!(_context6.t0.response && _context6.t0.response.status && _context6.t0.response.status === 404)) {
|
|
618
|
+
_context6.next = 16;
|
|
695
619
|
break;
|
|
696
620
|
}
|
|
697
621
|
debug.log('Error 404 for chat file ' + chatDocument);
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
case 15:
|
|
701
|
-
return _context5.abrupt("return", _context5.sent);
|
|
702
|
-
case 18:
|
|
622
|
+
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
623
|
+
case 16:
|
|
703
624
|
debug.log('*** Error NON 404 for chat file ' + chatDocument);
|
|
704
|
-
statusTR.appendChild(widgets.errorMessageBlock(dom,
|
|
625
|
+
statusTR.appendChild(widgets.errorMessageBlock(dom, _context6.t0, 'pink'));
|
|
626
|
+
case 18:
|
|
627
|
+
return _context6.abrupt("return", statusTR);
|
|
628
|
+
case 19:
|
|
629
|
+
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
705
630
|
case 20:
|
|
706
|
-
return _context5.abrupt("return", statusTR);
|
|
707
|
-
case 21:
|
|
708
|
-
_context5.next = 23;
|
|
709
|
-
return renderMessageTable(date, live);
|
|
710
|
-
case 23:
|
|
711
|
-
return _context5.abrupt("return", _context5.sent);
|
|
712
|
-
case 24:
|
|
713
631
|
case "end":
|
|
714
|
-
return
|
|
632
|
+
return _context6.stop();
|
|
715
633
|
}
|
|
716
|
-
},
|
|
634
|
+
}, _callee6, null, [[2, 7]]);
|
|
717
635
|
}));
|
|
718
636
|
return _createMessageTable.apply(this, arguments);
|
|
719
637
|
};
|
|
720
|
-
createMessageTable = function _createMessageTable2(
|
|
638
|
+
createMessageTable = function _createMessageTable2(_x6, _x7) {
|
|
721
639
|
return _createMessageTable.apply(this, arguments);
|
|
722
640
|
};
|
|
723
641
|
removePreviousMessages = function _removePreviousMessag(backwards, messageTable) {
|
|
@@ -736,31 +654,31 @@ function _infiniteMessageArea() {
|
|
|
736
654
|
extr.messageTable = messageTable;
|
|
737
655
|
};
|
|
738
656
|
_insertPreviousMessages = function _insertPreviousMessag2() {
|
|
739
|
-
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
657
|
+
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(backwards) {
|
|
740
658
|
var extremity, date, live, todayDoc, doc, newMessageTable;
|
|
741
|
-
return _regenerator["default"].wrap(function
|
|
742
|
-
while (1) switch (
|
|
659
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
660
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
743
661
|
case 0:
|
|
744
662
|
extremity = backwards ? earliest : latest;
|
|
745
663
|
date = extremity.messageTable.date; // day in mssecs
|
|
746
|
-
|
|
664
|
+
_context5.next = 4;
|
|
747
665
|
return dateFolder.loadPrevious(date, backwards);
|
|
748
666
|
case 4:
|
|
749
|
-
date =
|
|
667
|
+
date = _context5.sent;
|
|
750
668
|
// backwards
|
|
751
669
|
debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
|
|
752
670
|
if (!(!date && !backwards && !liveMessageTable)) {
|
|
753
|
-
|
|
671
|
+
_context5.next = 9;
|
|
754
672
|
break;
|
|
755
673
|
}
|
|
756
|
-
|
|
674
|
+
_context5.next = 9;
|
|
757
675
|
return appendCurrentMessages();
|
|
758
676
|
case 9:
|
|
759
677
|
if (date) {
|
|
760
|
-
|
|
678
|
+
_context5.next = 11;
|
|
761
679
|
break;
|
|
762
680
|
}
|
|
763
|
-
return
|
|
681
|
+
return _context5.abrupt("return", true);
|
|
764
682
|
case 11:
|
|
765
683
|
// done
|
|
766
684
|
live = false;
|
|
@@ -769,10 +687,10 @@ function _infiniteMessageArea() {
|
|
|
769
687
|
doc = dateFolder.leafDocumentFromDate(date);
|
|
770
688
|
live = doc.sameTerm(todayDoc); // Is this todays?
|
|
771
689
|
}
|
|
772
|
-
|
|
690
|
+
_context5.next = 15;
|
|
773
691
|
return createMessageTable(date, live);
|
|
774
692
|
case 15:
|
|
775
|
-
newMessageTable =
|
|
693
|
+
newMessageTable = _context5.sent;
|
|
776
694
|
extremity.messageTable = newMessageTable; // move pointer to earliest
|
|
777
695
|
if (backwards ? newestFirst : !newestFirst) {
|
|
778
696
|
// put on bottom or top
|
|
@@ -781,158 +699,62 @@ function _infiniteMessageArea() {
|
|
|
781
699
|
// put on top as we scroll back
|
|
782
700
|
div.insertBefore(newMessageTable, div.firstChild);
|
|
783
701
|
}
|
|
784
|
-
return
|
|
702
|
+
return _context5.abrupt("return", live);
|
|
785
703
|
case 19:
|
|
786
704
|
case "end":
|
|
787
|
-
return
|
|
705
|
+
return _context5.stop();
|
|
788
706
|
}
|
|
789
|
-
},
|
|
707
|
+
}, _callee5);
|
|
790
708
|
}));
|
|
791
709
|
return _insertPreviousMessages.apply(this, arguments);
|
|
792
710
|
};
|
|
793
|
-
insertPreviousMessages = function _insertPreviousMessag(
|
|
711
|
+
insertPreviousMessages = function _insertPreviousMessag(_x5) {
|
|
794
712
|
return _insertPreviousMessages.apply(this, arguments);
|
|
795
713
|
};
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
case 2:
|
|
805
|
-
latest = _context3.sent;
|
|
806
|
-
if (!((0, _chatLogic.isDeleted)(latest) && !options.showDeletedMessages)) {
|
|
807
|
-
_context3.next = 5;
|
|
808
|
-
break;
|
|
809
|
-
}
|
|
810
|
-
return _context3.abrupt("return");
|
|
811
|
-
case 5:
|
|
812
|
-
thread = _solidLogic.store.any(null, ns.sioc('has_member'), message, message.doc());
|
|
813
|
-
id = _solidLogic.store.any(message, ns.sioc('id'), null, message.doc());
|
|
814
|
-
if (id && !thread) {
|
|
815
|
-
thread = _solidLogic.store.any(null, ns.sioc('has_member'), id, message.doc());
|
|
816
|
-
}
|
|
817
|
-
if (!options.thread) {
|
|
818
|
-
_context3.next = 21;
|
|
819
|
-
break;
|
|
820
|
-
}
|
|
821
|
-
if (!_solidLogic.store.holds(message, ns.sioc('has_reply'), options.thread)) {
|
|
822
|
-
_context3.next = 13;
|
|
823
|
-
break;
|
|
824
|
-
}
|
|
825
|
-
// root of thread
|
|
826
|
-
debug.log(' addMessage: displaying root of thread ' + thread);
|
|
827
|
-
_context3.next = 19;
|
|
828
|
-
break;
|
|
829
|
-
case 13:
|
|
830
|
-
if (!(thread && thread.sameTerm(options.thread))) {
|
|
831
|
-
_context3.next = 17;
|
|
832
|
-
break;
|
|
833
|
-
}
|
|
834
|
-
debug.log(' addMessage: Displaying body of thread ' + message.uri.slice(-10));
|
|
835
|
-
_context3.next = 19;
|
|
836
|
-
break;
|
|
837
|
-
case 17:
|
|
838
|
-
debug.log(' addMessage: Suppress non-thread message in thread table ' + message.uri.slice(-10));
|
|
839
|
-
return _context3.abrupt("return");
|
|
840
|
-
case 19:
|
|
841
|
-
_context3.next = 27;
|
|
842
|
-
break;
|
|
843
|
-
case 21:
|
|
844
|
-
if (!thread) {
|
|
845
|
-
_context3.next = 26;
|
|
846
|
-
break;
|
|
847
|
-
}
|
|
848
|
-
debug.log(' addMessage: Suppress thread message in non-thread table ' + message.uri.slice(-10));
|
|
849
|
-
return _context3.abrupt("return");
|
|
850
|
-
case 26:
|
|
851
|
-
debug.log(' addMessage: Normal non-thread message in non-thread table ' + message.uri.slice(-10));
|
|
852
|
-
case 27:
|
|
853
|
-
_context3.next = 29;
|
|
854
|
-
return insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext);
|
|
855
|
-
case 29:
|
|
856
|
-
case "end":
|
|
857
|
-
return _context3.stop();
|
|
858
|
-
}
|
|
859
|
-
}, _callee3);
|
|
860
|
-
}));
|
|
861
|
-
return _addMessage.apply(this, arguments);
|
|
862
|
-
};
|
|
863
|
-
addMessage = function _addMessage2(_x13, _x14) {
|
|
864
|
-
return _addMessage.apply(this, arguments);
|
|
865
|
-
};
|
|
866
|
-
_syncMessages = function _syncMessages3() {
|
|
867
|
-
_syncMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(chatChannel, messageTable) {
|
|
868
|
-
var displayed, ele, ele2, messages, stored, _iterator, _step, m;
|
|
869
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
870
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
871
|
-
case 0:
|
|
872
|
-
displayed = {};
|
|
873
|
-
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
874
|
-
if (ele.AJAR_subject) {
|
|
875
|
-
displayed[ele.AJAR_subject.uri] = true;
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
messages = _solidLogic.store.each(chatChannel, ns.wf('message'), null, messageTable.chatDocument);
|
|
879
|
-
stored = {};
|
|
880
|
-
_iterator = _createForOfIteratorHelper(messages);
|
|
881
|
-
_context2.prev = 5;
|
|
882
|
-
_iterator.s();
|
|
883
|
-
case 7:
|
|
884
|
-
if ((_step = _iterator.n()).done) {
|
|
885
|
-
_context2.next = 15;
|
|
886
|
-
break;
|
|
887
|
-
}
|
|
888
|
-
m = _step.value;
|
|
889
|
-
stored[m.uri] = true;
|
|
890
|
-
if (displayed[m.uri]) {
|
|
891
|
-
_context2.next = 13;
|
|
892
|
-
break;
|
|
893
|
-
}
|
|
894
|
-
_context2.next = 13;
|
|
895
|
-
return addMessage(m, messageTable);
|
|
896
|
-
case 13:
|
|
897
|
-
_context2.next = 7;
|
|
898
|
-
break;
|
|
899
|
-
case 15:
|
|
900
|
-
_context2.next = 20;
|
|
901
|
-
break;
|
|
902
|
-
case 17:
|
|
903
|
-
_context2.prev = 17;
|
|
904
|
-
_context2.t0 = _context2["catch"](5);
|
|
905
|
-
_iterator.e(_context2.t0);
|
|
906
|
-
case 20:
|
|
907
|
-
_context2.prev = 20;
|
|
908
|
-
_iterator.f();
|
|
909
|
-
return _context2.finish(20);
|
|
910
|
-
case 23:
|
|
911
|
-
// eslint-disable-next-line space-in-parens
|
|
912
|
-
for (ele = messageTable.firstChild; ele;) {
|
|
913
|
-
ele2 = ele.nextSibling;
|
|
914
|
-
if (ele.AJAR_subject && !stored[ele.AJAR_subject.uri]) {
|
|
915
|
-
messageTable.removeChild(ele);
|
|
916
|
-
}
|
|
917
|
-
ele = ele2;
|
|
918
|
-
}
|
|
919
|
-
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
920
|
-
if (ele.AJAR_subject) {
|
|
921
|
-
// Refresh thumbs up etc
|
|
922
|
-
widgets.refreshTree(ele); // Things inside may have changed too
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
case 25:
|
|
926
|
-
case "end":
|
|
927
|
-
return _context2.stop();
|
|
928
|
-
}
|
|
929
|
-
}, _callee2, null, [[5, 17, 20, 23]]);
|
|
930
|
-
}));
|
|
931
|
-
return _syncMessages.apply(this, arguments);
|
|
714
|
+
addMessage = function _addMessage(message, messageTable) {
|
|
715
|
+
var latest = (0, _chatLogic.mostRecentVersion)(message);
|
|
716
|
+
// const content = store.any(latest, ns.sioc('content'))
|
|
717
|
+
if ((0, _chatLogic.isDeleted)(latest) && !options.showDeletedMessages) {
|
|
718
|
+
return; // ignore deleted messaged -- @@ could also leave a placeholder
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext); // fresh from elsewhere
|
|
932
722
|
};
|
|
933
|
-
syncMessages = function
|
|
934
|
-
|
|
723
|
+
syncMessages = function _syncMessages(about, messageTable) {
|
|
724
|
+
var displayed = {};
|
|
725
|
+
var ele, ele2;
|
|
726
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
727
|
+
if (ele.AJAR_subject) {
|
|
728
|
+
displayed[ele.AJAR_subject.uri] = true;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
var messages = _solidLogic.store.statementsMatching(about, ns.wf('message'), null, messageTable.chatDocument).map(function (st) {
|
|
732
|
+
return st.object;
|
|
733
|
+
});
|
|
734
|
+
var stored = {};
|
|
735
|
+
messages.forEach(function (m) {
|
|
736
|
+
stored[m.uri] = true;
|
|
737
|
+
if (!displayed[m.uri]) {
|
|
738
|
+
addMessage(m, messageTable);
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
// eslint-disable-next-line space-in-parens
|
|
743
|
+
for (ele = messageTable.firstChild; ele;) {
|
|
744
|
+
ele2 = ele.nextSibling;
|
|
745
|
+
if (ele.AJAR_subject && !stored[ele.AJAR_subject.uri]) {
|
|
746
|
+
messageTable.removeChild(ele);
|
|
747
|
+
}
|
|
748
|
+
ele = ele2;
|
|
749
|
+
}
|
|
750
|
+
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
751
|
+
if (ele.AJAR_subject) {
|
|
752
|
+
// Refresh thumbs up etc
|
|
753
|
+
widgets.refreshTree(ele); // Things inside may have changed too
|
|
754
|
+
}
|
|
755
|
+
}
|
|
935
756
|
};
|
|
757
|
+
|
|
936
758
|
// Body of main function
|
|
937
759
|
|
|
938
760
|
options = options || {};
|
|
@@ -948,6 +770,7 @@ function _infiniteMessageArea() {
|
|
|
948
770
|
statusArea: statusArea,
|
|
949
771
|
div: statusArea
|
|
950
772
|
}; // logged on state, pointers to user's stuff
|
|
773
|
+
// const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
|
|
951
774
|
earliest = {
|
|
952
775
|
messageTable: null
|
|
953
776
|
}; // Stuff about each end of the loaded days
|
|
@@ -955,15 +778,15 @@ function _infiniteMessageArea() {
|
|
|
955
778
|
messageTable: null
|
|
956
779
|
};
|
|
957
780
|
lock = false;
|
|
958
|
-
|
|
781
|
+
_context12.next = 30;
|
|
959
782
|
return loadInitialContent();
|
|
960
|
-
case
|
|
961
|
-
return
|
|
962
|
-
case
|
|
783
|
+
case 30:
|
|
784
|
+
return _context12.abrupt("return", div);
|
|
785
|
+
case 31:
|
|
963
786
|
case "end":
|
|
964
|
-
return
|
|
787
|
+
return _context12.stop();
|
|
965
788
|
}
|
|
966
|
-
},
|
|
789
|
+
}, _callee12);
|
|
967
790
|
}));
|
|
968
791
|
return _infiniteMessageArea.apply(this, arguments);
|
|
969
792
|
}
|