Removed old js calls

This commit is contained in:
Marcel Baumgartner 2023-08-23 12:35:30 +02:00
parent b846b28802
commit 4d04d12a39
3 changed files with 0 additions and 113 deletions

View file

@ -8,7 +8,6 @@
@using Moonlight.App.Services.Sessions
@using Moonlight.App.Events
@layout ThemeInit
@implements IDisposable
@inherits LayoutComponentBase
@ -162,18 +161,6 @@
UserProcessed = true;
await InvokeAsync(StateHasChanged);
try
{
await JsRuntime.InvokeVoidAsync("document.body.removeAttribute", "data-kt-app-reset-transition");
await JsRuntime.InvokeVoidAsync("document.body.removeAttribute", "data-kt-app-page-loading");
await JsRuntime.InvokeVoidAsync("KTMenu.createInstances");
await JsRuntime.InvokeVoidAsync("KTDrawer.createInstances");
}
catch (Exception)
{
/* ignore errors to make sure that the session call is executed */
}
await SessionClientService.Start();
NavigationManager.LocationChanged += async (_, _) =>
@ -198,11 +185,6 @@
await KeyListenerService.Initialize();
RunDelayedMenu(0);
RunDelayedMenu(1);
RunDelayedMenu(3);
RunDelayedMenu(5);
if (ConfigService.Get().Moonlight.EnableLatencyCheck)
{
await JsRuntime.InvokeVoidAsync("moonlight.loading.checkConnection",
@ -228,31 +210,4 @@
await Event.Off($"supportChat.{IdentityService.User.Id}.message", this);
}
}
private void AddBodyAttribute(string attribute, string value)
{
JsRuntime.InvokeVoidAsync("document.body.setAttribute", attribute, value);
}
private void AddBodyClass(string className)
{
JsRuntime.InvokeVoidAsync("document.body.classList.add", className);
}
private void RunDelayedMenu(int seconds)
{
Task.Run(async () =>
{
try
{
await Task.Delay(TimeSpan.FromSeconds(seconds));
await JsRuntime.InvokeVoidAsync("KTMenu.initHandlers");
}
catch (Exception e)
{
//Logger.Warn("Delayed menu error");
//Logger.Warn(e);
}
});
}
}

View file

@ -3,7 +3,6 @@
@using Moonlight.App.Extensions
@using Moonlight.App.Services.Sessions
@layout ThemeInit
@implements IDisposable
@inherits LayoutComponentBase

View file

@ -1,67 +0,0 @@
@using Moonlight.App.Extensions
@inherits LayoutComponentBase
@inject IJSRuntime JS
@inject NavigationManager NavigationManager
@Body
<script suppress-error="BL9992">
window.emptyBody = function(){
document.body.className = '';
}
</script>
@code
{
protected override void OnAfterRender(bool firstRender)
{
JS.InvokeVoidSafe("KTThemeMode.init");
JS.InvokeVoidSafe("emptyBody");
if (firstRender)
{
JS.InvokeVoidSafe("scrollTo", 0, 0);
JS.InvokeVoidSafe("KTDialer.init");
JS.InvokeVoidSafe("KTDrawer.init");
JS.InvokeVoidSafe("KTMenu.init");
JS.InvokeVoidSafe("KTImageInput.init");
JS.InvokeVoidSafe("KTPasswordMeter.init");
JS.InvokeVoidSafe("KTScroll.init");
JS.InvokeVoidSafe("KTScrolltop.init");
JS.InvokeVoidSafe("KTSticky.init");
JS.InvokeVoidSafe("KTSwapper.init");
JS.InvokeVoidSafe("KTToggle.init");
JS.InvokeVoidSafe("KTMenu.updateByLinkAttribute", $"/{NavigationManager.ToBaseRelativePath(NavigationManager.Uri)}");
}
JS.InvokeVoidAsync("KTLayoutSearch.init");
JS.InvokeVoidAsync("KTAppSidebar.init");
}
protected override void OnInitialized()
{
NavigationManager.LocationChanged += OnLocationChanged;
}
private async void OnLocationChanged(object sender, LocationChangedEventArgs args)
{
await JS.InvokeVoidSafeAsync("scrollTo", 0, 0);
await JS.InvokeVoidSafeAsync("KTDrawer.createInstances");
await JS.InvokeVoidSafeAsync("KTMenu.createInstances");
await JS.InvokeVoidSafeAsync("KTImageInput.createInstances");
await JS.InvokeVoidSafeAsync("KTPasswordMeter.createInstances");
await JS.InvokeVoidSafeAsync("KTScroll.createInstances");
await JS.InvokeVoidSafeAsync("KTScrolltop.createInstances");
await JS.InvokeVoidSafeAsync("KTSticky.createInstances");
await JS.InvokeVoidSafeAsync("KTSwapper.createInstances");
await JS.InvokeVoidSafeAsync("KTToggle.createInstances");
await JS.InvokeVoidSafeAsync("KTMenu.updateByLinkAttribute", $"/{NavigationManager.ToBaseRelativePath(args.Location)}");
await JS.InvokeVoidSafeAsync("KTAppSidebar.init");
}
public void Dispose()
{
NavigationManager.LocationChanged -= OnLocationChanged;
}
}