(contentDiv, url, sessionId)
| 1507 | |
| 1508 | // Create inline browser embed in chat |
| 1509 | function addInlineBrowserEmbed(contentDiv, url, sessionId) { |
| 1510 | // Remove any existing inline browser embeds (only one at a time) |
| 1511 | const existingEmbed = document.querySelector('.inline-browser-embed'); |
| 1512 | if (existingEmbed) { |
| 1513 | existingEmbed.remove(); |
| 1514 | } |
| 1515 | |
| 1516 | const browserDiv = document.createElement('div'); |
| 1517 | browserDiv.className = 'inline-browser-embed'; |
| 1518 | browserDiv.dataset.sessionId = sessionId; |
| 1519 | browserDiv.dataset.url = url; |
| 1520 | |
| 1521 | browserDiv.innerHTML = ` |
| 1522 | <div class="browser-embed-header"> |
| 1523 | <div class="browser-header-left"> |
| 1524 | <svg class="browser-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| 1525 | <circle cx="12" cy="12" r="10"></circle> |
| 1526 | <line x1="2" y1="12" x2="22" y2="12"></line> |
| 1527 | <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path> |
| 1528 | </svg> |
| 1529 | <span class="browser-title">Live Browser</span> |
| 1530 | <span class="browser-session-badge">Session Active</span> |
| 1531 | </div> |
| 1532 | <div class="browser-header-actions"> |
| 1533 | <button class="browser-action-btn" onclick="openBrowserInNewWindow('${url}')" title="Open in new window"> |
| 1534 | <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| 1535 | <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path> |
| 1536 | <polyline points="15 3 21 3 21 9"></polyline> |
| 1537 | <line x1="10" y1="14" x2="21" y2="3"></line> |
| 1538 | </svg> |
| 1539 | </button> |
| 1540 | <button class="browser-action-btn" onclick="moveBrowserToSidebar()" title="Move to sidebar"> |
| 1541 | <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| 1542 | <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect> |
| 1543 | <line x1="15" y1="3" x2="15" y2="21"></line> |
| 1544 | </svg> |
| 1545 | </button> |
| 1546 | <button class="browser-action-btn browser-fullscreen-btn" onclick="toggleBrowserFullscreen(this)" title="Fullscreen"> |
| 1547 | <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> |
| 1548 | <polyline points="15 3 21 3 21 9"></polyline> |
| 1549 | <polyline points="9 21 3 21 3 15"></polyline> |
| 1550 | <line x1="21" y1="3" x2="14" y2="10"></line> |
| 1551 | <line x1="3" y1="21" x2="10" y2="14"></line> |
| 1552 | </svg> |
| 1553 | </button> |
| 1554 | </div> |
| 1555 | </div> |
| 1556 | <div class="browser-embed-content"> |
| 1557 | <iframe |
| 1558 | src="${url}" |
| 1559 | class="browser-iframe" |
| 1560 | allow="clipboard-read; clipboard-write; camera; microphone" |
| 1561 | sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-modals" |
| 1562 | ></iframe> |
| 1563 | </div> |
| 1564 | <div class="browser-embed-footer"> |
| 1565 | <span class="browser-url">${url}</span> |
| 1566 | <button class="browser-copy-url" onclick="copyBrowserUrl('${url}')" title="Copy URL"> |
no test coverage detected