Created
January 10, 2011 17:59
-
-
Save leonardinius/773145 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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