My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
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
Updated Feb 26, 2010 by nakajim...@gmail.com

jQuery.pref and jQuery.prefArray require setprefs

<Require feature="setprefs" />

Obtaining Gadget Preferences

jQuery.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 Preferences

jQuery.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 ID

jQuery.pref can be used to obtain a module ID

  var moduleId = $.pref('mid');

Obtaining Gadget Parameters

jQuery.pref can be used to obtain iframe URL parameters

  var appId = $.pref('aid'); // appId
  var nocache = $.pref('nocache');

HTML Unescape

jQuery.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
Powered by Google Project Hosting