forked from shuding/innsbruck-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisqus.js
35 lines (31 loc) · 1.11 KB
/
disqus.js
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
/**
* Created by shuding on 5/22/16.
*/
module.exports = {
db: null,
init: _db => {
this.db = _db;
},
render: (template, options) => {
let disqus = options.blog.plugin ? options.blog.plugin.disqus || '' : '';
let context = {};
if (template == 'settings') {
// settings page
context.settings =
`<div class="input-group">
<h5>Disqus</h5>
<p><input type="text" name="plugin.disqus" placeholder="xxxx" value="${disqus}" style="width: inherit"> .disqus.com</p>
</div>`;
}
if (disqus)
context.postBottom = context.pageBottom =
`<div id="disqus_thread" style="margin-top: 50px"></div>
<script>
(function() { var d = document, s = d.createElement('script'); s.src = '//${disqus}.disqus.com/embed.js'; s.setAttribute('data-timestamp', +new Date()); (d.head || d.body).appendChild(s); })();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
`;
return context;
}
};