Talk:Greasemonkey Manual:API

From GreaseSpot Wiki
Revision as of 15:37, 20 February 2011 by Arantius (talk | contribs) (Reverted edits by 2.94.159.8 (Talk) to last revision by Arantius)
Jump to navigationJump to search

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)

Подскажите надежный сайт знакомств J.

Вопрос:   Я очень хочу познакомиться с спокойной девушкой. Времени после учебы совсем не остается, а в праздники обычно необходимо тоже  работать. Вметро знакомиться не удобно.  Пока на сайтах встречаю  преимущественно проституток. Предложите вариант решения проблемы, пожалуйста. Заранее большое спасибо ….