function launcher_actions(action) { if (action == 'minw') { LauncherAPI.MinimizeW() } else if (action == 'exit') { LauncherAPI.ExitW() } } function hoverEffect(isHovering, elementid) { const input = document.getElementById(elementid); if (isHovering) { input.classList.add('auth_input_hover_effect'); } else { input.classList.remove('auth_input_hover_effect'); } } function selectinstalldir() { LauncherAPI.GetInstallDirectory((event, path) => { document.getElementById('insallpahinput').value = path; }) LauncherAPI.SetInstallDirectory() } function startdownload() { document.getElementById('downloadpausebtn').classList.replace('downloadpausebtnplay', 'downloadpausebtn') document.getElementById('downloadpausebtnimg').src = "./icons/pause_tab.png" document.getElementById('downloadpausebtnimg').style.marginTop = '9px' document.getElementById('downloadpausebtn').pointerEvents = 'all' document.getElementById('downloadpausebtn').onclick = pausedownload LauncherAPI.StartDownload() } function pausedownload() { document.getElementById('downloadpausebtn').pointerEvents = 'none' document.getElementById('downloadpausebtn').classList.replace('downloadpausebtn', 'downloadpausebtnplay') document.getElementById('downloadpausebtnimg').src = "./icons/play_tab.png" document.getElementById('downloadpausebtnimg').style.marginTop = '8px' document.getElementById('downloadpausebtn').onclick = startdownload LauncherAPI.PauseDownload() setTimeout(() => { document.getElementById('downloadpausebtn').pointerEvents = 'all' }, 400); } function openclose_quality_menu(open) { const selectmenu = document.getElementById('quality_select'); if (open && (selectmenu.style.height !== '160px')) { selectmenu.style.height = '160px' } else { selectmenu.style.height = '0px' } } function select_qulaity(quality) { openclose_quality_menu(false) LauncherAPI.SetGameQuality(quality); console.log(quality) } function show_password() { if (document.getElementById('Passwordinput').type == "password") { document.getElementById('Passwordinput').type = "default" document.getElementById('passwordshbtn').src = "./icons/show_tab.png" } else { document.getElementById('Passwordinput').type = "password" document.getElementById('passwordshbtn').src = "./icons/hide_tab.png" } } LauncherAPI.OnMosAuth((event) => { LauncherAPI.onGetLauncherData((event, LauncherInfo) => { if (LauncherInfo[0]) { open_panel('LaunchSidePanel', 'HelloWindow', () => open_panel('HelloWindow', 'LaunchSidePanel', null, true, ['gamestartbtn'], () => LauncherAPI.ExitAccount()), true); LauncherAPI.FastCheckFiles(); //open_panel('LaunchSidePanel', 'AuthSidePanel', () => open_panel('AuthSidePanel', 'LaunchSidePanel', null, true, ['gamestartbtn'], () => LauncherAPI.ExitAccount()), true); //LauncherAPI.FastCheckFiles() } else { open_panel('DownloadSidePanel', 'HelloWindow', () => open_panel('HelloWindow', 'DownloadSidePanel', null, true, ['toinstallpathpanelbtn']), true); //open_panel('DownloadSidePanel', 'AuthSidePanel', () => open_panel('AuthSidePanel', 'DownloadSidePanel', null, true, ['toinstallpathpanelbtn']), true); } }) LauncherAPI.GetLauncherData() document.getElementById('AuthSidePanel').style.pointerEvents = 'all'; document.getElementById('authbutton').disabled = false; }); LauncherAPI.finishinstall((event, data) => { open_panel('LaunchSidePanel', 'DownloadWindow', () => open_panel('AuthSidePanel', 'LaunchSidePanel', null, true, ['gamestartbtn'], () => LauncherAPI.ExitAccount()), true); const updatedownloadstatus = document.getElementById('updatedownloadstatus') updatedownloadstatus.style.display = 'block' updatedownloadstatus.style.opacity = '1' updatedownloadstatus.style.pointerEvents = 'all' document.getElementById("update_ststus").innerHTML = `Все файлы успешно установлены!` }) LauncherAPI.finishcheck((event, data) => { document.getElementById("update_ststus").innerHTML = data.text if (data.updatell) { document.getElementById("loading_line_progress").style.width = `0%` } }) function cancel_download() { show_hide_alert(true) LauncherAPI.CancelDownload() } LauncherAPI.GetDownload((event, data) => { document.getElementById("downloadlineprogress").style.width = `${data.totalloadingpercent}%` document.getElementById("downloadpercenttext").innerHTML = `${data.totalloadingpercent}%` document.getElementById("percent_text").innerHTML = `${data.totalloadingpercent}/100.0%` document.getElementById("loading_line_progress").style.width = `${data.totalloadingpercent}%` if (data.FilePercent == '...') { document.getElementById("downloadfilename").innerHTML = `Проверка целостности файлов` document.getElementById("update_ststus").innerHTML = `Проверка целостности файлов` } else { document.getElementById("downloadfilename").innerHTML = `${data.downloadspeed} МБ/С` document.getElementById("update_ststus").innerHTML = `${data.downloadspeed} МБ/С` } }) LauncherAPI.GetDownloadStatus((event, status) => { if (status == 'DError') { pausedownload(); show_hide_alert(false, 'Ошибка скачивания', 'Произошла ошибка при скачивании файла, пожалуйста попробуйте снова.', 1, () => open_panel('InstallPathSidePanel', 'DownloadWindow', () => open_panel('DownloadSidePanel', 'InstallPathSidePanel', () => open_panel('AuthSidePanel', 'DownloadSidePanel', null, true, ['toinstallpathpanelbtn'], () => LauncherAPI.ExitAccount()), true, ['selectinstalldirbtn']), true, ['canceldownloadbtn'], () => show_hide_alert(true))) document.getElementById('downloadpausebtn').classList.replace('downloadpausebtnplay', 'downloadpausebtn') document.getElementById('downloadpausebtnimg').src = "./icons/pause_tab.png" document.getElementById('downloadpausebtnimg').style.marginTop = '9px' document.getElementById('downloadpausebtn').pointerEvents = 'all' document.getElementById('downloadpausebtn').onclick = pausedownload } else if (status == 'StartInstall') { document.getElementById('checkfilesbrtn').style.pointerEvents = 'none' document.getElementById('gamestartbtn').disabled = true//onclick = () => show_hide_alert(false, "Ошибка запуска", "Дождитесь окончания проверки файлов, затем попробуйте снова.", 1) document.getElementById('downloadpausebtn').classList.replace('downloadpausebtnplay', 'downloadpausebtn') document.getElementById('downloadpausebtnimg').src = "./icons/pause_tab.png" document.getElementById('downloadpausebtnimg').style.marginTop = '9px' document.getElementById('downloadpausebtn').pointerEvents = 'all' document.getElementById('downloadpausebtn').onclick = pausedownload } else if (status == 'EndInstall') { document.getElementById('checkfilesbrtn').style.pointerEvents = 'all' document.getElementById('gamestartbtn').disabled = false//onclick = () => LauncherAPI.StartGame() } else { document.getElementById("downloadinformer").innerHTML = `${status}` } }) LauncherAPI.gameprocess((event, status) => { if (status == 'Start') { document.getElementById('LaunchSidePanel').style.pointerEvents = 'all' document.getElementById('checkfilesbrtn').style.pointerEvents = 'none' document.getElementById('deletegamebtn').style.pointerEvents = 'none' document.getElementById('gamestartbtn').disabled = true document.getElementById('gamestartbtn').onclick = () => (LauncherAPI.StopAllProcesses()) setTimeout(() => { document.getElementById('gamestartbtn').innerHTML = "Остановить игру" document.getElementById('gamestartbtn').disabled = false }, 400 ) document.getElementById('checkdirectorybtn').style.pointerEvents = 'none' //document.getElementById('backbtn').style.pointerEvents = 'none' console.log("Start") } else if (status == 'End') { document.getElementById('LaunchSidePanel').style.pointerEvents = 'all' document.getElementById('checkfilesbrtn').style.pointerEvents = 'all' document.getElementById('deletegamebtn').style.pointerEvents = 'all' document.getElementById('gamestartbtn').disabled = true document.getElementById('gamestartbtn').onclick = () => (LauncherAPI.StartGame()) setTimeout(() => { document.getElementById('gamestartbtn').innerHTML = "Запустить игру" document.getElementById('gamestartbtn').disabled = false }, 400 ) document.getElementById('checkdirectorybtn').style.pointerEvents = 'all' //document.getElementById('backbtn').style.pointerEvents = 'all' console.log("End") } }); function open_panel(openpanel, closepanel, backbuttonfunc, sidepanel, buttonstodisable, additionfunc) { if (additionfunc) { additionfunc(); } if (buttonstodisable) { buttonstodisable.forEach(btn => { document.getElementById(btn).disabled = true; }); } if (sidepanel) { document.getElementById('dragpanel').classList.replace('drag-region', 'drag-region-sized'); } else { document.getElementById('dragpanel').classList.replace('drag-region-sized', 'drag-region'); document.getElementById('HelloWindowSmallSize').style.opacity = '0'; } if (backbuttonfunc) { //const backbtn = document.getElementById('backbtn') //backbtn.style.display = 'block' //backbtn.onclick = backbuttonfunc } else { //const backbtn = document.getElementById('backbtn') //backbtn.style.display = 'none' //backbtn.onclick = '' } if (closepanel) { const iclosepanel = document.getElementById(closepanel) iclosepanel.style.opacity = '0'; iclosepanel.style.pointerEvents = 'none'; } setTimeout(() => { if (buttonstodisable) { buttonstodisable.forEach(btn => { document.getElementById(btn).disabled = false; }); } if (closepanel) { const iclosepanel = document.getElementById(closepanel) iclosepanel.style.display = 'none'; } if (sidepanel) { document.getElementById('SidePanel').style.width = '450px'; document.getElementById('SidePanel').style.pointerEvents = 'all'; document.getElementById('loading_line').classList.add('loading_line_minsize'); document.getElementById('percent_text').style.marginRight = '475px'; Array.from(document.getElementsByClassName('top-buttons')).forEach(function(element) { element.style.borderColor = '#0000001A'; }); document.getElementById('HelloWindowSmallSize').style.display = 'block'; } else { document.getElementById('SidePanel').style.width = '0px'; document.getElementById('SidePanel').style.pointerEvents = 'none'; document.getElementById('loading_line').classList.remove('loading_line_minsize'); Array.from(document.getElementsByClassName('top-buttons')).forEach(function(element) { element.style.borderColor = '#FFFFFF1A'; }); document.getElementById('HelloWindowSmallSize').style.display = 'none'; } const iopenpanel = document.getElementById(openpanel) iopenpanel.style.display = 'block'; setTimeout(() => { iopenpanel.style.opacity = '1'; iopenpanel.style.pointerEvents = 'all'; if (sidepanel) { document.getElementById('HelloWindowSmallSize').style.opacity = '1'; } }, 100); }, 400); } function show_hide_alert(hide, title, text, optiontype, func) { if (hide) { document.getElementById('AlertYes').onclick = ''; document.getElementById('Alert_window').style.opacity = '0'; document.getElementById('Alert_window').style.pointerEvents = 'none'; setTimeout(() => { document.getElementById('Alert_window').style.display = 'none'; }, 400); } else { document.getElementById('Alert_window').style.display = 'flex'; setTimeout(() => { document.getElementById('Alert_window').style.opacity = '1'; document.getElementById('Alert_window').style.pointerEvents = 'all'; if (optiontype == 1) { document.getElementById('Alert_yesno_option').style.display = 'none'; document.getElementById('Alert_yes_option').style.display = 'flex'; } else if (optiontype == 2) { document.getElementById('Alert_yesno_option').style.display = 'flex'; document.getElementById('Alert_yes_option').style.display = 'none'; } document.getElementById('Alert_title').innerHTML = title; document.getElementById('Alert_text').innerHTML = text; }, 1); // Проверка на существование func и является ли она функцией if (func && typeof func === 'function') { document.getElementById('AlertYes').onclick = func; // Вызов функции, если она существует и является функцией document.getElementById('Alert_yes_option').onclick = func; if (optiontype == 1) { document.getElementById('close_alert').onclick = func; } } } } // ВЫПОЛНЕНИЕ ДЕЙСТВИЙ В СЛУЧАЕ ИСПОЛЬЗОВАНИЯ СОХРАНЁННЫХ ДАННЫХ АВТОРИЗАЦИИ window.addEventListener('DOMContentLoaded', () => { LauncherAPI.onGetLauncherData((event, LauncherInfo) => { const updatedownloadstatus = document.getElementById('updatedownloadstatus') if (LauncherInfo[0]) { updatedownloadstatus.style.display = 'block' setTimeout(() => { updatedownloadstatus.style.opacity = '1' updatedownloadstatus.style.pointerEvents = 'all' }, 1); } else { } let inputValue = LauncherInfo[1]; // Предполагаем, что LauncherInfo[1] содержит строку, которую вы хотите обрезать if (inputValue.length > 30) { inputValue = inputValue.substring(0, 30) + '...'; // Обрезаем строку и добавляем многоточие } document.getElementById('insallpahinput').value = inputValue; if (LauncherInfo[2] == '"0"') { document.getElementById('selectgamequality').value = 'Низкие настройки'; } else if (LauncherInfo[2] == '"1"') { document.getElementById('selectgamequality').value = 'Средние настройки'; } else if (LauncherInfo[2] == '"2"') { document.getElementById('selectgamequality').value = 'Эпические настройки'; } else if (LauncherInfo[2] == 'Preset') { document.getElementById('selectgamequality').value = 'Рекомендуемые настройки'; } }) LauncherAPI.GetLauncherData() /* АВТОРИЗАЦИИ ИЗ СОХРАНЁННОГО ФАЙЛА АВТОРИЗАЦИИ ИЗ СОХРАНЁННОГО ФАЙЛА АВТОРИЗАЦИИ ИЗ СОХРАНЁННОГО ФАЙЛА */ LauncherAPI.onAccountData((event, data) => { document.getElementById('userlogininput').value = data.login app.formData.login = data.login; window.Auth(data) }) // document.getElementById('startbtn').onclick = () => open_panel('AuthSidePanel', 'HelloWindow', null, true, ['startbtn'], () => LauncherAPI.loadAccount()); /* АВТОРИЗАЦИИ ИЗ СОХРАНЁННОГО ФАЙЛА АВТОРИЗАЦИИ ИЗ СОХРАНЁННОГО ФАЙЛА АВТОРИЗАЦИИ ИЗ СОХРАНЁННОГО ФАЙЛА */ }) document.addEventListener("DOMContentLoaded", function() { const images = document.querySelectorAll('.image-container'); let currentIndex = 0; function switchImage() { // Устанавливаем текущее изображение непрозрачным images[currentIndex].style.opacity = '0'; // Переключаемся на следующее изображение currentIndex = (currentIndex + 1) % images.length; // Устанавливаем следующее изображение полностью видимым images[currentIndex].style.opacity = '1'; // Повторяем каждые N секунд (3000 мс = 3 секунды) setTimeout(switchImage, 3000); } // Начинаем цикл с первого изображения setTimeout(switchImage, 3000); }); LauncherAPI.GetGameQuality((event, gamequality) => { if (gamequality == '"0"') { document.getElementById('selectgamequality').value = 'Низкие настройки'; } else if (gamequality == '"1"') { document.getElementById('selectgamequality').value = 'Средние настройки'; } else if (gamequality == '"2"') { document.getElementById('selectgamequality').value = 'Эпические настройки'; } else if (gamequality == 'Preset') { document.getElementById('selectgamequality').value = 'Рекомендуемые настройки'; } }); LauncherAPI.deletegamecallback((event, responce) => { if (responce == 'Error') { show_hide_alert(false, 'Ошибка удаления', 'Перед удалением всех файлов необходимо закрыть игру или дождаться окончания проверки файлов, закройте и попробуйте снова.', 1, () => show_hide_alert(true)) } else if (responce == 'Succes') { open_panel('DownloadSidePanel', 'LaunchSidePanel', null, true, ['gamestartbtn'], () => {LauncherAPI.ExitAccount(); show_hide_alert(true); updatedownloadstatus.style.opacity = '0'; updatedownloadstatus.style.pointerEvents = 'none'}); } }); document.addEventListener("DOMContentLoaded", function() { LauncherAPI.OnTestSend(); LauncherAPI.OnTest((event, responce) => { document.getElementById('startbtn').onclick = () => open_panel('AuthSidePanel', 'HelloWindow', null, true, ['startbtn'], () => LauncherAPI.loadAccount()); }); });