mirror of
https://github.com/arcan1s/arcanis.me.git
synced 2025-04-24 15:27:17 +00:00
test disqus comments
This commit is contained in:
parent
99c43a5420
commit
be84967b9a
14
_includes/comment.html
Normal file
14
_includes/comment.html
Normal file
@ -0,0 +1,14 @@
|
||||
<div id="disqus_thread"></div>
|
||||
<script type="text/javascript">
|
||||
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
|
||||
var disqus_shortname = 'anon'; // required: replace example with your forum shortname
|
||||
|
||||
/* * * 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="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
@ -1,41 +0,0 @@
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="http://datejs.googlecode.com/svn/trunk/build/date-en-US.js"></script>
|
||||
<script type="text/javascript">
|
||||
$("#post p").each( function(index) {
|
||||
if (index > 0 && $.trim($(this).text()).length > 0) {
|
||||
$(this).attr("id", "par" + index.toString());
|
||||
var html = $(this).html();
|
||||
$(this).html(html + " <a href='#par" + index.toString() + "'>#</a>");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<div id="comments">
|
||||
{% if page.category == "ru" %}
|
||||
<h2><a name="comments" class="anchor" href="#comments"><span class="octicon octicon-link"></span></a>Комментарии</h2>
|
||||
<p align="justify">Хотите оставить комментарий? Посетите <a href="https://github.com/arcan1s/arcan1s.github.io/issues/{{page.commentIssueId}}" target="_blank">эту страницу на GitHub</a> (Вам необходим аккаунт на GitHub).</p>
|
||||
{% else %}
|
||||
<h2><a name="comments" class="anchor" href="#comments"><span class="octicon octicon-link"></span></a>Comments</h2>
|
||||
<p align="justify">Want to leave a comment? Visit <a href="https://github.com/arcan1s/arcan1s.github.io/issues/{{page.commentIssueId}}" target="_blank"> this post's issue page on GitHub</a> (you'll need a GitHub account).</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function loadComments(data) {
|
||||
for (var i=0; i<data.length; i++) {
|
||||
var cuser = data[i].user.login;
|
||||
var cuserlink = "https://www.github.com/" + data[i].user.login;
|
||||
var clink = "https://github.com/arcan1s/arcan1s.github.io/issues/{{page.commentIssueId}}#issuecomment-" + data[i].url.substring(data[i].url.lastIndexOf("/")+1);
|
||||
var cbody = data[i].body_html;
|
||||
var cavatarlink = data[i].user.avatar_url;
|
||||
var cdate = Date.parse(data[i].created_at).toString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
$("#comments").append("<div class='comment'><div class='commentheader'><div class='commentgravatar'>" + '<img src="' + cavatarlink + '" alt="" width="20" height="20">' + "</div><a class='commentuser' href=\""+ cuserlink + "\">" + cuser + "</a><a class='commentdate' href=\"" + clink + "\">" + cdate + "</a></div><div class='commentbody'>" + cbody + "</div></div>");
|
||||
}
|
||||
}
|
||||
$.ajax("https://api.github.com/repos/arcan1s/arcan1s.github.io/issues/{{page.commentIssueId}}/comments?per_page=100", {
|
||||
headers: {Accept: "application/vnd.github.full+json"},
|
||||
dataType: "json",
|
||||
success: function(msg){
|
||||
loadComments(msg);
|
||||
}
|
||||
});
|
||||
</script>
|
@ -1 +0,0 @@
|
||||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
@ -15,9 +15,6 @@
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
{% if page.comment == true %}
|
||||
{% include header_comment.html %}
|
||||
{% endif %}
|
||||
{% if page.share == true %}
|
||||
{% include header_sharethis.html %}
|
||||
{% endif %}
|
||||
@ -26,7 +23,7 @@
|
||||
{{ content }}
|
||||
|
||||
{% if page.comment == true %}
|
||||
{% include footer_comment.html %}
|
||||
{% include comment.html %}
|
||||
{% endif %}
|
||||
|
||||
</section>
|
||||
|
Loading…
Reference in New Issue
Block a user