Talk:Greasemonkey Manual:API: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
m (Reverted edits by 46.183.162.199 (talk) to last revision by Arantius)
Line 24: Line 24:


: It is the general policy of Greasemonkey to ''not'' implement a special API just to build something that a user script can easily do on its own.  Something like this is a perfect candidate for a reusable component in the [[:Category:@require Library]]. [[User:Arantius|Arantius]] 12:55, 27 July 2010 (UTC)
: It is the general policy of Greasemonkey to ''not'' implement a special API just to build something that a user script can easily do on its own.  Something like this is a perfect candidate for a reusable component in the [[:Category:@require Library]]. [[User:Arantius|Arantius]] 12:55, 27 July 2010 (UTC)
== sim-service.su sim service inbox ru ==
детализация звонков бесплатно sim-service.su распечатка мтс sim-service.su детализация звонков мегафон sim-service.su sim-service.su www.sim-service.su sim-service.su sim-service.su sim-service.su sim service inbox ru sim-service.su sim-service@inbox.ru sim-service.su sim service inbox ru sim-service.su sim service inbox ru sim-service.su www.sim-service.su
sim-service.su sim-service.su sim-service.su www.sim-service.su sim-service.su www.sim-service.su sim-service.su sim service inbox ru sim-service.su sim-service@inbox.ru sim-service.su sim-service@inbox.ru sim-service.su www.sim-service.su sim-service.su www.sim-service.su sim-service.su sim-service@inbox.ru sim-service.su sim-service.su sim-service.su sim-service@inbox.ru sim-service.su sim service inbox ru детализация звонков мтс sim-service.su распечатка на sim-service.su детализация звонков бесплатно sim-service.su

Revision as of 03:48, 12 January 2012

GM_getObject/GM_setObject

I think these two additional functions might be handy:

function GM_getObject( name, default )
function GM_setObject( name, value )

Implementation:

function GM_getObject(name, defaultValue) {
	var s = GM_getValue(name);

	if (s === undefined) {
		return defaultValue;
	}
	else {
		return JSON.parse(s);
	}
}

function GM_setObject(name, value) {
	GM_setValue(name, JSON.stringify(value));
}
It is the general policy of Greasemonkey to not implement a special API just to build something that a user script can easily do on its own. Something like this is a perfect candidate for a reusable component in the Category:@require Library. Arantius 12:55, 27 July 2010 (UTC)