Skip to content
This repository

Scriptish offers a few API methods which provide extra functionality to user scripts.

Headers

Metadata Block

Using a specially formatted block of JavaScript comments Scriptish is able to read metadata about a user script. This is used by a user script author to pass Scriptish information such as who wrote or contributed to the script, conditions under which the script should be used, licensing details, dependencies, etc.

GM_getMetadata (new in Scriptish!)

This function provides access to a user script's metadata block.


Constants

console (improved in Scriptish!)

A smarter console, ensuring the availability of the log, debug, warn, error, info, and trace methods regardless of the console implementation.

GM_updatingEnabled (new in Scriptish!)

Always equal to true. Check if this exists to see if your user script engine supports @updateURL.

unsafeWindow

Provides access to the raw window, which is usually used to access functions defined on a page.


Data access and processing

GM_safeHTMLParser (new in Scriptish!)

This function will safely parse a string of HTML and return a document object. It cleans the provided HTML by removing tags like <script>, <style>, <head>, <body>, <title>, and <iframe>, and it will also remove all JavaScript, including element attributes that contain JavaScript.

GM_xmlhttpRequest (improved in Scriptish!)

This function is a cross-origin version of XMLHttpRequest. The beauty of this function is that a user script can make requests that do not use the same-origin policy, creating opportunities for powerful mashups.

GM_xpath (new in Scriptish!)

A simple API for selecting DOM nodes with XPath, eliminating much of the work typically required when using XPath in JavaScript.


Values

GM_deleteValue

This function will remove a user script preference.

GM_getValue

This function will retrieve a user script preference.

GM_listValues

This function will return a list of a user script's preferences.

GM_setValue (improved in Scriptish!)

This function will set a user script preference.


Resources

Note: Resources are included with a Metadata Block's @resource key.

GM_getResourceText

This function will return the plain text content of a @resource.

GM_getResourceURL

This function will return the contents of the @resource as a data: URL.


User Interface

GM_log (improved in Scriptish!)

This function sends messages to either the Firebug Console, Web Console, or Error Console.

GM_notification (new in Scriptish!)

This function sends a Growl-style notification/message to the user.

GM_openInTab (improved in Scriptish!)

This function opens a URL in a new tab, or optionally an existing tab.

GM_registerMenuCommand (improved in Scriptish!)

This function will add a menu item to the Scriptish menu under "User Script Commands".

GM_unregisterMenuCommand (new in Scriptish!)

This function will remove a GM_registerMenuCommand-created menu item from the Scriptish menu.

GM_enableMenuCommand (new in Scriptish!)

This function will enable a GM_registerMenuCommand-created menu item in the Scriptish menu.

GM_disableMenuCommand (new in Scriptish!)

This function will disable a GM_registerMenuCommand-created menu item in the Scriptish menu.

GM_setClipboard (new in Scriptish!)

This function will save data to the clipboard.


Other

GM_addStyle (improved in Scriptish!)

This function takes a string of CSS and adds it to the page.

GM_cryptoHash (new in Scriptish!)

This function will allow you to easily hash a string.

GM_generateUUID (new in Scriptish!)

This function will return a UUID using nsIUUIDGenerator.

Something went wrong with that request. Please try again.