GM.getResourceUrl

From GreaseSpot Wiki
Revision as of 23:16, 10 December 2007 by Marti (talk | contribs) (This is an Alpha article for when 0.8.0 is officially released... This will need to be confirmed before linked into the main API Reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Template:Underscore


Description

This API method ... TODO:

Examples | Notes

Syntax

GM_getResourceURL( resourceName )

Value: Function
Returns: String containing the base64 encoded data: URL scheme
Compatibility: Greasemonkey 0.8.0+
Parameters
Properties
resourceName

top

Properties


resourceName

Value: String
Usage: resourceName = "metadata-resource-name";
  • This value is used to retrieve the metadata block @resource name URI which will be retrieved, base64 encoded into the data: URL scheme and returned upon completion of this API method.

top | back

Examples

// ==UserScript==
// @name           I CAN HAS MOCHIKIT?
// @namespace      http://youngpup.net/userscripts
// @description    Simple library loading test which makes the Google logo pulsate.
// @include        http://www.google.com/
// @require        mochikit-packed.js
// @resource       better-logo http://wiki.greasespot.net/skins/common/images/gm-wiki-logo.png
// ==/UserScript==

/* Go to http://www.google.com to see this in action. */

var logo = document.evaluate(
  '/html/body/center/img', document, null, 9, null
).singleNodeValue;

logo.src = GM_getResourceURL("better-logo");
pulsate(logo);

top

Notes

top