Talk:Greasemonkey Manual:API: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
m (Reverted edits by 95.139.183.100 (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)
== Предлагаем СуперОкна 7 ( эмулятор ключа защиты ). Дорого. ==
Предлагаем <a href=http://saprsoft.com/product/suok7al-superokna-7-almaz/>СуперОкна 7 Алмаз</a> для расчета и производства пластиковых окон. Мы предлагаем полную версию <a href=http://saprsoft.com>СуперОкна 7</a>, то есть все модули включены. Вы можете <a href=http://saprsoft.com/product/super-okna-7>скачать СуперОкна 7 бесплатно</a> по индивидуальной ссылке, а затем <a href=http://saprsoft.com/product/super-okna-7>купить СуперОкна 7</a>. В комплекте вы найдете: <a href=http://saprsoft.com/product/suok7al-superokna-7-almaz/>последнее обновление СуперОкна 7</a>, эмулятор ключа защиты, инструкцию по установке. За дополнительной информацией обращайтесь по указанным контактам на сайте <a href=http://saprsoft.com/>www.saprsoft.com</a>. Также предлагаем такие услуги, как: готовые <a href=http://saprsoft.com/product/suok7al-superokna-7-almaz/>базы для программы СуперОкна 7</a>, создание <a href=http://saprsoft.com/product/suok7al-superokna-7-almaz/>базы для программы СуперОкна 7</a> по индивидуальным заказам.

Revision as of 13:24, 6 May 2011

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)