Greasemonkey Manual:API: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
No edit summary
 
Marti (talk | contribs)
m Moved heading levels down here
Line 1: Line 1:
{{Greasemonkey Manual TOC}}
{{Greasemonkey Manual TOC}}


= The APIs =
== The APIs ==


This section of the manual will be short and sweet.
This section of the manual will be short and sweet.

Revision as of 12:28, 15 December 2007


Greasemonkey Manual
Using Greasemonkey
Installing Scripts
Monkey Menu
Getting Help
User Script Authoring
Editing
Environment
API

The APIs

This section of the manual will be short and sweet. As mentioned elsewhere, Greasemonkey provides APIs to enhance the power of user scripts. They will be listed here, with a brief description, but each separate API call has its own page with more in-depth information, please continue reading there!

GM_addStyle
A function, taking one parameter, a string of CSS to apply to the page.
GM_getValue
A function intended to get stored values, see GM_setValue below.
GM_setValue
A function that accepts the name and value to store, persistently. This value can be retrieved later, even on a different invocation of the script, with GM_getValue.
GM_log
A function that accepts a parameter which will be routed to the Error Console, useful for examining values when writing a script.
GM_openInTab
Similar in spirit to window.open(), this function accepts a single parameter, the URL of a page to open in a new tab.
GM_registerMenuCommand
An advanced function which allows a user script to register a menu item, and command to run when clicked, in the Firefox UI.
GM_xmlhttpRequest
A version of the xmlHttpRequest method underlying AJAX, this API call does not use the same-origin policy that a script running in a normal page is limited with, allowing complex mashups.
unsafeWindow
As mentioned earlier, this object provides access to the raw javascript window scope of the content page.