-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptimizedContentList.user.js
More file actions
151 lines (135 loc) · 5.53 KB
/
Copy pathOptimizedContentList.user.js
File metadata and controls
151 lines (135 loc) · 5.53 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// ==UserScript==
// @name Optimized Content List
// @namespace Violentmonkey Scripts
// @match https://moodle.bbbaden.ch/course/view.php*
// @grant none
// @version 0.2
// @author PianoNic
// @downloadURL https://github.com/BBBaden-Moodle-userscripts/OptimizedContentList/raw/main/OptimizedContentList.user.js
// @updateURL https://github.com/BBBaden-Moodle-userscripts/OptimizedContentList/raw/main/OptimizedContentList.user.js
// @icon https://github.com/BBBaden-Moodle-userscripts/OptimizedContentList/blob/main/icons/icon.png?raw=true
// @grant GM_addStyle
// @require https://github.com/BBBaden-Moodle-userscripts/LoggingLibrary/raw/refs/heads/main/Logging.lib.user.js
// @require https://github.com/BBBaden-Moodle-userscripts/UserscriptBridgeLib/raw/main/userscriptBridge.lib.js
// ==/UserScript==
(function() {
'use strict';
Logger.info('optimizedcontentlist', 'v0.2 - Initializing');
// Initialize bridge connection for userscript manager
const connection = new Script();
Logger.success('optimizedcontentlist', 'Bridge connection initialized');
// If on extensions page, only initialize bridge and return
if (window.location.href === 'https://moodle.bbbaden.ch/userscript/extensions') {
Logger.info('optimizedcontentlist', 'On extensions page - bridge only mode');
return;
}
// Set your dynamic conditions here
const iconsEnabled = true;
const smallerIcons = true;
const titlesEnabled = true;
const smallTitles = true;
const changeTitleColor = true;
const remItemsEnabled = true;
const socialHeader = true;
const showFooter = true;
// Dynamic CSS template
const dynamicCSS = `
/* FIX: Remove border-top from activities */
.activity {
border-top: none !important;
padding-top: 0 !important;
margin-top: 0 !important;
}
/* FIX: Prevent text/link cutoff - override no-overflow */
.activity-altcontent .no-overflow {
overflow: visible !important;
white-space: normal !important;
text-overflow: clip !important;
max-width: none !important;
}
.activity-altcontent {
overflow: visible !important;
flex-wrap: wrap !important;
}
.activity-altcontent p,
.activity-altcontent a {
word-wrap: break-word !important;
overflow-wrap: break-word !important;
word-break: break-word !important;
white-space: normal !important;
max-width: 100% !important;
}
${iconsEnabled && smallerIcons ? `
/* ICONS NEW SIZE */
.activityicon {
height: 20px !important;
width: 20px !important;
}
.activityiconcontainer {
height: 30px !important;
width: 30px !important;
}
/* FIXED: Consistent compact spacing */
.activity-item {
margin-top: 0 !important;
margin-bottom: 0 !important;
padding-top: 0.4rem !important;
padding-bottom: 0.4rem !important;
}
/* Label items (headers) - slightly more spacing */
.activity-item.activityinline {
padding-top: 0.6rem !important;
padding-bottom: 0.3rem !important;
}
/* Indented items maintain left margin */
.section .activity.indented .activity-item {
margin-left: 1rem !important;
}
/* [BOOST THEME] SET ACTIVITY BOX PADDING */
.activity-item:not(.activityinline) {
border: 0px solid #dee2e6;
padding-left: 1rem !important;
padding-right: 1rem !important;
}
.section .activity.indented + .indented .activity-item {
border-top: 0px solid #dee2e6;
border-radius: unset;
}
` : ''}
${titlesEnabled ? `
/* Dynamic CSS for Titles */
h1, .h1 {
font-size: ${smallTitles ? '28px' : 'inherit'} !important;
color: ${changeTitleColor ? 'yourTitleColor' : 'inherit'} !important;
}
h2, .h2 {
font-size: ${smallTitles ? '24px' : 'inherit'} !important;
color: ${changeTitleColor ? 'yourTitleColor' : 'inherit'} !important;
}
h3, .h3 {
font-size: ${smallTitles ? '20px' : 'inherit'} !important;
color: ${changeTitleColor ? 'yourTitleColor' : 'inherit'} !important;
}
h4, .h4 {
font-size: ${smallTitles ? '16px' : 'inherit'} !important;
color: ${changeTitleColor ? 'yourTitleColor' : 'inherit'} !important;
margin-bottom: 0.25rem !important;
}
h5, .h5 {
color: ${changeTitleColor ? 'yourTitleColor' : 'inherit'} !important;
}
` : ''}
${remItemsEnabled ? `
/* Dynamic CSS for Removing Unnecessary Elements */
.socials-header {
display: ${socialHeader ? 'none' : 'inherit'} !important;
}
footer, .footer {
display: ${showFooter ? 'none' : 'inherit'} !important;
}
` : ''}
`;
// Add dynamic CSS to the page
GM_addStyle(dynamicCSS);
Logger.success('optimizedcontentlist', 'Initialization complete');
})();