Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 07:45 pm EST

Geeklog Forums

{return


Status: Banned

gtgillis

Forum User
Full Member
Registered: 11/05/03
Posts: 121
confused
I am playing with Facebook comments to see how difficult it would be to create a plugin or add the functuionality to the SocialShare plugin. While testing I inserted a <div> and a portion of script into the header.thtml file and a <div> into the storytext.thtml file. When I view the page source I see that part of the script from the header.thtml file has been stripped out.

This is the code I inserted into the header.thtml file.
Text Formatted Code

<div id="fb-root"></div>
<script>(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/en_US/all.js#xfbml=1&appId=MY_FB_APP_ID";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
 


This is what I see when I view the source. As you can see it is missing the "{return;}" on the line four.
Text Formatted Code

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id))
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=MY_FB_APP_ID";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
 


I guess I need to know how and why it is being stripped out and how I can work around it.


Regards,

Greg
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Hi,

add spaces around the brackets works. See here

Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: Banned

gtgillis

Forum User
Full Member
Registered: 11/05/03
Posts: 121
Thanks. That did the trick.



Quote by: ::Ben

Hi,

add spaces around the brackets works. See here

Ben

 Quote

All times are EST. The time is now 07:45 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content