User Scripts GMail Library

By Tim Smart Last update Jun 26, 2011 — Installed 21,009 times.

How to use the library?

in
Subscribe to How to use the library? 4 posts, 3 voices



dfar2008 User
FirefoxWindows

How to use the library?

 
Tim Smart Script's Author
FirefoxX11

DEPRECIATED


Include it in a Userscript using the @require metadata key. E.g.
// @require        http://userscripts.org/scripts/source/56812.user.js

You can then use the function GMailAPI( ... ); to make use of the API, with the only parameter being a object with several options. Some examples: (Note: read this http://code.google.com/p/gmail-greasemonkey/wik... first)
GMailAPI({
  onViewChange: function() {
    // Is called when GMail changes 'view'.
    this; // Contains a few handy bits and pieces.
  }
});
Notice I used the variable this in the onViewChange function, it contains the following (list may change without notice at any time):
this.info; // Contains info about the GMonkey API
this.viewType; // Contains the current view type. I.e. gmail.getActiveViewType
this.canvasElement; // Contains the curent canvas element
this.viewElement; // Contains the current view element. E.g. gmail.getActiveViewElement
this.navElement; // Contains current navigation element
this.mastheadElement; // Contains masthead element
this.labelsElement; // Contains labels element
this.convRhsElement; // Contains RHS element. I think an example is the chat box
this.footerElement; // Contains the footer element
this.addNavModule( params, ... ); // Add's a navigation module, see document at link above
this.clickElement( element ); // Clicks the given element

 
Mau User
FirefoxWindows

It doesn't seem to work for me...
If i just add

alert("");

GMailAPI({
  onViewChange: function() {
	// Is called when GMail changes 'view'.
	alert(this.info);
  }
});
,

I get the first message box, but nothing else...
mail.google.com is included and the script required...

 
Tim Smart Script's Author
FirefoxX11

To make an @require work, you have to re-install the script after adding the @require line. This is due to Greasemonkey only loading @requires's on installation.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel