-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs.js
More file actions
27 lines (22 loc) · 1.17 KB
/
docs.js
File metadata and controls
27 lines (22 loc) · 1.17 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
// Function to apply transition effect to elements with class 'kix-cursor'
function applyTransitionEffect(delay, easing) {
const cursors = document.getElementsByClassName("kix-cursor");
for (let cursor of cursors) {
if (cursor) {
let cursorStyle = cursor.getAttribute("style") || "";
if (!cursorStyle.includes(`transition: all ${delay}ms ${easing};`)) {
cursor.style.transition = `all ${delay}ms ${easing}`;
cursor.setAttribute('style', cursorStyle + cursor.style.cssText);
}
}
}
}
// Get the transition delay and easing function from Chrome storage and apply the transition effect
chrome.storage.sync.get(['transitionDelay', 'transitionEasing'], (data) => {
const delay = data.transitionDelay || 100; // Default to 100ms if not set
const easing = data.transitionEasing || 'ease'; // Default to 'ease' if not set
applyTransitionEffect(delay, easing);
// Observe for changes in the document and reapply the transition effect
const observer = new MutationObserver(() => applyTransitionEffect(delay, easing));
observer.observe(document.body, { childList: true, subtree: true });
});