Fix loading FB script.
authorJan Prachař <jan.prachar@intya.cz>
Thu, 26 May 2011 13:38:36 +0000 (15:38 +0200)
committerJan Prachař <jan.prachar@intya.cz>
Thu, 26 May 2011 13:38:36 +0000 (15:38 +0200)
app/templates/@layout.phtml
web/js/front-scripts.js

index 62750ba..a547b16 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="cs" xml:lang="cs">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/" lang="cs" xml:lang="cs">
 <head>
 {control metas}
 {block #metas}
@@ -37,5 +37,6 @@
             <p>&copy; 2011 Intya s.r.o.</p>
         </div>
     </div>
+    <div id="fb-root"></div>
 </body>
 </html>
\ No newline at end of file
index a1cf71b..72bcca5 100644 (file)
@@ -5,10 +5,13 @@ _gaq.push(['_trackPageview']);
 $(function(){
 
     /** FACEBOOK */
-    var e = document.createElement('script');
-    e.src = document.location.protocol + '//connect.facebook.net/cs_CZ/all.js#xfbml=1';
-    e.async = true;
-    document.getElementById('fb-root').appendChild(e);
+    var fbRoot = document.getElementById('fb-root');
+    if (fbRoot) {
+        var e = document.createElement('script');
+        e.src = document.location.protocol + '//connect.facebook.net/cs_CZ/all.js#xfbml=1';
+        e.async = true;
+        fbRoot.appendChild(e);
+    }
 
 
     var ajaxLoadedHandler;