Stackoverflow忍者的两个问题:
我有一个使用Disqus的博客.但是,我正在使用的主题没有空间来拥有'反应'(Twitters的数量),只需要有注释数字的空间.
好的,基本上我没有足够的空间来支持这个为Disqus提供的"反应".有谁知道我怎么能从Disqus中删除'反应'计数?
新的Disqus点了一个方框,"你的网站正在使用新的Disqus.请查看2012年的常见问题解答,或访问我们的支持页面寻求帮助." 消息,我很想删除它.有谁知道怎么做?
在单页面应用程序中使用Disqus的最佳方法是什么?我看到角度js docs已经成功实现了它.
目前我们的方法看起来就像我们的AngularJS应用程序,但它看起来不稳定,难以测试,并加载错误的线程ID(相同的线程几乎到处都加载).
'use strict';
angular.module('studentportalenApp.components')
.directive('disqusComponent',['$log', '$rootScope', function($log, $rootScope) {
var _initDisqus = function _initDisqus(attrs)
{
if(window.DISQUS) {
DISQUS.reset({
reload: true,
config: function () {
this.page.identifier = attrs.threadId;
this.disqus_container_id = 'disqus_thread';
this.page.url = attrs.permalinkUrl;
}
});
}
else
{
$log.error('window.DISQUS did not exist before directive was loaded.');
}
}
//Destroy DISQUS bindings just before route change, to properly dispose of listeners and frame (postMessage nullpointer exception)
$rootScope.$on('$routeChangeStart', function() {
if(window.DISQUS) {
DISQUS.reset();
}
});
var _linkFn = function link(scope, …Run Code Online (Sandbox Code Playgroud) unit-testing disqus angularjs single-page-application angularjs-directive
我们目前在<a href>标签内的主页上的每个帖子上显示了我们的Disqus评论计数,我们看到这是由一些javascript更新的,它会检测链接上是否存在#disqus_thread.
我们如何在标签之外显示评论计数?
这可能吗?
我们对评论的直接链接不感兴趣,所以我们想要删除链接,只显示计数.
随着新的Facebook评论模块的发布,人们可以分享他们与各种评论系统的经验 - 特别是Disqus,Echo,激烈的辩论和Facebook评论?
每个系统的优缺点是什么?
谢谢!
我想显示所有使用Disqus的博客帖子中的最新评论,并将其显示在侧边栏中,然后点击评论并转到原始帖子.
一个优点是能够从列表中遗漏我们自己的评论.
我一直有一段时间让评论计数脚本在我的反应页面上工作.首先,他们建议将脚本放在<body>标签底部的index.html文件中.我做到了这一点,看不到任何结果.
<body>
<div id="app">
</div>
<script src="static/index.js"></script>
<script id="dsq-count-scr" src="//mtg-hunter.disqus.com/count.js" async></script>
</body>Run Code Online (Sandbox Code Playgroud)
我有一个index.js文件,它正在加载我的所有组件,包括组件(让我们称之为ResultComponent.js)我想要注释计数<span>标签.<span>标签本身如下所示:
var commentCount = <span className="disqus-comment-count" onClick={function() {this.setState({currentSelectedTab: 4})}.bind(this)}
data-disqus-identifier={idGoesHere}
style={{fontVariant:"small-caps"}}>0 Comments</span>Run Code Online (Sandbox Code Playgroud)
到目前为止,这么简单.我没有使用任何<a>标签,所以我没有#disqus_thread任何地方.当我加载我的页面时,我希望我的评论数量会上升,但没有这样的运气.为了测试这一点,我从raw count.js脚本(位于此处)复制了原始脚本,未经修改.然后我将它直接粘贴到Chrome的devtools控制台上,它起作用了; 所有相关的评论计数器都达到了适当的值.
编辑:一天后,更多的刺激; 我在disqus.com域的实际代码中添加了断点.脚本标记中的脚本在正确的时间运行正常,除了它进入displayCount()函数时缺少变量.有几个变量只是没有给定值,所以它不能进入并填充注释计数,它总是失败.我不知道为什么失败时,它从我的index.html内,但不叫我生count.js代码粘贴到我的控制台,并做它.不知道为什么.
澄清一下,这是相关的代码:
e.displayCount = function(b) {
for (var c, a, d, e = b.counts, b = b.text.comments; c = e.shift(); )
if (a = j[c.id]) {
switch (c.comments) {
case 0:
d = b.zero;
break;
case 1:
d = …Run Code Online (Sandbox Code Playgroud)我也想在可能的情况下使用javascript客户端脚本执行此操作.
我使用Disqus来评论我的Ghost模板,但我遇到了麻烦.<iframe>如果它们不在视口中,则不会加载Disqus内的图像.
调试我可以找到:
overflow: auto从.surface-container图像中删除出现.height: 100%从.surface-container图像中删除出现.但是如果我删除任何这些属性抽屉不能正常工作,如果你打开抽屉,网站会向上滚动.
它接缝是浏览器问题,而不是与CSS相关的问题:/
我想删除Disqus插件的页脚.Disqus工作正常,但页脚看起来有点迭代.我想删除页脚,以便我只能看到相关的注释.
您可以在图像的末尾看到页脚.

<div class="well">
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'destinationcompk'; // required: replace example with your forum shortname
function disqus_config() {
this.callbacks.afterRender.push(function() { alert('clayton') });
}
var disqus_identifier = "image_".concat(12);
var disqus_title = "image_title".concat(12);
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//' + disqus_shortname + …Run Code Online (Sandbox Code Playgroud) 我在我的Wordpress网站上加载了Disquss,该网站运行在HTTPS上.问题是,虽然评论显示在网页的底部,但它们是白色的(并且由于页面的背景也是白色的,因此它们不可见).
如果我在Chrome中打开Inspector,则会在控制台选项卡上打印以下错误.
Refused to execute inline script because it violates the following
Content Security Policy directive: "script-src https://*.twitter.com:*
https://api.adsnative.com/v1/ad.json *.adsafeprotected.com *.google-analytics.com https://glitter-services.disqus.com
https://*.services.disqus.com:* disqus.com http://*.twitter.com:*
a.disquscdn.com api.taboola.com referrer.disqus.com *.scorecardresearch.com
*.moatads.com https://admin.appnext.com/offerWallApi.aspx 'unsafe-eval'
https://mobile.adnxs.com/mob *.services.disqus.com:*". Either the 'unsafe-
inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required
to enable inline execution.
Run Code Online (Sandbox Code Playgroud)
这是因为Chrome中的弹出窗口拦截器扩展,但我想通过内容安全策略启用它:http://www.html5rocks.com/en/tutorials/security/content-security-policy/.基本上,错误发生在chrome-extension://*方案中,因此我需要在Content-Security-Policy中添加适当的条目以允许chrome扩展.
我应该如何禁用Chrome扩展程序的安全策略?