-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
175 lines (167 loc) · 4.86 KB
/
Copy pathindex.js
File metadata and controls
175 lines (167 loc) · 4.86 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
window.eelib = {
leftBtn: 'none',
};
window.pages = [
{
id: 'alarm',
title: 'Alarm',
icon: 'img/other/alarm.svg',
btns: [
['search'],
['add'],
],
subcategories: ['all', 'horizontal', 'vertical', 'special'],
},
{
id: 'home',
title: 'Main',
description: 'General Elements',
icon: 'img/ui/home.svg',
active: true,
btns: [
['search'],
['add'],
['settings', 'img/ui/settings', 'changePage("settings")', true]
],
},
{
id: 'timer',
title: 'Timer',
icon: 'img/other/timer.svg',
btns: [
['search'],
['add'],
],
subcategories: ['all', 'horizontal', 'vertical', 'special'],
},
{
id: 'seconds',
title: 'Seconds',
icon: 'img/other/seconds.svg',
btns: [
['search'],
['add'],
],
subcategories: ['all', 'horizontal', 'vertical', 'special'],
},
{
id: 'about',
title: 'About',
icon: 'img/ui/time.svg',
noBottom: true,
},
{
id: 'settings',
title: 'Настройки',
icon: 'img/ui/settings.svg',
leftBtn: 'back',
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();
// Инициализация настроек
document.addEventListener("DOMContentLoaded", () => {
window.settingsManager.init({
storageKey: 'appSettings',
defaultSettings: {
clock: {
clockFormat: "24",
showSeconds: false,
showDate: true,
dateFormat: "DDMMYYYY",
timeZone: "local",
showDayOfWeek: true,
leadingZero: true,
amPm: false,
showYear: true,
monthAsText: false,
dateSeparator: "/",
jucheCalendar: false,
worldTime: [],
worldTimeSeconds: 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" },
{
type: "select",
key: "dateFormat",
label: "Date Format",
options: {
"DDMMYYYY": "DD/MM/YYYY",
"MMDDYYYY": "MM/DD/YYYY",
"YYYYMMDD": "YYYY/MM/DD"
}
},
{
type: "select",
key: "timeZone",
label: "Time Zone",
options: {
local: "Local Time",
UTC: "UTC"
}
},
{ type: "toggle", key: "showDayOfWeek", label: "Show Day of the Week" },
{ type: "toggle", key: "leadingZero", label: "Leading Zero for Hours" },
{ type: "toggle", key: "amPm", label: "AM/PM Indicator" },
{ type: "toggle", key: "showYear", label: "Show Year" },
{ type: "toggle", key: "monthAsText", label: "Month as Text" },
{
type: "select",
key: "dateSeparator",
label: "Date Separator",
options: {
"/": "/",
"-": "-",
".": ".",
" ": "Space"
}
},
{ type: "toggle", key: "jucheCalendar", label: "Juche calendar" }
]
},
},
onChange: (settings) => {
// Вызывается при любом изменении настроек
if (typeof updateTimeDisplay === 'function') {
updateTimeDisplay();
}
}
});
// Генерация UI
settingsManager.generateUI('settings');
// Примеры использования:
// settingsManager.get('clock.clockFormat')
// settingsManager.set('clock.showSeconds', true)
// settingsManager.reset()
});