Skip to content
Browse files

async js

  • Loading branch information...
1 parent 549ca87 commit 2a969c1edaccbe425ef83a7a5852dc6953132098 @bgolub committed Aug 22, 2013
Showing with 10 additions and 7 deletions.
  1. +0 −7 blog.py
  2. +10 −0 templates/base.html
View
7 blog.py
@@ -349,13 +349,6 @@ def render(self, entry, show_comments=False):
return self.render_string("modules/entry.html", entry=entry,
show_comments=show_comments)
- def javascript_files(self):
- if self.show_comments:
- return ["http://connect.facebook.net/en_US/all.js#appId=" +
- self.handler.application.settings["fb_app_id"] + "&xfbml=1"]
- return None
-
-
class MediaRSSModule(tornado.web.UIModule):
def render(self, entry):
soup = BeautifulSoup.BeautifulSoup(entry.body,
View
10 templates/base.html
@@ -30,6 +30,16 @@
{% end %}
</head>
<body>
+ {% if handler.settings.get("fb_app_id") %}
+ <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={{ handler.settings.get("fb_app_id", "") }}";
+ fjs.parentNode.insertBefore(js, fjs);
+ }(document, 'script', 'facebook-jssdk'));</script>
+ {% end %}
<table id="body">
<tr>
<td id="content">

0 comments on commit 2a969c1

Please sign in to comment.
Something went wrong with that request. Please try again.