Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
StyingDev authored Nov 2, 2024
1 parent 1476b89 commit 1c62099
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 13 deletions.
45 changes: 42 additions & 3 deletions Scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -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 = '';
}
});
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 0 additions & 4 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<button id="github-button">
<img src="icons/Github-icon.svg" alt="GitHub Icon">Github
</button>




<script src="Scripts/popup.js"></script>
</body>
</html>
15 changes: 10 additions & 5 deletions startpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,15 @@ <h2>Settings</h2>
<option value="https://www.bing.com/search">Bing</option>
<option value="https://search.yahoo.com/search">Yahoo</option>
<option value="https://www.qwant.com/">Qwant</option>
<option value="https://www.startpage.com/">StartPage</option>
<option value="https://www.startpage.com/search">StartPage</option>
<option value="https://priv.au/search">Priv.au</option>
<option value="https://search.brave.com/search">Brave Search</option>
<option value="https://www.mojeek.com/search">Mojeek</option>
<option value="https://metager.org/meta/meta.ger3">MetaGer</option>
<option value="https://searx.be/search">Searx.be</option>
<option value="https://search.unlocked.link/search">Unlocked.link</option>
<option value="https://searx.tiekoetter.com/search">Tiekoetter</option>
<option value="https://searx.dresden.network/search">Dresden.network</option>
</select>

<label for="time-format">Time Format:</label>
Expand Down Expand Up @@ -143,8 +150,6 @@ <h2>Settings</h2>
<span class="slider"></span>
</label>
</div>


<button id="save-settings">Save</button>
</div>

Expand Down Expand Up @@ -176,6 +181,6 @@ <h2>QuickLinks</h2>
<script src="Scripts/settings.js"></script>
<script src="Scripts/quicklinks.js"></script>
<script src="Scripts/weather.js"></script>
<script src="Scripts/color.js"></script>
<script src="Scripts/color.js"></script>
</body>
</html>
</html>

0 comments on commit 1c62099

Please sign in to comment.