Skip to content

Commit bc03eef

Browse files
committed
auto-hide pod via class attribute
1 parent 1a615a0 commit bc03eef

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

root/source.html

+2-12
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</div>
4646
</li>
4747
<% IF module.sloc > 0 %>
48-
<li><div><button class="btn-link pod-toggle" onclick="togglePod()"><i class="fa fa-exchange fa-fw black"></i><span class="hide-pod">Hide</span><span class="show-pod">Show</span> Pod</button></div></li>
48+
<li><div><button class="btn-link pod-toggle<% IF module.sloc > 0; " pod-hidden"; END %>" onclick="togglePod()"><i class="fa fa-exchange fa-fw black"></i><span class="hide-pod">Hide</span><span class="show-pod">Show</span> Pod</button></div></li>
4949
<% END %>
5050
<li class="nav-header">Info</li>
5151
<li><% module.sloc %> lines of code</li>
@@ -55,20 +55,10 @@
5555

5656
<div class="content">
5757
<% IF !module.binary %>
58-
<pre id="source" class="line-numbers" data-pod-lines="<%
58+
<pre id="source" class="line-numbers pod-toggle<% IF module.sloc > 0; " pod-hidden"; END %>" data-pod-lines="<%
5959
module.pod_lines.map(->(l){ l.0+1 _ "-" _ (l.0+l.1) }).join(', ')
6060
%>"><code class="language-<% filetype %>"><% source %></code></pre>
6161
<% ELSE %>
6262
This file cannot be displayed inline. Try the <a href="<% raw_url %>">raw file</a>.
6363
<% END %>
6464
</div>
65-
66-
<script type="text/javascript">
67-
68-
//document.getElementById('source').style.visibility = 'hidden';
69-
//SyntaxHighlighter.all();
70-
$(document).ready(function() {
71-
<% IF module.sloc > 0 %>
72-
togglePod();
73-
<% END %>
74-
</script>

root/static/js/syntaxhighlighter.js

-1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,5 @@ $(function () {
166166
});
167167

168168
function togglePod() {
169-
$('.syntaxhighlighter').toggleClass('pod-hidden');
170169
$('.pod-toggle').toggleClass('pod-hidden');
171170
}

0 commit comments

Comments
 (0)