[orkut-developer] New features: configurable app width and container version detection!
Hello orkut developers, We now support two cool new features for gadgets in canvas view: - Container version detection - Flexible application width A quick introduction follows. We hope you enjoy them! They're enabled on sandbox and should reach production soon. If you have any feedback, please let us know! *Container Version Detection* The Container Version is supplied to your gadget in a new iframe parameter (containerVersion), so it can be retrieved like this: var containerVersion = gadgets.util.getUrlParameters()[containerVersion]; Its value is 1 for the canvas view container in the *old orkut UI* and 2 for the canvas view container in the *new orkut UI*. You can read this to determine which container your application is running inside of. Please be aware, however, that container version is not the same as orkut UI version... for now, there is a 1-to-1 correspondence (1 for old orkut, 2 for new orkut) but this may come out of sync when we launch new container versions or new UIs. *Configurable Gadget Width* That's right, we now support configurable width for applications in canvas view! You can specify a preferred width to orkut in your applications XML by means of the preferred_width attribute of the Content tag: ?xml version=1.0 encoding=UTF-8? Module ModulePrefs title=Yourtitlehere author=authorhere author_email=email_h...@..com description=Description here screenshot=http://url/of/a/screenshot/of/your/app; thumbnail=http://url/of/the/thumbnail/for/your/app; Require feature=opensocial-0.8 / Locale lang=en country=us / /ModulePrefs Content type=html *preferred_width**=**900* ![CDATA[ ... /Content /Module The container will try to allocate your indicated width but might have to crop it if it's too big and expand it if it's too small. The actual width will be reported to you in the gadgetWidth iframe parameter, which could be read like this (but don't do that yet, keep on reading): var gadgetWidth = gadgets.util.getUrlParameters()[gadgetWidth]; // but wait! don't implement it like this... there's a slight catch. Keep on reading. Some points to take into account are: - The preferred_width parameter will only be taken into account when rendering your application on container version 2, but will be ignored in container version 1. - The container might or might not honor your preferred width depending on the available space. - The gadgetWidth iframe parameter is only available to your application in container version 2 and above. This is the slight catch we were talking about above. Therefore, the correct way to determine your application's actual width is first testing the container version and then, if the version is 2 or above, reading the gadgetWidth parameter. Otherwise (container version 1), the width of the gadget is fixed at 835px. So an example of Javascript code would be: // Determines the actual width of the application function getActualWidth() { return (gadgets.util.getUrlParameters()[containerVersion] = 2) ? gadgets.util.getUrlParameters()[gadgetWidth] : 835; } -- You received this message because you are subscribed to the Google Groups orkut Developer Forum group. To post to this group, send email to opensocial-orkut@googlegroups.com. To unsubscribe from this group, send email to opensocial-orkut+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/opensocial-orkut?hl=en.
[orkut-developer] New features: configurable app width and container version!
Hello orkut developers, We now support two cool new features for gadgets in canvas view: - Container version detection - Flexible application width A quick introduction follows. We hope you enjoy them! They're enabled on sandbox and should reach production soon. If you have any feedback, please let us know! *Container Version Detection* The Container Version is supplied to your gadget in a new iframe parameter (containerVersion) in canvas view, so it can be retrieved like this: var containerVersion = gadgets.util.getUrlParameters()[containerVersion]; Its value is 1 for the canvas view container in the old orkut UI and 2 for the canvas view container in the new orkut UI. You can read this to determine which container your application is running inside of. Please be aware, however, that container version is not the same as orkut UI version... for now, there is a 1-to-1 correspondence (1 for old orkut, 2 for new orkut) but this may come out of sync when we launch new container versions or new UIs. *Configurable App Width* That's right, we now support configurable width for applications in canvas view! You can specify a preferred width to orkut in your applications XML by means of the preferred_width attribute of the Content tag: ?xml version=1.0 encoding=UTF-8? Module ModulePrefs title=Yourtitlehere author=authorhere author_email=email_h...@..com description=Description here screenshot=http://url/of/a/screenshot/of/your/app; thumbnail=http://url/of/the/thumbnail/for/your/app; Require feature=opensocial-0.8 / Locale lang=en country=us / /ModulePrefs Content type=html *preferred_width=900* ![CDATA[ ... /Content /Module The container will try to allocate your indicated width but might have to crop it if it's too big and expand it if it's too small. The actual width will be reported to you in the gadgetWidth iframe parameter. Some points to take into account are: - The preferred_width parameter will only be taken into account when rendering your application on container version 2, but will be ignored in container version 1. - The container might or might not honor your preferred width depending on the available space. - The gadgetWidth iframe parameter is only available to your application in container version 2 and above. This is the slight catch we were talking about above. Therefore, the correct way to determine your application's actual width is first testing the container version and then, if the version is 2 or above, reading the gadgetWidth parameter. Otherwise (container version 1), the width of the gadget is fixed at 835px. So an example of Javascript code would be: // Determines the actual width of the application function getActualWidth() { return (gadgets.util.getUrlParameters()[containerVersion] = 2) ? gadgets.util.getUrlParameters()[gadgetWidth] : 835; } -- You received this message because you are subscribed to the Google Groups orkut Developer Forum group. To post to this group, send email to opensocial-orkut@googlegroups.com. To unsubscribe from this group, send email to opensocial-orkut+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/opensocial-orkut?hl=en.
[orkut-developer] Re: New features: configurable app width and container version!
Hi Bruno Can you please clarify, if I don't change anything the width would be 835 as it is today? Is it correct? thanks On Feb 22, 5:04 am, Bruno Oliveira (\btco\) bru...@google.com wrote: Hello orkut developers, We now support two cool new features for gadgets in canvas view: - Container version detection - Flexible application width A quick introduction follows. We hope you enjoy them! They're enabled on sandbox and should reach production soon. If you have any feedback, please let us know! *Container Version Detection* The Container Version is supplied to your gadget in a new iframe parameter (containerVersion) in canvas view, so it can be retrieved like this: var containerVersion = gadgets.util.getUrlParameters()[containerVersion]; Its value is 1 for the canvas view container in the old orkut UI and 2 for the canvas view container in the new orkut UI. You can read this to determine which container your application is running inside of. Please be aware, however, that container version is not the same as orkut UI version... for now, there is a 1-to-1 correspondence (1 for old orkut, 2 for new orkut) but this may come out of sync when we launch new container versions or new UIs. *Configurable App Width* That's right, we now support configurable width for applications in canvas view! You can specify a preferred width to orkut in your applications XML by means of the preferred_width attribute of the Content tag: ?xml version=1.0 encoding=UTF-8? Module ModulePrefs title=Yourtitlehere author=authorhere author_email=email_h...@..com description=Description here screenshot=http://url/of/a/screenshot/of/your/app; thumbnail=http://url/of/the/thumbnail/for/your/app; Require feature=opensocial-0.8 / Locale lang=en country=us / /ModulePrefs Content type=html *preferred_width=900* ![CDATA[ ... /Content /Module The container will try to allocate your indicated width but might have to crop it if it's too big and expand it if it's too small. The actual width will be reported to you in the gadgetWidth iframe parameter. Some points to take into account are: - The preferred_width parameter will only be taken into account when rendering your application on container version 2, but will be ignored in container version 1. - The container might or might not honor your preferred width depending on the available space. - The gadgetWidth iframe parameter is only available to your application in container version 2 and above. This is the slight catch we were talking about above. Therefore, the correct way to determine your application's actual width is first testing the container version and then, if the version is 2 or above, reading the gadgetWidth parameter. Otherwise (container version 1), the width of the gadget is fixed at 835px. So an example of Javascript code would be: // Determines the actual width of the application function getActualWidth() { return (gadgets.util.getUrlParameters()[containerVersion] = 2) ? gadgets.util.getUrlParameters()[gadgetWidth] : 835; }- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups orkut Developer Forum group. To post to this group, send email to opensocial-orkut@googlegroups.com. To unsubscribe from this group, send email to opensocial-orkut+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/opensocial-orkut?hl=en.