Spaces:
Running
Running
File size: 9,499 Bytes
cdf0905 |
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 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
// Определения приложений с их содержимым
const appDefinitions = {
'explorer': {
name: 'Проводник',
icon: 'explorer-icon.png',
width: 800,
height: 500,
getContent: () => `
<div style="padding: 10px;">
<h3>Проводник</h3>
<div style="display: flex; margin-top: 10px;">
<div style="width: 200px; border-right: 1px solid #ddd; padding-right: 10px;">
<div style="margin-bottom: 5px;">Desktop</div>
<div style="margin-bottom: 5px;">Documents</div>
<div style="margin-bottom: 5px;">Downloads</div>
<div style="margin-bottom: 5px;">Music</div>
<div style="margin-bottom: 5px;">Pictures</div>
<div style="margin-bottom: 5px;">Videos</div>
</div>
<div style="flex: 1; padding-left: 10px;">
<div style="display: flex; flex-wrap: wrap;">
<div style="text-align: center; margin: 10px; width: 80px;">
<img src="src/images/folder-icon.png" style="width: 40px; height: 40px;">
<div>Folder 1</div>
</div>
<div style="text-align: center; margin: 10px; width: 80px;">
<img src="src/images/folder-icon.png" style="width: 40px; height: 40px;">
<div>Folder 2</div>
</div>
<div style="text-align: center; margin: 10px; width: 80px;">
<img src="src/images/text-file-icon.png" style="width: 40px; height: 40px;">
<div>Document.txt</div>
</div>
</div>
</div>
</div>
</div>
`
},
'browser': {
name: 'Браузер',
icon: 'browser-icon.png',
width: 900,
height: 600,
getContent: () => `
<iframe
src="https://www.saucedemo.com/"
referrerpolicy="no-referrer"
sandbox="allow-scripts allow-same-origin"
style="width: 100%; height: 100%; border: none;"></iframe>
`
},
'calculator': {
name: 'Калькулятор',
icon: 'calculator-icon.png',
width: 300,
height: 400,
getContent: () => `
<div style="display: flex; flex-direction: column; padding: 10px;">
<input type="text" value="0" style="text-align: right; padding: 10px; margin-bottom: 10px; font-size: 20px;">
<div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px;">
<button style="padding: 10px;">7</button>
<button style="padding: 10px;">8</button>
<button style="padding: 10px;">9</button>
<button style="padding: 10px;">/</button>
<button style="padding: 10px;">4</button>
<button style="padding: 10px;">5</button>
<button style="padding: 10px;">6</button>
<button style="padding: 10px;">*</button>
<button style="padding: 10px;">1</button>
<button style="padding: 10px;">2</button>
<button style="padding: 10px;">3</button>
<button style="padding: 10px;">-</button>
<button style="padding: 10px;">0</button>
<button style="padding: 10px;">.</button>
<button style="padding: 10px;">=</button>
<button style="padding: 10px;">+</button>
</div>
</div>
`
},
'notepad': {
name: 'Заметки',
icon: 'notepad-icon.png',
width: 500,
height: 400,
getContent: () => `
<div style="display: flex; flex-direction: column; height: 100%;">
<div style="padding: 5px; border-bottom: 1px solid #ddd;">
<span style="margin-right: 10px;">File</span>
<span style="margin-right: 10px;">Edit</span>
<span style="margin-right: 10px;">Format</span>
<span style="margin-right: 10px;">View</span>
<span style="margin-right: 10px;">Help</span>
</div>
<textarea style="flex: 1; padding: 10px; border: none; resize: none; font-family: 'Consolas', monospace;">Это текстовый редактор Windows...</textarea>
</div>
`
},
'photos': {
name: 'Фотографии',
icon: 'photos-icon.png',
width: 700,
height: 500,
getContent: () => `
<div style="display: flex; flex-direction: column; height: 100%;">
<div style="padding: 5px; border-bottom: 1px solid #ddd;">
<span style="margin-right: 10px;">File</span>
<span style="margin-right: 10px;">Edit</span>
<span style="margin-right: 10px;">View</span>
<span style="margin-right: 10px;">Help</span>
</div>
<div style="flex: 1; display: flex; align-items: center; justify-content: center; background-color: #f0f0f0;">
<div style="text-align: center; color: #888;">
<div style="font-size: 48px;">🖼️</div>
<div>Нет доступных изображений</div>
</div>
</div>
</div>
`
},
'settings': {
name: 'Настройки',
icon: 'settings-icon.png',
width: 800,
height: 600,
getContent: () => `
<div style="display: flex; height: 100%;">
<div style="width: 200px; border-right: 1px solid #ddd; padding: 10px;">
<div style="margin-bottom: 10px; font-weight: bold;">Система</div>
<div style="margin-bottom: 10px;">Дисплей</div>
<div style="margin-bottom: 10px;">Звук</div>
<div style="margin-bottom: 10px;">Уведомления</div>
<div style="margin-bottom: 10px; font-weight: bold;">Сеть и Интернет</div>
<div style="margin-bottom: 10px;">Wi-Fi</div>
<div style="margin-bottom: 10px;">Ethernet</div>
<div style="margin-bottom: 10px; font-weight: bold;">Персонализация</div>
<div style="margin-bottom: 10px;">Фон</div>
<div style="margin-bottom: 10px;">Цвета</div>
<div style="margin-bottom: 10px;">Темы</div>
</div>
<div style="flex: 1; padding: 20px;">
<h2>Настройки Windows</h2>
<p>Выберите категорию слева, чтобы изменить настройки.</p>
</div>
</div>
`
},
'computer': {
name: 'Этот компьютер',
icon: 'computer-icon.png',
width: 700,
height: 500,
getContent: () => `
<div style="padding: 10px;">
<h3>Этот компьютер</h3>
<div style="display: flex; flex-wrap: wrap; margin-top: 20px;">
<div style="text-align: center; margin: 10px; width: 100px;">
<img src="src/images/disk-c-icon.png" style="width: 40px; height: 40px;">
<div>Локальный диск (C:)</div>
</div>
<div style="text-align: center; margin: 10px; width: 100px;">
<img src="src/images/disk-d-icon.png" style="width: 40px; height: 40px;">
<div>Локальный диск (D:)</div>
</div>
<div style="text-align: center; margin: 10px; width: 100px;">
<img src="src/images/folder-icon.png" style="width: 40px; height: 40px;">
<div>Desktop</div>
</div>
<div style="text-align: center; margin: 10px; width: 100px;">
<img src="src/images/folder-icon.png" style="width: 40px; height: 40px;">
<div>Documents</div>
</div>
<div style="text-align: center; margin: 10px; width: 100px;">
<img src="src/images/folder-icon.png" style="width: 40px; height: 40px;">
<div>Downloads</div>
</div>
</div>
</div>
`
},
'recycle-bin': {
name: 'Корзина',
icon: 'recycle-bin-icon.png',
width: 600,
height: 400,
getContent: () => `
<div style="padding: 10px;">
<h3>Корзина</h3>
<div style="margin-top: 20px; text-align: center; color: #888;">
<p>Корзина пуста</p>
</div>
</div>
`
}
};
// Функция для получения информации о приложении по его ID
function getAppInfo(appId) {
return appDefinitions[appId] || null;
}
// Функция для запуска приложения
function launchApp(appId) {
const appInfo = getAppInfo(appId);
if (!appInfo) {
console.error(`Не найдено определение для приложения с ID: ${appId}`);
return;
}
console.log(`Запуск приложения: ${appInfo.name}`);
createWindow({
title: appInfo.name,
icon: appInfo.icon,
content: appInfo.getContent(),
width: appInfo.width,
height: appInfo.height,
x: Math.random() * (window.innerWidth - appInfo.width - 200) + 100,
y: Math.random() * (window.innerHeight - appInfo.height - 200) + 100,
isActive: true,
appId: appId
});
} |