Move social to LauncherUI

This commit is contained in:
Maroxy 2021-10-24 08:17:04 +02:00
parent e75952ca68
commit 0cde3979bf
2 changed files with 15 additions and 9 deletions

View file

@ -156,6 +156,19 @@ export class LauncherUI
Genshinlib.getBackgroundUri().then(uri => $('body').css('background-image', `url(${uri})`));
}
public static updateSocial (): void
{
fetch(`https://genshin.mihoyo.com/launcher/10/${Genshinlib.lang.launcher}?api_url=https%3A%2F%2Fapi-os-takumi.mihoyo.com%2Fhk4e_global&prev=false`)
.then(res => res.text())
.then(body => {
$('#__layout').remove();
$(body).find('#__layout').appendTo('#launchcontent');
$('#launchcontent .home__main .home-swiper-wrap').remove();
$('#launchcontent .home__main .home-news').remove();
});
}
public static updateLang (lang: string|null = null): void
{
if (lang !== null)

View file

@ -25,18 +25,11 @@ $(() => {
LauncherUI.setState('game-launch-available');
LauncherUI.updateBackground();
fetch(`https://genshin.mihoyo.com/launcher/10/${Genshinlib.lang.launcher}?api_url=https%3A%2F%2Fapi-os-takumi.mihoyo.com%2Fhk4e_global&prev=false`)
.then(res => res.text())
.then(body => {
$(body).find('#__layout').appendTo('#launchcontent');
$('#launchcontent .home__main .home-swiper-wrap').remove();
$('#launchcontent .home__main .home-news').remove();
});
LauncherUI.updateSocial();
ipcRenderer.on('change-lang', (event: void, data: any) => {
LauncherUI.updateBackground();
LauncherUI.updateSocial();
// Needs data.lang in the arguments since the button doesn't get updated otherwise.
LauncherUI.updateLang(data.lang);
});