private void OnDomContentLoaded(object o, WebViewControlDOMContentLoadedEventArgs a)
 {
     WriteLine($"{WebView.GetType().Name}.{nameof(WebView.DOMContentLoaded)}: {a.Uri?.ToString() ?? string.Empty}");
     Application.DoEvents();
 }
Ejemplo n.º 2
0
 private void WebView_FrameDOMContentLoaded(object sender, WebViewControlDOMContentLoadedEventArgs e)
 {
     Debug.WriteLine(callerName());
     UpdateHistory();
 }
Ejemplo n.º 3
0
 private void AssetControl_DOMContentLoaded(object sender, WebViewControlDOMContentLoadedEventArgs e)
 {
     //throw new NotImplementedException();
 }
Ejemplo n.º 4
0
 private void weball_DOMContentLoaded(object sender, WebViewControlDOMContentLoadedEventArgs e)
 {
     injectJS("OMContent");
 }
Ejemplo n.º 5
0
        private async void webbrowser_DOMContentLoaded(object sender, WebViewControlDOMContentLoadedEventArgs e)
        {
            if (Regex.IsMatch(e.Uri.ToString(), videoPattern /*"\\?wersja=((360p)|(480p)|(720p)|(1080p))"*/))
            {
                var videoExists = await webbrowser.InvokeScriptAsync("eval", new string[] {
                    "document.querySelector('.text-alert').innerText ? 'false' : 'true';"
                });

                if (videoExists == "true")
                {
                    var videoUrl = await webbrowser.InvokeScriptAsync("eval", new string[] {
                        "document.querySelector('video').src;"
                    });

                    var title = await webbrowser.InvokeScriptAsync("eval", new string[] {
                        "document.querySelector('.title-name > span').innerHTML;"
                    });

                    var quality = Regex.Match(e.Uri.ToString(), "(360p)|(480p)|(720p)|(1080p)").Value;

                    var video = new Video(title, Regex.Match(e.Uri.ToString(), videoPattern).Value);
                    video.VideoUrl = videoUrl;
                    video.Id       = Regex.Match(e.Uri.ToString(), "[a-z0-9]{9}").Value;

                    switch (quality)
                    {
                    case "360p":
                        video.Quality = EQuality.LQ;
                        break;

                    case "720p":
                        video.Quality = EQuality.HD;
                        break;

                    case "1080p":
                        video.Quality = EQuality.FHD;
                        break;

                    default:
                        video.Quality = EQuality.SD;
                        break;
                    }

                    if (!downloadableList.Contains(video))
                    {
                        downloadableList.Add(video);
                    }

                    if (toSearchList.Count > 0)
                    {
                        toSearchList.RemoveAt(0);
                    }
                }
            }
            else if (Regex.IsMatch(e.Uri.ToString(), folderPattern))
            {
                var videos = await webbrowser.InvokeScriptAsync("eval", new string[] {
                    "var videos = '';document.querySelectorAll('#folder-replace .thumb-wrapper-just .caption-label a').forEach(a => videos += a.href + ' ');videos.trim();"
                });

                foreach (var url in videos.Split(' '))
                {
                    if (q360.IsChecked.Value)
                    {
                        toSearchList.Add(url + "?wersja=360p");
                    }
                    if (q480.IsChecked.Value)
                    {
                        toSearchList.Add(url + "?wersja=480p");
                    }
                    if (q720.IsChecked.Value)
                    {
                        toSearchList.Add(url + "?wersja=720p");
                    }
                    if (q1080.IsChecked.Value)
                    {
                        toSearchList.Add(url + "?wersja=1080p");
                    }
                }
            }

            if (toSearchList.Count > 0)
            {
                webbrowser.Navigate(toSearchList[0]);
                return;
            }

            root.IsEnabled = true;
        }