Spaces:
Sleeping
Sleeping
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Test Embedded Chat Bot</title> | |
<style> | |
* { | |
margin: 0; | |
padding: 0; | |
box-sizing: border-box; | |
} | |
body { | |
min-height: 100vh; | |
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; | |
line-height: 1.6; | |
background-color: #fff; | |
color: #333; | |
} | |
.header { | |
background: #f3f4f6; | |
padding: 1rem 2rem; | |
border-bottom: 1px solid #e5e7eb; | |
position: sticky; | |
top: 0; | |
z-index: 10; | |
} | |
.content { | |
max-width: 1200px; | |
margin: 0 auto; | |
padding: 2rem; | |
} | |
.section { | |
margin-bottom: 5rem; | |
} | |
.section h2 { | |
font-size: 1.5rem; | |
margin-bottom: 1rem; | |
color: #111827; | |
} | |
.card-grid { | |
display: grid; | |
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); | |
gap: 1.5rem; | |
margin-bottom: 2rem; | |
} | |
.card { | |
background: #fff; | |
padding: 1.5rem; | |
border-radius: 0.5rem; | |
box-shadow: 0 1px 3px rgba(0,0,0,0.1); | |
border: 1px solid #e5e7eb; | |
min-height: 200px; | |
display: flex; | |
flex-direction: column; | |
justify-content: space-between; | |
} | |
.card h3 { | |
color: #111827; | |
margin-bottom: 0.5rem; | |
} | |
.card p { | |
color: #4b5563; | |
} | |
.footer { | |
background: #f3f4f6; | |
padding: 2rem; | |
text-align: center; | |
border-top: 1px solid #e5e7eb; | |
color: #6b7280; | |
margin-top: 5rem; | |
} | |
.spacer { | |
height: 50vh; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.05), transparent); | |
margin: 3rem 0; | |
font-size: 1.2rem; | |
color: #666; | |
font-style: italic; | |
} | |
@media (prefers-color-scheme: dark) { | |
body { | |
background-color: #1a1a1a; | |
color: #e5e5e5; | |
} | |
.header, .footer { | |
background: #2d2d2d; | |
border-color: #404040; | |
} | |
.card { | |
background: #2d2d2d; | |
border-color: #404040; | |
} | |
.card h3 { | |
color: #e5e5e5; | |
} | |
.card p { | |
color: #a3a3a3; | |
} | |
.spacer { | |
background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.05), transparent); | |
color: #999; | |
} | |
} | |
</style> | |
</head> | |
<body> | |
<header class="header"> | |
<h1>Test Page for Embedded Chat Bot</h1> | |
</header> | |
<main class="content"> | |
<section class="section"> | |
<h2>About This Test Page</h2> | |
<p>This is a full-page test environment for the PlayGO AI Chat Bot. The chat bot appears as a floating button at the bottom right corner of the page.</p> | |
</section> | |
<div class="spacer"> | |
Scroll down to see more content... | |
</div> | |
<section class="section"> | |
<h2>Sample Content</h2> | |
<div class="card-grid"> | |
<div class="card"> | |
<h3>Card 1</h3> | |
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> | |
</div> | |
<div class="card"> | |
<h3>Card 2</h3> | |
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> | |
</div> | |
<div class="card"> | |
<h3>Card 3</h3> | |
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p> | |
</div> | |
</div> | |
</section> | |
<div class="spacer"> | |
Keep scrolling to test the chat bot's fixed position... | |
</div> | |
<section class="section"> | |
<h2>More Content</h2> | |
<div class="card-grid"> | |
<div class="card"> | |
<h3>Card 4</h3> | |
<p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | |
</div> | |
<div class="card"> | |
<h3>Card 5</h3> | |
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.</p> | |
</div> | |
<div class="card"> | |
<h3>Card 6</h3> | |
<p>Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur.</p> | |
</div> | |
</div> | |
</section> | |
<div class="spacer"> | |
The chat bot should remain visible at all times... | |
</div> | |
<section class="section"> | |
<h2>Final Section</h2> | |
<div class="card-grid"> | |
<div class="card"> | |
<h3>Card 7</h3> | |
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum.</p> | |
</div> | |
<div class="card"> | |
<h3>Card 8</h3> | |
<p>Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod.</p> | |
</div> | |
<div class="card"> | |
<h3>Card 9</h3> | |
<p>Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates.</p> | |
</div> | |
</div> | |
</section> | |
</main> | |
<footer class="footer"> | |
<p>Test Page Footer</p> | |
</footer> | |
<!-- Embed script --> | |
<script> | |
// Debug logging | |
console.log('Setting up PlayGo Chat Widget'); | |
// Create queue before loading script | |
window.PlayGoChatWidget = { | |
q: [], | |
ready: false | |
}; | |
// Initialize configuration | |
const config = { | |
buttonText: '需要協助嗎?', | |
theme: 'system', | |
primaryColor: '#FF6B6B', | |
placeholder: 'Type your message...' | |
}; | |
// Add custom CSS for chat widget spacing | |
const style = document.createElement('style'); | |
style.textContent = ` | |
#playgo-chat-widget { | |
padding: 16px !important; | |
border-radius: 16px !important; | |
background: transparent !important; | |
} | |
#playgo-chat-widget iframe { | |
border-radius: 16px !important; | |
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.08) !important; | |
transition: height 0.5s ease-in-out, box-shadow 0.3s ease-in-out !important; | |
} | |
#playgo-chat-widget iframe:hover { | |
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.08) !important; | |
} | |
@media (prefers-color-scheme: dark) { | |
#playgo-chat-widget iframe { | |
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2) !important; | |
} | |
#playgo-chat-widget iframe:hover { | |
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3), 0 4px 8px rgba(0, 0, 0, 0.2) !important; | |
} | |
} | |
`; | |
document.head.appendChild(style); | |
// Add to queue | |
window.PlayGoChatWidget.q.push(['init', config]); | |
// Load script | |
(function() { | |
console.log('Loading embed script'); | |
const script = document.createElement('script'); | |
script.src = '/api/embed'; | |
script.async = true; | |
script.onload = function() { | |
console.log('Embed script loaded'); | |
}; | |
script.onerror = function(error) { | |
console.error('Error loading embed script:', error); | |
}; | |
document.body.appendChild(script); | |
})(); | |
</script> | |
</body> | |
</html> |