diff --git a/assets/css/custom.css b/assets/css/custom.css index 578e421..a681d3b 100644 --- a/assets/css/custom.css +++ b/assets/css/custom.css @@ -36,6 +36,9 @@ body { position: relative; overflow: hidden; transition: background-color 0.3s ease; + background-size: cover; + background-position: center; + background-repeat: no-repeat; } .video-panel .panel-label { diff --git a/assets/js/main.js b/assets/js/main.js index f7710de..93796b1 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -15,7 +15,12 @@ document.addEventListener('DOMContentLoaded', function () { const modalSaveBtn = document.getElementById('modal-save-btn'); const sceneNameInput = document.getElementById('scene-name-input'); const sceneTypeSelect = document.getElementById('scene-type-select'); + + // Source settings elements + const colorSettings = document.getElementById('source-color-group'); + const imageSettings = document.getElementById('source-image-group'); const sceneColorInput = document.getElementById('scene-color-input'); + const sceneImageUrlInput = document.getElementById('scene-image-url-input'); // Data Store let scenes = []; @@ -72,12 +77,19 @@ document.addEventListener('DOMContentLoaded', function () { if (!scene) return; activePreviewSceneId = scene.id; - + + // Clear previous styles + previewPanel.style.backgroundColor = '#000'; + previewPanel.style.backgroundImage = 'none'; previewContent.textContent = scene.name; + switch (scene.type) { case 'color': previewPanel.style.backgroundColor = scene.value; break; + case 'image': + previewPanel.style.backgroundImage = `url('${scene.value}')`; + break; default: previewPanel.style.backgroundColor = '#000'; break; @@ -89,6 +101,7 @@ document.addEventListener('DOMContentLoaded', function () { activePreviewSceneId = null; previewContent.textContent = 'Select a Scene'; previewPanel.style.backgroundColor = '#000'; + previewPanel.style.backgroundImage = 'none'; renderSceneList(); } @@ -127,6 +140,7 @@ document.addEventListener('DOMContentLoaded', function () { programContent.textContent = previewScene.name; programPanel.style.backgroundColor = previewPanel.style.backgroundColor; + programPanel.style.backgroundImage = previewPanel.style.backgroundImage; clearPreview(); }); @@ -139,6 +153,12 @@ document.addEventListener('DOMContentLoaded', function () { modalCloseBtn.addEventListener('click', hideModal); modalCancelBtn.addEventListener('click', hideModal); + sceneTypeSelect.addEventListener('change', (e) => { + const type = e.target.value; + colorSettings.style.display = type === 'color' ? 'block' : 'none'; + imageSettings.style.display = type === 'image' ? 'block' : 'none'; + }); + modalSaveBtn.addEventListener('click', () => { const name = sceneNameInput.value.trim(); if (!name) { @@ -146,7 +166,17 @@ document.addEventListener('DOMContentLoaded', function () { return; } const type = sceneTypeSelect.value; - const value = sceneColorInput.value; // For now, only color + let value; + + if (type === 'color') { + value = sceneColorInput.value; + } else if (type === 'image') { + value = sceneImageUrlInput.value.trim(); + if (!value) { + alert('Please enter an image URL.'); + return; + } + } const newScene = addScene(name, type, value); updatePreview(newScene.id); @@ -154,6 +184,10 @@ document.addEventListener('DOMContentLoaded', function () { // Reset form and hide modal sceneNameInput.value = ''; sceneColorInput.value = '#1e90ff'; + sceneImageUrlInput.value = ''; + sceneTypeSelect.value = 'color'; + colorSettings.style.display = 'block'; + imageSettings.style.display = 'none'; hideModal(); }); @@ -161,8 +195,8 @@ document.addEventListener('DOMContentLoaded', function () { function initialize() { // Add some default scenes addScene('Main Camera', 'color', '#003366'); + addScene('Starting Soon Screen', 'image', 'https://images.pexels.com/photos/1762851/pexels-photo-1762851.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1'); addScene('Screen Share', 'color', '#006633'); - addScene('Starting Soon', 'color', '#333333'); // Set initial program scene for display const firstScene = scenes[0]; @@ -170,7 +204,8 @@ document.addEventListener('DOMContentLoaded', function () { activeProgramSceneId = firstScene.id; programContent.textContent = firstScene.name; programPanel.style.backgroundColor = firstScene.value; - } + programPanel.style.backgroundImage = 'none'; +} // Select the second scene for preview initially if (scenes.length > 1) { @@ -179,4 +214,4 @@ document.addEventListener('DOMContentLoaded', function () { } initialize(); -}); +}); \ No newline at end of file diff --git a/index.php b/index.php index 4e3d8d0..bb41f40 100644 --- a/index.php +++ b/index.php @@ -94,14 +94,20 @@ -