MCPcopy
hub / github.com/pinokiocomputer/pinokio / showOverlay

Function showOverlay

preload.js:1042–1092  ·  view source on GitHub ↗
(message, frameUrl, html, screenshot)

Source from the content-addressed store, hash-verified

1040 }
1041
1042 const showOverlay = (message, frameUrl, html, screenshot) => {
1043 const overlay = ensureOverlay()
1044 if (overlay.container.parentNode) {
1045 overlay.container.parentNode.appendChild(overlay.container)
1046 }
1047 for (const node of document.querySelectorAll('.pinokio-inspector-overlay')) {
1048 if (node !== overlay.container) {
1049 node.style.display = 'none'
1050 }
1051 }
1052 overlay.container.style.display = 'flex'
1053 overlay.status.textContent = message || ''
1054 overlay.urlRow.textContent = frameUrl ? `Page: ${frameUrl}` : ''
1055 state.displayUrl = frameUrl || null
1056
1057 // Handle HTML content
1058 if (html) {
1059 const pageUrl = frameUrl || state.displayUrl || state.lastUrl || ''
1060 const domPath = state.lastDomPath || ''
1061 const lines = []
1062 if (pageUrl) {
1063 lines.push(`Page: ${pageUrl}`)
1064 }
1065 if (domPath) {
1066 lines.push(`DOM: ${domPath}`)
1067 }
1068 lines.push(`HTML: ${html}`)
1069 overlay.htmlSection.style.display = 'block'
1070 overlay.htmlBlock.style.display = 'block'
1071 overlay.htmlBlock.value = lines.join('\n')
1072 overlay.copyButton.style.display = 'inline-flex'
1073 overlay.copyButton.textContent = 'Copy snippet'
1074 } else {
1075 overlay.htmlSection.style.display = 'none'
1076 overlay.htmlBlock.style.display = 'none'
1077 overlay.htmlBlock.value = ''
1078 overlay.copyButton.style.display = 'none'
1079 }
1080
1081 // Handle screenshot content
1082 if (screenshot) {
1083 overlay.screenshotImg.src = screenshot
1084 overlay.screenshotBlock.style.display = 'block'
1085 overlay.copyScreenshotButton.style.display = 'inline-flex'
1086 overlay.copyScreenshotButton.textContent = 'Copy screenshot'
1087 } else {
1088 overlay.screenshotImg.src = ''
1089 overlay.screenshotBlock.style.display = 'none'
1090 overlay.copyScreenshotButton.style.display = 'none'
1091 }
1092 }
1093
1094 const hideOverlay = () => {
1095 const overlay = state.overlay

Callers 3

startInspectorFunction · 0.85
handleInspectorMessageFunction · 0.85
preload.jsFile · 0.85

Calls 1

ensureOverlayFunction · 0.85

Tested by

no test coverage detected