The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

how to change position of the facebook comments code

View previous topic View next topic Go down

Solved how to change position of the facebook comments code

Post by Michael_vx on March 26th 2014, 11:49 pm

hi to the best support forum every thing i hace asked till now is solved
now i have new thing to ask about i have JavaScript that put the facebook
under the topic at the end under the topic at the end of the topic page
i tried to understand by my self about the position settings but i faill
the image of the code


the code

Code:
$(document).ready(function () {
 

var fb_skin = "light"; //Valores posibles "light" o "dark". Skin claro u oscuro de Facebook Comments
  var fb_numposts = 5; //Nْmero de comentarios a mostrar por defecto

 
(function (d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s);
  js.id = id;
  js.src = "//connect.facebook.net/ar_AR/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs)
  }(document, 'script', 'facebook-jssdk'));
  v = '.forumline:has(.post .postbody)';
  ifphpbb2in = '';
  ifphpbb2out = '';
  if ($(v).length == 0) {
  v = '.post:has(.postbody, .pun .postbody)';
  } else {
  ifphpbb2in = '<table class="forumline"><tr><td colspan=3>';
  ifphpbb2out = '</td></tr></table>';
  }
  if ($(v).length == 0) {
  v = '#blog_comments'
  }
  $(v).eq(-1).after(ifphpbb2in + '<div class=fb-comments data-href="http://' + location.host + location.pathname + '" data-colorscheme="' + fb_skin + '" data-num-posts=' + fb_numposts + ' data-width=' + $(v).eq(-1).css('width') + '></div>' + ifphpbb2out);
  });
Edit solved
under topic as i want thanks to your tip Ange Tuteur you really great


Last edited by Michael_vx on March 27th 2014, 2:46 pm; edited 1 time in total (Reason for editing : solved)

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: how to change position of the facebook comments code

Post by Michael_vx on March 27th 2014, 6:20 am

Sync okay i think no progress for this one or this is not my lucky day
if i need to wait just let me know

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: how to change position of the facebook comments code

Post by Ange Tuteur on March 27th 2014, 6:25 am

Hi,

You want to place this after every message in a topic ?

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: how to change position of the facebook comments code

Post by Michael_vx on March 27th 2014, 6:33 am

@Ange Tuteur wrote:Hi,

You want to place this after every message in a topic ?
no i want to after the first message in the topic not after the last message in topic thats all

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: how to change position of the facebook comments code

Post by Ange Tuteur on March 27th 2014, 6:36 am

Try this :
Code:
    $(document).ready(function () {
     

          var fb_skin = "light"; //Valores posibles "light" o "dark". Skin claro u oscuro de Facebook Comments
          var fb_numposts = 5; //Nْmero de comentarios a mostrar por defecto

     
            (function (d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s);
          js.id = id;
          js.src = "//connect.facebook.net/ar_AR/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs)
          }(document, 'script', 'facebook-jssdk'));
          v = '.forumline:has(.post:first)';
          ifphpbb2in = '';
          ifphpbb2out = '';
          if ($(v).length == 0) {
              v = '.post:first:has(.postbody, .pun .postbody)';
          } else {
          ifphpbb2in = '<table class="forumline"><tr><td colspan=3>';
          ifphpbb2out = '</td></tr></table>';
          }
          if ($(v).length == 0) {
          v = '#blog_comments'
          }
          $(v).eq(-1).after(ifphpbb2in + '<div class=fb-comments data-href="http://' + location.host + location.pathname + '" data-colorscheme="' + fb_skin + '" data-num-posts=' + fb_numposts + ' data-width=' + $(v).eq(-1).css('width') + '></div>' + ifphpbb2out);
          });

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: how to change position of the facebook comments code

Post by Michael_vx on March 27th 2014, 6:45 am

okay its still under the last message in topic
can it be changed to be after the first message
like when i start topic and some one reply the code apper before his reply
that what i`m thinking about
i don`t know if it possible or just apper like signatrue and i think that would make like in all messages but it will be okay in that case

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: how to change position of the facebook comments code

Post by Ange Tuteur on March 27th 2014, 9:28 am

I can't really test fully since it's really laggy, but try this :
Code:
        $(document).ready(function () {
     

          var fb_skin = "light"; //Valores posibles "light" o "dark". Skin claro u oscuro de Facebook Comments
          var fb_numposts = 5; //Nْmero de comentarios a mostrar por defecto

     
            (function (d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s);
          js.id = id;
          js.src = "//connect.facebook.net/ar_AR/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs)
          }(document, 'script', 'facebook-jssdk'));
          v = '.forumline:has(tr.post .postbody)';
          ifphpbb2in = '';
          ifphpbb2out = '';
          if ($(v).length == 0) {
              v = 'tr.post:first:has(.postbody)';
          } else {
          ifphpbb2in = '<table class="forumline"><tr><td colspan=3>';
          ifphpbb2out = '</td></tr></table>';
          }
          if ($(v).length == 0) {
          v = '#blog_comments'
          }
            $('tr.post:first').after(ifphpbb2in + '<div class=fb-comments data-href="http://' + location.host + location.pathname + '" data-colorscheme="' + fb_skin + '" data-num-posts=' + fb_numposts + ' data-width=' + $(v).css('width') + '></div>' + ifphpbb2out);
          });

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: how to change position of the facebook comments code

Post by Michael_vx on March 27th 2014, 9:53 am

its looks like almost solved its apper in the poster profile and make topics with bad view its need to be inside the topic not poster profile i think
sorry for late to reply
you really doing great work
edit
you might give a little look
http://micsoft.logu2.com/t1865-topic

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved i find a way

Post by Michael_vx on March 27th 2014, 11:16 am

first sorry for 2nd post in row
why i did the 2nd post in row ?
because i find a way to put the code in topic and not in poster profile
the way was to change from
tr.post:first
to
.signature_div
its about 80% solved now
i will try to make it apper for once but if i could not i will say that
Ange Tuteur
really thank you you did gave me the tip in the edits you made to the code i sow what is changed and i tried my on way to make it
thanks again
Edit
i made it .signature_div:first its worked at the first post under signature the only thing is might be problem is the signature is needed to the one who will start the topic i guees now if there a way to force signature to all Members and default signature for new members this topic is 100% solved
:wouhou:
Code:
$(document).ready(function () {
 

var fb_skin = "light"; //Valores posibles "light" o "dark". Skin claro u oscuro de Facebook Comments
  var fb_numposts = 5; //Nْmero de comentarios a mostrar por defecto

 
(function (d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s);
  js.id = id;
  js.src = "//connect.facebook.net/ar_AR/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs)
  }(document, 'script', 'facebook-jssdk'));
  v = '.forumline:has(td.signature_div .postbody)';
  ifphpbb2in = '';
  ifphpbb2out = '';
  if ($(v).length == 0) {
  v = 'tr.post:first:has(.signature_div, .pun)';
  } else {
  ifphpbb2in = '<table class="forumline"><tr><td colspan=3>';
  ifphpbb2out = '</td></tr></table>';
  }
  if ($(v).length == 0) {
  v = '#blog_comments'
  }
  $('.signature_div:first').after(ifphpbb2in + '<div class=fb-comments data-href="http://' + location.host + location.pathname + '" data-colorscheme="' + fb_skin + '" data-num-posts=' + fb_numposts + ' data-width=' + $(v).css('width') + '></div>' + ifphpbb2out);
  });

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: how to change position of the facebook comments code

Post by Ange Tuteur on March 27th 2014, 11:47 am

Oh you want it to be inside the post ?

Try with postbody, it should work :
Code:
$(document).ready(function () {
 

var fb_skin = "light"; //Valores posibles "light" o "dark". Skin claro u oscuro de Facebook Comments
  var fb_numposts = 5; //Nْmero de comentarios a mostrar por defecto

 
(function (d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s);
  js.id = id;
  js.src = "//connect.facebook.net/ar_AR/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs)
  }(document, 'script', 'facebook-jssdk'));
  v = '.forumline:has(tr.post .postbody)';
  ifphpbb2in = '';
  ifphpbb2out = '';
  if ($(v).length == 0) {
  v = 'tr.post:first:has(.postbody)';
  } else {
  ifphpbb2in = '<table class="forumline"><tr><td colspan=3>';
  ifphpbb2out = '</td></tr></table>';
  }
  if ($(v).length == 0) {
  v = '#blog_comments'
  }
  $('tr.post .postbody:first').after(ifphpbb2in + '<div class=fb-comments data-href="http://' + location.host + location.pathname + '" data-colorscheme="' + fb_skin + '" data-num-posts=' + fb_numposts + ' data-width=' + $(v).css('width') + '></div>' + ifphpbb2out);
  });

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: how to change position of the facebook comments code

Post by Michael_vx on March 27th 2014, 1:32 pm

@Ange Tuteur wrote:Oh you want it to be inside the post ?

Try with postbody, it should work :
Code:
$(document).ready(function () {
 

var fb_skin = "light"; //Valores posibles "light" o "dark". Skin claro u oscuro de Facebook Comments
  var fb_numposts = 5; //Nْmero de comentarios a mostrar por defecto

 
(function (d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s);
  js.id = id;
  js.src = "//connect.facebook.net/ar_AR/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs)
  }(document, 'script', 'facebook-jssdk'));
  v = '.forumline:has(tr.post .postbody)';
  ifphpbb2in = '';
  ifphpbb2out = '';
  if ($(v).length == 0) {
  v = 'tr.post:first:has(.postbody)';
  } else {
  ifphpbb2in = '<table class="forumline"><tr><td colspan=3>';
  ifphpbb2out = '</td></tr></table>';
  }
  if ($(v).length == 0) {
  v = '#blog_comments'
  }
  $('tr.post .postbody:first').after(ifphpbb2in + '<div class=fb-comments data-href="http://' + location.host + location.pathname + '" data-colorscheme="' + fb_skin + '" data-num-posts=' + fb_numposts + ' data-width=' + $(v).css('width') + '></div>' + ifphpbb2out);
  });
loul
you did not read my last topic
when i change
$('tr.post:first').after(ifphpbb2in +
to
$('.signature_div:first').after(ifphpbb2in +
the code apperd in side the topic and by the way i can not edit the template
its all thanks to you the only thing needed i think is if the member have no signatrue the code might not apper i guess but i will try find a way to make signatrue for all members i dont know how yet but i will
the code is solved
:rose:
the code to work for none template

Code:
$(document).ready(function () {
       

              var fb_skin = "light"; //Valores posibles "light" o "dark". Skin claro u oscuro de Facebook Comments
              var fb_numposts = 5; //Nْmero de comentarios a mostrar por defecto

       
                (function (d, s, id) {
              var js, fjs = d.getElementsByTagName(s)[0];
              if (d.getElementById(id)) return;
              js = d.createElement(s);
              js.id = id;
              js.src = "//connect.facebook.net/ar_AR/all.js#xfbml=1";
              fjs.parentNode.insertBefore(js, fjs)
              }(document, 'script', 'facebook-jssdk'));
              v = '.forumline:has(td.signature_div .postbody)';
              ifphpbb2in = '';
              ifphpbb2out = '';
              if ($(v).length == 0) {
                  v = 'td.post:first:has(.signature_div, .pun)';
              } else {
              ifphpbb2in = '<table class="forumline"><tr><td colspan=3>';
              ifphpbb2out = '</td></tr></table>';
              }
              if ($(v).length == 0) {
              v = '#blog_comments'
              }
                $('tr.post .postbody:first').after(ifphpbb2in + '<div class=fb-comments data-href="http://' + location.host + location.pathname + '" data-colorscheme="' + fb_skin + '" data-num-posts=' + fb_numposts + ' data-width=' + $(v).css('width') + '></div>' + ifphpbb2out);
              });

1000% solved you can close the topic

:wouhou:

and please add the code to tips and tricks this code wont need template


Last edited by Michael_vx on March 27th 2014, 3:15 pm; edited 1 time in total (Reason for editing : 1000% solved)

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: how to change position of the facebook comments code

Post by Ange Tuteur on March 27th 2014, 7:33 pm

Topic solved and archived

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum