I don't even know if my question is right, I mean, I couldn't say if it's a css button that doesn't let my code works. I want to load all comments of this news site.
As you can see, at the bottom of the page, the most 5 recents comments is opened and below them a button to load more comments. This button is what I intended to auto-click and I believe it's a css button.
As my attempt to click failed I tryied an alternate solution without success. The hidden comments are marked with the:
class="off"
When I remove this class on firebug, the comment instantly appears on the page, but I couldn't get it selected or founded with jQuery, when I tryied the following:
$("li").removeClass("off");
- Here is my fail code, which appears to never found the elements waited:
// ==UserScript==
// @name globo coments
// @description globo coments
// @include http://*.globo.com/*.html
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @version 1
// @grant GM_addStyle
// ==/UserScript==
function maisComents(jNode) {
alert('???');
}
waitForKeyElements ("#glb-materia .widget widget-comentarios #boxComentarios .glbComentarios-lista glbComentarios-lista-recentes button .glbComentarios-botao-mais", maisComents);
- At the script tab of firebug you can see this:
<div id='boxComentarios'></div>
<script type="text/javascript">
glb.runner.push('comentarios', function(global, $) {
var articleUrl = 'http://ego.globo.com/biquini/noticia/2013/11/marina-elali-exibe-boa-forma-de-biquini.html',
slug = articleUrl.split('/').pop().split('.').shift(),
hash = global.sha1(slug);
$('#boxComentarios').comentarios({
'uri': '/jornalismo/ego/biquini',
'url': articleUrl,
'titulo': slug,
'idExterno': hash,
'exibeTeaserComentarios': true,
'qtdComentariosNoTeaser': 5,
'botaoComentario': {'topo': '.listar-comentarios-topo'}
});
});
</script>
</div>
Which in this line, is set the numbers of comments
'qtdComentariosNoTeaser': 5,
- I believe there is many ways to load all comments, but I couldn't find any solution. Could you please anybody help me?