Skip to content

Instantly share code, notes, and snippets.

@mastef
Created February 12, 2019 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mastef/a3f6781c20917491dbc0dcf7d5b31f45 to your computer and use it in GitHub Desktop.
Save mastef/a3f6781c20917491dbc0dcf7d5b31f45 to your computer and use it in GitHub Desktop.
hltv toggle comment threads on click
$('.post').off('click')
function postClick() {
console.log($(this));
var results = $(this).nextUntil('.post');
var a = 0;
for(i=0;i<results.length;i++) {
if($(results[0]).hasClass('threading')) {
a++;
$(results[0]).toggle();
}else{
if($(results[0]).find('.threading').length > 0) a++;
$(results[0]).find('.threading').toggle();
}
}
//if(a == 0) return;
if(!$(this).hasClass('show') && !$(this).hasClass('hide')) {
$(this).addClass('hide');
}else{
$(this).toggleClass('hide');
$(this).toggleClass('show');
}
if($(this).hasClass('hide')) {
$(this).css('opacity', 0.5);
}else{
$(this).css('opacity', 1);
}
}
$('.post').on('click', postClick)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment