Skip to content

Instantly share code, notes, and snippets.

@tiff
Created May 28, 2010 16:28
Show Gist options
  • Save tiff/417380 to your computer and use it in GitHub Desktop.
Save tiff/417380 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<!--
FIG - Feature Inspector Gadget, find out what gadget features are supported by any gadget container.
Copyright (C) 2009 XING AG
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<ModulePrefs
title="__MSG_abbr__ - __MSG_title__ __MSG_current_version__"
title_url="http://shonzilla.com/gadgets/fig.xml"
author="__MSG_author__"
author_email="__MSG_author_email__"
author_affiliation="__MSG_author_affiliation__"
author_link="__MSG_author_link__"
author_location="__MSG_author_location__"
description="__MSG_description__ __MSG_last_version__: __MSG_current_version__, __MSG_date__: __MSG_current_version_date__"
thumbnail="__MSG_thumbnail__"
screenshot="__MSG_screenshot__">
<Locale messages="http://shonzilla.com/gadgets/ALL_ALL.xml"/>
<Locale lang="de" messages="http://shonzilla.com/gadgets/de_ALL.xml"/>
<Locale lang="es" messages="http://shonzilla.com/gadgets/es_ALL.xml"/>
<Locale lang="sr" messages="http://shonzilla.com/gadgets/sr_ALL.xml"/>
<!--
Standard gadget features according to Apache Shindig OpenSocial container
-->
<Optional feature="analytics" />
<Optional feature="content-rewrite">
<Param name="expires">86400</Param>
<Param name="include-url">.jpg</Param>
<Param name="exclude-url">.png</Param>
</Optional>
<Optional feature="core" />
<Optional feature="core.io" />
<Optional feature="dynamic-height" />
<Optional feature="dynamic-height.util" />
<Optional feature="flash" />
<Optional feature="minimessage" />
<Optional feature="oauthpopup" />
<!--
We have to exclude opensocial-0.6 in order to avoid
a js error in google's container
<Optional feature="opensocial-0.6" />
-->
<Optional feature="opensocial-0.7" />
<Optional feature="opensocial-0.8" />
<Optional feature="opensocial-0.9" />
<Optional feature="opensocial-base" />
<Optional feature="opensocial-data" />
<Optional feature="opensocial-data-context" />
<!-- <Optional feature="opensocial-i18n" /> -->
<Optional feature="opensocial-jsonrpc" />
<Optional feature="opensocial-reference" />
<Optional feature="opensocial-templates" />
<Optional feature="osapi" />
<Optional feature="osapi.ui" />
<Optional feature="pubsub" />
<Optional feature="rpc" />
<Optional feature="setprefs" />
<Optional feature="settitle" />
<Optional feature="skins" />
<Optional feature="swfobject" />
<Optional feature="tabs" />
<Optional feature="views" />
<Optional feature="xmlutil" />
<!--
Container-specific gadget features
-->
<Optional feature="ads" />
<Optional feature="atlassian.util" />
<Optional feature="cache" />
<Optional feature="drag" />
<Optional feature="finance" />
<Optional feature="google.blog" />
<Optional feature="google.sharedstate" />
<Optional feature="grid" />
<Optional feature="invite" />
<Optional feature="linkedin-ext" />
<Optional feature="multisize" />
<Optional feature="netlog" />
<Optional feature="opensocial-payment" />
<Optional feature="payment" />
<Optional feature="sharedmap" />
<Optional feature="tracking" />
<Optional feature="vzflash" />
<Optional feature="wave" />
<Optional feature="xing-ext" />
</ModulePrefs>
<Content type="html"><![CDATA[
<style type="text/css">
body {
font-size: 11px;
font-family: Verdana, Arial, sans-serif;
}
h2 {
font-size: 20px;
}
table th {
background-color: silver;
}
table .supported {
background-color: green;
}
table .unsupported {
background-color: red;
}
table .supported,
table .unsupported {
width: 20%;
text-align: center;
text-transform: uppercase;
color: #fff;
font-size: 9px;
}
table .name {
font-family: Courier, Fixed, monospace;
width: 30%;
}
table .docUrl {
width: 50%;
text-align: center;
font-size: 11px;
}
table .docUrl a {
background: url(http://de.wikipedia.org/skins-1.5/monobook/external.png) center __BIDI_END_EDGE__ no-repeat;
padding: 0 13px;
}
#unchecked-features,
#custom-features {
margin: 25px 0 0 0;
}
#unchecked-features {
color: #999;
margin-bottom: 10px;
}
.content-rewrite-test {
display: none;
}
.ie {
background-color: red;
color: #fff;
padding: 5px;
text-transform: uppercase;
margin-bottom: 20px;
text-align: center;
}
</style>
<!--[if lt IE 8]>
<div class="ie">This Gadget isn't compatible with Internet Explorer versions lower than 8. Sorry.</div>
<![endif]-->
<div id="standard-features">
<h2>__MSG_standard_features__</h2>
<table width="100%" id="standard-features-table" border="1" cellpadding="3" cellspacing="3"></table>
</div>
<div id="custom-features">
<h2>__MSG_custom_features__</h2>
<table width="100%" id="custom-features-table" border="1" cellpadding="3" cellspacing="3"></table>
</div>
<div id="unchecked-features">
<strong>__MSG_please_note__:</strong> <i>__MSG_title__</i> __MSG_not_able__:
<i>caja</i>,
<i>opensocial-current</i>,
<i>locked-domain</i> __MSG_and__
<i>auth-refresh</i>.
</div>
<div class="content-rewrite-test">
<img src="http://www.shonzilla.com/gadgets/img/foobar.jpg" id="cr-jpg" />
<img src="http://www.shonzilla.com/gadgets/img/foobar.png" id="cr-png" />
</div>
<script type="text/javascript">
var GadgetFeatureInspector = {
_features: {
"analytics": function() { return window.urchinTracker || !!window._gat || !!window._IG_GA || !!window._IG_Analytics; },
// "auth-refresh": function() { return false; }, // Probably undetectable
// "caja": function() { return false; }, // TODO
"content-rewrite": function() { return document.getElementById("cr-jpg").src != "http://www.shonzilla.com/gadgets/img/foobar.jpg" && document.getElementById("cr-png").src == "http://www.shonzilla.com/gadgets/img/foobar.png"; },
"core": function() { return !!window.gadgets; },
"core.io": function() { return !!window.gadgets && !!gadgets.io; },
"dynamic-height": function() { return ( !!window.gadgets && !!gadgets.window && !!gadgets.window.adjustHeight ) || !!window._IG_AdjustIFrameHeight; },
"dynamic-height.util": function() { return !!window.gadgets && !!gadgets.window && !!gadgets.window.getViewportDimensions; },
"flash": function() { return ( !!window.gadgets && !!gadgets.flash ) || !!window._IG_EmbedFlash; },
// "locked-domain": function() { return false; }, // Propably undetectable
"minimessage": function() { return ( !!window.gadgets && !!gadgets.MiniMessage ) || !!window._IG_MiniMessage; },
"oauthpopup": function() { return !!window.gadgets && !!gadgets.oauth && !!gadgets.oauth.Popup; },
// "opensocial-0.6": function() { return !!window.opensocial && !!opensocial.Environment && !!opensocial.Environment.prototype && !!opensocial.Environment.prototype.getSurface; },
"opensocial-0.7": function() { return !!window.opensocial && !!opensocial.DataRequest && !!opensocial.DataRequest.Group; },
"opensocial-0.8": function() { return !!window.opensocial && !!opensocial.IdSpec && !!opensocial.IdSpec.GroupId; },
"opensocial-0.9": function() { return !!window.opensocial && !!opensocial.Person && !!opensocial.Person.prototype && !!opensocial.Person.prototype.getAppData; },
"opensocial-base": function() { return !!window.FieldTranslations; }, // TODO... not sure if this is correct for all OSO versions
// "opensocial-current": function() { return !!window.requiredConfig; }, // TODO
"opensocial-data": function() { return !!window.opensocial && !!opensocial.data; },
"opensocial-data-context": function() { return !!window.opensocial && !!opensocial.data && !!opensocial.data.DataContext; },
// "opensocial-i18n": function() { return !!window.gadgets && !!gadgets.i18n; },
"opensocial-jsonrpc": function() { return !!window.JsonRpcContainer; },
"opensocial-reference": function() { return !!window.opensocial && !!opensocial.getEnvironment; },
"opensocial-templates": function() { return ( !!window.opensocial && !!opensocial.template || !!window.os ); },
"osapi": function() { return !!window.osapi; },
"osapi.ui": function() { return !!window.osapi && !!osapi.ui; },
"pubsub": function() { return !!window.gadgets && !!gadgets.pubsub; },
"rpc": function() { return !!window.gadgets && !!gadgets.rpc; },
"setprefs": function() { return ( !!window.gadgets && !!gadgets.Prefs && !!gadgets.Prefs.prototype && !!gadgets.Prefs.prototype.set ) || ( !!window._IG_Prefs && !!_IG_Prefs.prototype && !!_IG_Prefs.prototype.set ); },
"settitle": function() { return ( !!window.gadgets && !!gadgets.window && !!gadgets.window.setTitle ) || !!window._IG_SetTitle; },
"skins": function() { return !!window.gadgets && !!gadgets.skins; },
"swfobject": function() { return !!window.swfobject; },
"tabs": function() { return ( !!window.gadgets && !!gadgets.Tab ) || !!window._IG_Tabs; },
"views": function() { return !!window.gadgets && !!gadgets.views; },
"xmlutil": function() { return !!window.opensocial && !!opensocial.xmlutil; }
},
_customFeatures: {
"ads": function() { return !!window._ADS_ClickDestinationUrl; },
"atlassian.util": function() { return !!window.atlassian && !!atlassian.util; },
"cache": function() { return !!window.gadgets && !!gadgets.cache; },
"drag": function() { return !!window._IG_Drag; },
"finance": function() { return !!window.google && !!google.finance; },
"google.blog": function() { return !!window.google && !!google.Blog; },
"google.sharedstate": function() { return !!window.gadgets && !!gadgets.sharedstate; },
"grid": function() { return !!window._IG_Grid; },
"invite": function() { return !!window.vz && !!vz.invite; },
"linkedin-ext": function() { return !!window.linkedin; },
"multisize": function() { return !!window._IG_MultiSize; },
"netlog": function() { return !!window.Netlog; },
"opensocial-payment": function() { return !!window.opensocial && !!opensocial.newFetchPaymentRequest; },
"payment": function() { return !!window.Netlog && !!Netlog.Payment; },
"sharedmap": function() { return !!window.GMap2; },
"tracking": function() { return !!window.gadgets && !!gadgets.tracking; },
"vzflash": function() { return !!window.vz && !!vz.flash; },
"wave": function() { return !!window.wave; },
"xing-ext": function() { return !!window.xing; }
},
// Feature documentation link map "feature" : object
// where object is either a "link" or {("title": "link")+}
_featureDocs: {
"analytics": "http://code.google.com/apis/analytics/docs/tracking/gadgetTracking.html",
"content-rewrite": "http://wiki.opensocial.org/index.php?title=Content_Rewriter_Feature",
"core": "http://code.google.com/apis/gadgets/docs/spec.html#corejavascriptapi",
"core.io": "",
"dynamic-height": "http://code.google.com/apis/gadgets/docs/reference/#gadgets.window", // http://code.google.com/apis/gadgets/docs/ui.html#Dyn_Height
"dynamic-height.util": "",
"flash": "http://code.google.com/apis/gadgets/docs/reference/#gadgets.flash", // "http://code.google.com/apis/gadgets/docs/ui.html#Flash"
// "locked-domain": "",
"minimessage": "http://code.google.com/apis/gadgets/docs/reference/#gadgets.MiniMessage", // "http://code.google.com/apis/gadgets/docs/ui.html#Mini"
"oauthpopup": "http://wiki.opensocial.org/index.php?title=OAuth_Popup",
// "opensocial-0.6": "http://code.google.com/apis/opensocial/articles/tutorial/tutorial-0.6.html",
"opensocial-0.7": "http://code.google.com/apis/opensocial/articles/tutorial/tutorial-0.7.html",
"opensocial-0.8": "http://code.google.com/apis/opensocial/articles/tutorial/tutorial-0.8.html",
"opensocial-0.9": "http://www.opensocial.org/Technical-Resources/opensocial-spec-v09/",
"opensocial-base": "",
// "opensocial-current": "",
"opensocial-data": "http://opensocial-resources.googlecode.com/svn/spec/0.9/OpenSocial-Data-Pipelining.xml",
"opensocial-data-context": "http://opensocial-resources.googlecode.com/svn/spec/0.9/OpenSocial-Data-Pipelining.xml#rfc.section.11",
"opensocial-i18n":
"http://wiki.opensocial.org/index.php?title=Gadgets.i18n_%28v0.9%29",
"opensocial-jsonrpc": "http://opensocial-resources.googlecode.com/svn/spec/draft/RPC-Protocol.xml",
"opensocial-reference": "",
"opensocial-templates": "http://opensocial-resources.googlecode.com/svn/spec/0.9/OpenSocial-Templating.xml",
"osapi": "http://wiki.opensocial.org/index.php?title=OSAPI_Specification#OSAPI_Features",
"osapi.ui": "http://wiki.opensocial.org/index.php?title=OSAPI_Specification#osapi.ui",
"pubsub": "http://code.google.com/apis/gadgets/docs/pubsub.html",
"rpc": "http://code.google.com/apis/gadgets/docs/reference/#gadgets.rpc",
"setprefs": {"Method Docs": "http://code.google.com/apis/gadgets/docs/reference/#gadgets.Prefs",
"Tutorial": "http://code.google.com/apis/gadgets/docs/fundamentals.html#SetPrefs"},
"settitle": {"Method Docs" : "http://code.google.com/apis/gadgets/docs/reference/#gadgets.window.setTitle",
"Tutorial": "http://code.google.com/apis/gadgets/docs/ui.html#Settitle"},
"skins": {"Method Docs": "http://code.google.com/apis/gadgets/docs/reference/#gadgets.skins"},
"swfobject": "http://code.google.com/p/swfobject/wiki/documentation",
"tabs": {"Method Docs": "http://code.google.com/apis/gadgets/docs/reference/#gadgets.Tab",
"Tutorial": "http://code.google.com/apis/gadgets/docs/ui.html#Tabs"},
"views": "http://code.google.com/apis/gadgets/docs/reference/#gadgets.views",
"xmlutil": "",
"ads": {"Tutorial": "http://www.google.com/adwords/gadgetads/tutorial.html"},
"atlassian.util": {"Atlassian Gadget Framework": "http://confluence.atlassian.com/display/GADGETS010/Using+the+Atlassian+Gadgets+JavaScript+Framework"},
"cache": "http://developer.studivz.net/wiki/index.php/Gadgets.cache_%28v0.8%29",
"drag": {"Drag'n'drop Feature Docs": "http://code.google.com/apis/gadgets/docs/legacy/ui.html#Drag"},
"finance": {"Financial Gadgets Docs": "http://code.google.com/apis/finance/docs/finance-gadgets.html"},
"google.blog": "http://code.google.com/apis/blogger/docs/gadgets/gadgets_for_blogger.html",
"google.sharedstate": "http://code.google.com/apis/talk/gadgets_realtime.html#api_reference",
"grid": "http://code.google.com/apis/gadgets/docs/legacy/reference.html#Ref_Grid",
"invite": "http://developer.studivz.net/wiki/index.php/Vz.invite",
"multisize": "http://gadgetads.googlecode.com/svn-history/r507/trunk/gadget-multisize-feature.html",
"netlog": "http://netlog.com/developer/documentation/article=opensocialextensions#Netlog",
"opensocial-payment": "http://code.google.com/p/opensocial-virtual-currency/",
"payment": "http://netlog.com/developer/documentation/article=opensocialextensions#Payment",
"sharedmap": "http://code.google.com/apis/maps/documentation/mapplets/basics.html",
"tracking": "http://developer.studivz.net/wiki/index.php/Lesson_14:_Tracking_of_user_interaction",
"vzflash": "http://developer.studivz.net/wiki/index.php/Vz.flash",
"wave": "http://code.google.com/apis/wave/extensions/gadgets/guide.html"
},
initialize: function() {
var standardFeaturesTable = document.getElementById("standard-features-table"),
customFeaturesTable = document.getElementById("custom-features-table");
this._renderFeatures(standardFeaturesTable, this._features, true);
this._renderFeatures(customFeaturesTable, this._customFeatures, true);
this._adjustHeight();
},
/**
* Render feature info as a table row.
* @param domEl {object} DOM element in which to render a table row
* @param features {object} a list of features and their info
* @param append {boolean} whether features info should be appended to existing content or not
*/
_renderFeatures: function(domEl, features, append) {
var html = "", i, isFeatureSupported, state;
var LINK_NA = '__MSG_not_available__', DEFAULT_LINK_TEXT = '__MSG_documentation__';
domEl.innerHTML = '<tr><th>__MSG_feature_name__</th><th>__MSG_container_support__</th><th>__MSG_feature_doc__</th></tr>';
for (i in features) {
if (features.hasOwnProperty(i)) {
isFeatureSupported = features[i]();
stateClass = isFeatureSupported ? "supported" : "unsupported";
state = isFeatureSupported ? '__MSG_supported__' : '__MSG_unsupported__';
featureDocItem = this._featureDocs[i];
if (featureDocItem && featureDocItem != "") {
if (typeof(featureDocItem) == 'object') {
for (featureDocTitle in featureDocItem) {
docLinkTag += '<a target="_blank" href="' + featureDocItem[featureDocTitle] + '">' + featureDocTitle + '</a>&nbsp;';
}
} else { // one string => one standard feature doc
docLinkTag = '<a target="_blank" href="' + featureDocItem + '">' + DEFAULT_LINK_TEXT + '</a> ';
}
} else {
docLinkTag = '<i>' + LINK_NA + '</i>';
}
html += '<tr><td class="name">' + i + '</td><td class="' + stateClass + '">' + state + '</td>'
+ '<td class="docUrl">' + docLinkTag + '</td></tr>';
docLinkTag = "";
}
}
append ? (domEl.innerHTML += html) : (domEl.innerHTML = html);
},
_adjustHeight: function() {
try {
gadgets.window.adjustHeight();
} catch(e) {
try { window._IG_AdjustIFrameHeight(); } catch(e) {}
};
}
};
var initializer = function() {
GadgetFeatureInspector.initialize();
};
if (window.gadgets && gadgets.util && gadgets.util.registerOnLoadHandler) {
gadgets.util.registerOnLoadHandler(initializer);
} else if (window._IG_RegisterOnloadHandler) {
window._IG_RegisterOnloadHandler(initializer);
} else {
initializer();
}
try {
// Register a view of the gadget for Google Analytics to track
var ga = _IG_Analytics("UA-12111800-1", "/fig.xml");
} catch (e) { // Ignore
}
</script>
<!-- Token required by Orkut -->
<!-- ALm6fM15RAmxwoKP/bjlS7pvz9fmbBTYhfzorGnB/YFX/mItooLu6Af5gUGPhx58JLNr3j5wb3+W0+E3Rt4mbxT+UV7OK/ZyuuLisfHRSPh9ZejrBtQw86zuJakS0KZ0v3ScYEMmY1w1 -->
]]></Content>
</Module>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment