-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcactus_script.html
99 lines (81 loc) · 3.72 KB
/
cactus_script.html
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{% if CACTUS_SITENAME -%}
{% if CACTUS_JS_URL is not defined %}
{% set CACTUS_JS_URL = 'https://latest.cactus.chat/cactus.js' %}
{% endif %}
{% if CACTUS_CSS_URL is not defined %}
{% set CACTUS_CSS_URL = 'https://latest.cactus.chat/style.css' %}
{% endif %}
{% if CACTUS_HOMESERVER is not defined %}
{% set CACTUS_HOMESERVER = 'https://matrix.cactus.chat:8448' %}
{% endif %}
{% if CACTUS_SERVERNAME is not defined %}
{% set CACTUS_SERVERNAME = 'cactus.chat' %}
{% endif %}
{% if CACTUS_HTML_DATA %}
<script type="text/javascript" src="{{ CACTUS_JS_URL }}"
data-default-homeserver-url="{{ CACTUS_HOMESERVER }}"
data-server-name="{{ CACTUS_SERVERNAME }}"
data-site-name="{{ CACTUS_SITENAME }}"
{% if not article.metadata['cactus_comment_section_id'] %}
data-comment-section-id="{{ article.slug }}"
{% else %}
data-comment-section-id="{{ article.metadata['cactus_comment_section_id'] }}"
{% endif %}
{% if CACTUS_PAGE_SIZE %}
data-page-size="{{ CACTUS_PAGE_SIZE }}"
{% endif %}
{% if article.metadata['cactus_page_size'] %}
data-page-size="{{ article.metadata['cactus_page_size'] }}"
{% endif %}
{% if CACTUS_LOGIN_ENABLED %}
data-page-size="{{ CACTUS_LOGIN_ENABLED }}"
{% endif %}
{% if article.metadata['cactus_login_enabled'] is defined %}
data-page-size="{{ article.metadata['cactus_login_enabled'] }}"
{% endif %}
{% if CACTUS_GUEST_POSTING %}
data-guest-posting-enabled="{{ CACTUS_GUEST_POSTING }}"
{% endif %}
{% if CACTUS_UPDATE_INTERVAL %}
data-update-interval="{{ CACTUS_UPDATE_INTERVAL }}"
{% endif %}
</script>
{% else %}
<script type="text/javascript" src="{{ CACTUS_JS_URL }}"></script>
<link rel="stylesheet" href="{{ CACTUS_CSS_URL }}" type="text/css">
<script>
initComments({
node: document.getElementById("comment-section"),
{% if CACTUS_PAGE_SIZE %}
pageSize: {{ CACTUS_PAGE_SIZE }},
{% endif %}
{% if CACTUS_LOGIN_ENABLED is defined %}
loginEnabled: "{{ CACTUS_LOGIN_ENABLED }}",
{% endif %}
{% if article.metadata['cactus_login_enabled'] is defined %}
loginEnabled: "{{ article.metadata['cactus_login_enabled'] }}",
{% endif %}
{% if CACTUS_GUEST_POSTING %}
guestPostingEnabled: {{ CACTUS_GUEST_POSTING }},
{% endif %}
{% if article.metadata['cactus_guest_posting_enabled'] %}
guestPostingEnabled: "{{ article.metadata['cactus_guest_posting_enabled'] }}",
{% endif %}
{% if CACTUS_UPDATE_INTERVAL %}
updateInterval: {{ CACTUS_UPDATE_INTERVAL }},
{% endif %}
{% if article.metadata['cactus_update_interval'] %}
updateInterval: "{{ article.metadata['cactus_update_interval'] }}",
{% endif %}
defaultHomeserverUrl: "{{ CACTUS_HOMESERVER }}",
serverName: "{{ CACTUS_SERVERNAME }}",
siteName: "{{ CACTUS_SITENAME }}",
{% if not article.metadata['cactus_comment_section_id'] %}
commentSectionId: "{{ article.slug }}"
{% else %}
commentSectionId: "{{ article.metadata['cactus_comment_section_id'] }}"
{% endif %}
})
</script>
{% endif %}
{% endif %}