我在想是否有类似Facebook插件的Google Plus插件,例如DISQUS或IntenseDebate?
有没有人知道是否有这样的插件或者有没有使用Google+ API制作这样的插件的想法呢?
我在想是否有类似Facebook插件的Google Plus插件,例如DISQUS或IntenseDebate?
有没有人知道是否有这样的插件或者有没有使用Google+ API制作这样的插件的想法呢?
<script src="https://apis.google.com/js/plusone.js">
</script>
<div class="g-comments"
data-href="http://stackoverflow.com"
data-width="580"
data-first_party_property="BLOGGER"
data-view_type="FILTERED_POSTMOD">
</div>
https://jsfiddle.net/fdyuhp90/1/
无需API密钥
https://www.googleapis.com/plus/v1/activities/_somePublicActivityId_/comments?key=_yourApiKey_&callback=myawesomecallback
From your callback function print the comments somewhere in the page.
function myawesomecallback(resposneJson) {
var activity = resposneJson.items[0].inReplyTo[0];
var comments = resposneJson.items;
//find element to insert into
var insertionElements = document.getElementsByClassName('g-comments-for ' + activity.id);
var insertionElement = insertionElements[0];
var newContents = "";
for(i=0; i<comments.length; i++) {
var actor = comments[i].actor;
var commentBody = comments[i].object.content;
//do the insertion
newContents += "<dt><a href='" + actor.url +
"'><img src='" + actor.image.url + "' /></a></dt>" +
"<dd><a href='" + actor.url + "'>" + actor.displayName +
"</a>: " + commentBody + "</dd>";
}
insertionElement.innerHTML = "<dl>" + newContents +
"</dl> <p class='g-commentlink'>Please comment on the <a href='" +
activity.url + "'>Google+ activity</a></p>";
}
href
参数更改为window.location
后,评论框可以正常加载,但我无法添加任何评论。控制台显示请求/_/scs/apps-static/_/js/k=oz.comments_widget.en.50uyNOSkHIA.O/m=c_b/rt=j/sv=1/d=1/ed=1/am=Ag/rs=AGL…
时出现各种POST错误。我也无法在您的jsfiddle中添加评论。这种方法还有效吗?如果不是,是否有其他简单明了的解决方案? - Mikolaj