Skip to content

Instantly share code, notes, and snippets.

@leonardinius
Created January 10, 2011 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonardinius/773145 to your computer and use it in GitHub Desktop.
Save leonardinius/773145 to your computer and use it in GitHub Desktop.
xxx.yyy.getTopLevelWindow = function($w)
{
var w = $w || window;
while (w.parent && w.parent !== w) w = w.parent;
return w;
};
xxx.yyy.getArgument = function(argumentName)
{
var topWindow = xxx.yyy.getTopLevelWindow() || window;
var thisWindow = window;
var argumentValue = function(window) {
window.AJS.$.namespace('xx.yy.zz.arguments');
var value = window.AJS.$.trim(window.xx.yy.zz.arguments[argumentName] || '');
return value == '' ? null : value;
};
return argumentValue(topWindow) || argumentValue(thisWindow);
};
(function()
{
var issueId = xxx.yyy.getArgument('issueId') || '';
if (issueId != '')
{
var options = $.extend({}, xxx.yyy.options, { // options contains REST service url etc ...
'type' : 'GET',
data : { 'issueId' : issueId },
success : function (responseData, textStatus, XMLHttpRequest)
{
var data = responseData && responseData.issueData
? responseData.issueData : {};
xxx.yyy.loadIssueData(data);
}
});
xxx.yyy.controller.loadIssueData(options);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment