solid-ui 2.4.31-13dc2247 → 2.4.31-26d24f44
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/805.solid-ui.min.js +1 -1
- package/dist/805.solid-ui.min.js.map +1 -1
- package/dist/solid-ui.js +1641 -4633
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.js.LICENSE.txt +1 -1
- package/dist/solid-ui.min.js.map +1 -1
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js +1957 -1957
- package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js.map +1 -1
- package/lib/chat/bookmarks.js +7 -6
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +66 -251
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/dateFolder.js +126 -131
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +416 -611
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +191 -328
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +276 -462
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +208 -299
- package/lib/chat/thread.js.map +1 -1
- package/lib/preferences.js +0 -4
- package/lib/preferences.js.map +1 -1
- package/lib/tabs.js +1 -1
- package/lib/tabs.js.map +1 -1
- package/lib/utils/keyHelpers/accessData.d.ts +2 -2
- package/lib/utils/keyHelpers/accessData.d.ts.map +1 -1
- package/lib/utils/keyHelpers/accessData.js +115 -59
- package/lib/utils/keyHelpers/accessData.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/package.json +2 -2
- package/lib/utils/keyHelpers/otherHelpers.d.ts +0 -3
- package/lib/utils/keyHelpers/otherHelpers.d.ts.map +0 -1
- package/lib/utils/keyHelpers/otherHelpers.js +0 -22
- package/lib/utils/keyHelpers/otherHelpers.js.map +0 -1
package/lib/chat/thread.js
CHANGED
|
@@ -53,7 +53,8 @@ function thread(dom, kb, subject, messageStore, options) {
|
|
|
53
53
|
|
|
54
54
|
var div = dom.createElement('div');
|
|
55
55
|
// eslint-disable-next-line prefer-const
|
|
56
|
-
var messageTable;
|
|
56
|
+
var messageTable; // Shared by initial build and addMessageFromBindings
|
|
57
|
+
|
|
57
58
|
var me;
|
|
58
59
|
var updater = _solidLogic.store.updater;
|
|
59
60
|
var anchor = function anchor(text, term) {
|
|
@@ -99,66 +100,34 @@ function thread(dom, kb, subject, messageStore, options) {
|
|
|
99
100
|
form.appendChild(rhs);
|
|
100
101
|
form.AJAR_date = '9999-01-01T00:00:00Z'; // ISO format for field sort
|
|
101
102
|
|
|
102
|
-
var sendMessage =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
123
|
-
while (1) switch (_context.prev = _context.next) {
|
|
124
|
-
case 0:
|
|
125
|
-
if (!success) {
|
|
126
|
-
form.appendChild(UI.widgets.errorMessageBlock(dom, 'Error writing message: ' + body));
|
|
127
|
-
} else {
|
|
128
|
-
bindings = {
|
|
129
|
-
'?msg': message,
|
|
130
|
-
'?content': _solidLogic.store.literal(field.value),
|
|
131
|
-
'?date': dateStamp,
|
|
132
|
-
'?creator': me
|
|
133
|
-
};
|
|
134
|
-
renderMessage(bindings, false); // not green
|
|
103
|
+
var sendMessage = function sendMessage() {
|
|
104
|
+
// titlefield.setAttribute('class','pendingedit')
|
|
105
|
+
// titlefield.disabled = true
|
|
106
|
+
field.setAttribute('class', 'pendingedit');
|
|
107
|
+
field.disabled = true;
|
|
108
|
+
var _appendMsg = appendMsg(field.value),
|
|
109
|
+
message = _appendMsg.message,
|
|
110
|
+
dateStamp = _appendMsg.dateStamp,
|
|
111
|
+
sts = _appendMsg.sts;
|
|
112
|
+
var sendComplete = function sendComplete(uri, success, body) {
|
|
113
|
+
if (!success) {
|
|
114
|
+
form.appendChild(UI.widgets.errorMessageBlock(dom, 'Error writing message: ' + body));
|
|
115
|
+
} else {
|
|
116
|
+
var bindings = {
|
|
117
|
+
'?msg': message,
|
|
118
|
+
'?content': _solidLogic.store.literal(field.value),
|
|
119
|
+
'?date': dateStamp,
|
|
120
|
+
'?creator': me
|
|
121
|
+
};
|
|
122
|
+
renderMessage(bindings, false); // not green
|
|
135
123
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
case 1:
|
|
141
|
-
case "end":
|
|
142
|
-
return _context.stop();
|
|
143
|
-
}
|
|
144
|
-
}, _callee);
|
|
145
|
-
}));
|
|
146
|
-
return function sendComplete(_x, _x2, _x3) {
|
|
147
|
-
return _ref2.apply(this, arguments);
|
|
148
|
-
};
|
|
149
|
-
}();
|
|
150
|
-
_context2.next = 11;
|
|
151
|
-
return updater.updateMany([], sts, sendComplete);
|
|
152
|
-
case 11:
|
|
153
|
-
case "end":
|
|
154
|
-
return _context2.stop();
|
|
155
|
-
}
|
|
156
|
-
}, _callee2);
|
|
157
|
-
}));
|
|
158
|
-
return function sendMessage() {
|
|
159
|
-
return _ref.apply(this, arguments);
|
|
124
|
+
field.value = ''; // clear from out for reuse
|
|
125
|
+
field.setAttribute('class', '');
|
|
126
|
+
field.disabled = false;
|
|
127
|
+
}
|
|
160
128
|
};
|
|
161
|
-
|
|
129
|
+
updater.update([], sts, sendComplete);
|
|
130
|
+
};
|
|
162
131
|
form.appendChild(dom.createElement('br'));
|
|
163
132
|
var field, sendButton;
|
|
164
133
|
var turnOnInput = function turnOnInput() {
|
|
@@ -169,31 +138,15 @@ function thread(dom, kb, subject, messageStore, options) {
|
|
|
169
138
|
field.rows = 3;
|
|
170
139
|
// field.cols = 40
|
|
171
140
|
field.setAttribute('style', messageBodyStyle + 'background-color: #eef;');
|
|
172
|
-
field.addEventListener('keyup',
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (e.altKey) {
|
|
182
|
-
_context3.next = 4;
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
_context3.next = 4;
|
|
186
|
-
return sendMessage();
|
|
187
|
-
case 4:
|
|
188
|
-
case "end":
|
|
189
|
-
return _context3.stop();
|
|
190
|
-
}
|
|
191
|
-
}, _callee3);
|
|
192
|
-
}));
|
|
193
|
-
return function (_x4) {
|
|
194
|
-
return _ref3.apply(this, arguments);
|
|
195
|
-
};
|
|
196
|
-
}(), false);
|
|
141
|
+
field.addEventListener('keyup', function (e) {
|
|
142
|
+
// User preference?
|
|
143
|
+
if (e.keyCode === 13) {
|
|
144
|
+
if (!e.altKey) {
|
|
145
|
+
// Alt-Enter just adds a new line
|
|
146
|
+
sendMessage();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}, false);
|
|
197
150
|
rhs.innerHTML = '';
|
|
198
151
|
sendButton = UI.widgets.button(dom, UI.icons.iconBase + 'noun_383448.svg', 'Send');
|
|
199
152
|
sendButton.setAttribute('style', UI.style.buttonStyle + 'float: right;');
|
|
@@ -210,64 +163,94 @@ function thread(dom, kb, subject, messageStore, options) {
|
|
|
210
163
|
});
|
|
211
164
|
return form;
|
|
212
165
|
};
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
166
|
+
|
|
167
|
+
/* const sendMessage = function (oldMsg, options) { // alain
|
|
168
|
+
// titlefield.setAttribute('class','pendingedit')
|
|
169
|
+
// titlefield.disabled = true
|
|
170
|
+
field.setAttribute('class', 'pendingedit')
|
|
171
|
+
field.disabled = true
|
|
172
|
+
const sts = []
|
|
173
|
+
const now = new Date()
|
|
174
|
+
const timestamp = '' + now.getTime()
|
|
175
|
+
const dateStamp = $rdf.term(now)
|
|
176
|
+
// http://www.w3schools.com/jsref/jsref_obj_date.asp
|
|
177
|
+
const message = store.sym(messageStore.uri + '#' + 'Msg' + timestamp)
|
|
178
|
+
if (options === 'edit' || options === 'delete') {
|
|
179
|
+
sts.push(
|
|
180
|
+
new $rdf.Statement(mostRecentVersion(oldMsg), DCT('isReplacedBy'), message, messageStore)
|
|
181
|
+
)
|
|
182
|
+
} else {
|
|
183
|
+
sts.push(
|
|
184
|
+
new $rdf.Statement(subject, ns.wf('message'), message, messageStore)
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
// sts.push(new $rdf.Statement(message, ns.dc('title'), store.literal(titlefield.value), messageStore))
|
|
188
|
+
const msgBody = options !== 'delete' ? field.value : `message deleted\nby ${nick(me)}`
|
|
189
|
+
sts.push(
|
|
190
|
+
new $rdf.Statement(
|
|
191
|
+
message,
|
|
192
|
+
ns.sioc('content'),
|
|
193
|
+
store.literal(msgBody),
|
|
194
|
+
messageStore
|
|
195
|
+
)
|
|
196
|
+
)
|
|
197
|
+
sts.push(
|
|
198
|
+
new $rdf.Statement(message, DCT('created'), dateStamp, messageStore)
|
|
199
|
+
)
|
|
200
|
+
if (me) {
|
|
201
|
+
sts.push(
|
|
202
|
+
new $rdf.Statement(message, ns.foaf('maker'), me, messageStore)
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
const sendComplete = function (uri, success, body) {
|
|
206
|
+
if (!success) {
|
|
207
|
+
form.appendChild(
|
|
208
|
+
UI.widgets.errorMessageBlock(dom, 'Error writing message: ' + body)
|
|
209
|
+
)
|
|
210
|
+
} else {
|
|
211
|
+
const bindings = {
|
|
212
|
+
'?msg': message,
|
|
213
|
+
'?content': store.literal(field.value),
|
|
214
|
+
'?date': dateStamp,
|
|
215
|
+
'?creator': me
|
|
216
|
+
}
|
|
217
|
+
renderMessage(bindings, false) // not green
|
|
218
|
+
field.value = '' // clear from out for reuse
|
|
219
|
+
field.setAttribute('class', '')
|
|
220
|
+
field.disabled = false
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
updater.update([], sts, sendComplete)
|
|
224
|
+
} */
|
|
225
|
+
|
|
226
|
+
var appendMsg = function appendMsg(fieldValue) {
|
|
227
|
+
var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
228
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
229
|
+
// alain
|
|
230
|
+
var sts = [];
|
|
231
|
+
var now = new Date();
|
|
232
|
+
var timestamp = '' + now.getTime();
|
|
233
|
+
var dateStamp = $rdf.term(now);
|
|
234
|
+
// http://www.w3schools.com/jsref/jsref_obj_date.asp
|
|
235
|
+
var message = _solidLogic.store.sym(messageStore.uri + '#' + 'Msg' + timestamp);
|
|
236
|
+
if (options === 'edit' || options === 'delete') {
|
|
237
|
+
sts.push(new $rdf.Statement(mostRecentVersion(oldMsg), DCT('isReplacedBy'), message, messageStore));
|
|
238
|
+
} else {
|
|
239
|
+
sts.push(new $rdf.Statement(subject, ns.wf('message'), message, messageStore));
|
|
240
|
+
}
|
|
241
|
+
// sts.push(new $rdf.Statement(message, ns.dc('title'), store.literal(titlefield.value), messageStore))
|
|
242
|
+
var msgBody = options !== 'delete' ? fieldValue : "message deleted\nby ".concat(nick(me));
|
|
243
|
+
sts.push(new $rdf.Statement(message, ns.sioc('content'), _solidLogic.store.literal(msgBody), messageStore));
|
|
244
|
+
sts.push(new $rdf.Statement(message, DCT('created'), dateStamp, messageStore));
|
|
245
|
+
if (me) {
|
|
246
|
+
sts.push(new $rdf.Statement(message, ns.foaf('maker'), me, messageStore));
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
message: message,
|
|
250
|
+
dateStamp: dateStamp,
|
|
251
|
+
sts: sts
|
|
269
252
|
};
|
|
270
|
-
}
|
|
253
|
+
};
|
|
271
254
|
function nick(person) {
|
|
272
255
|
var s = _solidLogic.store.any(person, UI.ns.foaf('nick'));
|
|
273
256
|
if (s) return '' + s.value;
|
|
@@ -316,186 +299,112 @@ function thread(dom, kb, subject, messageStore, options) {
|
|
|
316
299
|
var msg = message;
|
|
317
300
|
// const listMsg = []
|
|
318
301
|
while (msg) {
|
|
319
|
-
message = msg;
|
|
320
302
|
// listMsg.push(msg)
|
|
321
303
|
msg = _solidLogic.store.statementsMatching(message, DCT('isReplacedBy'));
|
|
322
304
|
}
|
|
323
|
-
return
|
|
305
|
+
return msg;
|
|
324
306
|
};
|
|
325
307
|
var _deleteMessage = /*#__PURE__*/function () {
|
|
326
|
-
var
|
|
308
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(message) {
|
|
327
309
|
var deletions;
|
|
328
|
-
return _regenerator["default"].wrap(function
|
|
329
|
-
while (1) switch (
|
|
310
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
311
|
+
while (1) switch (_context.prev = _context.next) {
|
|
330
312
|
case 0:
|
|
331
|
-
|
|
313
|
+
_context.next = 2;
|
|
332
314
|
return _solidLogic.store.connectedStatements(message, messageStore);
|
|
333
315
|
case 2:
|
|
334
|
-
deletions =
|
|
335
|
-
|
|
336
|
-
return updater.updateMany(deletions, [], function (uri, ok, body) {
|
|
316
|
+
deletions = _context.sent;
|
|
317
|
+
updater.update(deletions, [], function (uri, ok, body) {
|
|
337
318
|
if (!ok) {
|
|
338
319
|
announce.error('Cant delete messages:' + body);
|
|
339
320
|
} else {
|
|
340
321
|
syncMessages(subject, messageTable);
|
|
341
322
|
}
|
|
342
323
|
});
|
|
343
|
-
case
|
|
324
|
+
case 4:
|
|
344
325
|
case "end":
|
|
345
|
-
return
|
|
326
|
+
return _context.stop();
|
|
346
327
|
}
|
|
347
|
-
},
|
|
328
|
+
}, _callee);
|
|
348
329
|
}));
|
|
349
|
-
return function _deleteMessage(
|
|
350
|
-
return
|
|
330
|
+
return function _deleteMessage(_x) {
|
|
331
|
+
return _ref.apply(this, arguments);
|
|
351
332
|
};
|
|
352
333
|
}();
|
|
353
|
-
var addMessage =
|
|
354
|
-
var
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
bindings = {
|
|
360
|
-
'?msg': message,
|
|
361
|
-
'?creator': _solidLogic.store.any(message, ns.foaf('maker')),
|
|
362
|
-
'?date': _solidLogic.store.any(message, DCT('created')),
|
|
363
|
-
'?content': _solidLogic.store.any(message, ns.sioc('content'))
|
|
364
|
-
};
|
|
365
|
-
_context6.next = 3;
|
|
366
|
-
return renderMessage(bindings, true);
|
|
367
|
-
case 3:
|
|
368
|
-
case "end":
|
|
369
|
-
return _context6.stop();
|
|
370
|
-
}
|
|
371
|
-
}, _callee6);
|
|
372
|
-
}));
|
|
373
|
-
return function addMessage(_x7) {
|
|
374
|
-
return _ref6.apply(this, arguments);
|
|
334
|
+
var addMessage = function addMessage(message) {
|
|
335
|
+
var bindings = {
|
|
336
|
+
'?msg': message,
|
|
337
|
+
'?creator': _solidLogic.store.any(message, ns.foaf('maker')),
|
|
338
|
+
'?date': _solidLogic.store.any(message, DCT('created')),
|
|
339
|
+
'?content': _solidLogic.store.any(message, ns.sioc('content'))
|
|
375
340
|
};
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
cancelButton = dom.createElement('button');
|
|
440
|
-
cancelButton.textContent = 'cancel';
|
|
441
|
-
td3.appendChild(cancelButton).addEventListener('click', function (_event) {
|
|
442
|
-
td3.removeChild(sureButton);
|
|
443
|
-
td3.removeChild(cancelButton);
|
|
444
|
-
td3.appendChild(delButton);
|
|
445
|
-
}, false);
|
|
446
|
-
sureButton = dom.createElement('button');
|
|
447
|
-
sureButton.textContent = 'Delete message';
|
|
448
|
-
td3.appendChild(sureButton).addEventListener('click', /*#__PURE__*/function () {
|
|
449
|
-
var _ref9 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(_event) {
|
|
450
|
-
var _yield$appendMsg2, sts;
|
|
451
|
-
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
452
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
453
|
-
case 0:
|
|
454
|
-
// alain: test for delete or edit depending on me = maker
|
|
455
|
-
td3.removeChild(sureButton);
|
|
456
|
-
td3.removeChild(cancelButton);
|
|
457
|
-
// deleteMessage(message) // alain or sendMessage(message, 'delete' or 'edit') //alain
|
|
458
|
-
if (!(me.value === _solidLogic.store.any(message, ns.foaf('maker')).value)) {
|
|
459
|
-
_context7.next = 9;
|
|
460
|
-
break;
|
|
461
|
-
}
|
|
462
|
-
_context7.next = 5;
|
|
463
|
-
return appendMsg();
|
|
464
|
-
case 5:
|
|
465
|
-
_yield$appendMsg2 = _context7.sent;
|
|
466
|
-
sts = _yield$appendMsg2.sts;
|
|
467
|
-
_context7.next = 9;
|
|
468
|
-
return updater.updateMany([], sts);
|
|
469
|
-
case 9:
|
|
470
|
-
case "end":
|
|
471
|
-
return _context7.stop();
|
|
472
|
-
}
|
|
473
|
-
}, _callee7);
|
|
474
|
-
}));
|
|
475
|
-
return function (_x11) {
|
|
476
|
-
return _ref9.apply(this, arguments);
|
|
477
|
-
};
|
|
478
|
-
}(), false);
|
|
479
|
-
case 7:
|
|
480
|
-
case "end":
|
|
481
|
-
return _context8.stop();
|
|
482
|
-
}
|
|
483
|
-
}, _callee8);
|
|
484
|
-
}));
|
|
485
|
-
return function (_x10) {
|
|
486
|
-
return _ref8.apply(this, arguments);
|
|
487
|
-
};
|
|
488
|
-
}(), false);
|
|
489
|
-
case 38:
|
|
490
|
-
case "end":
|
|
491
|
-
return _context9.stop();
|
|
341
|
+
renderMessage(bindings, true); // fresh from elsewhere
|
|
342
|
+
};
|
|
343
|
+
var renderMessage = function renderMessage(bindings, fresh) {
|
|
344
|
+
var creator = bindings['?creator'];
|
|
345
|
+
var message = bindings['?msg'];
|
|
346
|
+
var date = bindings['?date'];
|
|
347
|
+
var content = bindings['?content'];
|
|
348
|
+
var dateString = date.value;
|
|
349
|
+
var tr = dom.createElement('tr');
|
|
350
|
+
tr.AJAR_date = dateString;
|
|
351
|
+
tr.AJAR_subject = message;
|
|
352
|
+
var done = false;
|
|
353
|
+
for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
|
|
354
|
+
if (!ele) {
|
|
355
|
+
// empty
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
|
|
359
|
+
messageTable.insertBefore(tr, ele);
|
|
360
|
+
done = true;
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
if (!done) {
|
|
365
|
+
messageTable.appendChild(tr);
|
|
366
|
+
}
|
|
367
|
+
var td1 = dom.createElement('td');
|
|
368
|
+
tr.appendChild(td1);
|
|
369
|
+
creatorAndDate(td1, creator, UI.widgets.shortDate(dateString), message);
|
|
370
|
+
var td2 = dom.createElement('td');
|
|
371
|
+
tr.appendChild(td2);
|
|
372
|
+
var pre = dom.createElement('p');
|
|
373
|
+
pre.setAttribute('style', messageBodyStyle + (fresh ? 'background-color: #e8ffe8;' : 'background-color: #white;'));
|
|
374
|
+
td2.appendChild(pre);
|
|
375
|
+
pre.textContent = content.value;
|
|
376
|
+
var td3 = dom.createElement('td');
|
|
377
|
+
tr.appendChild(td3);
|
|
378
|
+
var delButton = dom.createElement('button');
|
|
379
|
+
td3.appendChild(delButton);
|
|
380
|
+
delButton.textContent = '-';
|
|
381
|
+
tr.setAttribute('class', 'hoverControl'); // See tabbedtab.css (sigh global CSS)
|
|
382
|
+
delButton.setAttribute('class', 'hoverControlHide');
|
|
383
|
+
delButton.setAttribute('style', 'color: red;');
|
|
384
|
+
delButton.addEventListener('click', function (_event) {
|
|
385
|
+
td3.removeChild(delButton); // Ask -- are you sure?
|
|
386
|
+
var cancelButton = dom.createElement('button');
|
|
387
|
+
cancelButton.textContent = 'cancel';
|
|
388
|
+
td3.appendChild(cancelButton).addEventListener('click', function (_event) {
|
|
389
|
+
td3.removeChild(sureButton);
|
|
390
|
+
td3.removeChild(cancelButton);
|
|
391
|
+
td3.appendChild(delButton);
|
|
392
|
+
}, false);
|
|
393
|
+
var sureButton = dom.createElement('button');
|
|
394
|
+
sureButton.textContent = 'Delete message';
|
|
395
|
+
td3.appendChild(sureButton).addEventListener('click', function (_event) {
|
|
396
|
+
// alain test for delete or edit depending on me = maker
|
|
397
|
+
td3.removeChild(sureButton);
|
|
398
|
+
td3.removeChild(cancelButton);
|
|
399
|
+
// deleteMessage(message) // alain or sendMessage(message, 'delete' or 'edit') //alain
|
|
400
|
+
if (me.value === _solidLogic.store.any(message, ns.foaf('maker')).value) {
|
|
401
|
+
var _appendMsg2 = appendMsg(),
|
|
402
|
+
sts = _appendMsg2.sts; // alain
|
|
403
|
+
updater.update([], sts);
|
|
492
404
|
}
|
|
493
|
-
},
|
|
494
|
-
})
|
|
495
|
-
|
|
496
|
-
return _ref7.apply(this, arguments);
|
|
497
|
-
};
|
|
498
|
-
}();
|
|
405
|
+
}, false);
|
|
406
|
+
}, false);
|
|
407
|
+
};
|
|
499
408
|
|
|
500
409
|
// Messages with date, author etc
|
|
501
410
|
|