views:

595

answers:

1

i've wasted 4 hrs today and several hairs trying to solve this issue but failed.

we use facebook.connect to auth users on our site and perform various actions. one of this actions should trigger fbml:dialog, i decided to use new js sdk. here's function i use:

function popupModalWindow(cat) {
var oldSize = FB.UIServer.Methods["fbml.dialog"].size;
FB.UIServer.Methods["fbml.dialog"].size = {width: 402, height: 112};
//FB.UIServer.id = FB.UIServer._active[id];

var messages = {
    interesting:  '<p>By submitting my entry, I confirm that I have obtained permission from the persons whose picture and/or voice appears in my entry for use and publication in this contest as outlined in the Official Rules [link]</p>'
};
 // alert(messages[cat]);
FB.ui(
{
 method: 'fbml.dialog',
 //id: 'ololo',
 display: 'dialog',
 width: 402,
 height: 112, /**/ //should work that way according api reference
 size : {width: 402, height: 112},
 fbml: '<link rel="stylesheet" href="http://rentatext.mygrate.biz/styles.css"/&gt;&lt;div class="modal-white" style="width: 402px;">'+
'<h6>User Agreement</h6>'+
'<fb:js-string var="oloe">document.getElementsByTagName("iframe")[0].id;</fb:js-string>'+
 '<div class="inner">'+messages[cat]+' <a class="fb-close" onclick="FB.UIServer._active[oloe].close()">i agree</a></div></div>'

 ,
},
function() {
alert(1);
}

);
console.debug(FB.UIServer);
}

Unfortunately, designer made this modal windows with grey background and some users may not notice default "close" button at top right corner of dialog. What i need is to bind event to some custom element that will close this dialog. I've tried different approaches but none of them had worked.

The latest one throws "a138033292903816_FB is not defined" when i click a.fb-close with onclick event handler. May be i'm missing something, i googled a lot but with no luck.

A: 

Facebook renames all of your javascript functions and variables to a randomstring. Check out this. Maybe you could use CSS to change the modal's background?

jostster