/
cto_ego
/
website
Обзор
Документация
Войти
/
cto_ego
/
website
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
mod/save.js
44 строки
1 KB
cto_ego
Create: index.html, index.js, styles.css, bugs.md, changelog.md, handbook.html, img_1.png, config.js, draw.js, formula.js, logger.js, mathf.js, matrixControllerState.js, matrixData.js, save.js, ui.js, update.js
22 июн 2026, 16:58
Верифицирован
22 июн 2026, 16:58
da9567f
Код
Авторство
О чём код?
class Save { /** * Generate and download json file this settings matrix */ generateAndDownload() { const f_x = mathf.inputMathf.formulas; Object.keys(f_x).forEach(id => { delete f_x[id].points; }); // Генерируем данные const sampleData = { timestamp: new Date().toISOString(), message: "Do not touch", colors: data.colors, mod: data.mode_matrix, speed: data.time_update, speedFill: parseFloat(document.getElementById('speedFillControl').value), /* Прикольная конструкция */ text: data.mode_matrix === 'find' ? data.cacheText : data.charArray_my, formulars: f_x }; Logger.info(mathf.inputMathf.formulas) this.downloadJSON(sampleData, 'export.json'); }; // download json this settings downloadJSON(data, filename) { const jsonString = JSON.stringify(data, null, 2); const blob = new Blob([jsonString], { type: 'application/json' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }; } class Load { } window.save = new Save();