MySpaceProfile = { /** * Set profile iframe to the correct height */ setHeight: function(height) { if ( typeof(height) == 'undefined' ) { height = $('#wibAppContainer').height(); } gadgets.window.adjustHeight(height); }, /** * Initialize WIB Myspace profile */ init: function(){ $(document).ready(function(){ // map nav links $('.map-nav li a').live('click', function(){ $('.map-container').toggle(); $('.map-nav li a').removeClass('active'); $(this).addClass('active'); return false; }); // loading... $('#wibAppContainer').html('
Loading...
'); // process AJAX request. i haven't been able to get a sig to verify on POST, so we use GET and then grab the friends list from REST var params = { CONTENT_TYPE: gadgets.io.ContentType.TEXT, METHOD: 'GET', AUTHORIZATION: gadgets.io.AuthorizationType.SIGNED }; // load profile html via ajax GET gadgets.io.makeRequest('http://myspace.whereivebeen.com/app/profile', function(data) { // if myspace returns one of those [object Object] errors, it's generally a 500 from their proxy // check if this is an object with an errorMessage and if so, print our AJAX error graphic if ( typeof(data.errorMessage) != 'undefined' ) { var html = MySpaceProfile.getAjaxErrorMsg(data.errorMessage); } // a good response should just come back as a string else { var html = data.text; } $('#wibAppContainer').html(html); // adjust profile box height MySpaceProfile.setHeight(); }, params); }); } };