-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtoomuchcaps.js
30 lines (26 loc) · 1.15 KB
/
toomuchcaps.js
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
function injectCSS(item) {
var ytbTextTransformStyle = item.ytbTextTransformStyle || "lowercase"; // Default to lowercase if undefined
var css = `
yt-formatted-string.style-scope.ytd-watch-metadata,
yt-formatted-string.style-scope.ytd-rich-grid-media,
span.style-scope.ytd-compact-video-renderer,
span.style-scope.ytd-rich-grid-slim-media,
span.style-scope.ytd-reel-item-renderer,
.ytp-title-link.yt-uix-sessionlink.ytp-title-fullerscreen-link,
.miniplayer-title.style-scope.ytd-miniplayer{
text-transform: ${ytbTextTransformStyle} !important;
}
`;
var style = document.createElement('style');
style.appendChild(document.createTextNode(css));
// Append style to document element to ensure it applies correctly
document.documentElement.appendChild(style);
}
function onError(error) {
console.error(`Error in injecting CSS: ${error}`);
}
// Ensure content script runs when document is ready
document.addEventListener('DOMContentLoaded', function () {
var getting = browser.storage.sync.get("ytbTextTransformStyle");
getting.then(injectCSS, onError);
});