mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
push new update, + Notices UI fixes
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Background Fetcher</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
video, img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
object-fit: cover;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Container for the media -->
|
||||
<div id="media-container">
|
||||
<!-- Will be populated dynamically -->
|
||||
</div>
|
||||
|
||||
<script src="background.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
const openDB=()=>new Promise(((e,t)=>{const o=indexedDB.open("MyDatabase",1);o.onerror=()=>t(o.error),o.onsuccess=()=>e(o.result),o.onupgradeneeded=e=>{e.target.result.createObjectStore("backgrounds",{keyPath:"id"})}})),readData=async()=>{const e=localStorage.getItem("selectedBackground");if(!e)return console.log("No selected background in local storage."),null;const t=(await openDB()).transaction("backgrounds","readonly").objectStore("backgrounds").get(e);return await new Promise(((e,o)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>o(t.error)}))},updateBackground=async()=>{try{const e=await readData();if(!e){console.log("No data found in IndexedDB.");const e=document.getElementById("media-container").querySelector(".current-media");return void(e&&e.remove())}const t=URL.createObjectURL(e.blob),o=document.getElementById("media-container");let a;"image"===e.type?(a=document.createElement("img"),a.src=t,a.alt="Uploaded content"):"video"===e.type&&(a=document.createElement("video"),a.src=t,a.autoplay=!0,a.loop=!0,a.muted=!0);const r=o.querySelector(".current-media");r&&(r.classList.remove("current-media"),r.classList.add("old-media")),a.classList.add("current-media"),o.appendChild(a),setTimeout((()=>{const e=o.querySelector(".old-media");e&&e.remove()}),100)}catch(e){console.error("An error occurred:",e)}},main=async()=>{await updateBackground(),window.addEventListener("storage",(async e=>{"selectedBackground"===e.key&&await updateBackground()}))};document.addEventListener("DOMContentLoaded",main);
|
||||
Reference in New Issue
Block a user