-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.js
More file actions
78 lines (71 loc) · 2.13 KB
/
Copy pathcontent.js
File metadata and controls
78 lines (71 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Modular CSS
const cssFiles = [
"https://carloshdrp.github.io/anilist-css/files/banner-remove.css",
"https://carloshdrp.github.io/anilist-css/files/navbar.css",
"https://carloshdrp.github.io/anilist-css/files/font.css",
"https://carloshdrp.github.io/anilist-css/files/stats2.css",
"https://carloshdrp.github.io/anilist-css/files/favourites.css",
"https://carloshdrp.github.io/anilist-css/files/feed.css",
"https://carloshdrp.github.io/anilist-css/files/footer.css"
];
cssFiles.forEach(url => {
const link = document.createElement("link");
link.rel = "stylesheet";
link.type = "text/css";
link.href = url;
document.head.appendChild(link);
});
// Default video
let defaultVideo = "https://i.imgur.com/WVXOFcd.mp4";
// Function to insert video
function insertVideo(url) {
let existing = document.getElementById("anilist-bg-video");
if (existing) existing.remove();
const video = document.createElement("video");
video.src = url;
video.autoplay = true;
video.loop = true;
video.muted = true;
video.playsInline = true;
video.id = "anilist-bg-video";
document.body.prepend(video);
}
// Load video from storage
chrome.storage.local.get(["bgVideo"], result => {
insertVideo(result.bgVideo || defaultVideo);
});
// Listen for updates from popup
chrome.runtime.onMessage.addListener((message) => {
if (message.action === "updateVideo") {
insertVideo(message.url);
}
});
// Styles
const style = document.createElement("style");
style.textContent = `
#anilist-bg-video {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
object-fit: cover;
z-index: -1;
pointer-events: none;
}
body {
background: rgba(0,0,0,0.6) !important;
}
.header-wrap .nav-wrap .link:nth-child(1):before {
content: "";
display: inline-block;
width: 24px;
height: 24px;
background: url("https://anilist.co/img/icons/icon.svg") no-repeat center center;
background-size: contain;
}
.header-wrap .nav-wrap .link {
color: var(--color-primary) !important;
}
`;
document.head.appendChild(style);