feat: add hosted embed URL functionality and enhance widget embed options with tabbed interface
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="robots" content="noindex" />
|
||||
<title>ClassroomIO Course Widget</title>
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
background: transparent;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="cio-mount"></div>
|
||||
<script type="module">
|
||||
const params = new URLSearchParams(location.search);
|
||||
const key = params.get('key');
|
||||
const apiBaseUrl = params.get('api');
|
||||
|
||||
if (!key) {
|
||||
const note = document.createElement('p');
|
||||
note.textContent = 'Missing widget key. Append ?key=<your-widget-key> to the URL.';
|
||||
note.style.cssText = 'font:14px system-ui;padding:16px;color:#475569;';
|
||||
document.body.appendChild(note);
|
||||
} else {
|
||||
const mount = document.getElementById('cio-mount');
|
||||
const widgetDiv = document.createElement('div');
|
||||
widgetDiv.setAttribute('data-cio-widget', 'course-widget');
|
||||
widgetDiv.setAttribute('data-widget-key', key);
|
||||
if (apiBaseUrl) {
|
||||
widgetDiv.setAttribute('data-api-base-url', apiBaseUrl);
|
||||
}
|
||||
mount.appendChild(widgetDiv);
|
||||
|
||||
const script = document.createElement('script');
|
||||
script.async = true;
|
||||
script.type = 'module';
|
||||
script.src = './course-widget.js';
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user