public void SendJavaScript(string javaScript)
 {
     if (webViewComponentController != null)
     {
         webViewComponentController.EvaluateJavaScript(javaScript);
     }
 }
        private void handleScrollDown(AbstractWebViewComponentController webViewComponentController)
        {
            string javaScript = "window.scrollBy(0, " + scrollAmount + ");";

            webViewComponentController.EvaluateJavaScript(javaScript);
        }
 private void onLoadComplete(AbstractWebViewComponentController webViewComponentController, bool success, string errorMessage)
 {
     if (success)
     {
         if (MonoSingleton <NativeAccessibilityManager> .Instance.IsEnabled)
         {
             string text = "Enabling Accessible Scroll buttons: ";
             if (scrollUp != null)
             {
                 scrollUp.onClick.AddListener(delegate
                 {
                     handleScrollUp(webViewComponentController);
                 });
                 scrollUp.gameObject.SetActive(value: true);
                 text += "scrollUp ";
             }
             if (scrollDown != null)
             {
                 scrollDown.onClick.AddListener(delegate
                 {
                     handleScrollDown(webViewComponentController);
                 });
                 scrollDown.gameObject.SetActive(value: true);
                 text += "scrollDown ";
             }
         }
         if (blockLinks)
         {
             string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation("GlobalUI.Settings.SettingsURLs.whitelist");
             Uri    uri = new Uri(webViewComponentController.Url);
             tokenTranslation = tokenTranslation + "," + uri.Host;
             string javaScript  = "\r\n\t\t\t\t\t\tconsole.log('[DisableLinks] define CPIdisableLinks');\r\n                        function CPIdisableLinks() {\r\n                            aTags = document.getElementsByTagName('a');\r\n                            var whitelist = '" + tokenTranslation + "';\r\n                            var hosts = whitelist.split(',');\r\n                            console.log('[DisableLinks] whitelist='+whitelist);\r\n                            for (i = 0; i < aTags.length; i++) {\r\n                                if (aTags[i].hasAttribute('href')) {\r\n                                    var href = aTags[i].getAttribute('href');\r\n                                    var whitelisted = false;\r\n                                    for (var j = 0; j < hosts.length; j++) {\r\n                                        if (href.indexOf(hosts[j]) > -1) {\r\n                                            whitelisted = true;\r\n                                            break;\r\n                                        }\r\n                                    }\r\n                                    console.log('[DisableLinks] checking '+href);\r\n                                    if (!whitelisted && href && href.indexOf('#') != 0 && (href.indexOf('/') != 0 || href.indexOf('//') == 0)) {\r\n                                        aTags[i].removeAttribute('href');\r\n                                        console.log('[DisableLinks] blocking '+href);\r\n                                    }\r\n                                }\r\n                            }\r\n                        }";
             string javaScript2 = "\r\n\t\t\t\t\t\tconsole.log('[DisableLinks] assign CPItarget');\r\n                        var CPItarget = document.getElementsByTagName('body')[0];\r\n\t\t\t\t\t\tconsole.log('[DisableLinks] assign CPIobserver');\r\n                        var CPIobserver = new MutationObserver(function(mutations) {\r\n                          console.log('[DisableLinks] disable links for dynamically added content');\r\n                          CPIdisableLinks();\r\n                        });\r\n\t\t\t\t\t\tconsole.log('[DisableLinks] assign CPIconfig');\r\n                        var CPIconfig = { attributes: true, childList: true, characterData: true };";
             if (webViewComponentController.SupportsAddJavascript)
             {
                 webViewComponentController.AddJavaScript(javaScript);
                 webViewComponentController.AddJavaScript(javaScript2);
             }
             else
             {
                 webViewComponentController.EvaluateJavaScript(javaScript);
                 webViewComponentController.EvaluateJavaScript(javaScript2);
             }
             string javaScript3 = "setTimeout(CPIdisableLinks, 300);";
             string javaScript4 = "setTimeout(function(){ CPIobserver.observe(CPItarget, CPIconfig);}, 500); ";
             webViewComponentController.EvaluateJavaScript(javaScript3);
             webViewComponentController.EvaluateJavaScript(javaScript4);
         }
         this.OnLoaded.InvokeSafe();
         isLoaded = true;
         if (!WaitForReadyToShow || IsReadyToShow)
         {
             webViewComponentController.Show();
         }
         if (loadingPanel != null)
         {
             loadingPanel.SetActive(value: false);
         }
     }
     else
     {
         Log.LogError(this, "Something wrong in web view loading: " + errorMessage);
         this.OnFailed.InvokeSafe();
     }
 }