Commit c54d1aca authored by Steve Tjoa's avatar Steve Tjoa

show/hide input cells

parent c41aed97
......@@ -171,6 +171,70 @@ div#notebook {
<div tabindex="-1" id="notebook" class="border-box-sizing">
<div class="container" id="notebook-container">
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[4]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2"><pre><span></span><span class="kn">import</span> <span class="nn">IPython.display</span> <span class="kn">as</span> <span class="nn">ipd</span>
<span class="c1"># Hide code by default when the notebook is exported as HTML.</span>
<span class="n">ipd</span><span class="o">.</span><span class="n">display_html</span><span class="p">(</span><span class="s1">&#39;&#39;&#39;</span>
<span class="s1">&lt;script&gt;</span>
<span class="s1">$(function() {</span>
<span class="s1"> if ($(&quot;body.notebook_app&quot;).length == 0) {</span>
<span class="s1"> $(&quot;.input&quot;).hide(); </span>
<span class="s1"> }</span>
<span class="s1">});</span>
<span class="s1">&lt;/script&gt;</span>
<span class="s1">&#39;&#39;&#39;</span><span class="p">,</span> <span class="n">raw</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="c1"># Create HTML buttons to show or hide IPython input cells.</span>
<span class="n">ipd</span><span class="o">.</span><span class="n">display_html</span><span class="p">(</span><span class="s1">&#39;&#39;&#39;</span>
<span class="s1">&lt;button onclick=&quot;$(&#39;.input&#39;).show();&quot;&gt;Show input&lt;/button&gt;</span>
<span class="s1">&lt;button onclick=&quot;$(&#39;.input&#39;).hide();&quot;&gt;Hide input&lt;/button&gt;</span>
<span class="s1">&#39;&#39;&#39;</span><span class="p">,</span> <span class="n">raw</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area"><div class="prompt"></div>
<div class="output_html rendered_html output_subarea ">
<script>
$(function() {
if ($("body.notebook_app").length == 0) {
$(".input").hide();
}
});
</script>
</div>
</div>
<div class="output_area"><div class="prompt"></div>
<div class="output_html rendered_html output_subarea ">
<button onclick="$('.input').show();">Show input</button>
<button onclick="$('.input').hide();">Hide input</button>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
......@@ -195,7 +259,7 @@ div#notebook {
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p><strong>musicinformationretrieval.com</strong> is a collection of instructional materials for music information retrieval. These materials contain a mix of casual conversation, technical discussion, and Python code.</p>
<p><strong>musicinformationretrieval.com</strong> is a collection of instructional materials for music information retrieval (MIR). These materials contain a mix of casual conversation, technical discussion, and Python code.</p>
<p>These pages, including the one you're reading, are authored using <a href="http://jupyter.org/">Jupyter notebooks</a>, formerly known as <a href="https://ipython.org/notebook.html">IPython notebooks</a>. They are statically hosted using <a href="https://pages.github.com/">GitHub Pages</a>. The GitHub repository is found here: <a href="https://github.com/stevetjoa/stanford-mir">stevetjoa/stanford-mir</a>.</p>
<p>This material is used during the annual Summer Workshop on Music Information Retrieval at CCRMA, Stanford University. <a href="https://ccrma.stanford.edu/workshops/music-information-retrieval-mir">Click here for workshop description and registration</a>.</p>
<p>This site is maintained by <a href="https://stevetjoa.com">Steve Tjoa</a>. For questions, please email <a href="mailto:steve@stevetjoa.com">steve@stevetjoa.com</a>. Do you have any feedback? Did you find errors or typos? Are you a teacher or researcher and would like to collaborate? Please let me know.</p>
......@@ -211,6 +275,34 @@ div#notebook {
<h2 id="About-Fundamentals-of-Music-Processing">About <em>Fundamentals of Music Processing</em><a class="anchor-link" href="#About-Fundamentals-of-Music-Processing">&#182;</a></h2>
</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In&nbsp;[3]:</div>
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython2"><pre><span></span><span class="n">ipd</span><span class="o">.</span><span class="n">Image</span><span class="p">(</span><span class="n">url</span><span class="o">=</span><span class="s2">&quot;https://images-na.ssl-images-amazon.com/images/I/51q5YtafVsL.jpg&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="output_wrapper">
<div class="output">
<div class="output_area"><div class="prompt output_prompt">Out[3]:</div>
<div class="output_html rendered_html output_subarea output_execute_result">
<img src="https://images-na.ssl-images-amazon.com/images/I/51q5YtafVsL.jpg"/>
</div>
</div>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
......
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<script>\n",
"$(function() {\n",
" if ($(\"body.notebook_app\").length == 0) {\n",
" $(\".input\").hide(); \n",
" }\n",
"});\n",
"</script>\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"<button onclick=\"$('.input').show();\">Show input</button>\n",
"<button onclick=\"$('.input').hide();\">Hide input</button>\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import IPython.display as ipd\n",
"\n",
"# Hide code by default when the notebook is exported as HTML.\n",
"ipd.display_html('''\n",
"<script>\n",
"$(function() {\n",
" if ($(\"body.notebook_app\").length == 0) {\n",
" $(\".input\").hide(); \n",
" }\n",
"});\n",
"</script>\n",
"''', raw=True)\n",
"\n",
"# Create HTML buttons to show or hide IPython input cells.\n",
"ipd.display_html('''\n",
"<button onclick=\"$('.input').show();\">Show input</button>\n",
"<button onclick=\"$('.input').hide();\">Hide input</button>\n",
"''', raw=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -18,7 +74,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**musicinformationretrieval.com** is a collection of instructional materials for music information retrieval. These materials contain a mix of casual conversation, technical discussion, and Python code. \n",
"**musicinformationretrieval.com** is a collection of instructional materials for music information retrieval (MIR). These materials contain a mix of casual conversation, technical discussion, and Python code. \n",
"\n",
"These pages, including the one you're reading, are authored using [Jupyter notebooks](http://jupyter.org/), formerly known as [IPython notebooks](https://ipython.org/notebook.html). They are statically hosted using [GitHub Pages](https://pages.github.com/). The GitHub repository is found here: [stevetjoa/stanford-mir](https://github.com/stevetjoa/stanford-mir).\n",
"\n",
......@@ -34,6 +90,31 @@
"## About *Fundamentals of Music Processing*"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<img src=\"https://images-na.ssl-images-amazon.com/images/I/51q5YtafVsL.jpg\"/>"
],
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ipd.Image(url=\"https://images-na.ssl-images-amazon.com/images/I/51q5YtafVsL.jpg\")"
]
},
{
"cell_type": "markdown",
"metadata": {
......
......@@ -206,8 +206,8 @@ div#notebook {
<div class="text_cell_render border-box-sizing rendered_html">
<ol>
<li><a href="about.html">About This Site</a> (<a href="about.ipynb">ipynb</a>)</li>
<li><a href="why_mir.html">What is MIR?</a></li>
<li><a href="python_basics.html">Python Basics</a></li>
<li><a href="why_mir.html">What is MIR?</a> (<a href="why_mir.ipynb">ipynb</a>)</li>
<li><a href="python_basics.html">Python Basics</a> (<a href="python_basics.ipynb">ipynb</a>)</li>
<li><a href="get_good_at_ipython.html">Getting Good at IPython</a> (<a href="get_good_at_ipython.ipynb">ipynb</a>)</li>
<li><a href="ipython_audio.html">Using Audio in IPython</a> (<a href="ipython_audio.ipynb">ipynb</a>)</li>
<li><a href="numpy_basics.html">NumPy and SciPy Basics</a> (<a href="numpy_basics.ipynb">ipynb</a>)</li>
......
......@@ -26,8 +26,8 @@
"metadata": {},
"source": [
"1. [About This Site](about.html) ([ipynb](about.ipynb))\n",
"1. [What is MIR?](why_mir.html)\n",
"1. [Python Basics](python_basics.html)\n",
"1. [What is MIR?](why_mir.html) ([ipynb](why_mir.ipynb))\n",
"1. [Python Basics](python_basics.html) ([ipynb](python_basics.ipynb))\n",
"1. [Getting Good at IPython](get_good_at_ipython.html) ([ipynb](get_good_at_ipython.ipynb))\n",
"1. [Using Audio in IPython](ipython_audio.html) ([ipynb](ipython_audio.ipynb))\n",
"1. [NumPy and SciPy Basics](numpy_basics.html) ([ipynb](numpy_basics.ipynb))"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment