Skip to content

Commit def4dc2

Browse files
authored
ADD: VK API support. (3)
1 parent 9e79f14 commit def4dc2

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{% if theme.vkontakte_api.enable %}
2+
3+
<div id="vk_api_transport"></div>
4+
<script type="text/javascript">
5+
window.vkAsyncInit = function() {
6+
VK.init({
7+
apiId: {{ theme.vkontakte_api.app_id }}
8+
});
9+
10+
{% if theme.vkontakte_api.like %}
11+
VK.Widgets.Like("vk_like", {type: "mini", height: 20});
12+
{% endif %}
13+
14+
{% if page.comments and theme.vkontakte_api.comments %}
15+
VK.Widgets.Comments("vk_comments", {limit: {{ theme.vkontakte_api.num_of_posts }}, attach: "*"});
16+
{% endif %}
17+
};
18+
setTimeout(function() {
19+
var el = document.createElement("script");
20+
el.type = "text/javascript";
21+
el.src = "//vk.com/js/api/openapi.js";
22+
el.async = true;
23+
document.getElementById("vk_api_transport").appendChild(el);
24+
}, 0);
25+
</script>
26+
27+
{% endif %}

0 commit comments

Comments
 (0)