1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
## -*- coding: utf-8 -*-
<%def name="comment_form(url, title, identifier)">
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : '${comment_system_id}',
status : true,
xfbml : true
});
};
// Load the SDK asynchronously
(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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-comments" data-href="${url}" data-width="470"></div>
</%def>
<%def name="comment_link(link, identifier)">
<span class="fb-comments-count" data-url="${link}">
</%def>
<%def name="comment_link_script()">
<div id="fb-root"></div>
<script>
// thank lxml for this
$('.fb-comments-count').each(function(i, obj) {
var url = obj.attributes['data-url'].value;
// change here if you dislike the default way of displaying
// this
obj.innerHTML = '<fb:comments-count href="' + url + '"></fb:comments-count> comments';
});
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : '${comment_system_id}',
status : true,
xfbml : true
});
};
// Load the SDK asynchronously
(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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
</%def>
|