-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.js
More file actions
177 lines (161 loc) · 5.56 KB
/
Copy pathconfig.js
File metadata and controls
177 lines (161 loc) · 5.56 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// config.js - Centralized configuration for Cyberdark
// Attached to global scope for access by other scripts without bundler
(function (global) {
const DEFAULT_SETTINGS = {
color1: '#00ffff',
color2: '#00ff00',
color3: '#ff00ff',
color4: '#ff0000',
textShadow: true,
highContrast: true,
focusOutline: true,
reducedMotion: false,
fontSize: 16,
lineHeight: 1.5,
colorBlindMode: 'none', // Changed from boolean to string enum
blacklist: [],
perSiteOverrides: {},
enabled: true, // Global toggle
// New Features
schedule: { enabled: false, start: '20:00', end: '06:00' },
resourceMonitorEnabled: true,
debugMode: false
};
const SITE_PROFILES = {
// Example profiles for specific sites
};
const PROBLEMATIC_SITES = [
'docs.google.com',
'sheets.google.com',
'slides.google.com',
'figma.com',
'chrome.google.com'
];
const PRESETS = {
cyberpunk: {
color1: '#00ffff',
color2: '#00ff00',
color3: '#ff00ff',
color4: '#ff0000',
textShadow: true,
highContrast: true
},
minimal: {
color1: '#ffffff',
color2: '#cccccc',
color3: '#aaaaaa',
color4: '#888888',
textShadow: false,
highContrast: false,
reducedMotion: true
},
vampire: {
color1: '#ff0000',
color2: '#880000',
color3: '#ff0000',
color4: '#440000',
textShadow: true,
highContrast: true
},
// Mission Control: NASA-style cockpit lighting for deep work
// Inspired by spacecraft instrument panels - optimized for night vision
// and long work sessions. Green phosphor text on deep space black.
cockpit: {
color1: '#00ff41', // Terminal green (phosphor)
color2: '#00cc33', // Darker green for hierarchy
color3: '#ff6b00', // Warning orange (alerts)
color4: '#003300', // Deep green (backgrounds)
textShadow: true, // Subtle glow for CRT effect
highContrast: true, // Maximum readability
fontSize: 14, // Slightly smaller, info-dense
fontFamily: '"Share Tech Mono", "SF Mono", "Consolas", monospace' // NASA-style
}
};
// Feature flags for rollback capability
const FEATURES = {
// Emergency dark mode injection at document_start
// Set to false to revert to original behavior if issues arise
emergencyDarkMode: true
};
const COLORBLIND_PALETTES = {
protanopia: { // Red-blind
color1: '#0072ce', // Blue
color2: '#f0e442', // Yellow
color3: '#56b4e9', // Sky Blue
color4: '#e69f00' // Orange
},
deuteranopia: { // Green-blind
color1: '#0072ce',
color2: '#f0e442',
color3: '#56b4e9',
color4: '#d55e00'
},
tritanopia: { // Blue-blind
color1: '#d55e00', // Vermilion
color2: '#009e73', // Bluish Green
color3: '#f0e442', // Yellow
color4: '#cc79a7' // Reddish Purple
},
achromatopsia: { // Monochromacy
color1: '#ffffff',
color2: '#aaaaaa',
color3: '#888888',
color4: '#444444'
}
};
// Precise hostname matching: exact or subdomain of pattern
function hostMatches(hostname, pattern) {
if (!hostname || !pattern) return false;
const h = String(hostname).toLowerCase();
const p = String(pattern).toLowerCase();
return h === p || h.endsWith('.' + p);
}
// Helper to check if a domain is blacklisted
function isBlacklisted(domain, blacklist = []) {
try {
return (
Array.isArray(blacklist) && blacklist.some(d => hostMatches(domain, d))
) || PROBLEMATIC_SITES.some(d => hostMatches(domain, d));
} catch (_) {
return false;
}
}
// Logger Mechanism
const Logger = {
logs: [],
MAX_LOGS: 100,
_add(level, message, data = null) {
const entry = {
timestamp: new Date().toISOString(),
level,
message,
data: data ? JSON.stringify(data) : null
};
this.logs.unshift(entry);
if (this.logs.length > this.MAX_LOGS) this.logs.pop();
// SECURITY: Only log to console in debug mode to prevent info leakage
if (typeof window !== 'undefined' && window.cyberdarkDebugMode) {
if (level === 'ERROR' || level === 'WARN') {
console[level.toLowerCase()](`[Cyberdark] ${message}`, data || '');
}
}
},
info(msg, data) { this._add('INFO', msg, data); },
warn(msg, data) { this._add('WARN', msg, data); },
error(msg, data) { this._add('ERROR', msg, data); },
debug(msg, data) { this._add('DEBUG', msg, data); },
getLogs() { return this.logs; },
clearLogs() { this.logs = []; }
};
global.CyberdarkConfig = {
DEFAULT_SETTINGS,
SITE_PROFILES,
PROBLEMATIC_SITES,
PRESETS,
FEATURES,
COLORBLIND_PALETTES,
isBlacklisted,
Logger,
hostMatches
};
})(typeof window !== 'undefined' ? window : this);