GM.getResourceUrl: Difference between revisions
From GreaseSpot Wiki
Jump to navigationJump to search
m 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 |
m →Syntax: Probably better to put the string return type in the description to maintain article consistancy |
||
Line 13: | Line 13: | ||
:Value: Function | :Value: Function | ||
:Returns: String | :Returns: String | ||
:Compatibility: [[Version_history#0.8.0|Greasemonkey 0.8.0+]] | :Compatibility: [[Version_history#0.8.0|Greasemonkey 0.8.0+]] | ||
Revision as of 04:49, 11 December 2007
Description
This API method ... TODO:
Syntax
GM_getResourceURL( resourceName )
- Value: Function
- Returns: String
- Compatibility: Greasemonkey 0.8.0+
Parameters Properties resourceName
- All properties are optional except resourceName.
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.
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);