-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml.cs
66 lines (57 loc) · 2.14 KB
/
App.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
62
63
64
65
66
using CefSharp;
using CefSharp.Wpf;
using MapleDesktop2._0;
using System.Windows;
using System.Windows.Controls;
namespace MapleDeaktop2._0
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
///
public partial class App : Application
{
internal ChromiumWebBrowser browser = new ChromiumWebBrowser();
protected override void OnStartup(StartupEventArgs e)
{
var settings = new CefSettings();
settings.CefCommandLineArgs["autoplay-policy"] = "no-user-gesture-required";
Cef.Initialize(settings, true, browserProcessHandler: null);
// browser.FrameLoadEnd += Browser_FrameLoadEnd;
//browser.FrameLoadStart += Browser_FrameLoadStart;
//WebWindow.SetBrowser(browser);
//Grid.Children.Add(browser);
base.OnStartup(e);
}
//internal void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
//{
// WebWindow.DebugWrite("Attempting to Skip Ad");
// Dispatcher.Invoke(() =>
// {
// string script = @"
// var video = document.getElementsByTagName('video')[0];
// video.oncanplay = function () {
// var ad = document.getElementsByClassName('ad-container')[0];
// ad.remove();
// }
// ";
// e.Frame.ExecuteJavaScriptAsync(script);
// });
//}
//internal void Browser_FrameLoadStart(object sender, FrameLoadStartEventArgs e)
//{
// WebWindow.DebugWrite("Attempting to Skip Ad");
// Dispatcher.Invoke(() =>
// {
// string script = @"
// var video = document.getElementsByTagName('video')[0];
// video.oncanplay = function () {
// var ad = document.getElementsByClassName('ad-container')[0];
// ad.remove();
// }
// ";
// e.Frame.ExecuteJavaScriptAsync(script);
// });
//}
}
}