From d2863522b9239031938c3d6ee64f317c6aaf9b1b 2013-05-30 16:47:48
From: MinRK <benjaminrk@gmail.com>
Date: 2013-05-30 16:47:48
Subject: [PATCH] toggle heading-link visibility with CSS alone
---

diff --git a/IPython/frontend/html/notebook/static/notebook/js/textcell.js b/IPython/frontend/html/notebook/static/notebook/js/textcell.js
index 6fd6d5a..74be539 100644
--- a/IPython/frontend/html/notebook/static/notebook/js/textcell.js
+++ b/IPython/frontend/html/notebook/static/notebook/js/textcell.js
@@ -515,14 +515,8 @@ var IPython = (function (IPython) {
                 .addClass('anchor-link')
                 .attr('href', '#' + link)
                 .html('ΒΆ')
-                .hide()
             )
         );
-        r.hover(function() {
-            r.find("a.anchor-link").show();
-        }, function() {
-            r.find("a.anchor-link").hide();
-        });
     };
 
 
diff --git a/IPython/frontend/html/notebook/static/notebook/less/textcell.less b/IPython/frontend/html/notebook/static/notebook/less/textcell.less
index 737538d..1e76c3e 100644
--- a/IPython/frontend/html/notebook/static/notebook/less/textcell.less
+++ b/IPython/frontend/html/notebook/static/notebook/less/textcell.less
@@ -27,4 +27,9 @@ a.heading-anchor {
 a.anchor-link:link {
   text-decoration: none;
   padding: 0px 20px;
+  visibility: hidden;
 }
+
+h1:hover .anchor-link {
+  visibility: visible;
+}
\ No newline at end of file
diff --git a/IPython/frontend/html/notebook/static/style/style.min.css b/IPython/frontend/html/notebook/static/style/style.min.css
index 170706a..55daf70 100644
--- a/IPython/frontend/html/notebook/static/style/style.min.css
+++ b/IPython/frontend/html/notebook/static/style/style.min.css
@@ -1037,7 +1037,8 @@ div.text_cell{padding:5px 5px 5px 5px;}
 div.text_cell_input{color:#000000;border:1px solid #cfcfcf;border-radius:4px;background:#f7f7f7;}
 div.text_cell_render{outline:none;resize:none;width:inherit;border-style:none;padding:5px;color:#000000;}
 a.heading-anchor{text-decoration:none;color:inherit;}
-a.anchor-link:link{text-decoration:none;padding:0px 20px;}
+a.anchor-link:link{text-decoration:none;padding:0px 20px;visibility:hidden;}
+h1:hover .anchor-link{visibility:visible;}
 .toolbar{padding:3px 15px;border-bottom:1px #ababab solid;}.toolbar button{margin-top:2px;margin-bottom:2px;}
 .toolbar select,.toolbar label{height:19px;vertical-align:middle;margin-right:2px;margin-bottom:0;display:inline;font-size:92%;margin-left:0.3em;margin-right:0.3em;padding:0px;}
 .toolbar select{width:auto;}