| | @@ -142,10 +142,13 @@ |
| 142 | 142 | loadOlderToolbar: undefined /* the load-posts toolbar (dynamically created) */, |
| 143 | 143 | inputArea: E1("#chat-input-area"), |
| 144 | 144 | inputLineWrapper: E1('#chat-input-line-wrapper'), |
| 145 | 145 | fileSelectWrapper: E1('#chat-input-file-area'), |
| 146 | 146 | viewMessages: E1('#chat-messages-wrapper'), |
| 147 | + viewZoom: E1('#chat-zoom'), |
| 148 | + zoomContent: E1('#chat-zoom-content'), |
| 149 | + zoomMarker: E1('#chat-zoom-marker'), |
| 147 | 150 | btnSubmit: E1('#chat-button-submit'), |
| 148 | 151 | btnAttach: E1('#chat-button-attach'), |
| 149 | 152 | inputX: E1('#chat-input-field-x'), |
| 150 | 153 | input1: E1('#chat-input-field-single'), |
| 151 | 154 | inputM: E1('#chat-input-field-multi'), |
| | @@ -600,10 +603,36 @@ |
| 600 | 603 | if(this.e.currentView.$beforeShow) this.e.currentView.$beforeShow(); |
| 601 | 604 | D.removeClass(e,'hidden'); |
| 602 | 605 | this.animate(this.e.currentView, 'anim-fade-in-fast'); |
| 603 | 606 | return this.e.currentView; |
| 604 | 607 | }, |
| 608 | + |
| 609 | + /** |
| 610 | + Makes message element eMsg the content of this.e.viewZoom. |
| 611 | + */ |
| 612 | + zoomMessage: function(eMsg){ |
| 613 | + const marker = this.e.zoomMarker; |
| 614 | + if( !eMsg ){ |
| 615 | + if( this.e.zoomedMsg ){ |
| 616 | + marker.parentNode.insertBefore(this.e.zoomedMsg, marker); |
| 617 | + delete this.e.zoomedMsg; |
| 618 | + } |
| 619 | + this.setCurrentView(this.e.viewMessages); |
| 620 | + return; |
| 621 | + } |
| 622 | + console.log("zoom message",eMsg); |
| 623 | + if( eMsg===this.e.zoomedMsg ){ |
| 624 | + return; |
| 625 | + } |
| 626 | + if( this.e.zoomedMsg ){ |
| 627 | + marker.parentNode.insertBefore(this.e.zoomedMsg, marker); |
| 628 | + } |
| 629 | + this.e.viewMessages.insertBefore(marker, eMsg); |
| 630 | + this.e.zoomContent.appendChild(eMsg); |
| 631 | + this.e.zoomedMsg = eMsg; |
| 632 | + this.setCurrentView(this.e.viewZoom); |
| 633 | + }, |
| 605 | 634 | /** |
| 606 | 635 | Updates the "active user list" view if we are not currently |
| 607 | 636 | batch-loading messages and if the active user list UI element |
| 608 | 637 | is active. |
| 609 | 638 | */ |
| | @@ -1351,13 +1380,14 @@ |
| 1351 | 1380 | // Date doesn't work, so dumb it down... |
| 1352 | 1381 | D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," zulu")); |
| 1353 | 1382 | } |
| 1354 | 1383 | const toolbar = D.addClass(D.div(), 'toolbar'); |
| 1355 | 1384 | D.append(this.e, toolbar); |
| 1385 | + const self = this; |
| 1386 | + |
| 1356 | 1387 | const btnDeleteLocal = D.button("Delete locally"); |
| 1357 | 1388 | D.append(toolbar, btnDeleteLocal); |
| 1358 | | - const self = this; |
| 1359 | 1389 | btnDeleteLocal.addEventListener('click', function(){ |
| 1360 | 1390 | self.hide(); |
| 1361 | 1391 | Chat.deleteMessageElem(eMsg) |
| 1362 | 1392 | }); |
| 1363 | 1393 | if( eMsg.classList.contains('notification') ){ |
| | @@ -1444,10 +1474,15 @@ |
| 1444 | 1474 | }) |
| 1445 | 1475 | ) |
| 1446 | 1476 | ); |
| 1447 | 1477 | }/*jump-to button*/ |
| 1448 | 1478 | } |
| 1479 | + const btnZoom = D.button("Zoom"); |
| 1480 | + D.append(toolbar2, btnZoom); |
| 1481 | + btnZoom.addEventListener('click', function(){ |
| 1482 | + Chat.zoomMessage(eMsg); |
| 1483 | + }); |
| 1449 | 1484 | const tab = eMsg.querySelector('.message-widget-tab'); |
| 1450 | 1485 | D.append(tab, this.e); |
| 1451 | 1486 | D.removeClass(this.e, 'hidden'); |
| 1452 | 1487 | Chat.animate(this.e, 'anim-fade-in-fast'); |
| 1453 | 1488 | }/*refresh()*/, |
| | @@ -2433,10 +2468,19 @@ |
| 2433 | 2468 | ev.stopPropagation(); |
| 2434 | 2469 | Chat.setCurrentView(Chat.e.viewMessages); |
| 2435 | 2470 | return false; |
| 2436 | 2471 | }, false); |
| 2437 | 2472 | })()/*search view setup*/; |
| 2473 | + |
| 2474 | + (function(){/*Set up the zoom view */ |
| 2475 | + Chat.e.viewZoom.querySelector('button.action-close').addEventListener('click', function(ev){ |
| 2476 | + ev.preventDefault(); |
| 2477 | + ev.stopPropagation(); |
| 2478 | + Chat.zoomMessage(null); |
| 2479 | + return false; |
| 2480 | + }, false); |
| 2481 | + })()/*zoom view setup*/; |
| 2438 | 2482 | |
| 2439 | 2483 | /** Callback for poll() to inject new content into the page. jx == |
| 2440 | 2484 | the response from /chat-poll. If atEnd is true, the message is |
| 2441 | 2485 | appended to the end of the chat list (for loading older |
| 2442 | 2486 | messages), else the beginning (the default). */ |
| 2443 | 2487 | |