-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent-script.js
More file actions
61 lines (47 loc) · 1.57 KB
/
content-script.js
File metadata and controls
61 lines (47 loc) · 1.57 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
console.log("start of script")
// class= fc-timegrid-slot fc-timegrid-slot-lane fc-timegrid-slot-minor
setTimeout(injectColor, 4000)
function injectColor() {
let timeSlots = document.querySelectorAll('.fc-timegrid-slot-lane')
timeSlots.forEach((slot, index) => {
console.log(index)
if (index > 0 && index < 24 || index > 91 && index < 96) { // 1am-5am & 10pm-12pm
slot.classList.add('night')
}
if (index > 27 && index < 64) {
slot.classList.add('work')
}
if (index >= 24 && index <= 27 || index >= 64 && index <= 67) {
slot.classList.add('golden-hour')
}
if (index >= 68 && index <= 75) {
slot.classList.add('family-time')
}
if (index >= 76 && index <= 91) {
slot.classList.add('cyber-focus')
}
if ((index + 1) % 4 ===0) {
slot.classList.add('border')
}
})
const divs = document.querySelectorAll('div'); // Get all div elements
divs.forEach(div => {
if (div.textContent.trim() === 'meeting') {
let parent = div;
// Traverse up 3 levels
for (let i = 0; i < 2; i++) {
if (parent.parentElement) {
parent = parent.parentElement;
} else {
console.log('Less than 3 parent levels available');
return; // Stop if there are not enough parents
}
}
// Add the class to the third parent
parent.classList.add('meeting');
console.log(parent.classList)
console.log('Added class to:', parent);
}
});
}
console.log("end of script")