Skip to content

Instantly share code, notes, and snippets.

@imajes
Created April 11, 2011 22:36
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 imajes/914520 to your computer and use it in GitHub Desktop.
Save imajes/914520 to your computer and use it in GitHub Desktop.
javascript:(function(){var%20otherlib=false;if(typeof%20jQuery=='undefined'&&typeof%20$=='function'){otherlib=true;}function%20getScript(url,success){var%20script=document.createElement('script');script.src=url;var%20head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;success();script.onload=script.onreadystatechange=null;head.removeChild(script);}};head.appendChild(script);}getScript('http://code.jquery.com/jquery-latest.min.js,function(){if(typeof%20jQuery!=undefined){if(otherlib){$jq=jQuery.noConflict();}if(!jQuery('body').hasClass('collapsible-comments')){jQuery('body').addClass('collapsible-comments');var%20span_html='%3Cspan%20style=\'cursor:pointer;margin-left:10px;\'%20class=\'expand-handle\'%3E[-]%3C/span%3E';if(window.location.href.indexOf('item?id=')!=-1){jQuery('center%20%3E%20table%20%3E%20tbody%20%3E%20tr:eq(2)%20%3E%20td%20%3E%20table:eq(1)%20span.comhead').append(span_html);}else%20if(window.location.href.indexOf('threads?id=')!=-1){jQuery('center%20%3E%20table%20%3E%20tbody%20%3E%20tr%20%3E%20td%20%3E%20table%20span.comhead').append(span_html);}jQuery('.expand-handle').live('click',function(){current_level_width=jQuery(this).parents('tr').eq(0).find('td%20%3E%20img').attr('width');jQuery(this).parents('table').eq(0).parents('tr').eq(0).nextAll().each(function(index,el){if(jQuery('tbody%20%3E%20tr%20%3E%20td%20%3E%20img',this).attr('width')%3Ecurrent_level_width){if(jQuery('tbody%20%3E%20tr%20%3E%20td%20%3E%20img',this).attr('width')%3C=inner_level_width){inner_level_width=1000;jQuery(this).hide();}if(inner_level_width==1000&&jQuery('.comment',this).css('display')=='none'){inner_level_width=jQuery('tbody%20%3E%20tr%20%3E%20td%20%3E%20img',this).attr('width');}}else{return%20false;}});inner_level_width=1000;jQuery(this).text('[+]').addClass('expand-handle-collapsed').removeClass('expand-handle');jQuery(this).closest('div').nextAll().hide();jQuery(this).closest('div').parent().prev().hide();jQuery(this).closest('div').css({'margin-left':'18px','margin-bottom':'5px'});});jQuery('.expand-handle-collapsed').live('click',function(){current_level_width=jQuery(this).parents('tr').eq(0).find('td%20%3E%20img').attr('width');jQuery(this).parents('table').eq(0).parents('tr').eq(0).nextAll().each(function(index,el){if(jQuery('tbody%20%3E%20tr%20%3E%20td%20%3E%20img',this).attr('width')%3Ecurrent_level_width){if(jQuery('tbody%20%3E%20tr%20%3E%20td%20%3E%20img',this).attr('width')%3C=inner_level_width){inner_level_width=1000;jQuery(this).show();}if(inner_level_width==1000&&jQuery('.comment',this).css('display')=='none'){inner_level_width=jQuery('tbody%20%3E%20tr%20%3E%20td%20%3E%20img',this).attr('width');}}else{return%20false;}});inner_level_width=1000;jQuery(this).text('[-]').addClass('expand-handle').removeClass('expand-handle-collapsed');jQuery(this).closest('div').nextAll().show();jQuery(this).closest('div').parent().prev().show();jQuery(this).closest('div').css({'margin-left':'0','margin-bottom':'-10px'});});}}});})();var%20current_level_width=0;var%20inner_level_width=1000;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment