1
0
mirror of https://github.com/mbirth/wiki.git synced 2024-11-09 13:16:45 +00:00

Added DISQUS comments and tabbed comment section.

This commit is contained in:
Markus Birth 2015-06-28 03:47:46 +02:00
parent 977c53aa09
commit b10913e70d
4 changed files with 67 additions and 2 deletions

View File

@ -1,2 +1,28 @@
<ul id="comments-tabs">
<li class="current" data-div="comments_disqus">Disqus</li>
<li data-div="comments_google">Google+</li>
</ul>
<div id="comments_disqus" class="comments-tab current">
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES * * */
var disqus_shortname = 'mb-wiki';
var disqus_identifier = '{% if page.id %}{{ page.id }}{% else %}/index{% endif %}';
var disqus_title = '{{ page.title }}';
var disqus_url = '{{ site.url }}/{{ page.url }}';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
</div>
<div id="comments_google" class="comments-tab">
<script src="//apis.google.com/js/plusone.js" type="text/javascript"></script> <script src="//apis.google.com/js/plusone.js" type="text/javascript"></script>
<div class="g-comments" data-href="{{ site.url }}{{ page.url }}" data-width="900" data-first_party_property="BLOGGER" data-view_type="FILTERED_POSTMOD">Loading Google+ comments...</div> <div class="g-comments" data-href="{{ site.url }}{{ page.url }}" data-width="900" data-first_party_property="BLOGGER" data-view_type="FILTERED_POSTMOD">Loading Google+ comments...</div>
</div>

View File

@ -8,6 +8,7 @@
<link rel="stylesheet" type="text/css" href="{{ site.url }}/css/layout-bright.css" media="screen" /> <link rel="stylesheet" type="text/css" href="{{ site.url }}/css/layout-bright.css" media="screen" />
<link rel="stylesheet" type="text/css" href="{{ site.url }}/css/pygment_trac.css" media="screen" /> <link rel="stylesheet" type="text/css" href="{{ site.url }}/css/pygment_trac.css" media="screen" />
<link rel="stylesheet" type="text/css" href="{{ site.url }}/css/print.css" media="print" /> <link rel="stylesheet" type="text/css" href="{{ site.url }}/css/print.css" media="print" />
<link rel="stylesheet" type="text/css" href="{{ site.url }}/css/comments.css" media="all" />
<link rel="stylesheet" type="text/css" href="{{ site.url }}/css/custom.css" media="all" /> <link rel="stylesheet" type="text/css" href="{{ site.url }}/css/custom.css" media="all" />
<link rel="alternate" type="application/atom+xml" href="{{ site.url }}/feed.xml" /> <link rel="alternate" type="application/atom+xml" href="{{ site.url }}/feed.xml" />
@ -26,6 +27,7 @@
<script src="{{ site.url }}/bower_components/jquery.toc/jquery.toc.js" type="text/javascript"></script> <script src="{{ site.url }}/bower_components/jquery.toc/jquery.toc.js" type="text/javascript"></script>
{% endif %} {% endif %}
<script src="{{ site.url }}/javascripts/gcse.js" type="text/javascript"></script> <script src="{{ site.url }}/javascripts/gcse.js" type="text/javascript"></script>
<script src="{{ site.url }}/javascripts/comments.js" type="text/javascript"></script>
</head> </head>
<body itemscope itemtype="http://schema.org/Blog"> <body itemscope itemtype="http://schema.org/Blog">
<meta itemprop="isBasedOnUrl" content="https://github.com/mbirth/wiki" /> <meta itemprop="isBasedOnUrl" content="https://github.com/mbirth/wiki" />

26
css/comments.sass Normal file
View File

@ -0,0 +1,26 @@
---
---
#comments-tabs
list-style: none
margin: 0
padding: 0
li
background: none
display: inline-block
padding: 10px 15px
cursor: pointer
li:before
content: normal
li.current
background: rgba(black, 0.1)
.comments-tab
display: none
padding: 1em
background: rgba(black, 0.1)
.comments-tab.current
display: inherit

View File

@ -0,0 +1,11 @@
---
---
$(document).ready ->
$('ul#comments-tabs li').click ->
tab_id = $(this).attr 'data-div'
$('ul#comments-tabs li').removeClass 'current'
$('.comments-tab').removeClass 'current'
$(this).addClass 'current'
$("##{tab_id}").addClass 'current'