solid-ui 2.4.15 → 2.4.16-9d83fb17
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/lib/chat/bookmarks.js +14 -13
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +340 -0
- package/lib/chat/chatLogic.js.map +1 -0
- package/lib/chat/dateFolder.js +12 -12
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +285 -665
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +445 -71
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +165 -103
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +162 -32
- package/lib/chat/thread.js.map +1 -1
- package/lib/versionInfo.js +3 -3
- package/lib/versionInfo.js.map +1 -1
- package/lib/webpack-bundle.js +1401 -986
- package/lib/webpack-bundle.js.map +1 -1
- package/lib/widgets/buttons.d.ts.map +1 -1
- package/lib/widgets/buttons.js +8 -1
- package/lib/widgets/buttons.js.map +1 -1
- package/package.json +1 -1
package/lib/chat/infinite.js
CHANGED
|
@@ -7,152 +7,53 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.createIfNotExists = createIfNotExists;
|
|
11
10
|
exports.desktopNotification = desktopNotification;
|
|
12
11
|
exports.infiniteMessageArea = infiniteMessageArea;
|
|
12
|
+
exports.insertMessageIntoTable = insertMessageIntoTable;
|
|
13
13
|
|
|
14
14
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
15
15
|
|
|
16
16
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
17
|
|
|
18
|
-
var _index = require("../authn/index");
|
|
19
|
-
|
|
20
18
|
var debug = _interopRequireWildcard(require("../debug"));
|
|
21
19
|
|
|
22
20
|
var _iconBase = require("../iconBase");
|
|
23
21
|
|
|
24
22
|
var _logic = require("../logic");
|
|
25
23
|
|
|
26
|
-
var _index2 = require("../media/index");
|
|
27
|
-
|
|
28
24
|
var ns = _interopRequireWildcard(require("../ns"));
|
|
29
25
|
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
var _dateFolder = require("./dateFolder");
|
|
26
|
+
var _chatLogic = require("./chatLogic");
|
|
33
27
|
|
|
34
28
|
var _message = require("./message");
|
|
35
29
|
|
|
36
|
-
var _bookmarks = require("./bookmarks");
|
|
37
|
-
|
|
38
30
|
var $rdf = _interopRequireWildcard(require("rdflib"));
|
|
39
31
|
|
|
40
|
-
var style = _interopRequireWildcard(require("../style"));
|
|
41
|
-
|
|
42
|
-
var utils = _interopRequireWildcard(require("../utils"));
|
|
43
|
-
|
|
44
32
|
var widgets = _interopRequireWildcard(require("../widgets"));
|
|
45
33
|
|
|
46
34
|
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); }
|
|
47
35
|
|
|
48
36
|
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; }
|
|
49
37
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
store: _logic.store,
|
|
64
|
-
style: style,
|
|
65
|
-
utils: utils,
|
|
66
|
-
widgets: widgets
|
|
67
|
-
};
|
|
68
|
-
/* global alert */
|
|
69
|
-
|
|
70
|
-
var SERVER_MKDIRP_BUG = false; // Set false timbl 2021-10-31 should be fixed by now
|
|
71
|
-
|
|
72
|
-
function createIfNotExists(_x) {
|
|
73
|
-
return _createIfNotExists.apply(this, arguments);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function _createIfNotExists() {
|
|
77
|
-
_createIfNotExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(doc) {
|
|
78
|
-
var contentType,
|
|
79
|
-
data,
|
|
80
|
-
fetcher,
|
|
81
|
-
response,
|
|
82
|
-
_args = arguments;
|
|
83
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
84
|
-
while (1) {
|
|
85
|
-
switch (_context.prev = _context.next) {
|
|
86
|
-
case 0:
|
|
87
|
-
contentType = _args.length > 1 && _args[1] !== undefined ? _args[1] : 'text/turtle';
|
|
88
|
-
data = _args.length > 2 && _args[2] !== undefined ? _args[2] : '';
|
|
89
|
-
fetcher = UI.store.fetcher;
|
|
90
|
-
_context.prev = 3;
|
|
91
|
-
_context.next = 6;
|
|
92
|
-
return fetcher.load(doc);
|
|
93
|
-
|
|
94
|
-
case 6:
|
|
95
|
-
response = _context.sent;
|
|
96
|
-
_context.next = 29;
|
|
97
|
-
break;
|
|
98
|
-
|
|
99
|
-
case 9:
|
|
100
|
-
_context.prev = 9;
|
|
101
|
-
_context.t0 = _context["catch"](3);
|
|
102
|
-
|
|
103
|
-
if (!(_context.t0.response.status === 404)) {
|
|
104
|
-
_context.next = 27;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
|
|
109
|
-
_context.prev = 13;
|
|
110
|
-
_context.next = 16;
|
|
111
|
-
return fetcher.webOperation('PUT', doc.uri, {
|
|
112
|
-
data: data,
|
|
113
|
-
contentType: contentType
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
case 16:
|
|
117
|
-
response = _context.sent;
|
|
118
|
-
_context.next = 23;
|
|
119
|
-
break;
|
|
120
|
-
|
|
121
|
-
case 19:
|
|
122
|
-
_context.prev = 19;
|
|
123
|
-
_context.t1 = _context["catch"](13);
|
|
124
|
-
debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context.t1);
|
|
125
|
-
throw _context.t1;
|
|
126
|
-
|
|
127
|
-
case 23:
|
|
128
|
-
delete fetcher.requested[doc.uri]; // delete cached 404 error
|
|
129
|
-
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
130
|
-
|
|
131
|
-
return _context.abrupt("return", response);
|
|
132
|
-
|
|
133
|
-
case 27:
|
|
134
|
-
debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context.t0);
|
|
135
|
-
throw _context.t0;
|
|
136
|
-
|
|
137
|
-
case 29:
|
|
138
|
-
return _context.abrupt("return", response);
|
|
139
|
-
|
|
140
|
-
case 30:
|
|
141
|
-
case "end":
|
|
142
|
-
return _context.stop();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}, _callee, null, [[3, 9], [13, 19]]);
|
|
146
|
-
}));
|
|
147
|
-
return _createIfNotExists.apply(this, arguments);
|
|
148
|
-
}
|
|
149
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Contains the [[infiniteMessageArea]] class
|
|
40
|
+
* @packageDocumentation
|
|
41
|
+
*/
|
|
42
|
+
// import { authn } from '../authn/index'
|
|
43
|
+
// import { media } from '../media/index'
|
|
44
|
+
// import * as pad from '../pad'
|
|
45
|
+
// import { DateFolder } from './dateFolder'
|
|
46
|
+
// import { findBookmarkDocument } from './bookmarks'
|
|
47
|
+
// pull in first avoid cross-refs
|
|
48
|
+
// import * as style from '../style'
|
|
49
|
+
// import * as utils from '../utils'
|
|
50
|
+
// const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
|
|
150
51
|
function desktopNotification(str) {
|
|
151
52
|
// Let's check if the browser supports notifications
|
|
152
53
|
if (!('Notification' in window)) {
|
|
153
|
-
debug.warn('This browser does
|
|
54
|
+
debug.warn('This browser does no t support desktop notification');
|
|
154
55
|
} else if (Notification.permission === 'granted') {
|
|
155
|
-
// Let's check whether
|
|
56
|
+
// Let's check whether notificatio n permissions have already been granted
|
|
156
57
|
// eslint-disable-next-line no-new
|
|
157
58
|
new Notification(str);
|
|
158
59
|
} else if (Notification.permission !== 'denied') {
|
|
@@ -168,33 +69,84 @@ function desktopNotification(str) {
|
|
|
168
69
|
// want to be respectful there is no need to bother them any more.
|
|
169
70
|
|
|
170
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Renders a chat message inside a `messageTable`
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
function insertMessageIntoTable(channelObject, messageTable, message, fresh, options, userContext) {
|
|
78
|
+
var messageRow = (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext); // const message = messageRow.AJAR_subject
|
|
79
|
+
|
|
80
|
+
if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
|
|
81
|
+
messageRow.style.backgroundColor = 'yellow';
|
|
82
|
+
options.selectedElement = messageRow;
|
|
83
|
+
messageTable.selectedElement = messageRow;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
var done = false;
|
|
87
|
+
|
|
88
|
+
for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
|
|
89
|
+
if (!ele) {
|
|
90
|
+
// empty
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var newestFirst = options.newestfirst === true;
|
|
95
|
+
var dateString = messageRow.AJAR_date;
|
|
96
|
+
|
|
97
|
+
if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
|
|
98
|
+
messageTable.insertBefore(messageRow, ele);
|
|
99
|
+
done = true;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!done) {
|
|
105
|
+
messageTable.appendChild(messageRow);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
171
108
|
/**
|
|
172
109
|
* Common code for a chat (discussion area of messages about something)
|
|
173
110
|
* This version runs over a series of files for different time periods
|
|
174
111
|
*
|
|
175
112
|
* Parameters for the whole chat like its title are stored on
|
|
176
113
|
* index.ttl#this and the chats messages are stored in YYYY/MM/DD/chat.ttl
|
|
114
|
+
*
|
|
115
|
+
* Use to import store as param 2, now ignores it and uses the UI main store
|
|
116
|
+
*
|
|
117
|
+
* Options include:
|
|
118
|
+
|
|
119
|
+
- shiftEnterSendsMessage: Use shift/enter to send message, Enter to add newline, instead of the reverse.
|
|
120
|
+
- authorDateOnLeft: Display the author's anme and date of the message in the left column instead of first above the content
|
|
121
|
+
- selectedMessage: Display one message highlighted with the chat around it
|
|
122
|
+
- solo: By itelf on a webpage, so user scroll anywhere in the web page scan scroll the chat.
|
|
123
|
+
- newestFirst: Arrange the chat messages chronologically newest at the top insted of at the bottom
|
|
124
|
+
- infinite: Use infinite scroll
|
|
125
|
+
- showDeletedMessages: Show messages which have been delted as "deleted message". Otherwise hide them.
|
|
126
|
+
- expandImagesInline: If a URI by itself in a message looks like an image URI, replace it with the image
|
|
127
|
+
- inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
|
|
128
|
+
|
|
177
129
|
*/
|
|
178
130
|
|
|
179
131
|
|
|
180
|
-
function infiniteMessageArea(_x2, _x3, _x4
|
|
132
|
+
function infiniteMessageArea(_x, _x2, _x3, _x4) {
|
|
181
133
|
return _infiniteMessageArea.apply(this, arguments);
|
|
182
134
|
}
|
|
183
135
|
|
|
184
136
|
function _infiniteMessageArea() {
|
|
185
|
-
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
186
|
-
var
|
|
137
|
+
_infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(dom, wasStore, chatChannel, options) {
|
|
138
|
+
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;
|
|
187
139
|
|
|
188
|
-
return _regenerator["default"].wrap(function
|
|
140
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
189
141
|
while (1) {
|
|
190
|
-
switch (
|
|
142
|
+
switch (_context12.prev = _context12.next) {
|
|
191
143
|
case 0:
|
|
192
144
|
_loadInitialContent = function _loadInitialContent3() {
|
|
193
|
-
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
145
|
+
_loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
194
146
|
var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
|
|
195
|
-
return _regenerator["default"].wrap(function
|
|
147
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
196
148
|
while (1) {
|
|
197
|
-
switch (
|
|
149
|
+
switch (_context11.prev = _context11.next) {
|
|
198
150
|
case 0:
|
|
199
151
|
fixScroll = function _fixScroll() {
|
|
200
152
|
if (options.selectedElement) {
|
|
@@ -222,27 +174,27 @@ function _infiniteMessageArea() {
|
|
|
222
174
|
}
|
|
223
175
|
|
|
224
176
|
if (!(options.selectedMessage && !live)) {
|
|
225
|
-
|
|
177
|
+
_context11.next = 15;
|
|
226
178
|
break;
|
|
227
179
|
}
|
|
228
180
|
|
|
229
181
|
selectedDate = dateFolder.dateFromLeafDocument(selectedDocument);
|
|
230
|
-
|
|
182
|
+
_context11.next = 7;
|
|
231
183
|
return createMessageTable(selectedDate, live);
|
|
232
184
|
|
|
233
185
|
case 7:
|
|
234
|
-
selectedMessageTable =
|
|
186
|
+
selectedMessageTable = _context11.sent;
|
|
235
187
|
div.appendChild(selectedMessageTable);
|
|
236
188
|
earliest.messageTable = selectedMessageTable;
|
|
237
189
|
latest.messageTable = selectedMessageTable;
|
|
238
190
|
yank();
|
|
239
191
|
setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
|
|
240
192
|
|
|
241
|
-
|
|
193
|
+
_context11.next = 19;
|
|
242
194
|
break;
|
|
243
195
|
|
|
244
196
|
case 15:
|
|
245
|
-
|
|
197
|
+
_context11.next = 17;
|
|
246
198
|
return appendCurrentMessages();
|
|
247
199
|
|
|
248
200
|
case 17:
|
|
@@ -250,7 +202,7 @@ function _infiniteMessageArea() {
|
|
|
250
202
|
latest.messageTable = liveMessageTable;
|
|
251
203
|
|
|
252
204
|
case 19:
|
|
253
|
-
|
|
205
|
+
_context11.next = 21;
|
|
254
206
|
return loadMoreWhereNeeded(null, fixScroll);
|
|
255
207
|
|
|
256
208
|
case 21:
|
|
@@ -262,10 +214,10 @@ function _infiniteMessageArea() {
|
|
|
262
214
|
|
|
263
215
|
case 23:
|
|
264
216
|
case "end":
|
|
265
|
-
return
|
|
217
|
+
return _context11.stop();
|
|
266
218
|
}
|
|
267
219
|
}
|
|
268
|
-
},
|
|
220
|
+
}, _callee11);
|
|
269
221
|
}));
|
|
270
222
|
return _loadInitialContent.apply(this, arguments);
|
|
271
223
|
};
|
|
@@ -275,18 +227,18 @@ function _infiniteMessageArea() {
|
|
|
275
227
|
};
|
|
276
228
|
|
|
277
229
|
_loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
|
|
278
|
-
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
230
|
+
_loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(event, fixScroll) {
|
|
279
231
|
var freeze, magicZone, done, scrollBottom, scrollTop;
|
|
280
|
-
return _regenerator["default"].wrap(function
|
|
232
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
281
233
|
while (1) {
|
|
282
|
-
switch (
|
|
234
|
+
switch (_context10.prev = _context10.next) {
|
|
283
235
|
case 0:
|
|
284
236
|
if (!lock) {
|
|
285
|
-
|
|
237
|
+
_context10.next = 2;
|
|
286
238
|
break;
|
|
287
239
|
}
|
|
288
240
|
|
|
289
|
-
return
|
|
241
|
+
return _context10.abrupt("return");
|
|
290
242
|
|
|
291
243
|
case 2:
|
|
292
244
|
lock = true;
|
|
@@ -296,12 +248,12 @@ function _infiniteMessageArea() {
|
|
|
296
248
|
|
|
297
249
|
case 5:
|
|
298
250
|
if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
|
|
299
|
-
|
|
251
|
+
_context10.next = 21;
|
|
300
252
|
break;
|
|
301
253
|
}
|
|
302
254
|
|
|
303
255
|
if (!(div.scrollHeight === 0)) {
|
|
304
|
-
|
|
256
|
+
_context10.next = 10;
|
|
305
257
|
break;
|
|
306
258
|
}
|
|
307
259
|
|
|
@@ -309,17 +261,17 @@ function _infiniteMessageArea() {
|
|
|
309
261
|
setTimeout(loadMoreWhereNeeded, 2000); // couple be less
|
|
310
262
|
|
|
311
263
|
lock = false;
|
|
312
|
-
return
|
|
264
|
+
return _context10.abrupt("return");
|
|
313
265
|
|
|
314
266
|
case 10:
|
|
315
267
|
// console.log(' chat/loadMoreWhereNeeded: Going now')
|
|
316
268
|
scrollBottom = div.scrollHeight - div.scrollTop;
|
|
317
269
|
debug.log('infinite scroll: adding above: top ' + div.scrollTop);
|
|
318
|
-
|
|
270
|
+
_context10.next = 14;
|
|
319
271
|
return earliest.messageTable.extendBackwards();
|
|
320
272
|
|
|
321
273
|
case 14:
|
|
322
|
-
done =
|
|
274
|
+
done = _context10.sent;
|
|
323
275
|
|
|
324
276
|
if (freeze) {
|
|
325
277
|
div.scrollTop = div.scrollHeight - scrollBottom;
|
|
@@ -328,14 +280,14 @@ function _infiniteMessageArea() {
|
|
|
328
280
|
if (fixScroll) fixScroll();
|
|
329
281
|
|
|
330
282
|
if (!done) {
|
|
331
|
-
|
|
283
|
+
_context10.next = 19;
|
|
332
284
|
break;
|
|
333
285
|
}
|
|
334
286
|
|
|
335
|
-
return
|
|
287
|
+
return _context10.abrupt("break", 21);
|
|
336
288
|
|
|
337
289
|
case 19:
|
|
338
|
-
|
|
290
|
+
_context10.next = 5;
|
|
339
291
|
break;
|
|
340
292
|
|
|
341
293
|
case 21:
|
|
@@ -343,17 +295,17 @@ function _infiniteMessageArea() {
|
|
|
343
295
|
div.scrollHeight - div.scrollTop - div.clientHeight < magicZone && // we are scrolled right to the bottom
|
|
344
296
|
latest.messageTable && !latest.messageTable["final"] && // there is more data to come
|
|
345
297
|
latest.messageTable.extendForwards)) {
|
|
346
|
-
|
|
298
|
+
_context10.next = 33;
|
|
347
299
|
break;
|
|
348
300
|
}
|
|
349
301
|
|
|
350
302
|
scrollTop = div.scrollTop;
|
|
351
303
|
debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
|
|
352
|
-
|
|
304
|
+
_context10.next = 26;
|
|
353
305
|
return latest.messageTable.extendForwards();
|
|
354
306
|
|
|
355
307
|
case 26:
|
|
356
|
-
done =
|
|
308
|
+
done = _context10.sent;
|
|
357
309
|
|
|
358
310
|
// then add more data on the bottom
|
|
359
311
|
if (freeze) {
|
|
@@ -363,14 +315,14 @@ function _infiniteMessageArea() {
|
|
|
363
315
|
if (fixScroll) fixScroll();
|
|
364
316
|
|
|
365
317
|
if (!done) {
|
|
366
|
-
|
|
318
|
+
_context10.next = 31;
|
|
367
319
|
break;
|
|
368
320
|
}
|
|
369
321
|
|
|
370
|
-
return
|
|
322
|
+
return _context10.abrupt("break", 33);
|
|
371
323
|
|
|
372
324
|
case 31:
|
|
373
|
-
|
|
325
|
+
_context10.next = 21;
|
|
374
326
|
break;
|
|
375
327
|
|
|
376
328
|
case 33:
|
|
@@ -378,72 +330,68 @@ function _infiniteMessageArea() {
|
|
|
378
330
|
|
|
379
331
|
case 34:
|
|
380
332
|
case "end":
|
|
381
|
-
return
|
|
333
|
+
return _context10.stop();
|
|
382
334
|
}
|
|
383
335
|
}
|
|
384
|
-
},
|
|
336
|
+
}, _callee10);
|
|
385
337
|
}));
|
|
386
338
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
387
339
|
};
|
|
388
340
|
|
|
389
|
-
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(
|
|
341
|
+
loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x10, _x11) {
|
|
390
342
|
return _loadMoreWhereNeeded.apply(this, arguments);
|
|
391
343
|
};
|
|
392
344
|
|
|
393
345
|
_appendCurrentMessages = function _appendCurrentMessage2() {
|
|
394
|
-
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
346
|
+
_appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
|
|
395
347
|
var now, chatDocument, messageTable;
|
|
396
|
-
return _regenerator["default"].wrap(function
|
|
348
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
397
349
|
while (1) {
|
|
398
|
-
switch (
|
|
350
|
+
switch (_context9.prev = _context9.next) {
|
|
399
351
|
case 0:
|
|
400
352
|
now = new Date();
|
|
401
|
-
chatDocument = dateFolder.leafDocumentFromDate(now);
|
|
402
|
-
/* Don't actually make the documemnt until a message is sent @@@@@ WHEN SERVER FIXED
|
|
403
|
-
* currently server won't patch to a file ina non-existent directory
|
|
404
|
-
*/
|
|
405
|
-
|
|
406
|
-
/*
|
|
407
|
-
if (SERVER_MKDIRP_BUG) {
|
|
408
|
-
try {
|
|
409
|
-
await createIfNotExists(chatDocument)
|
|
410
|
-
} catch (e) {
|
|
411
|
-
div.appendChild(UI.widgets.errorMessageBlock(
|
|
412
|
-
dom, 'Problem accessing chat file: ' + e))
|
|
413
|
-
return
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
*/
|
|
417
|
-
/// ///////////////////////////////////////////////////////////
|
|
353
|
+
chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
|
|
418
354
|
|
|
419
|
-
|
|
355
|
+
_context9.next = 4;
|
|
420
356
|
return createMessageTable(now, true);
|
|
421
357
|
|
|
422
358
|
case 4:
|
|
423
|
-
messageTable =
|
|
359
|
+
messageTable = _context9.sent;
|
|
424
360
|
div.appendChild(messageTable);
|
|
361
|
+
div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
362
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
363
|
+
while (1) {
|
|
364
|
+
switch (_context8.prev = _context8.next) {
|
|
365
|
+
case 0:
|
|
366
|
+
_context8.next = 2;
|
|
367
|
+
return addNewChatDocumentIfNewDay(new Date());
|
|
368
|
+
|
|
369
|
+
case 2:
|
|
370
|
+
syncMessages(chatChannel, messageTable); // @@ livemessagetable??
|
|
371
|
+
|
|
372
|
+
desktopNotification(chatChannel);
|
|
373
|
+
|
|
374
|
+
case 4:
|
|
375
|
+
case "end":
|
|
376
|
+
return _context8.stop();
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}, _callee8);
|
|
380
|
+
})); // The short chat version the live update listening is done in the pane but we do it in the widget @@
|
|
425
381
|
|
|
426
|
-
div.refresh
|
|
427
|
-
// only the last messageTable is live
|
|
428
|
-
addNewTableIfNewDay(new Date()).then(function () {
|
|
429
|
-
syncMessages(chatChannel, messageTable);
|
|
430
|
-
desktopNotification(chatChannel);
|
|
431
|
-
});
|
|
432
|
-
}; // The short chat version fors live update in the pane but we do it in the widget
|
|
433
|
-
|
|
382
|
+
_logic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
434
383
|
|
|
435
|
-
kb.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
|
|
436
384
|
|
|
437
385
|
liveMessageTable = messageTable;
|
|
438
386
|
latest.messageTable = liveMessageTable;
|
|
439
|
-
return
|
|
387
|
+
return _context9.abrupt("return", messageTable);
|
|
440
388
|
|
|
441
389
|
case 11:
|
|
442
390
|
case "end":
|
|
443
|
-
return
|
|
391
|
+
return _context9.stop();
|
|
444
392
|
}
|
|
445
393
|
}
|
|
446
|
-
},
|
|
394
|
+
}, _callee9);
|
|
447
395
|
}));
|
|
448
396
|
return _appendCurrentMessages.apply(this, arguments);
|
|
449
397
|
};
|
|
@@ -452,19 +400,18 @@ function _infiniteMessageArea() {
|
|
|
452
400
|
return _appendCurrentMessages.apply(this, arguments);
|
|
453
401
|
};
|
|
454
402
|
|
|
455
|
-
|
|
456
|
-
|
|
403
|
+
_addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
|
|
404
|
+
_addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
457
405
|
var newChatDocument, oldChatDocument, sts;
|
|
458
|
-
return _regenerator["default"].wrap(function
|
|
406
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
459
407
|
while (1) {
|
|
460
|
-
switch (
|
|
408
|
+
switch (_context7.prev = _context7.next) {
|
|
461
409
|
case 0:
|
|
462
|
-
// let now = new Date()
|
|
463
410
|
// @@ Remove listener from previous table as it is now static
|
|
464
|
-
newChatDocument = dateFolder.leafDocumentFromDate(
|
|
411
|
+
newChatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
465
412
|
|
|
466
413
|
if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
|
|
467
|
-
|
|
414
|
+
_context7.next = 7;
|
|
468
415
|
break;
|
|
469
416
|
}
|
|
470
417
|
|
|
@@ -475,36 +422,37 @@ function _infiniteMessageArea() {
|
|
|
475
422
|
}
|
|
476
423
|
|
|
477
424
|
oldChatDocument = latest.messageTable.chatDocument;
|
|
478
|
-
|
|
425
|
+
_context7.next = 6;
|
|
479
426
|
return appendCurrentMessages();
|
|
480
427
|
|
|
481
428
|
case 6:
|
|
482
429
|
// Adding a link in the document will ping listeners to add the new block too
|
|
483
|
-
if (!
|
|
430
|
+
if (!_logic.store.holds(oldChatDocument, ns.rdfs('seeAlso'), newChatDocument, oldChatDocument)) {
|
|
484
431
|
sts = [$rdf.st(oldChatDocument, ns.rdfs('seeAlso'), newChatDocument, oldChatDocument)];
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
432
|
+
|
|
433
|
+
try {
|
|
434
|
+
_logic.store.updater.update([], sts);
|
|
435
|
+
} catch (err) {
|
|
436
|
+
alert('Unable to link old chat file to new one:' + err);
|
|
437
|
+
}
|
|
490
438
|
}
|
|
491
439
|
|
|
492
440
|
case 7:
|
|
493
441
|
case "end":
|
|
494
|
-
return
|
|
442
|
+
return _context7.stop();
|
|
495
443
|
}
|
|
496
444
|
}
|
|
497
|
-
},
|
|
445
|
+
}, _callee7);
|
|
498
446
|
}));
|
|
499
|
-
return
|
|
447
|
+
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
500
448
|
};
|
|
501
449
|
|
|
502
|
-
|
|
503
|
-
return
|
|
450
|
+
addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
|
|
451
|
+
return _addNewChatDocumentIfNewDay.apply(this, arguments);
|
|
504
452
|
};
|
|
505
453
|
|
|
506
454
|
renderMessageTable = function _renderMessageTable(date, live) {
|
|
507
|
-
var
|
|
455
|
+
var scrollBackbutton;
|
|
508
456
|
var scrollForwardButton; /// ///////////////// Scroll down adding more above
|
|
509
457
|
|
|
510
458
|
function extendBackwards() {
|
|
@@ -512,23 +460,23 @@ function _infiniteMessageArea() {
|
|
|
512
460
|
}
|
|
513
461
|
|
|
514
462
|
function _extendBackwards() {
|
|
515
|
-
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
463
|
+
_extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
516
464
|
var done;
|
|
517
|
-
return _regenerator["default"].wrap(function
|
|
465
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
518
466
|
while (1) {
|
|
519
|
-
switch (
|
|
467
|
+
switch (_context.prev = _context.next) {
|
|
520
468
|
case 0:
|
|
521
|
-
|
|
469
|
+
_context.next = 2;
|
|
522
470
|
return insertPreviousMessages(true);
|
|
523
471
|
|
|
524
472
|
case 2:
|
|
525
|
-
done =
|
|
473
|
+
done = _context.sent;
|
|
526
474
|
|
|
527
475
|
if (done) {
|
|
528
|
-
if (
|
|
529
|
-
|
|
476
|
+
if (scrollBackbutton) {
|
|
477
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
|
|
530
478
|
|
|
531
|
-
|
|
479
|
+
scrollBackbutton.disabled = true;
|
|
532
480
|
}
|
|
533
481
|
|
|
534
482
|
messageTable.initial = true;
|
|
@@ -536,67 +484,67 @@ function _infiniteMessageArea() {
|
|
|
536
484
|
messageTable.extendedBack = true;
|
|
537
485
|
}
|
|
538
486
|
|
|
539
|
-
|
|
540
|
-
return
|
|
487
|
+
setScrollBackbuttonIcon();
|
|
488
|
+
return _context.abrupt("return", done);
|
|
541
489
|
|
|
542
490
|
case 6:
|
|
543
491
|
case "end":
|
|
544
|
-
return
|
|
492
|
+
return _context.stop();
|
|
545
493
|
}
|
|
546
494
|
}
|
|
547
|
-
},
|
|
495
|
+
}, _callee);
|
|
548
496
|
}));
|
|
549
497
|
return _extendBackwards.apply(this, arguments);
|
|
550
498
|
}
|
|
551
499
|
|
|
552
|
-
function
|
|
553
|
-
if (!
|
|
500
|
+
function setScrollBackbuttonIcon() {
|
|
501
|
+
if (!scrollBackbutton) {
|
|
554
502
|
return;
|
|
555
503
|
}
|
|
556
504
|
|
|
557
505
|
var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
|
|
558
506
|
var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
|
|
559
|
-
|
|
507
|
+
scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
|
|
560
508
|
|
|
561
509
|
function getScrollbackIcon(sense) {
|
|
562
510
|
return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
563
511
|
}
|
|
564
512
|
}
|
|
565
513
|
|
|
566
|
-
function
|
|
567
|
-
return
|
|
514
|
+
function scrollBackbuttonHandler(_x8) {
|
|
515
|
+
return _scrollBackbuttonHandler.apply(this, arguments);
|
|
568
516
|
} /// ////////////// Scroll up adding more below
|
|
569
517
|
|
|
570
518
|
|
|
571
|
-
function
|
|
572
|
-
|
|
573
|
-
return _regenerator["default"].wrap(function
|
|
519
|
+
function _scrollBackbuttonHandler() {
|
|
520
|
+
_scrollBackbuttonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_event) {
|
|
521
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
574
522
|
while (1) {
|
|
575
|
-
switch (
|
|
523
|
+
switch (_context2.prev = _context2.next) {
|
|
576
524
|
case 0:
|
|
577
525
|
if (!messageTable.extendedBack) {
|
|
578
|
-
|
|
526
|
+
_context2.next = 6;
|
|
579
527
|
break;
|
|
580
528
|
}
|
|
581
529
|
|
|
582
530
|
removePreviousMessages(true, messageTable);
|
|
583
531
|
messageTable.extendedBack = false;
|
|
584
|
-
|
|
585
|
-
|
|
532
|
+
setScrollBackbuttonIcon();
|
|
533
|
+
_context2.next = 8;
|
|
586
534
|
break;
|
|
587
535
|
|
|
588
536
|
case 6:
|
|
589
|
-
|
|
537
|
+
_context2.next = 8;
|
|
590
538
|
return extendBackwards();
|
|
591
539
|
|
|
592
540
|
case 8:
|
|
593
541
|
case "end":
|
|
594
|
-
return
|
|
542
|
+
return _context2.stop();
|
|
595
543
|
}
|
|
596
544
|
}
|
|
597
|
-
},
|
|
545
|
+
}, _callee2);
|
|
598
546
|
}));
|
|
599
|
-
return
|
|
547
|
+
return _scrollBackbuttonHandler.apply(this, arguments);
|
|
600
548
|
}
|
|
601
549
|
|
|
602
550
|
function extendForwards() {
|
|
@@ -604,20 +552,20 @@ function _infiniteMessageArea() {
|
|
|
604
552
|
}
|
|
605
553
|
|
|
606
554
|
function _extendForwards() {
|
|
607
|
-
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
555
|
+
_extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
608
556
|
var done;
|
|
609
|
-
return _regenerator["default"].wrap(function
|
|
557
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
610
558
|
while (1) {
|
|
611
|
-
switch (
|
|
559
|
+
switch (_context3.prev = _context3.next) {
|
|
612
560
|
case 0:
|
|
613
|
-
|
|
561
|
+
_context3.next = 2;
|
|
614
562
|
return insertPreviousMessages(false);
|
|
615
563
|
|
|
616
564
|
case 2:
|
|
617
|
-
done =
|
|
565
|
+
done = _context3.sent;
|
|
618
566
|
|
|
619
567
|
if (done) {
|
|
620
|
-
scrollForwardButton.firstChild.setAttribute('src',
|
|
568
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg');
|
|
621
569
|
scrollForwardButton.disabled = true;
|
|
622
570
|
messageTable["final"] = true;
|
|
623
571
|
} else {
|
|
@@ -625,14 +573,14 @@ function _infiniteMessageArea() {
|
|
|
625
573
|
}
|
|
626
574
|
|
|
627
575
|
setScrollForwardButtonIcon();
|
|
628
|
-
return
|
|
576
|
+
return _context3.abrupt("return", done);
|
|
629
577
|
|
|
630
578
|
case 6:
|
|
631
579
|
case "end":
|
|
632
|
-
return
|
|
580
|
+
return _context3.stop();
|
|
633
581
|
}
|
|
634
582
|
}
|
|
635
|
-
},
|
|
583
|
+
}, _callee3);
|
|
636
584
|
}));
|
|
637
585
|
return _extendForwards.apply(this, arguments);
|
|
638
586
|
}
|
|
@@ -641,37 +589,48 @@ function _infiniteMessageArea() {
|
|
|
641
589
|
var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
|
|
642
590
|
|
|
643
591
|
var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
|
|
644
|
-
scrollForwardButton.firstChild.setAttribute('src',
|
|
592
|
+
scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
|
|
645
593
|
|
|
646
594
|
function getScrollForwardButtonIcon(sense) {
|
|
647
595
|
return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
|
|
648
596
|
}
|
|
649
597
|
}
|
|
650
598
|
|
|
651
|
-
function scrollForwardButtonHandler(
|
|
599
|
+
function scrollForwardButtonHandler(_x9) {
|
|
652
600
|
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
653
601
|
} /// ///////////////////////
|
|
654
602
|
|
|
603
|
+
/*
|
|
604
|
+
options = options || {}
|
|
605
|
+
options.authorDateOnLeft = true
|
|
606
|
+
const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
|
|
607
|
+
const channelObject = new ChatChannel(chatChannel, options)
|
|
608
|
+
const dateFolder = channelObject.dateFolder
|
|
609
|
+
const div = dom.createElement('div')
|
|
610
|
+
const statusArea = div.appendChild(dom.createElement('div'))
|
|
611
|
+
const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
|
|
612
|
+
*/
|
|
613
|
+
|
|
655
614
|
|
|
656
615
|
function _scrollForwardButtonHandler() {
|
|
657
|
-
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
658
|
-
return _regenerator["default"].wrap(function
|
|
616
|
+
_scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
|
|
617
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
659
618
|
while (1) {
|
|
660
|
-
switch (
|
|
619
|
+
switch (_context4.prev = _context4.next) {
|
|
661
620
|
case 0:
|
|
662
621
|
if (!messageTable.extendedForwards) {
|
|
663
|
-
|
|
622
|
+
_context4.next = 6;
|
|
664
623
|
break;
|
|
665
624
|
}
|
|
666
625
|
|
|
667
626
|
removePreviousMessages(false, messageTable);
|
|
668
627
|
messageTable.extendedForwards = false;
|
|
669
628
|
setScrollForwardButtonIcon();
|
|
670
|
-
|
|
629
|
+
_context4.next = 9;
|
|
671
630
|
break;
|
|
672
631
|
|
|
673
632
|
case 6:
|
|
674
|
-
|
|
633
|
+
_context4.next = 8;
|
|
675
634
|
return extendForwards();
|
|
676
635
|
|
|
677
636
|
case 8:
|
|
@@ -680,10 +639,10 @@ function _infiniteMessageArea() {
|
|
|
680
639
|
|
|
681
640
|
case 9:
|
|
682
641
|
case "end":
|
|
683
|
-
return
|
|
642
|
+
return _context4.stop();
|
|
684
643
|
}
|
|
685
644
|
}
|
|
686
|
-
},
|
|
645
|
+
}, _callee4);
|
|
687
646
|
}));
|
|
688
647
|
return _scrollForwardButtonHandler.apply(this, arguments);
|
|
689
648
|
}
|
|
@@ -703,7 +662,7 @@ function _infiniteMessageArea() {
|
|
|
703
662
|
messageTable["final"] = true;
|
|
704
663
|
liveMessageTable = messageTable;
|
|
705
664
|
latest.messageTable = messageTable;
|
|
706
|
-
var tr =
|
|
665
|
+
var tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
|
|
707
666
|
|
|
708
667
|
if (newestFirst) {
|
|
709
668
|
messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
|
|
@@ -718,27 +677,27 @@ function _infiniteMessageArea() {
|
|
|
718
677
|
|
|
719
678
|
|
|
720
679
|
if (options.infinite) {
|
|
721
|
-
var
|
|
722
|
-
var
|
|
680
|
+
var scrollBackbuttonTR = dom.createElement('tr');
|
|
681
|
+
var scrollBackbuttonCell = scrollBackbuttonTR.appendChild(dom.createElement('td')); // up traingles: noun_1369237.svg
|
|
723
682
|
// down triangles: noun_1369241.svg
|
|
724
683
|
|
|
725
684
|
var scrollBackIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
726
685
|
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
686
|
+
scrollBackbutton = widgets.button(dom, _iconBase.icons.iconBase + scrollBackIcon, 'Previous messages ...');
|
|
687
|
+
scrollBackbuttonCell.style = 'width:3em; height:3em;';
|
|
688
|
+
scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false);
|
|
730
689
|
messageTable.extendedBack = false;
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
var dateCell =
|
|
690
|
+
scrollBackbuttonCell.appendChild(scrollBackbutton);
|
|
691
|
+
setScrollBackbuttonIcon();
|
|
692
|
+
var dateCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
734
693
|
dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
|
|
735
|
-
dateCell.textContent =
|
|
694
|
+
dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
|
|
736
695
|
// @@@@@@@@@@@ todo move this button to other end of message cell, o
|
|
737
696
|
|
|
738
|
-
var scrollForwardButtonCell =
|
|
697
|
+
var scrollForwardButtonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
|
|
739
698
|
var scrollForwardIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
|
|
740
699
|
|
|
741
|
-
scrollForwardButton =
|
|
700
|
+
scrollForwardButton = widgets.button(dom, _iconBase.icons.iconBase + scrollForwardIcon, 'Later messages ...');
|
|
742
701
|
scrollForwardButtonCell.appendChild(scrollForwardButton);
|
|
743
702
|
scrollForwardButtonCell.style = 'width:3em; height:3em;';
|
|
744
703
|
scrollForwardButton.addEventListener('click', scrollForwardButtonHandler, false);
|
|
@@ -748,13 +707,13 @@ function _infiniteMessageArea() {
|
|
|
748
707
|
|
|
749
708
|
if (!newestFirst) {
|
|
750
709
|
// opposite end from the entry field
|
|
751
|
-
messageTable.insertBefore(
|
|
710
|
+
messageTable.insertBefore(scrollBackbuttonTR, messageTable.firstChild); // If not newestFirst
|
|
752
711
|
} else {
|
|
753
|
-
messageTable.appendChild(
|
|
712
|
+
messageTable.appendChild(scrollBackbuttonTR); // newestFirst
|
|
754
713
|
}
|
|
755
714
|
}
|
|
756
715
|
|
|
757
|
-
var sts =
|
|
716
|
+
var sts = _logic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
|
|
758
717
|
|
|
759
718
|
if (!live && sts.length === 0) {// not todays
|
|
760
719
|
// no need buttomns at the moment
|
|
@@ -771,57 +730,57 @@ function _infiniteMessageArea() {
|
|
|
771
730
|
};
|
|
772
731
|
|
|
773
732
|
_createMessageTable = function _createMessageTable3() {
|
|
774
|
-
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
733
|
+
_createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(date, live) {
|
|
775
734
|
var chatDocument, messageTable, statusTR;
|
|
776
|
-
return _regenerator["default"].wrap(function
|
|
735
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
777
736
|
while (1) {
|
|
778
|
-
switch (
|
|
737
|
+
switch (_context6.prev = _context6.next) {
|
|
779
738
|
case 0:
|
|
780
739
|
debug.log(' createMessageTable for ' + date);
|
|
781
740
|
chatDocument = dateFolder.leafDocumentFromDate(date);
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
return
|
|
741
|
+
_context6.prev = 2;
|
|
742
|
+
_context6.next = 5;
|
|
743
|
+
return _logic.store.fetcher.load(chatDocument);
|
|
785
744
|
|
|
786
745
|
case 5:
|
|
787
|
-
|
|
746
|
+
_context6.next = 19;
|
|
788
747
|
break;
|
|
789
748
|
|
|
790
749
|
case 7:
|
|
791
|
-
|
|
792
|
-
|
|
750
|
+
_context6.prev = 7;
|
|
751
|
+
_context6.t0 = _context6["catch"](2);
|
|
793
752
|
messageTable = dom.createElement('table');
|
|
794
753
|
statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
|
|
795
754
|
|
|
796
|
-
if (!(
|
|
797
|
-
|
|
755
|
+
if (!(_context6.t0.response && _context6.t0.response.status && _context6.t0.response.status === 404)) {
|
|
756
|
+
_context6.next = 16;
|
|
798
757
|
break;
|
|
799
758
|
}
|
|
800
759
|
|
|
801
760
|
debug.log('Error 404 for chat file ' + chatDocument);
|
|
802
|
-
return
|
|
761
|
+
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
803
762
|
|
|
804
763
|
case 16:
|
|
805
764
|
debug.log('*** Error NON 404 for chat file ' + chatDocument);
|
|
806
|
-
statusTR.appendChild(
|
|
765
|
+
statusTR.appendChild(widgets.errorMessageBlock(dom, _context6.t0, 'pink'));
|
|
807
766
|
|
|
808
767
|
case 18:
|
|
809
|
-
return
|
|
768
|
+
return _context6.abrupt("return", statusTR);
|
|
810
769
|
|
|
811
770
|
case 19:
|
|
812
|
-
return
|
|
771
|
+
return _context6.abrupt("return", renderMessageTable(date, live));
|
|
813
772
|
|
|
814
773
|
case 20:
|
|
815
774
|
case "end":
|
|
816
|
-
return
|
|
775
|
+
return _context6.stop();
|
|
817
776
|
}
|
|
818
777
|
}
|
|
819
|
-
},
|
|
778
|
+
}, _callee6, null, [[2, 7]]);
|
|
820
779
|
}));
|
|
821
780
|
return _createMessageTable.apply(this, arguments);
|
|
822
781
|
};
|
|
823
782
|
|
|
824
|
-
createMessageTable = function _createMessageTable2(
|
|
783
|
+
createMessageTable = function _createMessageTable2(_x6, _x7) {
|
|
825
784
|
return _createMessageTable.apply(this, arguments);
|
|
826
785
|
};
|
|
827
786
|
|
|
@@ -843,38 +802,38 @@ function _infiniteMessageArea() {
|
|
|
843
802
|
};
|
|
844
803
|
|
|
845
804
|
_insertPreviousMessages = function _insertPreviousMessag2() {
|
|
846
|
-
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
805
|
+
_insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(backwards) {
|
|
847
806
|
var extremity, date, live, todayDoc, doc, newMessageTable;
|
|
848
|
-
return _regenerator["default"].wrap(function
|
|
807
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
849
808
|
while (1) {
|
|
850
|
-
switch (
|
|
809
|
+
switch (_context5.prev = _context5.next) {
|
|
851
810
|
case 0:
|
|
852
811
|
extremity = backwards ? earliest : latest;
|
|
853
812
|
date = extremity.messageTable.date; // day in mssecs
|
|
854
813
|
|
|
855
|
-
|
|
814
|
+
_context5.next = 4;
|
|
856
815
|
return dateFolder.loadPrevious(date, backwards);
|
|
857
816
|
|
|
858
817
|
case 4:
|
|
859
|
-
date =
|
|
818
|
+
date = _context5.sent;
|
|
860
819
|
// backwards
|
|
861
820
|
debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
|
|
862
821
|
|
|
863
822
|
if (!(!date && !backwards && !liveMessageTable)) {
|
|
864
|
-
|
|
823
|
+
_context5.next = 9;
|
|
865
824
|
break;
|
|
866
825
|
}
|
|
867
826
|
|
|
868
|
-
|
|
827
|
+
_context5.next = 9;
|
|
869
828
|
return appendCurrentMessages();
|
|
870
829
|
|
|
871
830
|
case 9:
|
|
872
831
|
if (date) {
|
|
873
|
-
|
|
832
|
+
_context5.next = 11;
|
|
874
833
|
break;
|
|
875
834
|
}
|
|
876
835
|
|
|
877
|
-
return
|
|
836
|
+
return _context5.abrupt("return", true);
|
|
878
837
|
|
|
879
838
|
case 11:
|
|
880
839
|
// done
|
|
@@ -886,11 +845,11 @@ function _infiniteMessageArea() {
|
|
|
886
845
|
live = doc.sameTerm(todayDoc); // Is this todays?
|
|
887
846
|
}
|
|
888
847
|
|
|
889
|
-
|
|
848
|
+
_context5.next = 15;
|
|
890
849
|
return createMessageTable(date, live);
|
|
891
850
|
|
|
892
851
|
case 15:
|
|
893
|
-
newMessageTable =
|
|
852
|
+
newMessageTable = _context5.sent;
|
|
894
853
|
extremity.messageTable = newMessageTable; // move pointer to earliest
|
|
895
854
|
|
|
896
855
|
if (backwards ? newestFirst : !newestFirst) {
|
|
@@ -901,30 +860,30 @@ function _infiniteMessageArea() {
|
|
|
901
860
|
div.insertBefore(newMessageTable, div.firstChild);
|
|
902
861
|
}
|
|
903
862
|
|
|
904
|
-
return
|
|
863
|
+
return _context5.abrupt("return", live);
|
|
905
864
|
|
|
906
865
|
case 19:
|
|
907
866
|
case "end":
|
|
908
|
-
return
|
|
867
|
+
return _context5.stop();
|
|
909
868
|
}
|
|
910
869
|
}
|
|
911
|
-
},
|
|
870
|
+
}, _callee5);
|
|
912
871
|
}));
|
|
913
872
|
return _insertPreviousMessages.apply(this, arguments);
|
|
914
873
|
};
|
|
915
874
|
|
|
916
|
-
insertPreviousMessages = function _insertPreviousMessag(
|
|
875
|
+
insertPreviousMessages = function _insertPreviousMessag(_x5) {
|
|
917
876
|
return _insertPreviousMessages.apply(this, arguments);
|
|
918
877
|
};
|
|
919
878
|
|
|
920
879
|
addMessage = function _addMessage(message, messageTable) {
|
|
921
|
-
var
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
(
|
|
880
|
+
var latest = (0, _chatLogic.mostRecentVersion)(message); // const content = store.any(latest, ns.sioc('content'))
|
|
881
|
+
|
|
882
|
+
if ((0, _chatLogic.isDeleted)(latest) && !options.showDeletedMessages) {
|
|
883
|
+
return; // ignore deleted messaged -- @@ could also leave a placeholder
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext); // fresh from elsewhere
|
|
928
887
|
};
|
|
929
888
|
|
|
930
889
|
syncMessages = function _syncMessages(about, messageTable) {
|
|
@@ -937,9 +896,10 @@ function _infiniteMessageArea() {
|
|
|
937
896
|
}
|
|
938
897
|
}
|
|
939
898
|
|
|
940
|
-
var messages =
|
|
899
|
+
var messages = _logic.store.statementsMatching(about, ns.wf('message'), null, messageTable.chatDocument).map(function (st) {
|
|
941
900
|
return st.object;
|
|
942
901
|
});
|
|
902
|
+
|
|
943
903
|
var stored = {};
|
|
944
904
|
messages.forEach(function (m) {
|
|
945
905
|
stored[m.uri] = true;
|
|
@@ -962,368 +922,28 @@ function _infiniteMessageArea() {
|
|
|
962
922
|
for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
|
|
963
923
|
if (ele.AJAR_subject) {
|
|
964
924
|
// Refresh thumbs up etc
|
|
965
|
-
|
|
925
|
+
widgets.refreshTree(ele); // Things inside may have changed too
|
|
966
926
|
}
|
|
967
927
|
}
|
|
968
928
|
};
|
|
969
929
|
|
|
970
|
-
|
|
971
|
-
var form = dom.createElement('tr');
|
|
972
|
-
var lhs = dom.createElement('td');
|
|
973
|
-
var middle = dom.createElement('td');
|
|
974
|
-
var rhs = dom.createElement('td');
|
|
975
|
-
form.appendChild(lhs);
|
|
976
|
-
form.appendChild(middle);
|
|
977
|
-
form.appendChild(rhs);
|
|
978
|
-
form.AJAR_date = '9999-01-01T00:00:00Z'; // ISO format for field sort
|
|
979
|
-
|
|
980
|
-
var field, sendButton;
|
|
981
|
-
|
|
982
|
-
function sendMessage(_x6) {
|
|
983
|
-
return _sendMessage.apply(this, arguments);
|
|
984
|
-
} // sendMessage
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
function _sendMessage() {
|
|
988
|
-
_sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(text) {
|
|
989
|
-
var now, sts, timestamp, dateStamp, chatDocument, message, content, sendComplete;
|
|
990
|
-
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
991
|
-
while (1) {
|
|
992
|
-
switch (_context6.prev = _context6.next) {
|
|
993
|
-
case 0:
|
|
994
|
-
sendComplete = function _sendComplete() {
|
|
995
|
-
var bindings = {
|
|
996
|
-
'?msg': message,
|
|
997
|
-
'?content': content,
|
|
998
|
-
'?date': dateStamp,
|
|
999
|
-
'?creator': me
|
|
1000
|
-
};
|
|
1001
|
-
(0, _message.renderMessage)(liveMessageTable, bindings, false, options, userContext); // not green
|
|
1002
|
-
|
|
1003
|
-
if (!text) {
|
|
1004
|
-
field.value = ''; // clear from out for reuse
|
|
1005
|
-
|
|
1006
|
-
field.setAttribute('style', messageBodyStyle);
|
|
1007
|
-
field.disabled = false;
|
|
1008
|
-
field.scrollIntoView(newestFirst); // allign bottom (top)
|
|
1009
|
-
|
|
1010
|
-
field.focus(); // Start typing next line immediately
|
|
1011
|
-
|
|
1012
|
-
field.select();
|
|
1013
|
-
}
|
|
1014
|
-
};
|
|
1015
|
-
|
|
1016
|
-
now = new Date();
|
|
1017
|
-
_context6.next = 4;
|
|
1018
|
-
return addNewTableIfNewDay(now);
|
|
1019
|
-
|
|
1020
|
-
case 4:
|
|
1021
|
-
if (!text) {
|
|
1022
|
-
field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
|
|
1023
|
-
|
|
1024
|
-
field.disabled = true;
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
sts = [];
|
|
1028
|
-
timestamp = '' + now.getTime();
|
|
1029
|
-
dateStamp = $rdf.term(now);
|
|
1030
|
-
chatDocument = dateFolder.leafDocumentFromDate(now);
|
|
1031
|
-
message = kb.sym(chatDocument.uri + '#' + 'Msg' + timestamp);
|
|
1032
|
-
content = kb.literal(text || field.value); // if (text) field.value = text No - don't destroy half-finsihed user input
|
|
1033
|
-
|
|
1034
|
-
sts.push(new $rdf.Statement(chatChannel, ns.wf('message'), message, chatDocument));
|
|
1035
|
-
sts.push(new $rdf.Statement(message, ns.sioc('content'), content, chatDocument));
|
|
1036
|
-
sts.push(new $rdf.Statement(message, DCT('created'), dateStamp, chatDocument));
|
|
1037
|
-
|
|
1038
|
-
if (me) {
|
|
1039
|
-
sts.push(new $rdf.Statement(message, ns.foaf('maker'), me, chatDocument));
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
if (!(SERVER_MKDIRP_BUG && (kb.fetcher.requested[chatDocument.uri] === undefined || kb.fetcher.requested[chatDocument.uri] === 404))) {
|
|
1043
|
-
_context6.next = 19;
|
|
1044
|
-
break;
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
debug.log('@@@ SERVER_MKDIRP_BUG: Should only happen once: create chat file: ' + chatDocument);
|
|
1048
|
-
_context6.next = 19;
|
|
1049
|
-
return createIfNotExists(chatDocument);
|
|
1050
|
-
|
|
1051
|
-
case 19:
|
|
1052
|
-
_context6.prev = 19;
|
|
1053
|
-
_context6.next = 22;
|
|
1054
|
-
return updater.update([], sts);
|
|
1055
|
-
|
|
1056
|
-
case 22:
|
|
1057
|
-
_context6.next = 28;
|
|
1058
|
-
break;
|
|
1059
|
-
|
|
1060
|
-
case 24:
|
|
1061
|
-
_context6.prev = 24;
|
|
1062
|
-
_context6.t0 = _context6["catch"](19);
|
|
1063
|
-
form.appendChild(UI.widgets.errorMessageBlock(dom, 'Error writing message: ' + _context6.t0));
|
|
1064
|
-
return _context6.abrupt("return");
|
|
1065
|
-
|
|
1066
|
-
case 28:
|
|
1067
|
-
sendComplete();
|
|
1068
|
-
|
|
1069
|
-
case 29:
|
|
1070
|
-
case "end":
|
|
1071
|
-
return _context6.stop();
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
}, _callee6, null, [[19, 24]]);
|
|
1075
|
-
}));
|
|
1076
|
-
return _sendMessage.apply(this, arguments);
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
form.appendChild(dom.createElement('br')); // DRAG AND DROP
|
|
1080
|
-
|
|
1081
|
-
function droppedFileHandler(files) {
|
|
1082
|
-
var base = messageTable.chatDocument.dir().uri;
|
|
1083
|
-
UI.widgets.uploadFiles(kb.fetcher, files, base + 'Files', base + 'Pictures', /*#__PURE__*/function () {
|
|
1084
|
-
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(theFile, destURI) {
|
|
1085
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
1086
|
-
while (1) {
|
|
1087
|
-
switch (_context2.prev = _context2.next) {
|
|
1088
|
-
case 0:
|
|
1089
|
-
_context2.next = 2;
|
|
1090
|
-
return sendMessage(destURI);
|
|
1091
|
-
|
|
1092
|
-
case 2:
|
|
1093
|
-
case "end":
|
|
1094
|
-
return _context2.stop();
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
}, _callee2);
|
|
1098
|
-
}));
|
|
1099
|
-
|
|
1100
|
-
return function (_x7, _x8) {
|
|
1101
|
-
return _ref.apply(this, arguments);
|
|
1102
|
-
};
|
|
1103
|
-
}());
|
|
1104
|
-
} // When a set of URIs are dropped on the field
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
var droppedURIHandler = /*#__PURE__*/function () {
|
|
1108
|
-
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(uris) {
|
|
1109
|
-
var _iterator, _step, uri;
|
|
1110
|
-
|
|
1111
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
1112
|
-
while (1) {
|
|
1113
|
-
switch (_context3.prev = _context3.next) {
|
|
1114
|
-
case 0:
|
|
1115
|
-
_iterator = _createForOfIteratorHelper(uris);
|
|
1116
|
-
_context3.prev = 1;
|
|
1117
|
-
|
|
1118
|
-
_iterator.s();
|
|
1119
|
-
|
|
1120
|
-
case 3:
|
|
1121
|
-
if ((_step = _iterator.n()).done) {
|
|
1122
|
-
_context3.next = 9;
|
|
1123
|
-
break;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
uri = _step.value;
|
|
1127
|
-
_context3.next = 7;
|
|
1128
|
-
return sendMessage(uri);
|
|
1129
|
-
|
|
1130
|
-
case 7:
|
|
1131
|
-
_context3.next = 3;
|
|
1132
|
-
break;
|
|
1133
|
-
|
|
1134
|
-
case 9:
|
|
1135
|
-
_context3.next = 14;
|
|
1136
|
-
break;
|
|
1137
|
-
|
|
1138
|
-
case 11:
|
|
1139
|
-
_context3.prev = 11;
|
|
1140
|
-
_context3.t0 = _context3["catch"](1);
|
|
1141
|
-
|
|
1142
|
-
_iterator.e(_context3.t0);
|
|
1143
|
-
|
|
1144
|
-
case 14:
|
|
1145
|
-
_context3.prev = 14;
|
|
1146
|
-
|
|
1147
|
-
_iterator.f();
|
|
1148
|
-
|
|
1149
|
-
return _context3.finish(14);
|
|
1150
|
-
|
|
1151
|
-
case 17:
|
|
1152
|
-
case "end":
|
|
1153
|
-
return _context3.stop();
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
}, _callee3, null, [[1, 11, 14, 17]]);
|
|
1157
|
-
}));
|
|
1158
|
-
|
|
1159
|
-
return function droppedURIHandler(_x9) {
|
|
1160
|
-
return _ref2.apply(this, arguments);
|
|
1161
|
-
};
|
|
1162
|
-
}(); // When we are actually logged on
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
function turnOnInput() {
|
|
1166
|
-
if (options.menuHandler && menuButton) {
|
|
1167
|
-
var menuOptions = {
|
|
1168
|
-
me: me,
|
|
1169
|
-
dom: dom,
|
|
1170
|
-
div: div,
|
|
1171
|
-
newBase: messageTable.chatDocument.dir().uri
|
|
1172
|
-
};
|
|
1173
|
-
menuButton.addEventListener('click', function (event) {
|
|
1174
|
-
options.menuHandler(event, chatChannel, menuOptions);
|
|
1175
|
-
}, false);
|
|
1176
|
-
} // Turn on message input
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
(0, _message.creatorAndDate)(lhs, me, '', null);
|
|
1180
|
-
field = dom.createElement('textarea');
|
|
1181
|
-
middle.innerHTML = '';
|
|
1182
|
-
middle.appendChild(field);
|
|
1183
|
-
field.rows = 3; // field.cols = 40
|
|
1184
|
-
|
|
1185
|
-
field.setAttribute('style', messageBodyStyle + 'background-color: #eef;'); // Trap the Enter BEFORE it is used ti make a newline
|
|
1186
|
-
|
|
1187
|
-
field.addEventListener('keydown', /*#__PURE__*/function () {
|
|
1188
|
-
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(e) {
|
|
1189
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
1190
|
-
while (1) {
|
|
1191
|
-
switch (_context4.prev = _context4.next) {
|
|
1192
|
-
case 0:
|
|
1193
|
-
if (!(e.keyCode === 13)) {
|
|
1194
|
-
_context4.next = 4;
|
|
1195
|
-
break;
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
if (e.altKey) {
|
|
1199
|
-
_context4.next = 4;
|
|
1200
|
-
break;
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
_context4.next = 4;
|
|
1204
|
-
return sendMessage();
|
|
1205
|
-
|
|
1206
|
-
case 4:
|
|
1207
|
-
case "end":
|
|
1208
|
-
return _context4.stop();
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
}, _callee4);
|
|
1212
|
-
}));
|
|
1213
|
-
|
|
1214
|
-
return function (_x10) {
|
|
1215
|
-
return _ref3.apply(this, arguments);
|
|
1216
|
-
};
|
|
1217
|
-
}(), false);
|
|
1218
|
-
UI.widgets.makeDropTarget(field, droppedURIHandler, droppedFileHandler);
|
|
1219
|
-
rhs.innerHTML = '';
|
|
1220
|
-
sendButton = UI.widgets.button(dom, UI.icons.iconBase + 'noun_383448.svg', 'Send');
|
|
1221
|
-
sendButton.setAttribute('style', UI.style.buttonStyle + 'float: right;');
|
|
1222
|
-
sendButton.addEventListener('click', function (_event) {
|
|
1223
|
-
return sendMessage();
|
|
1224
|
-
}, false);
|
|
1225
|
-
rhs.appendChild(sendButton);
|
|
1226
|
-
var chatDocument = dateFolder.leafDocumentFromDate(new Date());
|
|
1227
|
-
var imageDoc;
|
|
1228
|
-
|
|
1229
|
-
function getImageDoc() {
|
|
1230
|
-
imageDoc = kb.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
|
|
1231
|
-
return imageDoc;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
function tookPicture(_x11) {
|
|
1235
|
-
return _tookPicture.apply(this, arguments);
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
function _tookPicture() {
|
|
1239
|
-
_tookPicture = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(imageDoc) {
|
|
1240
|
-
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
1241
|
-
while (1) {
|
|
1242
|
-
switch (_context5.prev = _context5.next) {
|
|
1243
|
-
case 0:
|
|
1244
|
-
if (!imageDoc) {
|
|
1245
|
-
_context5.next = 3;
|
|
1246
|
-
break;
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
_context5.next = 3;
|
|
1250
|
-
return sendMessage(imageDoc.uri);
|
|
1251
|
-
|
|
1252
|
-
case 3:
|
|
1253
|
-
case "end":
|
|
1254
|
-
return _context5.stop();
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
}, _callee5);
|
|
1258
|
-
}));
|
|
1259
|
-
return _tookPicture.apply(this, arguments);
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
middle.appendChild(UI.media.cameraButton(dom, kb, getImageDoc, tookPicture));
|
|
1263
|
-
UI.pad.recordParticipation(chatChannel, chatChannel.doc()); // participation =
|
|
1264
|
-
} // turn on inpuut
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
var context = {
|
|
1268
|
-
div: middle,
|
|
1269
|
-
dom: dom
|
|
1270
|
-
};
|
|
1271
|
-
UI.authn.logIn(context).then(function (context) {
|
|
1272
|
-
me = context.me;
|
|
1273
|
-
turnOnInput();
|
|
1274
|
-
Object.assign(context, userContext);
|
|
1275
|
-
(0, _bookmarks.findBookmarkDocument)(context).then(function (context) {
|
|
1276
|
-
debug.log('Bookmark file: ' + context.bookmarkDocument);
|
|
1277
|
-
});
|
|
1278
|
-
});
|
|
1279
|
-
return form;
|
|
1280
|
-
};
|
|
1281
|
-
|
|
1282
|
-
kb = kb || UI.store;
|
|
1283
|
-
ns = UI.ns;
|
|
1284
|
-
WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#');
|
|
1285
|
-
DCT = $rdf.Namespace('http://purl.org/dc/terms/'); // const POSIX = $rdf.Namespace('http://www.w3.org/ns/posix/stat#')
|
|
1286
|
-
|
|
930
|
+
// Body of main function
|
|
1287
931
|
options = options || {};
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
dateFolder = new _dateFolder.DateFolder(chatChannel, 'chat.ttl');
|
|
1291
|
-
options.authorAboveContent = true; // var participation // An object tracking users use and prefs
|
|
932
|
+
options.authorDateOnLeft = false; // @@ make a user optiosn
|
|
1292
933
|
|
|
1293
|
-
|
|
1294
|
-
// 'font-size: 100%; margin: 0.1em 1em 0.1em 1em; background-color: white; white-space: pre-wrap; padding: 0.1em;'
|
|
934
|
+
newestFirst = options.newestFirst === '1' || options.newestFirst === true; // hack for now
|
|
1295
935
|
|
|
936
|
+
channelObject = new _chatLogic.ChatChannel(chatChannel, options);
|
|
937
|
+
dateFolder = channelObject.dateFolder;
|
|
1296
938
|
div = dom.createElement('div');
|
|
939
|
+
channelObject.div = div;
|
|
1297
940
|
statusArea = div.appendChild(dom.createElement('div'));
|
|
1298
941
|
userContext = {
|
|
1299
942
|
dom: dom,
|
|
1300
943
|
statusArea: statusArea,
|
|
1301
944
|
div: statusArea
|
|
1302
945
|
}; // logged on state, pointers to user's stuff
|
|
1303
|
-
|
|
1304
|
-
updater = UI.store.updater;
|
|
1305
|
-
/** Does a file exist on the web?
|
|
1306
|
-
* @returns {Boolean}
|
|
1307
|
-
*/
|
|
1308
|
-
|
|
1309
|
-
/*
|
|
1310
|
-
async function documentExists (doc) {
|
|
1311
|
-
try {
|
|
1312
|
-
await kb.fetcher.load(doc)
|
|
1313
|
-
} catch (err) {
|
|
1314
|
-
if (err.response.status === 404) {
|
|
1315
|
-
return false
|
|
1316
|
-
} else {
|
|
1317
|
-
debug.log('documentExists: doc load error NOT 404: ' + doc + ': ' + err)
|
|
1318
|
-
throw err
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
return true
|
|
1322
|
-
}
|
|
1323
|
-
*/
|
|
1324
|
-
|
|
1325
|
-
/* Form for a new message
|
|
1326
|
-
*/
|
|
946
|
+
// const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
|
|
1327
947
|
|
|
1328
948
|
earliest = {
|
|
1329
949
|
messageTable: null
|
|
@@ -1333,18 +953,18 @@ function _infiniteMessageArea() {
|
|
|
1333
953
|
messageTable: null
|
|
1334
954
|
};
|
|
1335
955
|
lock = false;
|
|
1336
|
-
|
|
956
|
+
_context12.next = 30;
|
|
1337
957
|
return loadInitialContent();
|
|
1338
958
|
|
|
1339
|
-
case
|
|
1340
|
-
return
|
|
959
|
+
case 30:
|
|
960
|
+
return _context12.abrupt("return", div);
|
|
1341
961
|
|
|
1342
|
-
case
|
|
962
|
+
case 31:
|
|
1343
963
|
case "end":
|
|
1344
|
-
return
|
|
964
|
+
return _context12.stop();
|
|
1345
965
|
}
|
|
1346
966
|
}
|
|
1347
|
-
},
|
|
967
|
+
}, _callee12);
|
|
1348
968
|
}));
|
|
1349
969
|
return _infiniteMessageArea.apply(this, arguments);
|
|
1350
970
|
}
|