예제 #1
0
        public override void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
        {
            if (!TwitterUrls.IsTweetDeck(frame.Url) || browser.IsLoading)
            {
                extraContext.Reset();
            }

            base.OnBeforeContextMenu(browserControl, browser, frame, parameters, model);

            bool isSelecting = parameters.TypeFlags.HasFlag(ContextMenuType.Selection);
            bool isEditing   = parameters.TypeFlags.HasFlag(ContextMenuType.Editable);

            if (!isSelecting && !isEditing)
            {
                AddSeparator(model);

                IMenuModel globalMenu = model.Count == 0 ? model : model.AddSubMenu(MenuGlobal, Program.BrandName);

                globalMenu.AddItem(CefMenuCommand.Reload, TitleReloadBrowser);
                globalMenu.AddCheckItem(MenuMute, TitleMuteNotifications);
                globalMenu.SetChecked(MenuMute, Config.MuteNotifications);
                globalMenu.AddSeparator();

                globalMenu.AddItem(MenuSettings, TitleSettings);
                globalMenu.AddItem(MenuPlugins, TitlePlugins);
                globalMenu.AddItem(MenuAbout, TitleAboutProgram);

                AddDebugMenuItems(globalMenu);
            }
        }
예제 #2
0
        public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
        {
            if (model.Count > 0)
            {
                model.AddSeparator();
            }

            if (!string.IsNullOrEmpty(parameters.UnfilteredLinkUrl))
            {
                model.AddItem((CefMenuCommand)26501, "Copy Link Address");
            }

            if (!string.IsNullOrEmpty(parameters.LinkUrl))
            {
                model.AddItem((CefMenuCommand)26502, "Open Link in New Window");
            }

            if (!string.IsNullOrEmpty(parameters.UnfilteredLinkUrl) || !string.IsNullOrEmpty(parameters.LinkUrl))
            {
                model.AddSeparator();
            }

            var dev = model.AddSubMenu((CefMenuCommand)26503, "Developer Tools");

            dev.AddItem((CefMenuCommand)26504, "Inspector");
        }
예제 #3
0
        public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
        {
            // Remove any existent option using the Clear method of the model
            //
            //model.Clear();

            Console.WriteLine("Context menu opened !");

            // You can add a separator in case that there are more items on the list
            if (model.Count > 0)
            {
                model.AddSeparator();
            }


            // Add a new item to the list using the AddItem method of the model
            model.AddSubMenu((CefMenuCommand)initial_command, "Add to Target");
            IMenuModel target_menu = model.GetSubMenu((CefMenuCommand)initial_command);

            target_menu.AddItem((CefMenuCommand)initial_command + 1, "New");
            int i = 2;

            foreach (Target target in Main_Instance.Instance.Workspace.Targets)
            {
                target_menu.AddItem((CefMenuCommand)initial_command + i, target.Title);
                i++;
            }

            //model.AddItem((CefMenuCommand)26502, "Close DevTools");

            // Add a separator
            //model.AddSeparator();

            // Add another example item
            // model.AddItem((CefMenuCommand)26503, "Display alert message");
        }
예제 #4
0
        public override void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
        {
            bool isSelecting = parameters.TypeFlags.HasFlag(ContextMenuType.Selection);
            bool isEditing   = parameters.TypeFlags.HasFlag(ContextMenuType.Editable);

            model.Remove(CefMenuCommand.Back);
            model.Remove(CefMenuCommand.Forward);
            model.Remove(CefMenuCommand.Print);
            model.Remove(CefMenuCommand.ViewSource);
            RemoveSeparatorIfLast(model);

            if (isSelecting)
            {
                if (isEditing)
                {
                    model.AddSeparator();
                    model.AddItem(MenuWriteApplyROT13, "Apply ROT13");
                }

                model.AddSeparator();
            }

            base.OnBeforeContextMenu(browserControl, browser, frame, parameters, model);

            if (isSelecting && !isEditing && TwitterUrls.IsTweetDeck(frame.Url))
            {
                InsertSelectionSearchItem(model, MenuSearchInColumn, "Search in a column");
            }

            if (Context.Types.HasFlag(ContextInfo.ContextType.Chirp) && !isSelecting && !isEditing)
            {
                model.AddItem(MenuOpenTweetUrl, "Open tweet in browser");
                model.AddItem(MenuCopyTweetUrl, "Copy tweet address");
                model.AddItem(MenuScreenshotTweet, "Screenshot tweet to clipboard");

                if (!string.IsNullOrEmpty(Context.Chirp.QuoteUrl))
                {
                    model.AddSeparator();
                    model.AddItem(MenuOpenQuotedTweetUrl, "Open quoted tweet in browser");
                    model.AddItem(MenuCopyQuotedTweetUrl, "Copy quoted tweet address");
                }

                model.AddSeparator();
            }

            if (!isSelecting && !isEditing)
            {
                AddSeparator(model);

                IMenuModel globalMenu = model.Count == 0 ? model : model.AddSubMenu(MenuGlobal, Program.BrandName);

                globalMenu.AddItem(CefMenuCommand.Reload, TitleReloadBrowser);
                globalMenu.AddCheckItem(MenuMute, TitleMuteNotifications);
                globalMenu.SetChecked(MenuMute, Config.MuteNotifications);
                globalMenu.AddSeparator();

                globalMenu.AddItem(MenuSettings, TitleSettings);
                globalMenu.AddItem(MenuPlugins, TitlePlugins);
                globalMenu.AddItem(MenuAbout, TitleAboutProgram);

                AddDebugMenuItems(globalMenu);
            }

            RemoveSeparatorIfLast(model);

            form.InvokeAsyncSafe(form.AnalyticsFile.BrowserContextMenus.Trigger);
        }
예제 #5
0
        public void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
        {
            // clear the menu
            model.Clear();
            //enable expath locator mouse
            //var selected = browserControl.EvaluateScriptAsync("document.activeElement.localName").ToString();
            //chek if form is exist
            //var formExists = browserControl.EvaluateScriptAsync("$('form').length");
            //if form exist enable autofill form
            //if(formExists != null)
            //{
            //enable autofill form
            //auto will be used in xcode or after request loaded
            // auto fill can be used for autobot, or like save password featured in google chrome
            //browserControl.ExecuteScriptAsync(File.ReadAllText(Js.autofill));
            //}
            model.AddItem((CefMenuCommand)RefreshTab, "Refresh");

            if (parameters.IsEditable)
            {
                model.AddItem(CefMenuCommand.Paste, "Paste");
            }
            // to copy text

            if (parameters.SelectionText.CheckIfValid())
            {
                var x = model.AddSubMenu((CefMenuCommand)GoogleDork, "GoogleDork");
                if (parameters.SelectionText.CheckURLValid())
                {
                    LinksFromSelectionText = true;
                    model.AddItem((CefMenuCommand)OpenLinkInNewTab, "Open link in new tab");
                }
                else
                {
                    model.AddItem(CefMenuCommand.Copy, "Copy");
                    model.AddItem((CefMenuCommand)Search, "Search");
                    x.AddItem((CefMenuCommand)DorkInTitle, "InTitle");
                    x.AddItem((CefMenuCommand)DorkInUrl, "InUrl");
                    x.AddItem((CefMenuCommand)DorkInText, "InText");
                    x.AddItem((CefMenuCommand)DorkSite, "Site");
                    x.AddItem((CefMenuCommand)DorkLink, "Link");
                    x.AddItem((CefMenuCommand)DorkFileType, "FileType");
                    x.AddItem((CefMenuCommand)DorkExt, "Ext");
                }
            }
            //Removing existing menu item
            //bool removed = model.Remove(CefMenuCommand.ViewSource); // Remove "View Source" option
            if (parameters.LinkUrl != "" && !parameters.SelectionText.CheckIfValid())
            {
                model.AddItem((CefMenuCommand)OpenLinkInNewTab, "Open link in new tab");
                model.AddItem((CefMenuCommand)CopyLinkAddress, "Copy link");
            }

            model.AddSeparator();
            var s = model.AddSubMenu((CefMenuCommand)save, "Save");

            if (parameters.MediaType == ContextMenuMediaType.Image && parameters.HasImageContents && parameters.SourceUrl.CheckIfValid())
            {
                s.AddItem((CefMenuCommand)SaveImageAs, "Save Image");
            }
            else if (parameters.MediaType == ContextMenuMediaType.Video && parameters.SourceUrl.CheckIfValid())
            {
                s.AddItem((CefMenuCommand)SaveVideoAs, "Save Video");
            }
            else
            {
                s.AddItem((CefMenuCommand)SaveLinkAs, "Save page");
            }

            model.AddSeparator();
            model.AddItem((CefMenuCommand)GetSource, "View source");
            model.AddItem((CefMenuCommand)ShowDevTools, "Developer tools");
            model.AddItem((CefMenuCommand)CloseTab, "Close tab");
        }
예제 #6
0
        public override void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
        {
            model.Remove(CefMenuCommand.Back);
            model.Remove(CefMenuCommand.Forward);
            model.Remove(CefMenuCommand.Print);
            model.Remove(CefMenuCommand.ViewSource);
            RemoveSeparatorIfLast(model);

            if (parameters.TypeFlags.HasFlag(ContextMenuType.Selection))
            {
                model.AddSeparator();
            }

            base.OnBeforeContextMenu(browserControl, browser, frame, parameters, model);

            lastHighlightedTweet       = TweetDeckBridge.LastHighlightedTweet;
            lastHighlightedQuotedTweet = TweetDeckBridge.LastHighlightedQuotedTweet;

            if (!BrowserUtils.IsTweetDeckWebsite(frame) || browser.IsLoading)
            {
                lastHighlightedTweet       = string.Empty;
                lastHighlightedQuotedTweet = string.Empty;
            }

            if (!string.IsNullOrEmpty(lastHighlightedTweet) && (parameters.TypeFlags & (ContextMenuType.Editable | ContextMenuType.Selection)) == 0)
            {
                model.AddItem((CefMenuCommand)MenuOpenTweetUrl, "Open tweet in browser");
                model.AddItem((CefMenuCommand)MenuCopyTweetUrl, "Copy tweet address");
                model.AddItem((CefMenuCommand)MenuScreenshotTweet, "Screenshot tweet to clipboard");

                if (!string.IsNullOrEmpty(lastHighlightedQuotedTweet))
                {
                    model.AddSeparator();
                    model.AddItem((CefMenuCommand)MenuOpenQuotedTweetUrl, "Open quoted tweet in browser");
                    model.AddItem((CefMenuCommand)MenuCopyQuotedTweetUrl, "Copy quoted tweet address");
                }

                model.AddSeparator();
            }

            if ((parameters.TypeFlags & (ContextMenuType.Editable | ContextMenuType.Selection)) == 0)
            {
                AddSeparator(model);

                IMenuModel globalMenu = model.Count == 0 ? model : model.AddSubMenu((CefMenuCommand)MenuGlobal, Program.BrandName);

                globalMenu.AddItem(CefMenuCommand.Reload, "Reload browser");
                globalMenu.AddCheckItem((CefMenuCommand)MenuMute, "Mute notifications");
                globalMenu.SetChecked((CefMenuCommand)MenuMute, Program.UserConfig.MuteNotifications);
                globalMenu.AddSeparator();

                globalMenu.AddItem((CefMenuCommand)MenuSettings, "Settings");
                globalMenu.AddItem((CefMenuCommand)MenuPlugins, "Plugins");
                globalMenu.AddItem((CefMenuCommand)MenuAbout, "About " + Program.BrandName);

                #if DEBUG
                globalMenu.AddSeparator();
                AddDebugMenuItems(globalMenu);
                #endif
            }

            RemoveSeparatorIfLast(model);
        }
예제 #7
0
        void IContextMenuHandler.OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
        {
            //Removing existing menu item
            //model.Clear();

            if (parameters.TypeFlags.HasFlag(ContextMenuType.Selection))
            {
                model.AddItem((CefMenuCommand)SearchSelectedText, "Search selected text using Google");
                model.AddItem((CefMenuCommand)SaveText, "Save selected text");
                model.AddSeparator();
            }

            if (!string.IsNullOrEmpty(parameters.UnfilteredLinkUrl))
            {
                model.AddItem((CefMenuCommand)26501, "Open link in new tab");
                model.AddSeparator();
            }
            if (parameters.TypeFlags.HasFlag(ContextMenuType.Media) && parameters.HasImageContents)
            {
                if (!RuntimeSettings.IsUsingTor)
                {
                    if (OsirtHelper.HasJpegExtension(parameters.SourceUrl))
                    {
                        model.AddItem((CefMenuCommand)ViewImageExifData, "View image EXIF data");
                    }
                    model.AddItem((CefMenuCommand)MenuSaveImage, "Save image");
                }
                model.AddItem((CefMenuCommand)CopyImgLocation, "Copy image location to clipboard");

                var sub = model.AddSubMenu((CefMenuCommand)ReverseImgSearchSubMenu, "Reverse image search tools");
                sub.AddItem((CefMenuCommand)ReverseImageSearchTineye, "Reverse image search using TinEye");
                //sub.AddItem((CefMenuCommand)ReverseImageSearchYandex, "Reverse image search using Yandex");
                sub.AddItem((CefMenuCommand)ReverseImageSearchGoogle, "Reverse image search using Google");
                model.AddSeparator();
                //
            }
            if (OsirtHelper.IsOnYouTube(browserControl.Address))
            {
                model.AddItem((CefMenuCommand)SaveYouTubeVideo, "Extract YouTube video");
            }
            if (OsirtHelper.IsOnFacebook(browserControl.Address))
            {
                model.AddItem((CefMenuCommand)ViewFacebookId, "Show Facebook profile ID");
            }
            if (OsirtHelper.IsOnTwitter(browserControl.Address))
            {
                model.AddItem((CefMenuCommand)ViewTwitterId, "Show Twitter profile ID");
            }

            model.AddItem((CefMenuCommand)ViewSource, "View page source");
            model.AddItem((CefMenuCommand)ExtractAllLinks, "Extract all links on page");
            model.AddItem((CefMenuCommand)Bookmark, "Add page to bookmarks");


            model.Remove(CefMenuCommand.ViewSource);
            model.Remove(CefMenuCommand.Print);
            model.Remove(CefMenuCommand.Undo);
            model.Remove(CefMenuCommand.Redo);
            model.Remove(CefMenuCommand.Forward);
            model.Remove(CefMenuCommand.Back);
        }
예제 #8
0
        void IContextMenuHandler.OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
        {
            //To disable the menu then call clear
            // model.Clear();

            //Removing existing menu item
            //bool removed = model.Remove(CefMenuCommand.ViewSource); // Remove "View Source" option

            //Add new custom menu items
            model.AddItem((CefMenuCommand)ShowDevTools, EmbeddedBrowserControlRes.Show_DevTools);
            model.AddItem((CefMenuCommand)CloseDevTools, EmbeddedBrowserControlRes.Close_DevTools);

            //BufferLink = null;
            if (string.IsNullOrEmpty(parameters.UnfilteredLinkUrl) == false)
            {
                //BufferLink = parameters.LinkUrl;
                model.AddItem((CefMenuCommand)OpenLinkInNewTab, EmbeddedBrowserControlRes.Open_Link_In_New_Tab);
            }


            if (parameters.TypeFlags.HasFlag(ContextMenuType.Selection))
            {
                model.AddItem((CefMenuCommand)SearchSelectedText, EmbeddedBrowserControlRes.Search_selected_text_using_Google);
                model.AddItem((CefMenuCommand)SaveText, EmbeddedBrowserControlRes.Save_selected_text);
                model.AddSeparator();
            }


            if (parameters.TypeFlags.HasFlag(ContextMenuType.Media) && parameters.HasImageContents)
            {
                if (EmbeddedBrowserHelper.HasJpegExtension(parameters.SourceUrl))
                {
                    //model.AddItem((CefMenuCommand)ViewImageExifData, "View image EXIF data");
                }
                //model.AddItem((CefMenuCommand)MenuSaveImage, "Save image");
                model.AddItem((CefMenuCommand)CopyImgLocation, EmbeddedBrowserControlRes.Copy_image_location_to_clipboard);

                var sub = model.AddSubMenu((CefMenuCommand)ReverseImgSearchSubMenu, EmbeddedBrowserControlRes.Reverse_image_search_tools);
                sub.AddItem((CefMenuCommand)ReverseImageSearchTineye, EmbeddedBrowserControlRes.Reverse_image_search_using_TinEye);
                //sub.AddItem((CefMenuCommand)ReverseImageSearchYandex, EmbeddedBrowserControlRes.Reverse_image_search_using_Yandex);
                sub.AddItem((CefMenuCommand)ReverseImageSearchGoogle, EmbeddedBrowserControlRes.Reverse_image_search_using_Google);
                model.AddSeparator();
                //
            }
            if (EmbeddedBrowserHelper.IsOnYouTube(browserControl.Address))
            {
                //model.AddItem((CefMenuCommand)SaveYouTubeVideo, "Extract YouTube video");
            }
            if (EmbeddedBrowserHelper.IsOnFacebook(browserControl.Address))
            {
                //model.AddItem((CefMenuCommand)ViewFacebookId, "Show Facebook profile ID");
            }
            if (EmbeddedBrowserHelper.IsOnTwitter(browserControl.Address))
            {
                //model.AddItem((CefMenuCommand)ViewTwitterId, "Show Twitter profile ID");
            }

            //model.AddItem((CefMenuCommand)ViewSource, "*View page source");
            //model.AddItem((CefMenuCommand)ExtractAllLinks, "Extract all links on page");
            //model.AddItem((CefMenuCommand)Bookmark, "Add page to bookmarks");
            string s  = EmbeddedBrowserControlRes.View_source;
            string s2 = EmbeddedBrowserControlRes.Forward;

            model.SetLabel(CefMenuCommand.ViewSource, EmbeddedBrowserControlRes.View_source);
            model.SetLabel(CefMenuCommand.Print, EmbeddedBrowserControlRes.Print);
            model.SetLabel(CefMenuCommand.Undo, EmbeddedBrowserControlRes.Undo);
            model.SetLabel(CefMenuCommand.Redo, EmbeddedBrowserControlRes.Redo);
            model.SetLabel(CefMenuCommand.Forward, EmbeddedBrowserControlRes.Forward);
            model.SetLabel(CefMenuCommand.Back, EmbeddedBrowserControlRes.Back);

            /*
             * model.Remove(CefMenuCommand.ViewSource);
             * model.Remove(CefMenuCommand.Print);
             * model.Remove(CefMenuCommand.Undo);
             * model.Remove(CefMenuCommand.Redo);
             * model.Remove(CefMenuCommand.Forward);
             * model.Remove(CefMenuCommand.Back);
             */
        }
예제 #9
0
        public override void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
        {
            model.Remove(CefMenuCommand.Back);
            model.Remove(CefMenuCommand.Forward);
            model.Remove(CefMenuCommand.Print);
            model.Remove(CefMenuCommand.ViewSource);
            RemoveSeparatorIfLast(model);

            if (parameters.TypeFlags.HasFlag(ContextMenuType.Selection))
            {
                if (parameters.TypeFlags.HasFlag(ContextMenuType.Editable))
                {
                    model.AddSeparator();
                    model.AddItem(MenuInputApplyROT13, "Apply ROT13");
                }

                model.AddSeparator();
            }

            base.OnBeforeContextMenu(browserControl, browser, frame, parameters, model);

            lastHighlightedTweetUrl = TweetDeckBridge.LastHighlightedTweetUrl;
            lastHighlightedQuoteUrl = TweetDeckBridge.LastHighlightedQuoteUrl;

            if (!TwitterUtils.IsTweetDeckWebsite(frame) || browser.IsLoading)
            {
                lastHighlightedTweetUrl = string.Empty;
                lastHighlightedQuoteUrl = string.Empty;
            }

            if (!string.IsNullOrEmpty(lastHighlightedTweetUrl) && (parameters.TypeFlags & (ContextMenuType.Editable | ContextMenuType.Selection)) == 0)
            {
                model.AddItem(MenuOpenTweetUrl, "Open tweet in browser");
                model.AddItem(MenuCopyTweetUrl, "Copy tweet address");
                model.AddItem(MenuScreenshotTweet, "Screenshot tweet to clipboard");

                if (!string.IsNullOrEmpty(lastHighlightedQuoteUrl))
                {
                    model.AddSeparator();
                    model.AddItem(MenuOpenQuotedTweetUrl, "Open quoted tweet in browser");
                    model.AddItem(MenuCopyQuotedTweetUrl, "Copy quoted tweet address");
                }

                model.AddSeparator();
            }

            if ((parameters.TypeFlags & (ContextMenuType.Editable | ContextMenuType.Selection)) == 0)
            {
                AddSeparator(model);

                IMenuModel globalMenu = model.Count == 0 ? model : model.AddSubMenu(MenuGlobal, Program.BrandName);

                globalMenu.AddItem(CefMenuCommand.Reload, TitleReloadBrowser);
                globalMenu.AddCheckItem(MenuMute, TitleMuteNotifications);
                globalMenu.SetChecked(MenuMute, Program.UserConfig.MuteNotifications);
                globalMenu.AddSeparator();

                globalMenu.AddItem(MenuSettings, TitleSettings);
                globalMenu.AddItem(MenuPlugins, TitlePlugins);
                globalMenu.AddItem(MenuAbout, TitleAboutProgram);

                if (HasDevTools)
                {
                    globalMenu.AddSeparator();
                    AddDebugMenuItems(globalMenu);
                }
            }

            RemoveSeparatorIfLast(model);

            form.InvokeAsyncSafe(() => form.TriggerAnalyticsEvent(AnalyticsFile.Event.BrowserContextMenu));
        }