-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.cs
61 lines (55 loc) · 1.91 KB
/
MainWindow.xaml.cs
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
using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT;
using Microsoft.Toolkit.Wpf.UI.Controls;
using System;
using System.Windows;
namespace AnimeAll
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private readonly string[] script = new string[]
{
@"$('.image-with-text, .ad-bebi, .bebi-icon-hover, img[border]').remove();",
};
public MainWindow()
{
InitializeComponent();
}
private void weball_ContainsFullScreenElementChanged(object sender, object e)
{
if ((sender as WebView).ContainsFullScreenElement)
{
// Fullscreen
rootWindow.Visibility = Visibility.Collapsed;
rootWindow.WindowStyle = WindowStyle.None;
rootWindow.ResizeMode = ResizeMode.NoResize;
rootWindow.WindowState = WindowState.Maximized;
rootWindow.Topmost = true;
rootWindow.Visibility = Visibility.Visible;
}
else
{
// Exit Fullscreen
rootWindow.WindowStyle = WindowStyle.SingleBorderWindow;
rootWindow.WindowState = WindowState.Normal;
rootWindow.ResizeMode = ResizeMode.CanResize;
rootWindow.Topmost = false;
}
}
private void injectJS(string msg)
{
weball.InvokeScriptAsync("eval", this.script);
Console.WriteLine("Script has been invoked, " + msg);
}
private void weball_FrameDOMContentLoaded(object sender, WebViewControlDOMContentLoadedEventArgs e)
{
injectJS("FrameDOM");
}
private void weball_DOMContentLoaded(object sender, WebViewControlDOMContentLoadedEventArgs e)
{
injectJS("OMContent");
}
}
}