if(typeof(tabletAdapter) == "undefined" || !tabletAdapter) {
tabletAdapter = {
//Reload facebook plugin(s) to show their current status
_updateFacebookPlugins : function() {
console.log("BEGIN _updateFacebookPlugins");
//details page like button
var detailsPageLikeBtn = document.getElementById('social_facebook_Details_Like_Button_Display');
//make sure its been liked
if ( detailsPageLikeBtn ){
var likeBtnIframe = detailsPageLikeBtn.getElementsByTagName("iframe")[0];
//refresh the like button iFrame
var url = likeBtnIframe.getAttribute("src");
likeBtnIframe.setAttribute("src", url);
}
console.log("EXIT _updateFacebookPlugins");
},
//Connect to Facebook, display the link "Connect To Facebook"
_displayConnectFacebookLink : function() {
console.log("BEGIN _displayConnectFacebookLink");
var FBloginLink=document.getElementById("FooterFBlogin");
if(FBloginLink!=null && FBloginLink != undefined){
FBloginLink.style.display="inline";
} else {
setTimeout( function(){ tabletAdapter._displayConnectFacebookLink(); }, 1000);
console.log("EXIT _displayConnectFacebookLink, dom is not fully loaded yet.");
return;
}
var FBlogoffLink=document.getElementById("FooterFBlogoff");
if(FBlogoffLink!=null && FBlogoffLink != undefined){
FBlogoffLink.style.display="none";
}
console.log("EXIT _displayConnectFacebookLink");
},
//Display "Disconnect from Facebook"
_displayFacebookMenu : function(name) { //subscribe to FB events
console.log("BEGIN _displayFacebookMenu");
var FBloginLink=document.getElementById("FooterFBlogin");
if(FBloginLink!=null && FBloginLink != undefined){
FBloginLink.style.display="none";
} else {
setTimeout( function(){ tabletAdapter._displayFacebookMenu(); }, 1000);
console.log("EXIT _displayFacebookMenu, dom is not fully loaded yet.");
return;
}
var FBlogoffLink=document.getElementById("FooterFBlogoff");
if(FBlogoffLink!=null && FBlogoffLink != undefined){
FBlogoffLink.style.display="inline";
FBlogoffLink.title = name + " has logged on Facebook";
}
console.log("EXIT _displayFacebookMenu");
},
}
//set facebook adapter. So the adapter could response the FB events.
fbIntegrationJS.setUiAdapter(tabletAdapter);
tabletAdapter
defines
3 callback functions that are invoked by
FBintegrationCommon.js.
When a shopper accesses a product page, the
FBintegrationCommon.js script
is invoked by the Facebook SDK to respond to Facebook events. The
script also handles
Connect to Facebook and
Disconnect
from Facebook events from the link on the footer of the
page. The methods in
FBTAbletAdapter
are then invoked
to accordingly update the store UI. In this case, the
_updateFacebookPlugins function
will refresh the
Like button;
_displayConnectFacebookLink will
display the
Connect to Facebook link at the
footer, while the
_displayFacebookMenu function
displays
Disconnect from Facebook.