Merge lp:~marcoceppi/juju-core/add-anchors into lp:juju-core/docs

Proposed by Marco Ceppi
Status: Merged
Merged at revision: 167
Proposed branch: lp:~marcoceppi/juju-core/add-anchors
Merge into: lp:juju-core/docs
Diff against target: 56 lines (+35/-0)
2 files modified
htmldocs/css/main.css (+25/-0)
htmldocs/js/main.js (+10/-0)
To merge this branch: bzr merge lp:~marcoceppi/juju-core/add-anchors
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+194623@code.launchpad.net

Description of the change

Add the super cool anchors to all h(1-5) with an id attribute.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'htmldocs/css/main.css'
2--- htmldocs/css/main.css 2013-11-06 15:36:33 +0000
3+++ htmldocs/css/main.css 2013-11-09 15:58:47 +0000
4@@ -521,3 +521,28 @@
5 margin-top: 10px;
6 display:block;
7 }
8+
9+.anchor {
10+ display: inline-block;
11+ margin-left: 3px;
12+ opacity: .0;
13+ position: relative;
14+ top: 1px;
15+ width: 16px;
16+ height: 15px;
17+ background: url('/media/glyphicons_243_anchor.png') 50% 50% no-repeat;
18+ background-size: 12px 11px;
19+}
20+
21+h1:hover .anchor,
22+h2:hover .anchor,
23+h3:hover .anchor,
24+h4:hover .anchor,
25+h5:hover .anchor {
26+ opacity: 0.5;
27+}
28+
29+.anchor:hover {
30+ background-color: #ddd;
31+ border-radius: 2px;
32+}
33
34=== modified file 'htmldocs/js/main.js'
35--- htmldocs/js/main.js 2013-08-22 13:48:21 +0000
36+++ htmldocs/js/main.js 2013-11-09 15:58:47 +0000
37@@ -26,6 +26,16 @@
38 });
39
40 $(document).ready(function() {
41+ var anchor_tpl = $('<a>').addClass('anchor');
42+ $('h1, h2, h3, h4, h5').each(function() {
43+ if($(this).attr('id')) {
44+ var id = $(this).attr('id');
45+ var link = anchor_tpl.clone();
46+ link.attr('href', '#'+id);
47+ console.log(link);
48+ $(this).append(link);
49+ }
50+ });
51 $('.doc-content section.code-example').each(function() {
52 var parent = this;
53 $(parent).find('nav.control a').each(function() {
54
55=== added file 'htmldocs/media/glyphicons_243_anchor.png'
56Binary files htmldocs/media/glyphicons_243_anchor.png 1970-01-01 00:00:00 +0000 and htmldocs/media/glyphicons_243_anchor.png 2013-11-09 15:58:47 +0000 differ

Subscribers

People subscribed via source and target branches