On Jul 15, 1:43 am, datamgmt <[email protected]> wrote:
> For a debugging function I want to dump all the user prefs without
> explicitly listing them in multiple getString calls.
>
> I thought:
>
> for (var pref_name in prefs) {
>         html +=  Key: " + pref_name + " Value: " + prefs[pref_name];
>       }
>
> would work but it returns a list of the functions
>
>  Key: getString
> Value: function (K) {return J[K]?F(J[K]):""; }
>  Key: setDontEscape_
> Value: function () {F=function(K){return K } }
>  Key: getInt
> Value: function (K) {var L=parseInt(J[K],10); return isNaN(L)?0:L; }
>  Key: getFloat
> Value: function (K) {var L=parseFloat(J[K]); return isNaN(L)?0:L; }
>  Key: getBool
> Value: function (K) {var L=J[K]; if(L){return L==="true"||L===true||!!
> parseInt(L,10) }return false; }
>  Key: set
> Value: function (D, E) {if(arguments.length>2){var F={}; for(var
> C=0,B=arguments.length; C
>  Key: getArray
> Value: function (N) {var O=J[N]; if(O){var K=O.split("|"); for(var
> M=0,L=K.length; M
>  Key: setArray
> Value: function (C, D) {for(var B=0,A=D.length; B
>  Key: getMsg
> Value: function (K) {return D[K]||""; }
>  Key: getCountry
> Value: function () {return B; }
>  Key: getLang
> Value: function () {return E; }
>  Key: getModuleId
> Value: function () {return A; }
>
> Any suggestions as to ways round this?
>
> rgds
> davidw

Since gadgets are rendered in iframes, and the user prefs are part of
the URL used in the iframe's src attribute, you can chop up the query
string with your language of choice.  Any parameter that starts with
the string "up_" is a user preference.

For instance, the following URL has user preferences lang (false),
langs (a serialized json object), title (the empty string) and help
(0):
http://ig.gmodules.com/gadgets/ifr?view=home&url=http://bayareacoder.com/gogo/translator/translator.xml&up_lang=false&up_langs={%22source_lang%22:%22ENGLISH%22,%22dest_lang%22:%22CHINESE_TRADITIONAL%22}&up_title=&up_help=0

In javascript you can access this information through the
window.location.search property.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to