Extension-Specific Context Menu - google-chrome-extension

I'm trying to add an item to the right-click menu on my extension. I've tried to find a method which would work, but a lot of the results seem to deal with context menus on the actual page, not the extension icon itself. The contextMenus API doesn't seem to work for this, unfortunately.

There is currently no API for that. Head for Chromium Issue 78631 and click the star to cast your vote for it and receive updates by e-mail. In the meantime, you could create a popup with a menu that lists both the primary action and the actions you would have put in the context menu.
(I assume you're trying to add the context menu item to your browser action. Your question is a little ambiguous.)

Related

Chrome Extension Context Menu Items Limit

Although the docs are pointing out:
The maximum number of items that can be added to the top-level browser action context menu is menus.ACTION_MENU_TOP_LEVEL_LIMIT, but you can add any number of items to submenus.
I am only able to add 1000 submenu items to the Chrome Extension context menu.
I don't want to create a UI additionally, because the context menu is really handy for my use case. The user is working in a code editor and can look up code syntax string values via the context menu and can add the value at the position of the cursor where the user right-clicked.
Do you know of such limitations or a workaround besides using an additional UI element?

Is it possible to attach event on the *opening* of the context menu?

I am developing a WebExtension and as you know it is impossible to inject content script on chrome://* pages and https://chrome.google.com/webstore/*. I have a buttons in a context menu and for correct UX I would like to drop my item from context menu on such protected page.
According to the documentation I can handle click on my context menu item, but looks like no way to check the url of the page on the moment of right mouse click without trying to inject content script into every page?
As a workaround I have a code that checks url after click to the menu item.

Chrome Extension, trigger click on the icon

I searched on Google and StackOverflow, and I was not able to find a solution to my problem (to my greatest surprise).
I'm looking to display the popup, exactly like when the user click on the icon of my extension, but via javascript.
The idea behind it is simple : On a specific page, I inject a button and add an event listener on it ("click"). When the user click on that button, I'd like to display the tooltip, simple as that :)
... but I can not find anything related to it. Any idea ?
Thank you in advance.
Opening the popup is impossible without user interaction. For good reason too, remember that no one likes popups that open themselves. What you can do is inject your popup onto the site the user is at, through a content script.
https://developer.chrome.com/extensions/content_scripts
As per your description,
On a specific page, I inject a button and add an event listener on it ("click"). When the user click on that button, I'd like to display the tooltip, simple as that :)
I think what you need is just chrome.pageAction, it's similar to browserAction, while represents actions that can be taken on the current page, but aren't applicable to all pages.

TestComplete Menu Item

I am new to TestComplete. I have a question and it may be something impossible or too simple. I have a toolbar containg File, Edit, View, etc. I want to get one item (eg. Edit) to mapped objects. I can get the whole toolbar only. I want to simulate a click event on Edit. How can I do this?
As a rule, TestComplete does not work with menu items as with separate objects. It works with a menu object or even only with a menu's parent object and you can specify which item to select by passing the caption of this item to the corresponding method of a menu object. For example:
objMenu.Click("Edit|Paste");
// or
parent.MainMenu("Edit|Paste");
Please find more details on how TestComplete interacts with menus in the Working With Menus help topic.

How can I add a bit of custom functionality to every CRM 2011 grid ribbon?

I have a small bit of custom functionality which I need to run from each and every grid ribbon in CRM 2011. The functionality is in a JS web-resource and I can attach it to a button enable rule and it all works fine.
The issue is that I need this to run on every grid in CRM, but I'm struggling to find something in the ribbon which appears on every screen. I did try attaching it to one of the buttons in the Jewel menu, but this only fires if the user clicks on the "File" tab.
Any thoughts...?
The jewel menu button is a good idea.
Add an anonymous JavaScript function to the library you are adding to the jewel button.
This will run when the library is loaded, just after the page loads:
var whatever = 30; // maybe you do not need a parameter
(function (what) {
/* Do what you need to do */
}(whatever));
If it’s on premise I‘d inject my script to the ribbon.js or global.js or some other js and ping from there.
Another option, less intrusive , is to use a resource that runs in each and every form i.e. myframewrok.js. This resource can check for the opener and inject the script to the opener dynamically.
A third options might be to ping a web service using a plug-in registered on execute or retrieve multiple messages which fire repeatedly for any grid in the system.
In the end we attached it to the "Advanced Find" button as this appeared on every ribbon that we needed the functionality on. The Jewel menu did not seem to work for us as it only fired when the user actually clicked the "File" button.

Resources