|
WorkingWithGoogleGadgets
A guide to using and authoring basic gadgets for use on Google Code
Gadgets Working with Google Gadgets
IntroductionIn 2008 we launched gadget support throughout our project hosting service, allowing users to add gadgets to any wiki or project homepage. This guide aims to provide a starting point for both using and authoring simple gadgets within your own projects. Using existing gadgetsA number of specialized gadgets have already been created for project hosting, with some being listed on our InterestingDeveloperGadgets page. The Project Feeds section of each project also provides a list of custom gadgets (see our support project as an example). You can also find thousands of non-developer specific gadgets at http://www.google.com/ig/directory . Gadgets can be added to any wiki or project home page using our new <wiki:gadget...> syntax. For example, the gadget found at: http://google-code-project-hosting-gadgets.googlecode.com/svn/trunk/examples/issueupdates_example.xml Can be added using the following code: <wiki:gadget url="http://google-code-project-hosting-gadgets.googlecode.com/svn/trunk/examples/issueupdates_example.xml" up_projectName="support" /> Resulting in the following:
In this case, the up_projectName attribute is a configuration option specific to this gadget used to control which project's information is displayed. Creating your own gadgetsGoogle Gadgets are simple HTML and Javascript applications that can be embedded in webpages and other apps. From the developer perspective, they're normally small XML files used to wrap HTML, with metadata used by the gadgets API. Full documentation can be found on the Gadgets API homepage, but below are two simple examples. Hello, world!Taken from the Getting Started guide, the following is an example of a simple gadget that simply displayed "Hello, world!" <?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="hello world example" />
<Content type="html">
<![CDATA[
Hello, world!
]]>
</Content>
</Module>Embedding a remote URLYou can also use Gadgets to display the contents of a remote page. <?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="remote content example" /> <Content type="url" href="http://code.google.com" /> </Module> You can also specify dimensions for your gadget in your actual wiki syntax: <wiki:gadget url="..." width="540" height="400" /> Advantages of type=html over type=urltype=html gadgets have a few advantages over type=url gadgets:
In some cases, this means that you need to rewrite some of your functionality, but the effort is usually minimal. Plus, by using APIs to fetch your data rather than just generating HTML, you are creating APIs that other people can use to create mashups for developers. Gracefully DegradeGadgets can render in a variety of containers. Some of them have different end-user expectations than others:
When you code your gadget, code with both use cases in mind. Your iGoogle users will appreciate the ability to customize the gadget through a familiar interface (the "edit settings" menu). If you try to call prefs.set() and the gadget is being rendered on the Wiki, you'll get an exception because that is not a supported feature on Google Code. Therefore, be sure to code your gadget such that it works well in both iGoogle and Google Code. There is a simple way to determine if your gadget is on iGoogle: write some JavaScript that searches document.location for "synd=ig". If that's present, you know it is safe to call prefs.set(). Use Standard Preference NamesGoogle Code users will use a syntax that looks like this: <wiki:gadget url="..." up_pref1="val1" up_pref2="val2"/> To make life easier on users of the Wiki, please use a standard user pref name for the project name. Example: <UserPref name="projectName" display_name="Project Name" default_value="no_project_selected" /> If you use something other than projectName, users would have to inspect your gadget to figure out what the variable is. Here's an example: <wiki:gadget url="..." up_projectName="google-web-toolkit"/> Also, by using a user pref value for specifying gadget customizations, your gadget becomes more portable across the different ways that gadgets can be embedded:
Use the Asset ProxyReferring to images, .css, or .js files directly from your gadget can cause performance or load problems. Instead, take advantage of the gadgets asset proxy by prefixing all your static URLs with /gadgets/proxy?url=. Here's an example: <img border="0" src="/gadgets/proxy?url=http://igoogleinfogadget.googlecode.com/svn/trunk/img_fallback/content_start.gif" /> You can use the same trick for CSS background-image: url(), <script src=...>, etc. You can also use the gadgets.io.getProxyUrl() method to compute the proxy URLs dynamically, which is useful for any content loaded via JavaScript, AJAX, jQuery.load(), etc. Publishing your gadgetsHosting gadgets on Google CodeIt's also possible to host your gadgets directly out of your project hosting repository. As in the example above, the file: http://google-code-project-hosting-gadgets.googlecode.com/svn/trunk/examples/issueupdates_example.xml Is just a normal file stored in google-code-project-hosting-gadgets's svn repository, and can be referenced using: <wiki:gadget url="http://google-code-project-hosting-gadgets.googlecode.com/svn/trunk/examples/issueupdates_example.xml" /> If you do plan on hosting your gadget and related resources out of your source repository, though, ensure that all of your resource calls go through gadget.io.getProxyUrl or gadget.io.makeRequest. Gadgets themselves are cached, but direct links to files within your repository can lead to a significant decrease in performance. Testing Your GadgetYou should test your gadget in the following places:
Test in multiple browsers, and be sure to use Firebug with error reporting enabled when interacting with your gadget. Promote the Gadget From Your SiteTo promote the gadget for use on iGoogle: See Add to Google - Information for Publishers. You can also add the gadget pre-customized: http://www.google.com/ig/add?moduleurl=http://www.google.com/ig/modules/horoscope.xml&up_sign=Capricorn To promote the gadget for embedding on arbitrary 3rd party web sites, use the creator. You can link to the creator by constructing a URL as follows: http://www.gmodules.com/ig/creator?url=http://www.google.com/ig/modules/horoscope.xml&up_sign=Taurus Note that the &up= variables only accept characters Promote your Gadgets in the iGoogle DirectoryFollow the instructions at http://www.google.com/ig/submit to add your gadget to the directory. Be sure to include descriptive metadata so that your gadget can be found more easily. Integrating other Google productsGadgets also allow for tighter integration with other Google products. Google Docs, for example, outputs iframed content that can be adapted into gadgets, while Youtube provides Flash embed codes that can be embedded in a normal HTML gadget. Google Docs Forms and PresentationsUsing Google Docs it's possible to create simple and customizable feedback forms, then embed them within any webpage. Taking the embed code provided by Google Docs: <iframe src="http://spreadsheets.google.com/embeddedform?key=pcei2KUN61t4vbuSjTGjzNw" width="310" height="566" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe> We can convert the content the iframe into a gadget: <?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="Gadget Form Example" /> <Content type="url" href="http://spreadsheets.google.com/embeddedform?key=pcei2KUN61t4vbuSjTGjzNw" /> </Module> Then reference it within our project home page or a wiki page: <wiki:gadget url="..." width="310" height="566" /> Similar embed codes are provided for presentations as well, allowing presentations to be inserted alongside their related wiki documentation. Embedding YouTube videosIt's now possible to embed videos directly using our new video gadget, which currently handles both YouTube and Google Video content: <wiki:gadget url="http://code.google.com/p/google-code-project-hosting-gadgets/source/browse/trunk/video/gcVideo.xml" up_video="..." /> There is also a short hand wiki tag for embedding videos. For more information, refer to the WikiSyntax documentation. Google GroupsMarkMail's Gadget Builder provides step-by-step tool for generating gadgets for any Google Group based on simple search term. Google ModeratorGoogle Moderator allows users to submit feedback and vote on feedback from others. You can use it as a way of collecting basic input beyond the issue tracker. Create a series for your project first, and then put the URL of that series in the gadget code: <wiki:gadget url="http://www.google.com/moderator/static/moderator-embed-gadget.xml" height="400" width="900" up_url="http://www.google.com/moderator/#15/e=1c1a0&t=1c1a0.40" up_sort="HOT" up_hl="en" /> | |
How do I delete those little Gadgets? I have tried multiple times to delete unwanted gadgets, but after I "hit delete" they reappear when I go to my igoogle page. I need some advice. doncovington@comcast.net
it s very nice way to teach to the student
How about making <wiki:gadget/>'s align-able, like <wiki:gadget align="right" ... />?
怎么其它页面发不了评论只有这里能发啊
这个 wiki 系统是开源的吗?哪里可以看到源代码?
Is this wiki system a open source project? how to get it's source code?
<wiki:gadget url="http://google-code-project-hosting-gadgets.googlecode.com/svn/trunk/examples/issueupdates_example.xml" up_projectName="support" />
The following works in IE and Firefox but not in Goolgle Chrome. Is there a way to fix it? http://7.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/youtube_videos.xml
Vince impingdoing@gmail.com
How to include a googledoc "draw" in a wiki page ?
need details
hi all I need to develop google gadget that use webservice form another domain i am facing cross domain interaction problem(access denied) when my gadget tries make soap request. To solve this how can i add proxy in google gadget. please some one help me
tinithetiger@gmail.com
Feel the need to preview comments in projects hosted here at Google Code Project Hosting? Then check this out: Preview comments - This is basically a hack for comment previewing before you post a comment on a wiki page, rendered using JavaScript?.
This hack is hosted at a project wikignpi, hosted at Google Code Project Hosting :)
It's a good information. Thank you. Lamparas http://www.dec-iluminacion.com
It's been a requested feature: Adsense for Project Hosting.
Here's one working solution: http://code.google.com/p/gprojecthosting-adsense/ :-)
Every thing is working great. http://www.projectin.eu
how about...this? # 1 סוב בט ‰ אַ ‰ אַ € ~ אַ ° אַ אַ אַ אַ ¸ אַ € ¹ איך ¬ אַ € ¡אַ € אַ € ° א, אַ א, ז א ™ ~ ג E / \ אַסעגידזשלנפּ - אַ ¡אַ א ¥ ¤ אַ © אַ ª אַ ¬ אַ ¯ ³ אַ אַ אַ אַ † אַז ‰ ¥ âμ אַ 'איך' € אַ ª אַ º אַ | אַ א ¿¬ אַ € | אַ € "א € œ אַ € אַ € ~ אַ ¸ אַ € ¹ א · עאָע E # ™ און 1, ה בטוו |I see you baby and you're looking so good I got a feeling and I think that we should Let's take it outside let's go for a ride Let's do it whatever we want Let's make it a crime let's do it in time Let's do it wherever we want
Let's fuck
I wanna baby and I know that you would I got it baby and I know that you're good Let's do it for sin let's bring in your friends Let's do it whatever we want Let's do it for them let's do it again Let's do it wherever we want
Let's Fuck
Let's go all the way Let's do it all day Let's do it whatever we want Let's turn out the lights Let's do it all night Let's do it as long as we want
Let's fuck Let's do it again Let's do it whatever we want Let's fuck
for new google location web maps more for tomorrow.
I need to know what much domain is and where can I find it?
How do I create a wiki table that has new lines in it? such as a list of items in a cell?