Gmail extension/gadget API - how to add a button to the compose toolbar? - google-chrome

I'm trying to figure out how can I add a button to the Gmail compose window.
In "Gmail Labs" they have some extensions that add certain buttons For example "Send & Archive" button and "Inserting images" button, so I assume this is possible.
I checked their API here and it seems that you can either add a gadget to left sidebar or use contextual gadgets that are dependent on the message context. I'm looking for a way to add a button to the toolbar of the compose window, and both options don't seem to support it.
Do you know how can this be done?
If it's not possible using Gmail API, is there another way I can achieve this? Maybe by creating a Google Chrome extension or user scripts?
I would appreciate any info that can direct me in the right direction.
Thanks.

The Gmail Labs have special permissions because they are written by Google Employees, unfortunately we mortals don't have such power. There is a way around it of course and you've correctly pointed out that it is to make a Chrome Extension or a UserScript. If you choose to do a Chrome Extension it will just be a wrapper for a UserScript anyway
You will have to create and inject the button programmatically. This will involve quite a bit of scouring the Gmail source code (spoiler: it's ugly).
Without more details about what you want to do, I won't be able to provide much more help but I can help you with one problem right away. You have to make your script wait until the Gmail loading process is done which is a bit of a challenge. This is the solution I'm currently using in Minimalist:
function bootstrap() {
target = document.querySelectorAll('.vt:not(.SFzvCe)');
if (document.querySelectorAll('html.xiu1Fc, html.aao')[0] == null) {
return;
}
if (target.length > 0) {
// loaded, do stuff
} else {
window.setTimeout(bootstrap, 200);
}
}
window.addEventListener('DOMSubtreeModified', bootstrap);
That version waits for the chat to fully load. Let me know if you have any other questions: #anstosa

You can use InboxSDK for that.
Here is documentation link
Also you have a Hello world repo, where is a solved your problem
hello repo

Related

How to get the DOM elements of the active page in google app script from add-on

I am currently developing a google calendar add on . And I need to access the DOM of the current active page from the add On
I need to know how to get the DOM element in app script for google add on
Problem
Unfortunately, at the day of this answer there is no functionality in Apps Script to get the DOM of any site.
Workaround
Try using a chrome addon as these might let you get the DOM of sites. Here you can find out more about chrome add ons.
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)

How can I make the advanced button work in chrome 'App isnt verified'?

I'm sorry this question might not be completely on topic, but i couldn't find answers googling it.
I'm creating an google app script (with clasp).
When i run the script i get the following popup as usual:
I'm supposed to click on advance and go anways.
But the advanced button no longer works! it doesn't show me the followup button to continue anymore!
Does anyone have the same issue and was able to fix it? It seems to have originated after the chrome update (with rounded ui).
I tried deleting the original grant (i added a feature that needed bigger scope), but even that didn't work.
It might be one of my chrome extensions.
Doing the same thing in incognito mode, worked!

Google Chrome extension - integrate with Google Calendar

How can a Chrome extension alter the Google Calendar event editing UI?
I see that, for example, the Moxtra extension has managed to inject UI including a button just below the location. According to their YouTube video they added a button to fill out the event description although when I installed Moxtra this no longer seems to work.
Stepping back from this a bit, it occurs to me that editing the Google Calendar page seems like something that could easily get messed up by future changes to Google Calendar. Perhaps it is better to edit the event description from the extension's own UI? If so, how can that be done?
Thanks.
It can be done with content scripts and modification of the DOM.
They probably check Event edit page for specific selectors and try to insert their own elements in the page, if they found it.
So, if UI of Google Calendar will change, extensions like Moxtra will be probably also broken.
You are right about the edit of the description - it's safer. But you still need to get a description field and change a content of it. There is no 100% safe way to do it and don't break on the change of UI.

Adding Button in Gmail for web users

I am trying to figure out how can I add a button to the Gmail compose window.
Please see the image below for better idea..
Using Google App Script I have achieved some functionality where we can create almost anything, but How can We create a button in Gmail?
Even if not compose window as shown in image above, I will like to learn how to add button at any place in Gmail.com's window using gadget or any other way.
Note: I have tried many things and ended up nowhere, The Sidebar is deprecated by google so please don't highlight that..
I will be glad if any working code to add button in Gmail available,
Thanks in advance

Get the active tab url in crossrider

I came to know that crossrider.com is helping us to develop extension for different browsers, while keeping the same code.
I have two questions
Question 1:
After going through docs and libraries in crossrider, I still wonder how to get the active tab url.
Question 2:
I also need to open a popup after clicking toolbar icon, similar to google chrome extension.
I came across crossrider siderbar plugin. But, I am unable to change the url for sidebar dynamically.
Do we have any other crossrider plugins which opens like an popup ?
Answer Q1: You can use our appAPI.tabs.onTabSelectionChanged(function callback([{tabId, tabUrl}])) method (soon to be documented). To keep track of the ActiveTab URL, in the callback, simply set a global variable to the callback's optional tabUrl parameter. This is currently supported in Chrome and Firefox.
Answer Q2: I'm afraid that currently there isn't a native popup plugin (your welcome to write one and submit it for consideration ;-)). However, you can configure and use jQueryUI popups from within the extension.
I need to get active tab url in IE.
If it is not possible using jquery in IE, can we use messaging api to send messages from pages to background scope, and store the active tab url in background's global variable?