コード例 #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
        protected override void OnBeforeContextMenu(CefBrowser browser, CefFrame frame, CefContextMenuParams state, CefMenuModel model)
        {
            if (!TwitterUrls.IsTweetDeck(frame.Url) || browser.IsLoading)
            {
                extraContext.Reset();
            }

            base.OnBeforeContextMenu(browser, frame, state, model);
        }
コード例 #3
0
            private void BrowserComponentOnPageLoadEnd(object sender, PageLoadEventArgs e)
            {
                string url = e.Url;

                if (TwitterUrls.IsTweetDeck(url) && url != BlankURL)
                {
                    pluginManager.Execute(PluginEnvironment.Notification, browserComponent);
                }
            }
コード例 #4
0
        private void browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
        {
            IFrame frame = e.Frame;

            if (frame.IsMain && TwitterUrls.IsTweetDeck(frame.Url))
            {
                Ready?.Invoke(this, new PluginDispatchEventArgs(executor));
            }
        }
コード例 #5
0
        protected override bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool userGesture, bool isRedirect)
        {
            if (userGesture && request.TransitionType == TransitionType.LinkClicked)
            {
                bool block = request.Url == BlockNextUserNavUrl;
                BlockNextUserNavUrl = string.Empty;
                return(block);
            }
            else if (request.TransitionType.HasFlag(TransitionType.ForwardBack) && TwitterUrls.IsTweetDeck(frame.Url))
            {
                return(true);
            }

            return(base.OnBeforeBrowse(browserControl, browser, frame, request, userGesture, isRedirect));
        }
コード例 #6
0
        public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model)
        {
            if (!TwitterUrls.IsTweetDeck(frame.Url) || browser.IsLoading)
            {
                Context = CurrentInfo.Reset();
            }
            else
            {
                Context = CurrentInfo.Create(parameters);
            }

            if (parameters.TypeFlags.HasFlag(ContextMenuType.Selection) && !parameters.TypeFlags.HasFlag(ContextMenuType.Editable))
            {
                model.AddItem(MenuSearchInBrowser, "Search in browser");
                model.AddSeparator();
                model.AddItem(MenuReadApplyROT13, "Apply ROT13");
                model.AddSeparator();
            }
コード例 #7
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);
        }