You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by jo...@gmail.com on 2010/07/13 19:17:18 UTC
gadgets.util.getContainer() helper method (issue1760044)
Reviewers: dev-remailer_shindig.apache.org,
Description:
In several instances, I've seen gadgets getting their container ID for
one reason or another. Given this seems inevitable anyway, it seems
prudent to offer a standard helper method for such functionality.
Comments welcome.
Please review this at http://codereview.appspot.com/1760044/show
Affected files:
features/src/main/javascript/features/core.util/util.js
Index: features/src/main/javascript/features/core.util/util.js
===================================================================
--- features/src/main/javascript/features/core.util/util.js (revision
962724)
+++ features/src/main/javascript/features/core.util/util.js (working copy)
@@ -53,6 +53,7 @@
var features = {};
var services = {};
var onLoadHandlers = [];
+ var container = null;
/**
* @enum {boolean}
@@ -326,10 +327,18 @@
'unescapeString' : function(str) {
if (!str) return str;
return str.replace(/&#([0-9]+);/g, unescapeEntity);
+ },
+
+ 'getContainer': function() {
+ return container;
+ },
+
+ '_init': function() {
+ // Initialize url parameters so that hash data is pulled in before
it can be
+ // altered by a click.
+ var params = gadgets.util.getUrlParameters();
+ container = params.container || params.synd;
}
};
}();
-// Initialize url parameters so that hash data is pulled in before it can
be
-// altered by a click.
-gadgets['util'].getUrlParameters();
-
+gadgets['util']._init();