简体   繁体   English

Disqus插件动态标签说明

[英]Disqus Plugin Explanation of Dynamic Tags

So I am using the Disqus Plugin v2.65 . 所以我正在使用Disqus Plugin v2.65 I am trying to edit the dsq-global-toolbar at the top of the Disqus comments. 我正在尝试编辑Disqus评论顶部的dsq-global-toolbar

The following tags are in disqus-comment-system/comments.php 以下标签位于disqus-comment-system/comments.php

<div id="disqus_thread">

 <?php if (!get_option('disqus_disable_ssr')): ?>
  <?php
   // if (is_file(TEMPLATEPATH . '/comments.php')) {
   // include(TEMPLATEPATH . '/comments.php');
   // }
  ?>
  <div id="dsq-content">
   <ul id="dsq-comments">

however on my site there are mulitple tags (the disqus-global-toolbar div) that seem to be dynamically appended between the dsq-content div and the dsq-comments ul . 但是,在我的网站上,似乎有多个标签(disqus-global-toolbar div)动态地附加在dsq-content divdsq-comments ul Where is this coming from and where can I edit this? 这是哪里来的,我可以在哪里编辑? Any help would be greatly appreciated. 任何帮助将不胜感激。

I think it is coming somewhere around line 3140 in disqus.js 我认为它正在disqus.js中的3140行附近

You can use this code to wait for the document to finish loading completely then do your changes (client side): 您可以使用以下代码来等待文档完全加载完毕,然后进行更改(客户端):

$(document).ready(function() {
   window.disqus_no_style = true;

   $.getScript('http://sitename.disqus.com/embed.js', function() {
     var loader = setInterval(function() {
       if($('#disqus_thread').html().length) {
         clearInterval(loader);
         disqusReady();
       }
     }, 1000);
});

 function disqusReady() {
 //whatever you can imagine
 }
});

window.diqus_no_style can be deleted as well as the $.getsript wrapper. 可以删除window.diqus_no_style以及$ .getsript包装器。

Is that what you are looking for? 那是您要找的东西吗?


Something like this (use livequery instead of live): 这样的事情(使用livequery而不是live):

 function disqusReady() {
  $('#dsq-global-toolbar').livequery(function() {
    //$(this) will refer to object   
  });
 }

Not sure what plug-in you're talking about, but if it's WordPress, I've done the same thing. 不知道您在说什么插件,但是如果是WordPress,我也做了同样的事情。 Modify wp-content/plug-ins/disqus-comment-system/comments.php by adding an event handler for 'afterRender' (fires when the content ready in the DOM, but still hidden), eg. 通过为'afterRender'添加事件处理程序来修改wp-content / plug-ins / disqus-comment-system / comments.php(当DOM中的内容准备好但仍然隐藏时触发)。 around line 70: 在第70行附近:

config.callbacks.afterRender.push(myFunctionToModifyDisqusOutput);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM