/// <summary> /// Handles browser DOM loaded event. /// </summary> /// <remarks> /// Hides elements we don't care about. /// </remarks> private async void OnBrowserLoaded(object sender, WebViewDOMContentLoadedEventArgs args) { try { // Hiding a bunch of elements like menus, header, chat, footer, content, built-in full screen button var elementsToHide = "#global_header, #footer_spacer, #footer_responsive_optin_spacer, #footer"; // Hide HTML elements and change styles so it looks like the broadcast is in full-screen // We can't call the broadcast's own toggle full-screen function var lines = new[] { "var checkVideoExists = setInterval(function() {", // Have to wait for the video to load "if (document.getElementsByClassName('videoSrc').length) {", "clearInterval(checkVideoExists);", "$J('[class^=broadcast_embeddable_detail_chat_ctn]').hide();", // Hide chat "$J('[class^=broadcast_embeddable_video_placeholder]').css('height', '100vh');", // Full video height "$J('[class^=broadcast_embeddable_video_placeholder]').css('padding-right', '0');", // Remove video padding "var elementList = document.querySelectorAll('" + elementsToHide + "');", // Find all elements in the list "for (var i = 0; i < elementList.length; i++) { var e = elementList[i]; e.style.display = 'none'; }", // Hide elements "var checkFullscreenExists = setInterval(function() { if ($J('.BroadcastFullscreenToggle').is(':visible')) { $J('.BroadcastFullscreenToggle').hide(); }}, 200);", // Hide fullscreen button when it becomes visible "}}, 100);", "var checkProfileExists = setInterval(function() { if ($J('[class^=broadcastprofile_ProfileCtn]').length) { clearInterval(checkProfileExists); $J('[class^=broadcastprofile_ProfileCtn]').hide(); }}, 100);", "var checkInfoExists = setInterval(function() { if ($J('[class^=broadcastplayer_GameInfoCtn]').length) { clearInterval(checkInfoExists); $J('[class^=broadcastplayer_GameInfoCtn]').hide(); }}, 100);", "var checkEventsExist = setInterval(function() { if ($J('[class^=broadcastplayer_RelatedEvents]').length) { clearInterval(checkEventsExist); $J('[class^=broadcastplayer_RelatedEvents]').hide(); }}, 100);", "setTimeout(() => { clearInterval(checkVideoExists); clearInterval(checkProfileExists); clearInterval(checkInfoExists); clearInterval(checkEventsExist); }, 10000);", // Clear all intervals after a while }; await Browser.InvokeScriptAsync("eval", new string[] { string.Join(" ", lines) }); } catch { // Ignore script exceptions } }
private async void NetWeb_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { await NetWeb.InvokeScriptAsync("eval", new string[] { IPSource.IPHelper.GetDomain() }); NetWeb.DOMContentLoaded -= NetWeb_DOMContentLoaded; await Task.Delay(2000); await NetWeb.InvokeScriptAsync("eval", new string[] { IPSource.IPHelper.Script3 }); }
private async void OnDomContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { var model = Model; await AutoFill(model.UserName, "username", "email", "login"); await AutoFill(model.Password, "password", "passwd"); }
private void Wv_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { if (wv.DocumentTitle != "") { btn_Open.IsEnabled = true; } }
private void WebView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { #if DEBUG Debug.WriteLine("DOM Content Loaded"); #endif this._initialized = true; }
private void Web_FrameDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { ProgressText.Text = text3; Mean.Opacity = 0.3; // Progress.Visibility = Visibility.Collapsed; //ProgressText.Visibility = Visibility.Collapsed; //Mean.Visibility = Visibility.Collapsed; }
// event handling for dom content loaded /* * public event TypedEventHandler<WebView, WebViewDOMContentLoadedEventArgs> DOMContentLoaded * { * * }*/ public async void DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { try { string html = await sender.InvokeScriptAsync("eval", new string[] { "document.documentElement.outerHTML;" }); var text = html; var doc = new HtmlDocument(); doc.LoadHtml(text); var price = doc.DocumentNode.SelectSingleNode("//*[@id=\"mainContainer\"]/div[3]/div[2]/div/div[1]/div[3]/div/ul/li/div/div[2]/div/div/div/div[2]/span"); //var price = doc.DocumentNode.SelectNodes("//div[@class='styles__StyledPricePromoWrapper-e5kry1-12 gzebgK']"); Debug.WriteLine("Target price found:"); Debug.WriteLine(price.InnerText); } catch (HttpRequestException httpException) { Debug.WriteLine("HTTP exception caught."); Debug.WriteLine(httpException); } catch (Exception exception) { Debug.WriteLine("Exception caught."); Debug.WriteLine(exception); } }
private async void webView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { await AzureIoTHub.RegisterDirectMethodAsync( "SearchFuzzy", async delegate(string query) { System.Diagnostics.Debug.WriteLine($"Request for 'SearchFuzzy' is received."); await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => await webView.InvokeScriptAsync("eval", new[] { $"document.getElementById('search-input').value = '{query}'; shouldChangeCamera = true; search(searchResultsHandler);" }) ); }); await AzureIoTHub.RegisterDirectMethodAsync( "ZoomIn", async delegate(string query) { System.Diagnostics.Debug.WriteLine($"Request for 'ZoomIn' is received."); await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => await webView.InvokeScriptAsync("eval", new[] { $"plusZoomElement.click();" }) ); }); await AzureIoTHub.RegisterDirectMethodAsync( "ZoomOut", async delegate(string query) { System.Diagnostics.Debug.WriteLine($"Request for 'ZoomOut' is received."); await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => await webView.InvokeScriptAsync("eval", new[] { $"minusZoomElement.click();" }) ); }); }
private async void WebViewDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { try { LoadingOff(); if (args.Uri.ToString() == InstagramUri.ToString() && !IsWebBrowserInUse) { var cookies = GetBrowserCookie(args.Uri); var sb = new StringBuilder(); foreach (var item in cookies) { sb.Append($"{item.Name}={item.Value}; "); } string html = await WebView.InvokeScriptAsync("eval", new string[] { "document.documentElement.outerHTML;" }); var result = AppCore.InstaApi.SetCookiesAndHtmlForChallenge(html, sb.ToString()); WebView.Visibility = Visibility.Collapsed; IsWebBrowserInUse = true; if (result.Succeeded) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate { AppCore.SaveUserInfo(UserName, Password); MainPage.MainFrame.Navigate(typeof(MainView)); }); } else { await new MessageDialog($"{UserName} couldn't login.\r\nPlease try again.", "Unknown error").ShowAsync(); } WebView.Stop(); } } catch (Exception) { } }
async void OnDOMContentLoaded(Windows.UI.Xaml.Controls.WebView sender, WebViewDOMContentLoadedEventArgs args) { if (Element == null) { return; } // Add Injection Function await Control.InvokeScriptAsync("eval", new[] { FormsWebView.InjectedFunction }); // Add Global Callbacks if (Element.EnableGlobalCallbacks) { foreach (var callback in FormsWebView.GlobalRegisteredCallbacks) { await Control.InvokeScriptAsync("eval", new[] { FormsWebView.GenerateFunctionScript(callback.Key) }); } } // Add Local Callbacks foreach (var callback in Element.LocalRegisteredCallbacks) { await Control.InvokeScriptAsync("eval", new[] { FormsWebView.GenerateFunctionScript(callback.Key) }); } Element.HandleContentLoaded(); }
private async void Scroll_DOMContentLoadedAsync(WebView sender, WebViewDOMContentLoadedEventArgs args) { IncrementalLoadingBorder.SetVisibility(false); isDOMLoaded = true; DefineJsFunction(out var js); await sender.InvokeScriptAsync("eval", new[] { js }); }
private async void webviewChild1_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; string url = webviewChild1.Source.AbsoluteUri; string skoleurl = (string)localSettings.Values["skoleurl"]; string emuurl = (string)localSettings.Values["emuloginurl"]; if (url.Contains(skoleurl) && !url.Contains("parent") && !url.Contains("sso")) { string clickUnilogin = @"document.getElementsByTagName('a')[4].click();"; await webviewChild1.InvokeScriptAsync("eval", new string[] { clickUnilogin }); } else if (url.Contains(emuurl)) { string commandscript = String.Format("if (document.getElementById('user') != null) document.getElementById('user').value = '{0}'; if (document.getElementById('pass') != null) document.getElementById('pass').value='{1}'; if (document.getElementsByTagName('form') != null) document.getElementsByTagName('form')[0].submit(); ", localSettings.Values["FIUsername"], localSettings.Values["FIPassword"]); await webviewChild1.InvokeScriptAsync("eval", new string[] { commandscript }); } else if (url.Contains("Caroline")) { string urlChild2 = webviewChild2.Source.AbsoluteUri; if (urlChild2.Contains(skoleurl) && !urlChild2.Contains("parent") && !urlChild2.Contains("sso")) { string clickUnilogin = @"document.getElementsByTagName('a')[4].click();"; await webviewChild2.InvokeScriptAsync("eval", new string[] { clickUnilogin }); } string urlChild3 = webviewChild3.Source.AbsoluteUri; if (urlChild3.Contains(skoleurl) && !urlChild3.Contains("parent") && !urlChild3.Contains("sso")) { string clickUnilogin = @"document.getElementsByTagName('a')[4].click();"; await webviewChild3.InvokeScriptAsync("eval", new string[] { clickUnilogin }); } } }
private void PopWebView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { LoadingRing.IsActive = false; if (string.IsNullOrEmpty(TitleBlock.Text)) { TitleBlock.Text = PopWebView.DocumentTitle; } }
private void currentWebView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { RefreshAppBarButton.Visibility = Visibility.Visible; StopAppBarButton.Visibility = Visibility.Collapsed; MainProgressRing.IsActive = false; MainProgressRing.Visibility = Visibility.Collapsed; }
private async void TaobaoLogin_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { System.Diagnostics.Debug.WriteLine("DOM加载完成"); var inject = @"window.addEventListener('message',function(args){ window.external.notify(args.data); });"; await sender.InvokeScriptAsync("eval", new string[] { inject }); }
private async void OnDomContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { var model = Model; await AutoFill(model.UserName, "username", "email", "login"); await AutoFill(model.Password, "password", "passwd"); }
private async void TaobaoLogin_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { System.Diagnostics.Debug.WriteLine("DOM加载完成"); var inject = @"window.addEventListener('message',function(args){ window.external.notify(args.data); });"; await sender.InvokeScriptAsync("eval", new string[] { inject }); }
void webView1_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { if (original) { //ParseLyrics(); original = false; } }
private void we_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { if (zhuangtai == false) { WOF.Begin(); zhuangtai = true; } }
private async void WebView_FrameDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { //Prevent new windows await webView.InvokeScriptAsync("eval", new[] { @" (function() { var updateHyperlinks = function() { var hyperlinks = document.getElementsByTagName('a'); for (var i = 0; i < hyperlinks.length; i++) { if ((target = hyperlinks[i].getAttribute('target')) != null && target != '_self') { console.log(hyperlinks[i]); hyperlinks[i].setAttribute('target', '_self'); console.log(hyperlinks[i]); } } } var observeDOM = (function() { var MutationObserver = window.MutationObserver || window.WebKitMutationObserver, eventListenerSupported = window.addEventListener; return function(obj, callback) { if (MutationObserver) { // define a new observer var obs = new MutationObserver(function(mutations, observer) { if (mutations[0].addedNodes.length || mutations[0].removedNodes.length) callback(); }); // have the observer observe foo for changes in children obs.observe(obj, { childList: true, subtree: true }); } else if (eventListenerSupported) { obj.addEventListener('DOMNodeInserted', callback, false); obj.addEventListener('DOMNodeRemoved', callback, false); } } })(); observeDOM(document, updateHyperlinks); //setInterval(updateHyperlinks, 500); // //updateHyperlinks(); //Override window.open window.open = function() { return function(url) { window.location.href = url; }; }(window.open); })(); " }); }
private void OnDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { var webViewData = GetWebViewData(sender); if (webViewData.Bridge != null) { InvokeScript(sender, $"window.postMessage = data => {BridgeName}.postMessage(String(data))"); } }
private void OnDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { try { Debug.WriteLine("Page content loaded."); ProgressEnableUI(); } catch { } }
private async void webView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { var script = _app.DOMContentLoadedScript; if (args.Uri != null && !string.IsNullOrWhiteSpace(script)) { await InvokeScript(script); } }
private void DetailWebView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { LoadingRing.IsActive = false; DetailWebView.Focus(FocusState.Programmatic); if (string.IsNullOrEmpty(TitleBlock.Text)) { TitleBlock.Text = DetailWebView.DocumentTitle; } }
private void wv_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { LoadingTxt.Visibility = Visibility.Collapsed; Progress.Visibility = Visibility.Collapsed; if (args.Uri != null) { UrlBar.Text = args.Uri.ToString(); } }
private async void myWebView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { var widthString = await this.myWebView.InvokeScriptAsync("eval", new[] { "document.body.scrollHeight.toString()" }); double height = Convert.ToDouble(widthString); this.myWebView.Height = height; }
private void View_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { if (!this.logged) { this.logged = true; var account = Settings.AccountManager.Load(); var id = account.Item1.UserName; var pass = account.Item2; if (args.Uri == new Uri("http://its.tsinghua.edu.cn")) { var ignore = this.View.InvokeScriptAsync("eval", new string[] { $@" $.post( 'http://its.tsinghua.edu.cn/loginAjax', 'username={id}&password={pass}', function (data) {{ if(data.code != 0) $.common.message('error', data.msg).follow($('#loginbutton')[0]); else location.href = 'http://its.tsinghua.edu.cn/'; }}, 'json')" }); } else if (args.Uri == new Uri("https://sslvpn.tsinghua.edu.cn/dana-na/auth/url_default/welcome.cgi")) { var ignore = this.View.InvokeScriptAsync("eval", new string[] { $@"username.value = '{account.Item1.UserId}'; password.value = '{pass}'; frmLogin_4.submit();" }); } else if (args.Uri == new Uri("http://zhjwxk.cic.tsinghua.edu.cn/xklogin.do")) { var ignore = this.View.InvokeScriptAsync("eval", new string[] { $@"j_username.value = '{id}'; j_password.value = '{pass}';" }); } else if (args.Uri == new Uri("https://learn.tsinghua.edu.cn/f/login")) { var ignore = this.View.InvokeScriptAsync("eval", new string[] { $@" loginForm.i_user.value = '{id}'; loginForm.i_pass.value = '{pass}'; loginForm.submit();" }); } else { this.logged = false; } } this.UpdateTitle(); }
private async void MathView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { edSrc.IsEnabled = true; MathView.Width = MathView.ActualWidth; MathView.Height = MathView.ActualHeight; if (!string.IsNullOrEmpty(edSrc.Text.Trim())) { await GeneratingMath(); } }
async void wv_sample_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { _isDomReady = true; var newSize = CNBlogSettings.Instance.FontSize / 100 + 1; await this.wv_sample.InvokeScriptAsync("changeFontSize", new[] { newSize.ToString() }); this.tb_Version.Text = FunctionHelper.Functions.GetVersionString(); }
async void wv_sample_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { _isDomReady = true; var newSize = CNBlogSettings.Instance.FontSize / 100 + 1; await this.wv_sample.InvokeScriptAsync("changeFontSize", new[] { newSize.ToString() }); this.tb_Version.Text = FunctionHelper.Functions.GetVersionString(); }
private void Widok_OnFrameDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { string html = Widok.InvokeScript("eval", new string[] { "document.documentElement.textContent;" }); if (html.StartsWith("!OUTPUT!")) { var liczba = float.Parse(html.Substring(8)); Zaplata.Content = liczba; } }
/// <summary> /// Gets called when the monitoring WebView loads an HTML file and /// </summary> /// <param name="sender">The WebView calling this method</param> /// <param name="args">The event arguments</param> /// <exception cref="NotSupportedException">Following protocol is not supported for Hybrid requests</exception> protected virtual async void WebViewOnDomContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { if (sender != WebView) { return; } await RunServerAsync(); PushJavascript(); }
private void DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { foreach (RulesData item in Rules.rules.remove2.DOMContentLoaded) { if (item.status) { RemoveElementsByClassName(item.value); } } }
private void _htmltianqiV_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { try { } catch (Exception ex) { } _loadquanquan.IsActive = false; _htmltianqiV.Visibility = Windows.UI.Xaml.Visibility.Visible; }
private async void myWebView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { var widthString = await this.myWebView.InvokeScriptAsync("eval", new[] { "document.body.scrollHeight.toString()" }); double height = Convert.ToDouble(widthString); this.myWebView.Height = height; }
//DOM树加载完成后执行 private async void WebView_OnDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { // string js = @" // window.external.notify(""ddd""); // }"; // await sender.InvokeScriptAsync("eval", new string[] { js }); string[] arguments = { "document.cookie;" }; string result = await MP.InvokeScriptAsync("eval", arguments); await new MessageDialog(result).ShowAsync(); //await MP.InvokeScriptAsync("alert",new []{"document.cookie"}); }
private async void Web_OnDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { try { // inject event handler to arbitrary page once the DOM is loaded // in this case add event handlet to click on the main <table> element await Web.InvokeScriptAsync("eval", new[] { "document.getElementById(\"hnmain\").addEventListener(\"click\", function () { NotifyApp.setKeyCombination(43); }); "}); //new[] { "document.getElementById(\"hnmain\").addEventListener(\"click\", function () { window.external.notify(\"43\"); }); " }); } catch (Exception e) { Debug.WriteLine(e); } }
/// <summary> /// 在DOM事件加载完成之后,网页加入事件为了通知页面的C#代码 /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private async void webView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { //List<string> arguments = new List<string> { @" // for (var i = 0; i < document.links.length; i++) { // document.links[i].onclick = function() { // window.external.notify('appnews://' + this.href); // return false; // } // }" }; //的DOM完成后,先获得图片列表,然后对带图片链接,加入事件处理,以便于接受页面数据 var arguments = new List<string> { "$(document).ready(function(){var urlstr='picturelist'; $(\'[href$=\".jpg\"]\').each(function() { urlstr=urlstr+this.href+'|'+this.title+'\t';}); window.external.notify(urlstr); return true;});" }; await webView.InvokeScriptAsync("eval", arguments); }
private void _webView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { }
private async void ThreadSnapView_OnDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { try { if (_forumThread.ScrollToPost > 0) { await ThreadSnapView.InvokeScriptAsync("ScrollToDiv", new[] {_forumThread.ScrollToPostString}); } } catch (Exception) { } }
private void WebView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { Loader.IsIndeterminate = false; }
/// <summary> /// Event to indicate that the content is fully loaded in the webview. If you need to invoke script, it is best to wait for this event. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void webView1_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { string url = (args.Uri != null) ? args.Uri.ToString() : "<null>"; rootPage.NotifyUser(String.Format("Content for \"{0}\" has finished loading.\n", url), NotifyType.StatusMessage); }
/// <summary> /// This method is executed when the contents of the Reviews section is loaded. /// </summary> /// <param name="sender">Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.</param> /// <param name="args">WebViewDOMContentLoadedEventArgs is a parameter called args that contains the event data, see the WebViewDOMContentLoadedEventArgs MSDN page for more information.</param> private void webAppReviews_FrameDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { OpenInBrowser.IsEnabled = true; appReviewsUri = args.Uri; }
private async void TopicWebView_OnDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { var uiSettings = new UISettings(); var color = uiSettings.GetColorValue(UIColorType.Accent); //this chain of commands will remove unnecessary stuff string bodyLight = Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "#3d3d3d" : "#d0d0d0"; string bodyLighter = Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "#2f2f2f" : "#e6e6e6"; string bodyDarker = Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "#212121" : "#cacaca"; string fontColor = Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "white" : "black"; string fontColorInverted = Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "black" : "white"; var zoom = 100*ActualWidth/(_args.CreateNewTopic ? 800 : 1060); _prevSize = new Size(ActualWidth, ActualHeight); List<string> commands; if (_args.CreateNewTopic) { commands = new List<string> { @"document.getElementById(""headerSmall"").outerHTML='';document.getElementById(""menu"").outerHTML='';document.getElementsByClassName(""js-sns-icon-container icon-block-small"")[0].outerHTML='';document.getElementsByTagName(""footer"")[0].innerHTML='';document.getElementsByClassName(""mauto clearfix pt24"")[0].outerHTML='';", @"$(""#contentWrapper"").find('div:first').remove();", $@"$(""#contentWrapper"").css(""background-color"", ""{bodyLighter}"");", $@"$(""body"").css(""font-family"", ""Segoe UI"").css(""color"", ""{fontColor}"").css(""background-color"", ""{bodyLighter}"");", @"$(""footer"").remove()", @"$(""input[name='preview']:first"").remove()", $@"$(""textarea"").css(""background-color"",""{bodyDarker}"").css(""color"", ""{fontColor}"")", $@"$(""td"").css(""color"", ""{fontColor}"")", $@"$(""a"").css(""color"", ""#{color.ToString().Substring(3)}"");", $@"$(""#content"").css(""border-color"", ""{bodyLighter}"").css(""background-color"",""{bodyLighter}"");", $@"$(""html"").css(""zoom"", ""{Math.Floor(zoom)}%"").css(""background-color"", ""{bodyLighter}"");", @"$(""iframe"").remove()", $@"$(""#dialog"").css(""border-color"", ""{bodyLight}"")", $@"$(""td"").css(""border-color"", ""{bodyDarker}"")", $@"$("".inputtext"").css(""background-color"", ""{bodyDarker}"").css(""color"", ""{fontColor}"")", $@"$("".normal_header"").css(""color"", ""{fontColor}"")", $@"$("".inputButton"").css(""background-color"", ""{bodyLight}"").css(""border-color"",""{fontColorInverted}"");", $@"$("".bgbdrContainer"").css(""background-color"", ""{bodyDarker}"").css(""border-color"",""{fontColorInverted}"");", }; } else { commands = new List<string> { @"document.getElementById(""headerSmall"").outerHTML='';document.getElementById(""menu"").outerHTML='';document.getElementsByClassName(""js-sns-icon-container icon-block-small"")[0].outerHTML='';document.getElementsByTagName(""footer"")[0].innerHTML='';document.getElementsByClassName(""mauto clearfix pt24"")[0].outerHTML='';", @"$(""#contentWrapper"").find('div:first').remove();", @"$(""div[id^="" +""ad-skin"" + ""]"").remove();", $@"$(""#contentWrapper"").css(""background-color"", ""{bodyLighter}"");", $@"$(""body"").css(""font-family"", ""Segoe UI"").css(""color"", ""{fontColor}"").css(""background-color"", ""{bodyLighter}"");", $@"$(""td"").css(""background-color"", ""{bodyDarker}"").css(""border-color"", ""{bodyDarker}"");", $@"$("".forum_boardrow2"").css(""background-color"", ""{bodyDarker}"");", $@"$("".forum_boardrow1"").css(""background-color"", ""{bodyLighter}"").css(""border-color"",""{fontColorInverted}"");", $@"$("".forum_category"").css(""background-color"", ""{bodyLight}"");", $@"$("".forum_boardrowspacer"").css(""background-color"", ""{bodyLighter}"");", $@"$("".btn-forum"").css(""background-color"", ""{bodyLight}"").css(""border-color"",""{fontColorInverted}"");", $@"$(""html"").css(""zoom"", ""{Math.Floor(zoom)}%"");", @"$("".wrapper"").find("".fl-r.ar"").remove()", $@"$("".inputButton"").css(""border-color"",""{fontColorInverted}"").css(""background-color"",""{bodyLight}"")", $@"$(""a"").css(""color"", ""#{color.ToString().Substring(3)}"");", $@"$(""#content"").css(""border-color"", ""{bodyLighter}"").css(""background-color"",""{bodyLighter}"");", $@"$("".forum_category,.forum_locheader"").css(""color"",""{fontColor}"");", $@"$("".codetext"").css(""background-color"",""{bodyDarker}"");", $@"$("".quotetext"").css(""background-color"",""{bodyLight}"").css(""border-color"",""{bodyLighter}"");", $@"$("".vote_container"").css(""background-color"",""#{color.ToString().Substring(3)}"")", $@"$(""textarea"").css(""background-color"",""{bodyDarker}"").css(""color"", ""{fontColor}"")", }; } foreach (var command in commands) { try { await TopicWebView.InvokeScriptAsync("eval", new string[] {command}); } catch (Exception) { //htm.. no it's javascript this time oh, how fun! } } ViewModel.LoadingTopic = false; }
private void DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { m_base.FireOnLoading(false); HideReadingModeLoading(); }
void wbMain_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { }
private void webView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs e) { if (webView.DocumentTitle != "") ViewModel.CurrentWebTitle = webView.DocumentTitle; if (e.Uri != null) ViewModel.CurrentWebPage = e.Uri; ViewModel.IsBusy = false; //UNDONE //App.InvokeOnToastRise("Lỗi khi tải trang, hãy thử refresh lại trang web bằng nút F5", 4000); ViewModel.UpdateButton(); }
/// <summary> /// Invoked when the webview's DOM is fully loaded. All javascript libraries included /// on the current page's markup are ready to be used. /// </summary> /// <param name="sender">The webview containing the DOM</param> /// <param name="args">Event data containing the sender's current state.</param> private void webView_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { this.domReady.SetResult(true); }
static void Web_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { //var view = sender.DataTransferPackage.GetView(); //DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView(); //dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested); }
private async void wv_WebContent_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { try { var newSize = CNBlogSettings.Instance.FontSize / 100 + 1; await this.wv_WebContent.InvokeScriptAsync("changeFontSize", new[] { newSize.ToString() }); var text = Windows.Data.Html.HtmlUtilities.ConvertToText(content); // fill post content using javascript await this.wv_WebContent.InvokeScriptAsync("setContent", new[] { content }); } catch (Exception ex) { // invoke script may cause exception System.Diagnostics.Debug.WriteLine("exception when set post content", ex.Message); } FunctionHelper.Functions.RefreshUIOnDataLoaded(this.pb_Top, this.cmdBar); }
static void Web_FrameDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { // args.GetType() }
private async void wv_WebContent_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { try { // fill post content using javascript await this.wv_WebContent.InvokeScriptAsync("setContent", new[] { content }); } catch (Exception ex) { // invoke script may cause exception System.Diagnostics.Debug.WriteLine("exception when set post content", ex.Message); } Functions.HideProgressBar(this.pb_Top); }
private void DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { HideLoading(); HideReadingModeLoading(); }
private async void wv_Post_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { try { await this.wv_Post.InvokeScriptAsync("setContent", new[] { content }); } catch (Exception ex) { this.Title = ex.Message; } }
private void TwitterWebViewDomContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { WebViewProgressRing.IsActive = false; }
private async void ThreadWebView_OnDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { try { SetFontSize(); if (_forumThread != null && _forumThread.ScrollToPost > 0) { try { await ThreadWebView.InvokeScriptAsync("ScrollToDiv", new[] { _forumThread.ScrollToPostString }); } catch (Exception ex) { AwfulDebugger.SendMessageDialogAsync("A thread javascript command failed", ex); } } _vm.IsLoading = false; } catch (Exception) { } }
private void ArticleWebView_OnDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { ViewModel.LoadingVisibility = false; ViewModel.WebViewVisibility = true; }
private async void TopicWebView_OnDOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { var uiSettings = new UISettings(); var color = uiSettings.GetColorValue(UIColorType.Accent); //this chain of commands will remove unnecessary stuff string bodyLight = Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "#3d3d3d" : "#d0d0d0"; string bodyLighter = Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "#2f2f2f" : "#e6e6e6"; string bodyDarker = Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "#212121" : "#cacaca"; string fontColor = Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "white" : "black"; string fontColorInverted = Settings.SelectedTheme == (int)ApplicationTheme.Dark ? "black" : "white"; var zoom = 100*ActualWidth/500; _prevSize = new Size(ActualWidth, ActualHeight); List<string> commands; if (_args.CreateNewTopic) { commands = new List<string> { @"document.getElementById(""headerSmall"").outerHTML='';document.getElementById(""menu"").outerHTML='';document.getElementsByClassName(""js-sns-icon-container icon-block-small"")[0].outerHTML='';document.getElementsByTagName(""footer"")[0].innerHTML='';document.getElementsByClassName(""mauto clearfix pt24"")[0].outerHTML='';", @"$(""#contentWrapper"").find('div:first').remove();", $@"$(""#contentWrapper"").css(""background-color"", ""{bodyLighter}"").css(""width"", ""700px"");;", $@"$(""body"").css(""font-family"", ""Segoe UI"").css(""color"", ""{fontColor}"").css(""background-color"", ""{bodyLighter}"").css(""width"", ""700px"");;", @"$(""footer"").remove()", $@"$(""textarea"").css(""background-color"",""{bodyDarker}"").css(""color"", ""{fontColor}"")", $@"$(""td"").css(""color"", ""{fontColor}"")", $@"$(""a"").css(""color"", ""#{color.ToString().Substring(3)}"");", $@"$(""#content"").css(""border-color"", ""{bodyLighter}"").css(""background-color"",""{bodyLighter}"");", $@"$(""html"").css(""zoom"", ""{Math.Floor(zoom)}%"").css(""background-color"", ""{bodyLighter}"").css(""width"", ""700px"");", @"$(""iframe"").remove()", $@"$(""#dialog"").css(""border-color"", ""{bodyLight}"")", $@"$(""td"").css(""border-color"", ""{bodyDarker}"")", $@"$("".inputtext"").css(""background-color"", ""{bodyDarker}"").css(""color"", ""{fontColor}"")", $@"$("".normal_header"").css(""color"", ""{fontColor}"")", $@"$("".inputButton"").css(""background-color"", ""{bodyLight}"").css(""border-color"",""{fontColorInverted}"");", $@"$("".bgbdrContainer"").css(""background-color"", ""{bodyDarker}"").css(""border-color"",""{fontColorInverted}"");", }; } else { commands = new List<string> { @"$("".header"").remove(); $(""iframe"").remove(); $("".select.filter-sort"").remove(); $("".anchor-ad"").remove(); $(""footer"").remove(); $("".page-title"").remove(); $("".sns-unit"").remove();", $@"$(""a"").css(""color"", ""#{color.ToString().Substring(3)}"");", $@"$("".comment-title"").css(""background-color"",""{bodyLighter}"")", $@"$("".breadcrumb"").css(""background-color"",""{bodyLighter}"")", $@"$("".num"").removeClass().css(""font-size"",""30px"").css(""color"", ""{fontColor}"").css(""margin"", ""13px"")", $@"$("".icon-next"").not(""a.prev"").removeClass().css(""font-size"",""30px"").html(""»"")", $@"$("".icon-next.prev"").css(""font-size"",""20px"").removeClass().html(""«"")", $@"$("".db-ib"").removeClass().css(""font-size"",""30px"").css(""color"",""#{color.ToString().Substring(3)}"")", $@"$("".btn-post-comment"").css(""background-color"",""{bodyLight}"").css(""color"", ""{fontColor}"").css(""border-color"", ""{bodyDarker}"")", $@"$(""body"").css(""font-family"", ""Segoe UI"").css(""color"", ""{fontColor}"").css(""background-color"", ""{bodyLighter}"");", }; } foreach (var command in commands) { try { await TopicWebView.InvokeScriptAsync("eval", new string[] {command}); } catch (Exception) { //htm.. no it's javascript this time oh, how fun! } } ViewModel.LoadingTopic = false; }
/// <summary> /// Event to indicate that the content is fully loaded in the webview. If you need to invoke script, it is best to wait for this event. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void webView1_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { string url = (args.Uri != null) ? args.Uri.ToString() : "<null>"; appendLog(String.Format("Content for \"{0}\" has finished loading.\n", url)); }
/// <summary> /// Handle the event that indicates that the WebView content is fully loaded. /// If you need to invoke script, it is best to wait for this event. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void WebViewControl_DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args) { AppendLog($"Content for \"{UriToString(args.Uri)}\" has finished loading."); }