Can I have collapsible code blocks? - FogBugz Knowledge Exchange most recent 30 from http://fogbugz.stackexchange.com2013-05-24T08:56:10Zhttp://fogbugz.stackexchange.com/feeds/question/6395http://www.creativecommons.org/licenses/by-nc/2.5/rdfhttp://fogbugz.stackexchange.com/questions/6395/can-i-have-collapsible-code-blocksCan I have collapsible code blocks?Michel de Ruiter2010-12-22T22:43:16Z2011-11-02T14:06:03Z
<p>Case with large blocks of code can be too long to read comfortably. Then it would be nice to be able to 'collapse' the code block. Is that possible?</p>
http://fogbugz.stackexchange.com/questions/6395/can-i-have-collapsible-code-blocks/6396#6396Answer by Michel de Ruiter for Can I have collapsible code blocks?Michel de Ruiter2010-12-22T22:45:29Z2011-11-02T14:06:03Z<p>Actually, that wasn't a real question. It's the other way around: I implemented a <a href="http://fogbugz.stackexchange.com/questions/5520/customizing-your-fogbugz-install-with-bugmonkey" rel="nofollow">customization</a> doing this, and thought it could be helpful to other happy <a href="http://www.fogcreek.com/fogbugz/plugins/plugin.aspx?ixPlugin=42" rel="nofollow">Code Snippet plugin</a> users.</p>
<p>Here it is:</p>
<pre><code>name: Collapse Code Blocks
description: Collapse/expand a code block by double-clicking it
author: Michel de Ruiter
version: 1.0.0.2
js:
$("div.codesnippet").attr("title", "Double-click to collapse/expand")
.dblclick(function() {
$(this).toggleClass("collapsed");
});
css:
div.codesnippet.collapsed {
height: 15px;
background-color: #BBB;
overflow: hidden !important;
cursor: default;
}
</code></pre>
<p><strong>Edit:</strong> I changed it to double-click, to avoid trouble selecting code.</p>