-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotion.js
More file actions
58 lines (49 loc) · 2.72 KB
/
notion.js
File metadata and controls
58 lines (49 loc) · 2.72 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
// // Function to apply transition effect to the detected cursor or caret elements
// function applyTransitionEffectToCursorElements(delay, easing) {
// // Function to detect and apply transition effect
// function detectAndApplyTransition() {
// // List of potential selectors to find cursor or caret elements
// const potentialSelectors = [
// '.kix-cursor', // Example from Google Docs
// '.notion-caret', // Hypothetical class for Notion
// '.caret', // Common name
// '.cursor', // Common name
// '.cm-cursor', // CodeMirror (used in some editors)
// '.editor-caret', // Generic name
// '[data-testid="cursor"]', // Hypothetical data attribute
// '[class*="caret"]', // Class names containing 'caret'
// '[class*="cursor"]' // Class names containing 'cursor'
// ];
// let found = false;
// // Iterate over each potential selector
// for (let selector of potentialSelectors) {
// const elements = document.querySelectorAll(selector);
// if (elements.length > 0) {
// found = true;
// elements.forEach((element) => {
// let elementStyle = element.getAttribute("style") || "";
// if (!elementStyle.includes(`transition: all ${delay}ms ${easing};`)) {
// element.style.transition = `all ${delay}ms ${easing}`;
// element.setAttribute('style', elementStyle + element.style.cssText);
// }
// });
// console.log(`Elements found with selector: ${selector}`);
// break; // Exit if at least one selector is successful
// }
// }
// if (!found) {
// console.log("Cursor or caret elements not found. Check the selectors or DOM structure.");
// }
// }
// // Initial application
// detectAndApplyTransition();
// // Observe for changes in the document and reapply the transition effect
// const observer = new MutationObserver(() => detectAndApplyTransition());
// observer.observe(document.body, { childList: true, subtree: true });
// }
// // 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 || 200; // Default to 200ms if not set
// const easing = data.transitionEasing || 'ease'; // Default to 'ease' if not set
// applyTransitionEffectToCursorElements(delay, easing);
// });