|
Preference
It is possible to save and obtain gadget preferences. Gadget attributes such as the module ID, etc., can also be obtained.
jQuery.pref, jQuery.prefArray en, ja
jQuery.pref and jQuery.prefArray require setprefs <Require feature="setprefs" /> Obtaining Gadget PreferencesjQuery.pref can be used to obtain preferences var comment = $.pref('comment');
var lastModified = $.pref('lastModified');
var footprint = $.pref('footprint');jQuery.prefArray can be used to obtain preferences as array var feeling = $.prefArray('feeling');
console.info(feeling); // ['well', 'bad', 'cool']Saving Gadget PreferencesjQuery.pref can be used to save preferences $.pref('comment', 'Say Hello!');
$.pref('lastModified', new Date().getTime());
$.pref('footprint', false);Moreover, groups of preferences can be specified and saved in the same way $.pref({
comment: 'Say Hello!',
lastModified: new Date().getTime(),
footprint: false
});Furthermore, preferences can be saved as array $.pref('feeling', ['well', 'bad', 'cool']);Obtaining a Gadget Module IDjQuery.pref can be used to obtain a module ID var moduleId = $.pref('mid');Obtaining Gadget ParametersjQuery.pref can be used to obtain iframe URL parameters var appId = $.pref('aid'); // appId
var nocache = $.pref('nocache');HTML UnescapejQuery.pref and jQuery.prefArray are HTML Unescapes $.pref('comment', '<b>Say Hello!</b>');
var comment = $.pref('comment');
console.info(feeling); // '<b>Say Hello!</b>'
|
► Sign in to add a comment