http://wiki.greasespot.net/Knowing_Your_Own_Metadata

bit complicated that one - I used to use a cut down

var meta={};<><![CDATA[
// ==UserScript==
// *usual header stuff is hear*
// ==/UserScript==
]]></>.toString().split(/\n/).filter(/\/\/ @/).forEach(function(line) {
[, name, value] = line.match(/\/\/ @(\S+)\s*(.*)/);
if(typeof(meta[name]) == "undefined") { // first instance
meta[name] = value;
} else if(typeof(meta[name]) == "array") { // 3rd instance
meta[name].push(value);
} else { // 2nd instance, change to an array
var s = meta[name];
meta[name] = [];
meta[name].push(s);
meta[name].push(value);
}
});


meta.name will be the name, meta.include will be @include etc ... for
@include etc, meta.include MAY be an array if you have more than one
@include line

same goes for @exclude, @require, @resource

hope that helps



On 6 May 2010 23:03, KOLANICH <[email protected]> wrote:

> hadnt found a page in wiki
> i need  api like this
> alert(GM_getHeader("version"));//1.1
> alert(GM_getHeader("description"));// My super userscript.
> alert(GM_getHeader("include"));//  *somesite*/some.php?*
>
> --
> You received this message because you are subscribed to the Google Groups
> "greasemonkey-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<greasemonkey-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/greasemonkey-users?hl=en.
>
>


-- 
Coming soon - BravoStudio, a complete internet radio/tv solution

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to