Commit: 83c5c72f7a226893d9a33fc62372bf98fb4b1506

Author: Nate Abele | Date: 2010-03-09 12:33:59 -0500
Fixing display and visibility toggling of method source code.
diff --git a/views/browser/view.html.php b/views/browser/view.html.php index 1dcde38..3d58910 100644 --- a/views/browser/view.html.php +++ b/views/browser/view.html.php @@ -117,8 +117,10 @@ $this->title($namespace); <?php // Method source ?> <?php if (isset($object['source'])) { ?> - <pre class="source-code"> - <code class="php"><?php echo $object['source']; ?></code> - </pre> + <div class="source-wrapper"> + <pre class="source-code"> + <code class="php"><?php echo $h($object['source']); ?></code> + </pre> + </div> <button class="source-toggle">Show source</button> <?php } ?> diff --git a/views/layouts/default.html.php b/views/layouts/default.html.php index c6abbdb..6ffa6de 100644 --- a/views/layouts/default.html.php +++ b/views/layouts/default.html.php @@ -51,12 +51,16 @@ </div> <?php echo $this->html->script(array( 'http://code.jquery.com/jquery-1.4.1.min.js', - 'rad.cli', - 'showdown.min', - 'highlight.pack' + 'rad.cli.js', + 'showdown.min.js', + 'highlight.pack.js' )); ?> <script type="text/javascript" charset="utf-8"> + var codeSelector = '.source-wrapper'; + $(document).ready(function () { + $(codeSelector).hide(); + RadCli.setup(); var converter = new Showdown.converter("/"); @@ -66,9 +70,9 @@ $('pre.source-code').hide(); $('.source-toggle').bind('click', function() { - visible = $('pre code').is(':visible'); + visible = $(codeSelector).is(':visible'); $(this).text((visible ? 'Show' : 'Hide') + ' source'); - visible ? $('pre code').slideUp() : $('pre code').slideDown(); + visible ? $(codeSelector).slideUp() : $(codeSelector).slideDown(); }); hljs.initHighlightingOnLoad(); });