Last active
August 29, 2015 14:27
-
-
Save chrisshennan/9a92abecff5907ffb2be to your computer and use it in GitHub Desktop.
Notify authors of new disqus comments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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