I tried translating the buttons to Portuguese, but after replacing the two occurences of “Switch to WordPress Commenting” and one of “Switch to Facebook Commenting”, pressing the switch comment button does nothing, refreshes the Facebook commenting window.
Here is what I did:
theChampLoadEvent(function(){
var commentForm = document.getElementById('commentform');
if(commentForm){
theChampWPCommentingContent = commentForm.innerHTML;
if(theChampFBCommentEnable){
if(document.getElementById('reply-title')){
document.getElementById('reply-title').innerHTML = theChampFBCommentTitle;
}
}
theChampFBCommentingContent = '<div class="fb-comments" data-href="'+theChampFBCommentUrl+'"';
if(theChampFBCommentColor != ''){
theChampFBCommentingContent += ' data-colorscheme="'+theChampFBCommentColor+'"';
}
if(theChampFBCommentNumPosts != ''){
theChampFBCommentingContent += ' data-numposts="'+theChampFBCommentNumPosts+'"';
}
if(theChampFBCommentWidth != ''){
theChampFBCommentingContent += ' data-width="'+theChampFBCommentWidth+'"';
}
if(theChampFBCommentOrderby != ''){
theChampFBCommentingContent += ' data-order-by="'+theChampFBCommentOrderby+'"';
}
if(theChampFBCommentMobile != ''){
theChampFBCommentingContent += ' data-mobile="'+theChampFBCommentMobile+'"';
}
theChampFBCommentingContent += ' ></div>';
if(!theChampForceFBComment){
var toggleButton = '<input onclick = "theChampToggleCommenting(this)" type="button" value="Comentarios normais" id="the_champ_comment_toggle" /><div style="clear:both"></div>';
}else{
var toggleButton = '';
}
commentForm.innerHTML = toggleButton + theChampFBCommentingContent;
}
theChampInitiateFBCommenting();
});
function theChampToggleCommenting(elem){
if(elem.value == 'Switch to WordPress Commenting'){
document.getElementById('commentform').innerHTML = '<input onclick = "theChampToggleCommenting(this)" type="button" value="Comentarios do Facebook" id="the_champ_comment_toggle" /><div style="clear:both"></div>' + theChampWPCommentingContent;
}else{
document.getElementById('commentform').innerHTML = '<input onclick = "theChampToggleCommenting(this)" type="button" value="Comentarios normais" id="the_champ_comment_toggle" /><div style="clear:both"></div>' + theChampFBCommentingContent;
theChampInitiateFBCommenting();
}
}
function theChampInitiateFBCommenting(){
FB.init({
appId : theChampFBAppID, // App ID
channelUrl : '//'+theChampSiteUrl+'/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
}
Here is a screen recording of the problem:
https://www.screencast.com/t/4oQ3wWrOrK
Could you please tell me how to do it properly? Thank you very much, I really like your plugin. Your work is professional and reliable.
Cheers!