-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblank.js
More file actions
196 lines (186 loc) · 4.96 KB
/
Copy pathblank.js
File metadata and controls
196 lines (186 loc) · 4.96 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
window.eelib = {
leftBtn: 'nav',
};
window.pages = [
{
id: 'home',
title: 'Main',
description: 'General Elements',
icon: 'img/ui/home.svg',
active: true,
btns: [
['search'],
],
},
{
id: 'demo',
title: 'Demo',
icon: 'img/ui/text.svg',
btns: [
['search'],
['add'],
],
subcategories: ['all', 'horizontal', 'vertical', 'special'],
subpages: [
'media',
'tables',
],
subpagesmode: 'default',
},
{
id: 'about',
title: 'About',
icon: 'img/ui/user.svg',
leftBtn: 'none',
btns: [
['search'],
['add'],
['test', 'img/ui/code'],
],
subpages: [
'seek',
],
subpagesmode: 'modal',
},
{
id: 'seek',
title: 'SeekBar',
icon: 'img/ui/spliter.svg',
subcategories: ['all', 'horizontal', 'vertical', 'special'],
leftBtn: 'back',
},
{
id: 'media',
title: 'Медиа',
icon: 'img/ui/image.svg',
leftBtn: 'back',
},
{
id: 'tables',
title: 'Таблицы',
icon: 'img/ui/list/list.svg',
leftBtn: 'back',
},
{
id: 'settings',
title: 'Настройки',
icon: 'img/ui/settings.svg',
noBottom: true,
},
];
// Wait for pages.js to be ready before initializing navigation
function initializeNav() {
if (window.pagesManager && typeof window.pagesManager.createBtnList === 'function') {
console.log('Initializing navigation...');
window.cnavMgr.init(pages);
window.cnavMgr.createNav(pages);
} else {
console.log('Waiting for pagesManager...');
window.addEventListener('pagesManagerReady', () => {
console.log('pagesManager ready, initializing navigation...');
window.cnavMgr.init(pages);
window.cnavMgr.createNav(pages);
}, { once: true });
}
}
// Initialize navigation
initializeNav();
const defaultSettings = {
clock: {
format: "24",
showSeconds: false,
showDate: true
},
theme: {
darkMode: false,
accentColor: "#2196F3"
}
};
const settingsSchema = {
clock: {
title: "Часы",
items: [
{
type: "select",
key: "format",
label: "Формат времени",
options: {
"12": "12-часовой",
"24": "24-часовой"
}
},
{ type: "toggle", key: "showSeconds", label: "Показывать секунды" },
{ type: "toggle", key: "showDate", label: "Показывать дату" }
]
},
theme: {
title: "Тема",
items: [
{ type: "toggle", key: "darkMode", label: "Темная тема" },
{ type: "text", key: "accentColor", label: "Цвет акцента" }
]
}
};
// Инициализация настроек
document.addEventListener("DOMContentLoaded", () => {
window.settingsManager.init({
storageKey: 'appSettings',
defaultSettings: {
weather: {
town: '',
location: [0, 0],
unit: "C",
background: false,
pageBackground: false,
},
clock: {
clockFormat: "24",
showSeconds: false,
showDate: true,
dateFormat: "DDMMYYYY",
timeZone: "local",
showDayOfWeek: true,
leadingZero: true,
amPm: false,
showYear: true,
monthAsText: false,
dateSeparator: "/",
jucheCalendar: false,
}
},
schema: {
clock: {
title: "Clock",
items: [
{
type: "select",
key: "clockFormat",
label: "Clock Format",
options: { "12": "12-hour", "24": "24-hour" }
},
{ type: "toggle", key: "showSeconds", label: "Show Seconds" },
{ type: "toggle", key: "showDate", label: "Show Date" }
]
},
weather: {
title: "Weather",
items: [
{ type: "toggle", key: "background", label: "Weather Background" },
{ type: "toggle", key: "pageBackground", label: "Page Background" }
]
}
},
onChange: (settings) => {
// Вызывается при любом изменении настроек
if (typeof updateTimeDisplay === 'function') {
updateTimeDisplay();
}
}
});
// Генерация UI
settingsManager.generateUI('settings');
// Примеры использования:
// settingsManager.get('clock.clockFormat')
// settingsManager.set('clock.showSeconds', true)
// settingsManager.reset()
});