Skip to content

Instantly share code, notes, and snippets.

@chrisshennan
Last active August 29, 2015 14:27
Show Gist options
  • Save chrisshennan/9a92abecff5907ffb2be to your computer and use it in GitHub Desktop.
Save chrisshennan/9a92abecff5907ffb2be to your computer and use it in GitHub Desktop.
Notify authors of new disqus comments.
$(function() {
window.disqus_config = function() {
this.callbacks.onNewComment = [function(comment) {
// Comment parameter has 2 values
// id = The id of the disqus comment
// text = the comment message
data = comment;
// Add in our article ID parameter so we can locate the article by ID
data.article_id = $('[data-article-id]').attr('data-article-id');
$.ajax({
method: 'POST',
url: '/comments/new',
data: data,
timeout: 10000
});
}];
}
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);
});
$(function() {
window.disqus_config = function() {
this.callbacks.onNewComment = [function(comment) {
// Comment parameter has 2 values
// id = The id of the disqus comment
// text = the comment message
data = comment;
// Add in the url so we can locate the article by URL
data.url = window.location.href;
$.ajax({
method: 'POST',
url: '/comments/new',
data: data,
timeout: 10000
});
}];
}
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);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment