diff --git a/Scripts/settings.js b/Scripts/settings.js index 897abe8..6dd4cf7 100644 --- a/Scripts/settings.js +++ b/Scripts/settings.js @@ -91,7 +91,7 @@ document.addEventListener("DOMContentLoaded", function() { // Handle background loading if (existingBackground) { newBackground = existingBackground; - document.body.style.backgroundImage = `url(${newBackground})`; + setBackground(newBackground); backgroundInput.value = newBackground; document.body.classList.remove("gradient-active"); } else { @@ -135,12 +135,12 @@ document.addEventListener("DOMContentLoaded", function() { // Apply background settings if (newBackground === "") { - document.body.style.backgroundImage = ''; + removeBackground(); document.body.classList.add("gradient-active"); localStorage.removeItem("background"); } else { localStorage.setItem("background", newBackground); - document.body.style.backgroundImage = `url(${newBackground})`; + setBackground(newBackground); document.body.classList.remove("gradient-active"); } @@ -178,4 +178,43 @@ document.addEventListener("DOMContentLoaded", function() { // Close settings sidebar after saving closeSidebar(); }); + + // Add these new functions + function setBackground(url) { + removeBackground(); + + if (url.toLowerCase().endsWith('.mp4')) { + const video = document.createElement('video'); + video.id = 'background-video'; + video.autoplay = true; + video.loop = true; + video.muted = true; + video.style.position = 'fixed'; + video.style.right = '0'; + video.style.bottom = '0'; + video.style.minWidth = '100%'; + video.style.minHeight = '100%'; + video.style.width = 'auto'; + video.style.height = 'auto'; + video.style.zIndex = '-1'; + video.style.objectFit = 'cover'; + + const source = document.createElement('source'); + source.src = url; + source.type = 'video/mp4'; + + video.appendChild(source); + document.body.insertBefore(video, document.body.firstChild); + } else { + document.body.style.backgroundImage = `url(${url})`; + } + } + + function removeBackground() { + const existingVideo = document.getElementById('background-video'); + if (existingVideo) { + existingVideo.remove(); + } + document.body.style.backgroundImage = ''; + } }); diff --git a/manifest.json b/manifest.json index a06088f..bfa5f54 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "StyTab", - "version": "1.1.5", + "version": "1.1.6", "description": "Stytab - A minimalist Startpage that meets your needs.", "chrome_url_overrides": { "newtab": "startpage.html" diff --git a/popup.html b/popup.html index ca69dae..0e38b46 100644 --- a/popup.html +++ b/popup.html @@ -18,10 +18,6 @@ - - - - diff --git a/startpage.html b/startpage.html index 8fca1f4..0a02bfc 100644 --- a/startpage.html +++ b/startpage.html @@ -99,8 +99,15 @@

Settings

- + + + + + + + + @@ -143,8 +150,6 @@

Settings

- - @@ -176,6 +181,6 @@

QuickLinks

- + - + \ No newline at end of file